3 Replies Latest reply on Jan 19, 2018 7:36 AM by e.pratt_1639216

    Changing an advertisement data.

    cnpante_3000656

      How can I change an advertisement packet...

      I followed this tutorial...

      PSoC-4-BLE/100_Projects_in_100_Days/Day009_Dynamic_Broadcaster at master · cypresssemiconductorco/PSoC-4-BLE · GitHub

       

      and made my own version for my application.. I'm currently debugging it.

      I set my Service Data to 0.

      I need it to switch it from 0 to 1, and vice versa.

       

       

      CYBLE_GAPP_DISC_MODE_INFO_T discoveryReport;

       

      int main(void)

      {

          CYBLE_API_RESULT_T apiResult;

          CyGlobalIntEnable; /* Enable global interrupts. */

       

       

          apiResult = CyBle_Start(StackEventHandler);

          /* Place your initialization/startup code here (e.g. MyInst_Start()) */

       

       

          for(;;)

          {

              CyBle_ProcessEvents();

              DynamicADVPayloadUpdate();

          }

      }

       

      void DynamicADVPayloadUpdate(void)

      {

          if(CyBle_GetBleSsState() == CYBLE_BLESS_STATE_EVENT_CLOSE)

          {

              discoveryReport.advData->advData[14u] = 0x01;

              CyBle_GapUpdateAdvData(discoveryReport.advData, discoveryReport.scanRspData);

          }

      }

       

      void StackEventHandler(uint32 event, void *eventParam)

      {

          switch(event)

          {

              /* Mandatory events to be handled by Find Me Target design */

              case CYBLE_EVT_STACK_ON:

              case CYBLE_EVT_GAP_DEVICE_DISCONNECTED:

                  /* Start BLE advertisement for 30 seconds and update link

                   * status on LEDs */

                  CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);

       

       

                break;

       

       

              case CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP:

                  if(CyBle_GetState() == CYBLE_STATE_DISCONNECTED)

                  {

                      CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);

                  }

                  break;

       

       

              default:

              break;

          }

      }

       

      Message was edited by: Cyrus Nikko Pante