question

Abhishek-3228 avatar image
0 Votes"
Abhishek-3228 asked AryaDing-MSFT commented

How to update sdp parameters of Rfomm service provider after it starts advertising?

Hi,

In UWP app, I am using Rfcomm for connecting apps to each other. In some cases, I need to update SDP attributes after Rfcomm starts advertising.
I am able to remove previous records and add new SDP attribute, but they are not reflecting on the client devices.

Code using for this:

     private void InitializeServiceSdpAttributes(RfcommServiceProvider rfcommProvider, string Details)
     {
         var sdpWriter = new DataWriter();

         // Write the Service Name Attribute.
         sdpWriter.WriteByte((4 << 3) | 5);

         // The length of the UTF-8 encoded Service Name SDP Attribute.
         sdpWriter.WriteByte((byte)Details.Length);

         // The UTF-8 encoded Service Name value.
         sdpWriter.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf8;
         sdpWriter.WriteString(Details);
         rfcommProvider.SdpRawAttributes.Remove(0x100); //Remove previous
         // Set the SDP Attribute on the RFCOMM Service Provider.
         rfcommProvider.SdpRawAttributes.Add(0x100, sdpWriter.DetachBuffer()); //Add new
     }

This code does not give any error, it runs smoothly but values not reflecting on client machines.

Is there any other event for updating SDP attributes?

Regards,
Abhishek

windows-uwp
· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@Abhishek-3228 Could you please tell me if you bind the service name to the listener and initialized the SDP properties successfully? I suggest that you could try the official sample to check if it works, the Scenario2 of this sample involves updating the sdp parameters.


0 Votes 0 ·

@AryaDing-MSFT I am also referring the sample you have mentioned. It is working fine.
My scenario is that I have set SDP attributes with value let's say "A" and start advertising and it reflecting on clients machine. But now, I want to update the SDP attribute value to "B". I am not able to do that.
And I am not able to find update of SDP attributes is the official sample.
Could you please help me out in that.

Thanks in advance.

0 Votes 0 ·

@Abhishek-3228 We are consulting with other engineers about your question, there may be some delay.

0 Votes 0 ·
Show more comments

0 Answers