This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

adding attributes to an SDP record

Other Parts Discussed in Thread: CC2564

I'm using the Bluetopia stack for the cc2564 and i'm having difficulty figuring out how to add an SDP attribute to a service record when the attribute has  data sequences,  for example in this protocol descriptor list:

Attribute Identifier : 0x4 - ProtocolDescriptorList
Data Sequence
   Data Sequence
   UUID16 : 0x0100 - L2CAP

   Data Sequence
   UUID16 : 0x0003 - RFCOMM
    Channel/Port (Integer) : 0x1

According to the Bluetopia Stack API documentation the SDP_Add_Attribute()  takes a single attribute (data element)  that can only hold a single value. How do i construct  a sequence that has multiple elements? Are multiple elements implied by the SDP_Data_Element_Length? 

  • Hi,

    I did not get you.
    SDP_Add_Attribute() takes a single attribute (Attribute Identifier) and the data elements (SDP_Data_Element).
    Have you checked the SDP_Data_Element_t structure?
  • i did look at the SDP_Data_Element_t documentation and that's why i'm confused: :) . For a data element of type data sequence you use the union member:

    struct _tagSDP_Data_Element_t *SDP_Data_Element_Sequence,  

    By my reading this is a ptr to a struct that is defined to hold ONE element.  

    My guess is that this typing of a ptr to a struct is is being very loosely used to mean a pointer to a GROUP of data elements of potentially different sizes. The SDP_Data_Element_length is then used to "walk this grouping of unequal size structs.

    Peter

  • sorry meant to say a group of data elements of diifferent "data element types" not "sizes". Structs are all the same sizes. I guess another way to say this is that SDP_Data_Element_Sequence is a ptr to an array of structs and that The SDP_Data_Element_length determines the total number of data elements.
  • Hi,

    Did you try calling it sequentially?
  • Hi Sundeep,

    so it turns out there are a couple of issues, all of which could have been EASILY  solved with a just few words in the API documentation:) 

    1) if a data element is a data sequence then you provide a pointer to an ARRAY of data element structs.

    2) the specification of data length is inconsistent. If it's a data sequence then the data length is the number (1...n)  of data elements in the array you are pointing to ...NOT the byte count).

    3) BUT if it is NOT a data sequence then it  IS the byte count of the type e.g. UUID_16_t = 2 bytes

    4) BUT if it is a string you give it one less than the sizeof operator returns for an an initialized byte array (Byte_t aStr = "Hello Bluetopia" )  ...because apparently the stack is not expected a null terminated string and it adds it's own null when adding the attribute. 

    BTW it would have been totally impossible to figure  this out without the linux  sdptool  which allows you to browse the SDP  database.  I started with the case of no data sequence in the attribute and worked my way up to the nested data sequences.