1 2 Previous Next 17 Replies Latest reply on Nov 10, 2016 11:16 AM by jayi

    128-bit UUID service x 2

    cheong2k

      Hi all,

       

      Please see the follow code that creating 2 services with 128-bit UUID, the iPhone side can only see nothing.

       

      If putting a zero byte between two 128-bit service, it will work better but iPhone can only see the first service.

       

      Please help.

       

      --Cheong

       

      /* GATT database */

      const uint8_t gatt_db[] =

      {

         // Generic Attribute service

          PRIMARY_SERVICE_UUID16 (HDLS_GENERIC_ATTRIBUTE, UUID_SERVCLASS_GATT_SERVER),

       

          CHARACTERISTIC_UUID16 (HDLC_GENERIC_ATTRIBUTE_SERVICE_CHANGED,

                                 HDLC_GENERIC_ATTRIBUTE_SERVICE_CHANGED_VALUE,

                                 GATT_UUID_GATT_SRV_CHGD,

                                 LEGATTDB_CHAR_PROP_NOTIFY,

                                 LEGATTDB_PERM_NONE),

       

          // Generic Access service

          PRIMARY_SERVICE_UUID16 (HDLS_GENERIC_ACCESS, UUID_SERVCLASS_GAP_SERVER),

       

          CHARACTERISTIC_UUID16 (HDLC_GENERIC_ACCESS_DEVICE_NAME,

                                     HDLC_GENERIC_ACCESS_DEVICE_NAME_VALUE,

                                     GATT_UUID_GAP_DEVICE_NAME,

                                     LEGATTDB_CHAR_PROP_READ,

                                     LEGATTDB_PERM_READABLE),

       

          CHARACTERISTIC_UUID16 (HDLC_GENERIC_ACCESS_APPEARANCE,

                                 HDLC_GENERIC_ACCESS_APPEARANCE_VALUE,

                                 GATT_UUID_GAP_ICON,

                                 LEGATTDB_CHAR_PROP_READ,

                                 LEGATTDB_PERM_READABLE),

                                

                        

          // TX Power service

      PRIMARY_SERVICE_UUID16 (HDLS_TX_POWER, UUID_SERVCLASS_TX_POWER),

       

          CHARACTERISTIC_UUID16 (HDLC_TX_POWER_LEVEL,

                                 HDLC_TX_POWER_LEVEL_VALUE,

                                 GATT_UUID_TX_POWER_LEVEL,

                                 LEGATTDB_CHAR_PROP_READ,

               LEGATTDB_PERM_READABLE),

       

           

      //service1

      PRIMARY_SERVICE_UUID128 (HDLS_SERVICE1, PERIPHERAL_SERVICE1_UUID),

       

      CHARACTERISTIC_UUID128(HDLC_SERVICE1_CHARS1,

               HDLC_SERVICE1_CHARS1_VALUE,

               PERIPHERAL_SERVICE1_CHARS1_UUID,

               LEGATTDB_CHAR_PROP_READ,

               LEGATTDB_PERM_READABLE),

                      

      0x00  // putting a zero here will work better, but still no service 2, otherwise, both services will not work

       

      //service2

      PRIMARY_SERVICE_UUID128 (HDLS_SERVICE2, PERIPHERAL_SERVICE2_UUID),

       

      CHARACTERISTIC_UUID128(HDLC_SERVICE2_CHARS1,

               HDLC_SERVICE2_CHARS1_VALUE,

               PERIPHERAL_SERVICE2_CHARS1_UUID,

               LEGATTDB_CHAR_PROP_READ,

               LEGATTDB_PERM_READABLE),

      };

        • 1. Re: 128-bit UUID service x 2
          mifo

          Perhaps mkochhal can assist as he has gone through this issue as well here: Re: 128-bit UUID support on WICED SDK 3.3.1

           

          seyhan vikr jayi grga

          • 2. Re: 128-bit UUID service x 2
            mkochhal

            Cheong,

            Hi.

             

            There is no zero byte ... I used to have problems with that ...

             

            Please include your gatt_db header file as well.

            • 3. Re: 128-bit UUID service x 2
              mifo

              Thanks Manish.

              • 4. Re: 128-bit UUID service x 2
                cheong2k

                Hi @mkochhal,

                 

                Thanks for your response.

                 

                 

                #include "wiced.h"

                 

                #ifdef __cplusplus

                extern "C" {

                #endif

                 

                #define     PERIPHERAL_SERVICE1_UUID              0xAA,0xBB,0x00,0x00,0xDF,0xFB,0x48,0xD2,0xB0,0x60,0xD0,0xF5,0xA7,0x10,0x96,0xE0

                #define     PERIPHERAL_SERVICE1_CHARS1_UUID       0xAA,0xBB,0x01,0x00,0xDF,0xFB,0x48,0xD2,0xB0,0x60,0xD0,0xF5,0xA7,0x10,0x96,0xE0

                #define     PERIPHERAL_SERVICE1_CHARS2_UUID       0xAA,0xBB,0x02,0x00,0xDF,0xFB,0x48,0xD2,0xB0,0x60,0xD0,0xF5,0xA7,0x10,0x96,0xE0

                 

                 

                #define     PERIPHERAL_SERVICE2_UUID              0xAA,0xB1,0x00,0x00,0xDF,0xFB,0x48,0xD2,0xB0,0x60,0xD0,0xF5,0xA7,0x10,0x96,0xE0

                #define     PERIPHERAL_SERVICE2_CHARS1_UUID       0xAA,0xB1,0x01,0x00,0xDF,0xFB,0x48,0xD2,0xB0,0x60,0xD0,0xF5,0xA7,0x10,0x96,0xE0

                 

                 

                enum {

                    // ***** Primary service 'Generic Attribute'

                    HDLS_GENERIC_ATTRIBUTE      =  0x0100,

                    HDLC_GENERIC_ATTRIBUTE_SERVICE_CHANGED,

                    HDLC_GENERIC_ATTRIBUTE_SERVICE_CHANGED_VALUE,

                 

                 

                    // ***** Primary service 'Generic Access'

                    HDLS_GENERIC_ACCESS,

                    HDLC_GENERIC_ACCESS_DEVICE_NAME,

                    HDLC_GENERIC_ACCESS_DEVICE_NAME_VALUE,

                    HDLC_GENERIC_ACCESS_APPEARANCE,

                    HDLC_GENERIC_ACCESS_APPEARANCE_VALUE,

                 

                 

                    // ***** Primary service 'Link Loss'

                    HDLS_LINK_LOSS,

                    HDLC_LINK_LOSS_ALERT_LEVEL,

                    HDLC_LINK_LOSS_ALERT_LEVEL_VALUE,

                 

                 

                    // ***** Primary service 'Immediate Alert'

                    HDLS_IMMEDIATE_ALERT,

                    HDLC_IMMEDIATE_ALERT_LEVEL,

                    HDLC_IMMEDIATE_ALERT_LEVEL_VALUE,

                 

                 

                    // ***** Primary service 'TX Power'

                    HDLS_TX_POWER,

                    HDLC_TX_POWER_LEVEL,

                    HDLC_TX_POWER_LEVEL_VALUE,

                   

                 

                    // ***** Primary service 'peripheral'Properties

                    HDLS_SERVICE1,

                    HDLC_SERVICE1_CHARS1,

                    HDLC_SERVICE1_CHARS1_VALUE,

                    HDLC_SERVICE1_CHARS1_CCCD,

                 

                    HDLC_SERVICE1_CHARS2,

                    HDLC_SERVICE1_CHARS2_VALUE,

                 

                  // ***** Primary service 'peripheral'Properties

                  HDLS_SERVICE2,

                    HDLC_SERVICE2_CHARS1,

                    HDLC_SERVICE2_CHARS1_VALUE,

                };

                 

                extern const uint8_t  gatt_db[];

                extern const uint16_t gatt_db_size;

                 

                #ifdef __cplusplus

                }

                #endif

                • 5. Re: 128-bit UUID service x 2
                  mkochhal

                  Cheong, you have a problem because of   HDLC_SERVICE1_CHARS1_CCCD ... where is this defined?

                   

                  Please remove that. Unless you have a characteristic that needs a notification, then only you can try this:

                   

                   

                  #define __UUID_HIFITABLET_STATUS      0xde, 0xc9, 0xc1, 0x95, 0xb2, 0x3b, 0x75, 0x10, 0x82, 0x73, 0xd2, 0x49, 0x28, 0x3a, 0x97, 0x7e

                  // ----- Characteristic 'status'

                      HDLC_HIFITABLET_STATUS,                      // Characteristic Declaration handle         

                      HDLC_HIFITABLET_STATUS_VALUE,                // Characteristic Value handle

                      HDLD_HIFITABLET_STATUS_CLIENT_CONFIGURATION, // Client Configuration

                   

                  and you complete this declaration with a definition in the C file:

                   

                  /* Characteristic 'status' */

                      //<Name>status</Name>

                      //<Uuid>xxx </Uuid>

                      CHARACTERISTIC_UUID128 (HDLC_HIFITABLET_STATUS,

                              HDLC_HIFITABLET_STATUS_VALUE,

                              __UUID_HIFITABLET_STATUS,

                              LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_NOTIFY,

                              LEGATTDB_PERM_READABLE),

                   

                   

                      /* Client Characteristic Configuration Descriptor */

                      //<Notification>true</Notification>

                      //<Indication>true</Indication>

                      CHAR_DESCRIPTOR_UUID16_WRITABLE (HDLD_HIFITABLET_STATUS_CLIENT_CONFIGURATION,

                              GATT_UUID_CHAR_CLIENT_CONFIG,

                              LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_CMD | LEGATTDB_PERM_WRITE_REQ | LEGATTDB_PERM_RELIABLE_WRITE),

                  • 6. Re: 128-bit UUID service x 2
                    cheong2k

                    Hi @mkochhal,

                     

                    I originally designed to have notify property, but just for testing, I removed it as simple as possible to see where is the problem.

                     

                    Actually, if you just create two services without characteristics, it will not work correctly, only the first service is shown on iPhone.

                     

                    //service1

                    PRIMARY_SERVICE_UUID128 (HDLS_SERVICE1, PERIPHERAL_SERVICE1_UUID),

                     

                    //service2

                    PRIMARY_SERVICE_UUID128 (HDLS_SERVICE2, PERIPHERAL_SERVICE2_UUID),

                     

                    --Cheong

                    • 7. Re: 128-bit UUID service x 2
                      jixing.zou

                      Hi mkochhal,

                          The attachments are my gatt_db file. Help me a look.

                      • 8. Re: 128-bit UUID service x 2
                        mkochhal

                        You have three services ... A peripheral usually has a service for the peripheral and several characteristics (Read/Write/Both or Read/Notify) that the service hosts in its GATT server. I haven't tried multiple services.

                         

                        In any case, here is my changes to your GATT declarations ... Please take a look and try again.

                        • 9. Re: 128-bit UUID service x 2
                          mkochhal

                          Also, please make sure you use random UUID generator to uniquely identify services ... there are many online.

                          • 10. Re: 128-bit UUID service x 2
                            cheong2k

                            Yes, we know that, so we just think it is a bug in their BT stack with multiple 128-bit service. We did use other vendors BLE chips and works just fine with multiple 128-bit service. We are from RedBear and doing BLE for 3 years already.

                             

                            Hi Broadcom team,

                            Can anyone take a look at this?


                            --Cheong

                            • 11. Re: 128-bit UUID service x 2
                              mkochhal

                              I can try tomorrow to add two more services and see if I can see them on Light Blue. I dont think advertising multiple services is a big deal, because in essence we do advertise GATT and GAP and then we add our own for the peripheral (i.e. 128 bit though).

                              • 12. Re: 128-bit UUID service x 2
                                jixing.zou

                                Hi all,

                                    About creat two 128bit UUID services, I found a strange thing.If I add a 16bit UUID service between two 128bit UUID services.That I will see all services on iPhone side. As shown in the attachment.

                                1 of 1 people found this helpful
                                • 13. Re: 128-bit UUID service x 2
                                  nishal

                                  Hi,

                                   

                                  I also have similar issue. I tried this but no help.. Is there any other modifications also required?

                                   

                                  Thanks in advance

                                  • 14. Re: 128-bit UUID service x 2
                                    nishal

                                    Hi all,

                                     

                                     

                                    Now I understand that if you have one adopted serviced(16 bit UUID) between two custom services(128 bit UUID), then we will be able to discover the custom and adopted services in IOS application.

                                     

                                    Is there any other standard method?

                                     

                                    Thanks

                                    1 of 1 people found this helpful
                                    1 2 Previous Next