4 Replies Latest reply on Jan 21, 2019 1:39 AM by user_1536336

    How to set Manufacturer Specific Data programmatically?

    user_1536336

      Hi,

       

      how can I set the advertisement data "Manufacturer Specific Data" programmatically? I tried the API function CyBle_GapUpdateAdvData() but I can't find the according definition to update the manufacturer data.

       

      I'm using PSoC Creator 4.2 and the CYBLE-212006-01 module.

       

      Thanks!

        • 1. Re: How to set Manufacturer Specific Data programmatically?
          PY_21

          Hello,

           

          Please refer the Day009_Dynamic_Broadcaster example project in the GitHub. In this example, manufacturer specific data is continuously updated in the firmware to demonstrate dynamic advertisement payload update feature.

           

          Thanks,

          P Yugandhar.

          • 2. Re: How to set Manufacturer Specific Data programmatically?
            user_1536336

            Hello,

             

            I extracted this part of code:

             

            extern CYBLE_GAPP_DISC_MODE_INFO_T cyBle_discoveryModeInfo;

             

            #define advPayload                                  (cyBle_discoveryModeInfo.advData->advData)

            #define MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX    (28u) /* index of the dynamic data in the ADV packet */

            #define LOOP_DELAY                                  (1u)  /* How often would you like to update the ADV payload */

            #define MIN_PAYLOAD_VALUE                           (0u)

            #define MAX_PAYLOAD_VALUE                           (200u)

               

            void DynamicADVPayloadUpdate(void)

            {

                if(CyBle_GetBleSsState() == CYBLE_BLESS_STATE_EVENT_CLOSE)

                {

                    count++; /* Loop counter */

                   

                    /* Once the system enters Sleep/Deepsleep mode during advertisement, the source of wake-up is the next 

                     * advertisement interval which has a wakeup interval of 1 advertisement (ADV) interval (100ms).

                     * LOOP_DELAY * ADV interval is the interval after which ADV data is updated in this firmware.*/

                   

                    if(count >= LOOP_DELAY)

                    {

                        /* Dynamic payload will be continuously updated */

                        advPayload[MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX] = dynamicPayload++;

                       

                        if(dynamicPayload == MAX_PAYLOAD_VALUE)

                        {

                            dynamicPayload = MIN_PAYLOAD_VALUE;

                        }

                       

                        count = 0;

                       

                        CyBle_GapUpdateAdvData(cyBle_discoveryModeInfo.advData, cyBle_discoveryModeInfo.scanRspData);

                    }

                }

            }

             

            Can you please explain, how to update more than just 1 byte in the manufacturer data?

             

            Am I right, that the defined "MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX   (28u)" refers to the marked index number in the picture?

             

            1.PNG

             

            So I just have to extend the Data size in my BLE module and define some more number like this:

             

            #define MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX_1    (29u)

            #define MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX_2    (30u)

             

            ...

             

            advPayload[MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX_1] = dynamicPayload++;

            advPayload[MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX_2] = dynamicPayload++;

             

            My main aim is to broadcast the manufacturer device address to get a never changing and unique device identifier.

             

            Is this aim covered by doing so?

             

             

            Thanks!

            • 3. Re: How to set Manufacturer Specific Data programmatically?
              PY_21

              Hello,

               

              1. Can you please explain, how to update more than just 1 byte in the manufacturer data?

              Ans:- We have to increase the data size in the BLE component as shown in attached image. Please make sure that the maximum length of the advertisement packet that we can send is limited to 31 bytes.

               

              2. Am I right, that the defined "MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX  (28u)" refers to the marked index number in the picture?

              Ans: Yes.

               

              Thanks,

              P Yugandhar.

              1 of 1 people found this helpful
              • 4. Re: How to set Manufacturer Specific Data programmatically?
                user_1536336

                Hi Yugandhar,

                 

                could you please also see my post here?

                 

                Where to call CyBle_GetDeviceAddress() function?

                 

                Thanks!