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.

Creating a SDP record for Basic printing profile

Hi all,

We have a BT device on which are currently registering SDP record  for SPP using SPP_Register_Generic_SDP_Record(). Now we want to add a sevice class for Basic Printing Profile(BPP).

I assigned UUID of 0x1118 and then created SDP record using  SDP_Create_Service_Record(), which is returning success. But I'm not able to see any difference in UUID response of that device. 

I even tried to scan for services using BlueSoleil tool. I can see BT device and services seen is Bluetooth SerialPort and Bluetooth Printer is not seen.

So I want to know is there is any prerequsites for adverstising the new SDP for BPP. Or what is the right method to do so.

I also want to know if there is any way to know that SDP is updated . 

Thanks in advance

Nishal

  • Hi Nishal,

    I believe you are on Tiva.
    You would need to use : GOEP_Register_SDP_Record() & SDP_Add_Attribute() to add the BPP SDP records.

    Regards,
    Gigi Joseph.
  • Hi Joseph,

    Yes I are using Tiva.
    So while registering with GOEP_Register_SDP_Record what are the the SDP_UUID_Entry_t are to be given before BPP. Can't we give UUID of BPP directly?

    Thanks,
    Nishal
  • Hi Nishal,

    Yes, you would need to give the BPP UUID - but in addition, there are many other fields which you need to give for a BPP (Printer) service record. Please see: "Table 48: Basic Printing Service Record (Printer)" from the BPP spec.

    For adding the BPP UUID, you can do something like:

    SDP_UUID_Entry_t bpp_uuid;
    bpp_uuid.SDP_Data_Element_Type = deUUID_16;
    ASSIGN_SDP_UUID_16(bpp_uuid.UUID_Value.UUID_16, 0x11, 0x18)

    Regards,
    Gigi Joseph.
  • Hi Gigi Joseph,

    I wanted to register a customized UUID. So I used GOEP_Register_SDP_Record with following entries:

    1.Customized UUID:0000XXXX-0000-1000-8000-00805F9B34FB. where XXXX is our UUID appended to base UUID.

    2.protocol descripter for L2CAP

    3.protocol descripter for RFCOMM

    4.protocol descripter for OBEX

    But when I do service discovery I am not able to get this UUID.

    Also if I replace the entire UUID(customized) with some known value I am able to get it or If my customized UUID is replaced with 0000000-XXXX-1000-8000-00805F9B34FB, even then I am able to get it. So I would I like to know is there any thing else missed out.

    Because earlier I tested with steps 1-4. I was able to get UUID.

    The difference from the previous testing is that, in earlier testing I opened 2 SPP ports. Now I am Using 7 SPP ports and additional GOEP port which does not base Base UUID.

    So can you give reason for this observation.

    Thanks and Regards ,

    Nishal

  • Hi,

    So mean to say if you try with tow ports open it is working now as well?

    Please see the E2E post e2e.ti.com/.../1395794 which might help.
  • Hi Sundeep,

    No its not related to 2 ports I think.
    Now I am observing that with two only ports open, I am not able to get the Customized UUID as indicated 0000XXXX-0000-1000-8000-00805F9B34FB. but the other UUID is getting discovered (i.e UUID 0000000-XXXX-1000-8000-00805F9B34FB).

    Thanks and regards,
    Nishal
  • Hi,

    It looks to me like some parsing issue.

    Anyway I am checking it internally, I will let you know once I have any response.
  • Nishal,

    It's odd that 0000XXXX-0000-1000-8000-00805F9B34FB can't be discovered but 0000000-XXXX-1000-8000-00805F9B34FB can. Maybe BlueSoleil filters unknown UUIDs but somehow 0000000-XXXX-1000-8000-00805F9B34FB bypasses it's filtering criteria.

    Can you provide the full code snippet for the custom UUID that can't be discovered and the full code snippet for the modified custom UUID that can be discovered? I'll see if I can reproduce the issue.

    Thanks,
    Samuel

  • Hi Samuel,

    The code snippet is given below:

    GOEP_SDP_Service_Record_t                SDPServiceRecord;
    SDP_UUID_Entry_t                               SDPUUIDEntry_arr[10];

    SDPUUIDEntry_arr[0].SDP_Data_Element_Type = deUUID_128;

    // 00000000-0000-1000-8000-00805F9B34FB: Base UUID
    // 0000XXXX-0000-1000-8000-00805F9B34FB: BAse UUID customized UUID

    ASSIGN_SDP_UUID_128(SDPUUIDEntry_arr[0].UUID_Value.UUID_128,0x00,0x00,
    0x00,0x00, 0x11,0x22, 0x10,0x00,0x80,0x00,0x00,0x80,0x5F,0x9B,0x34,0xFB);

    //0x0100 protocol descripter L2CAP

    SDPUUIDEntry_arr[1].SDP_Data_Element_Type = deUUID_16;
    ASSIGN_SDP_UUID_16(SDPUUIDEntry_arr[1].UUID_Value.UUID_16,0x01,0x00);

    //0x0003 protocol descripter RFCOMM

    SDPUUIDEntry_arr[2].SDP_Data_Element_Type = deUUID_16;
    ASSIGN_SDP_UUID_16(SDPUUIDEntry_arr[2].UUID_Value.UUID_16,0x00,0x03);

    //0x0008 protocol descripter OBEX

    SDPUUIDEntry_arr[3].SDP_Data_Element_Type = deUUID_16;
    ASSIGN_SDP_UUID_16(SDPUUIDEntry_arr[3].UUID_Value.UUID_16,0x00,0x08);

    SDPServiceRecord.NumberServiceClassUUID = 4;

    SDPServiceRecord.SDPUUIDEntries = SDPUUIDEntry_arr;

    SDPServiceRecord.ProtocolList = NULL;

    ret_val = GOEP_Open_Server_Port(FigLeaf_handle_info.BluetoothStackID,8, 1024, GOEP_Event_Callback, 0);


    if(ret_val>0)
    {

    GOEP_Register_SDP_Record(FigLeaf_handle_info.BluetoothStackID,ret_val, &SDPServiceRecord, "PRODUCT", &SDPServiceRecordHandle);

    }

    Also I would like to tell that, when I say UUID is not getting discovered , I mean Android BT is not discovering this UUID using servicediscovery(not Bluesoleil).

  • Hi Samuel,

    A little correction in the above code snippet. In the previous code snippet we are able to discover its UUID. The below given is the one which is not discoverd. Rest all the code is same.

    SDPUUIDEntry_arr[0].SDP_Data_Element_Type = deUUID_128;
    // 00000000-0000-1000-8000-00805F9B34FB: Base UUID
    // 0000XXXX-0000-1000-8000-00805F9B34FB: BAse UUID customized UUID
    ASSIGN_SDP_UUID_128(SDPUUIDEntry_arr[0].UUID_Value.UUID_128,0x00,0x00, 0x11,0x22,
    0x00,0x00, 0x10,0x00,0x80,0x00,0x00,0x80,0x5F,0x9B,0x34,0xFB);


    Thanks and regards,
    Nishal
  • Nishal,

    Thanks for sharing. I'll try this out next week and let you know what I find out.

    Thanks,
    Samuel
  • Nishal,

    Can you clarify what your intention is? Is your plan to implement the BPP profile yourself? If so then which role do you want to implement, Printer or Sender? If you are implementing the printer and you simply want multiple instances of a printer on a single device, then you don't need to register multiple SPP ports, you need to register multiple SDP records, from the BPP 1.2 spec:

    "If a Bluetooth device supporting the Bluetooth Basic Printing Profile can serve more than one Printer, it may register more than one Service Record according to the table below. The Service Records shall have different values for the RFCOMM channel number to be used when connecting to the printing service, in addition to other entries in the Service Records as appropriate."

    Regardless, I reviewed the BPP spec and specifically the SDP service record. I'm not sure which role you want to implement, and I'm assuming the printer role. Your code is a little off for what I think you are trying to do. To add a BPP printer service record, following "Table 12.1: Basic Printing Service Record (Printer)" in the BPP 1.2 spec, you can use something similar to the following code:

    int                        ret_val;
    SDP_UUID_Entry_t           SDPServiceClassUUIDEntries[2];
    SDP_Data_Element_t         BluetoothProfileDescriptorListDataElement;
    SDP_Data_Element_t         ProfileDescriptorDataElement;
    SDP_Data_Element_t         BPPProfileDescriptorDataElementList[2];
    GOEP_SDP_Service_Record_t  GOEPSDPServiceRecord;
    
    /* Initialize the Service Class UUIDs.                   */
    SDPServiceClassUUIDEntries[0].SDP_Data_Element_Type = deUUID_16;
    ASSIGN_SDP_UUID_16(SDPServiceClassUUIDEntries[0].UUID_Value.UUID_16, 0x11, 0x23);
    
    SDPServiceClassUUIDEntries[1].SDP_Data_Element_Type = deUUID_16;
    ASSIGN_SDP_UUID_16(SDPServiceClassUUIDEntries[1].UUID_Value.UUID_16, 0x11, 0x18);
    
    /* Initialize the GOEP SDP Service Record structure.     */
    GOEPSDPServiceRecord.NumberServiceClassUUID = sizeof(SDPServiceClassUUIDEntries)/sizeof(SDPServiceClassUUIDEntries[0]);
    GOEPSDPServiceRecord.SDPUUIDEntries         = SDPServiceClassUUIDEntries;
    GOEPSDPServiceRecord.ProtocolList           = NULL;
    
    ret_val = GOEP_Register_SDP_Record(BluetoothStackID, ServerPortNumber, &GOEPSDPServiceRecord, "PRODUCT", &SDPServiceRecordHandle);
    
    if(!ret_val)
    {
       /* The Service Record was successfully created, next  */
       /* format the Bluetooth Profile Descriptor List Data  */
       /* Element.                                           */
       BluetoothProfileDescriptorListDataElement.SDP_Data_Element_Type                      = deSequence;
       BluetoothProfileDescriptorListDataElement.SDP_Data_Element_Length                    = sizeof(ProfileDescriptorDataElement)/sizeof(SDP_Data_Element_t);
       BluetoothProfileDescriptorListDataElement.SDP_Data_Element.SDP_Data_Element_Sequence = &ProfileDescriptorDataElement;
    
       /* Initialize Profile Descriptor #0.                  */
       ProfileDescriptorDataElement.SDP_Data_Element_Type                      = deSequence;
       ProfileDescriptorDataElement.SDP_Data_Element_Length                    = sizeof(BPPProfileDescriptorDataElementList)/sizeof(SDP_Data_Element_t);
       ProfileDescriptorDataElement.SDP_Data_Element.SDP_Data_Element_Sequence = BPPProfileDescriptorDataElementList;
    
       /* Initialize the Profile UUID and Version Number Data*/
       /* Elements.                                          */
       BPPProfileDescriptorDataElementList[0].SDP_Data_Element_Type   = deUUID_16;
       BPPProfileDescriptorDataElementList[0].SDP_Data_Element_Length = sizeof(BPPProfileDescriptorDataElementList[0].SDP_Data_Element.UUID_16);
       ASSIGN_SDP_UUID_16(BPPProfileDescriptorDataElementList[0].SDP_Data_Element.UUID_16, 0x11, 0x22);
    
       BPPProfileDescriptorDataElementList[1].SDP_Data_Element_Type                  = deUnsignedInteger2Bytes;
       BPPProfileDescriptorDataElementList[1].SDP_Data_Element_Length                = sizeof(BPPProfileDescriptorDataElementList[1].SDP_Data_Element.UnsignedInteger2Bytes);
       BPPProfileDescriptorDataElementList[1].SDP_Data_Element.UnsignedInteger2Bytes = PROFILE_VERSION_YOU_PLAN_TO_IMPLEMENT (0x0100 or 0x0102);
    
       if((ret_val = SDP_Add_Attribute(BluetoothStackID, *SDPServiceRecordHandle, SDP_ATTRIBUTE_ID_BLUETOOTH_PROFILE_DESCRIPTOR_LIST, &BluetoothProfileDescriptorListDataElement)) >= 0)
       {
          /* Continue adding other mandatory attributes, such*/
          /* as the "Additional Protocol Descriptor Lists",  */
          /* "Document Formats Supported", "Character        */
          /* Repertoires Supported", "XHTML-Print Image      */
          /* Formats Supported", and "1284ID" attributes,    */
          /* using the SDP_Add_Attribute() function.         */
          TODO:
       }
    }

    Thanks,
    Samuel

  • Hi Samuel,

    Earlier I wanted to a register SDP record as BBP. Now I want to register a customized UUID not for BPP. 

    So I wanted to know is there any limitation if don't register a standard SDP records . But it has the base UUID.

    Thanks,

    Nishal

  • Nishal,

    There are no limitations. I think the code you were using wasn't formatting the SDP record properly though. Please use the code I sent as a reference, and refer to the BPP spec 1.2 spec to see the SDP record my code would create (https://www.bluetooth.org/en-us/specification/adopted-specifications).

    Thanks,
    Samuel