3 Replies Latest reply on Feb 19, 2018 7:53 AM by e.pratt_1639216

    CyBle_GapGetPeerBdAddr Is not returning the correct BLE ID

    nick.handran_1513271

      For some reason the following code does not return the expected BLE ID from a specific android device.  I've checked in the android "status" screen to find out what the ID should be: A0:CB:FD:7B:CA:67  I'm receiving 65:67:09:96:b4:95  though it seems that between compiles sometimes the value it returns changes I just got 63:c9:63:01:ee:5d for the same device.  It does provide different BLE IDs for different devices and it does seem to be static per device for some set of time.  It's just unreliable.

       

      Following code is used:

              case CYBLE_EVT_GAP_DEVICE_CONNECTED:/*Device connected*/

                      /* Enable notifications on the server side */

                      {

                          volatile uint8_t addr[CYBLE_GAP_BD_ADDR_SIZE];

                         CYBLE_GATTC_WRITE_CMD_REQ_T write_server;

                          CYBLE_GATT_ERR_CODE_T gattErrCode;

                          uint32_t connected_ble_addr[2];

       

                          if(CYBLE_ERROR_OK != CyBle_GapGetPeerBdAddr(connHandle.bdHandle, &connected_addr))

                          {

                              printf("Couldn't retrieve peer address.\r\n"); 

                          }

                          addr[0] = connected_addr.bdAddr[0];

                          addr[1] = connected_addr.bdAddr[1];

                          addr[2] = connected_addr.bdAddr[2];

                          addr[3] = connected_addr.bdAddr[3];

                          addr[4] = connected_addr.bdAddr[4];

                          addr[5] = connected_addr.bdAddr[5];

                        

                          connected_ble_addr[0] = addr[5] << 8 | addr[4];

                          connected_ble_addr[1] = addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0];

                          printf("peer address - %02x:%02x:%02x:%02x:%02x:%02x \r\n",

                                  addr[5], addr[4],

                                  addr[3], addr[2],

                                  addr[1], addr[0]);

                     }