5 Replies Latest reply on Nov 7, 2019 4:55 AM by PY_21

    Sending RSSI value to another device

    umg_4380326

      Hi,

       

      I have two devices of CYBLE- 2241100 as peripheral and central.

      I am advertising the device A and then getting the RSSI through scan report of that at the central device B.

      Now after switching device B ,central to peripheral mode, how can i send that rssi value of device A  through the advertising packet of device B to another central cypress device C?

       

      Regards,

      Shilpa

        • 1. Re: Sending RSSI value to another device
          PY_21

          Hello Shilpa,

           

          1. When the device B is in central mode store the advertisement data(RSSI Value) of device A in some buffer in device B. After switching the device B to peripheral mode, update the data buffer to structure CYBLE_GAPP_DISC_DATA_T cyBle_discoveryData before starting the advertisement as shown in below code.

           

                  cyBle_discoveryData.advData[5]=0x41;

                  cyBle_discoveryData.advData[6]=0x42;

                  cyBle_discoveryData.advData[7]=0x43;

                  cyBle_discoveryData.advData[8]=0x44;

                 

                  CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);

           

          2. You can also update the ADV data and SCAN response data of a Device while advertising is ongoing using CyBle_GapUpdateAdvData() API. Please refer to the Day009_Dynamic_Broadcaster project in the GitHub for more information.

           

          Thanks,

          P Yugandhar.

          • 2. Re: Sending RSSI value to another device
            umg_4380326

            Hi Yugandhar,

             

            How do i update the buffer to the structure?.How is it possible if there were two advertising devices whose data has to to stored in device B?

             

            Thanks

            Shilpa

            • 3. Re: Sending RSSI value to another device
              PY_21

              Hello Shilpa,

               

              At the central device, in scan progress result event(CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT), check for the particular advertising device address and then store the RSSI value in a buffer as shown in the below code.

               

               

              case CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT: 

                      advReport=*(CYBLE_GAPC_ADV_REPORT_T *)eventParam;

                 /* Checking for Device 1 */

                      if(advReport.peerBdAddr[0]==0x05 && advReport.peerBdAddr[1]==0xff && advReport.peerBdAddr[2]==0x31 && advReport.peerBdAddr[3]==0x01&&advReport.data[4]==0x08 &&advReport.data[5]==0x09)

                      {

                              buffer[0]=advReport.rssi;  

                          }

                 /* Checking for Device 2*/

                      else if(advReport.peerBdAddr[0]==0x04 && advReport.peerBdAddr[1]==0xaf && advReport.peerBdAddr[2]==0x50 && advReport.peerBdAddr[3]==0x78&&advReport.data[4]==0x0a&&advReport.data[5]==0x00)

                      {

                          buffer[1]=advReport.rssi;

                          }

              break;

               

              Please let me know if this helps.

               

              Thanks,

              P Yugandhar.

              • 4. Re: Sending RSSI value to another device
                umg_4380326

                Hi

                I have created a buffer and storing the value .I would like to know how can i update that to the structure like you suggested?

                 

                Thanks

                • 5. Re: Sending RSSI value to another device
                  PY_21

                  Hello Shilpa,

                   

                  1. You can update the buffer data to CYBLE_GAPP_DISC_DATA_T cyBle_discoveryData before starting the advertisement(after scanning was stopped) as shown in below code. This adv data will be advertised to all the central devices.

                   

                          cyBle_discoveryData.advData[0]=buffer[0];

                          cyBle_discoveryData.advData[1]=buffer[1];

                  CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);

                   

                  2. You can also update the Advertisement data and/or Scan response data of a Device while advertising is ongoing using CyBle_GapUpdateAdvData() API. Please refer to the Day009_Dynamic_Broadcaster project in the GitHub for more information.

                   

                  Thanks,

                  P Yugandhar.