3 Replies Latest reply on Oct 1, 2020 8:43 AM by StNu_1610991

    Dynamically changing the BLE advertising message content

    StNu_1610991

      The content of the advertising message is set up statically in the BLE component configuration. in PSoC Creator 4.3  We need to change two bytes dynamically in one field.  The start and stop of the advertising is  controlled in the CY_BLE_EVT_GAPP_ADVERTISEMENT_START_STOP event but I do not see a pointer to the message content to be able to change it.

       

      Could someone tell me where the message data is located or how this could be done?

        • 1. Re: Dynamically changing the BLE advertising message content
          PY_21

          Hello,

           

          Please refer to the Cy_BLE_GAPP_UpdateAdvScanData() API in the BLE component datasheet. This function is used by GAP Peripheral application to set Advertisement and/or Scan Response data. This function can be used during active advertisement as well. Application should ensure the validity of the data content. On completion of this operation, GAP Peripheral application receives CY_BLE_EVT_GAPP_UPDATE_ADV_SCAN_DATA_COMPLETE event.

           

           

          Thanks,
          P Yugandhar.

          • 2. Re: Dynamically changing the BLE advertising message content
            StNu_1610991

            OK. Thanks.

            From my perspective I never would have guessed by the name of the function that it could also modify the advertising data.  The documentation could be a lot more clear.

             

            Now, the next problem is getting access to the advertising packet byte array that was assembled statically.  First how can it be accessed and second, how is it put into the cy_stc_ble_gapp_disc_mode_info_t structure needed by the UpdateAdvScanData function?

            • 3. Re: Dynamically changing the BLE advertising message content
              StNu_1610991

              I found a solution not even needing Cy_BLE_GAPP_UpdateAdvScanData().

               

              The advertising packet bytes are at  cy_ble_config.discoveryModeInfo[cy_ble_advIndex].advData as a byte array.  For my application only 2 bytes need to be dynamically variable.  So, just setting the bytes in this array seems to be working fine.  The structure of the advertising message does not have to be changed.