This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to read Beacon UUID, RSSI, major , minor and Tx power by using NRF52840 DK?

HI All,

i m new to this technologies.Now m using NRF52840 DK and sdk as nrf15.2..we have developing the nrf52840 as a beacon scanner to scan the ibeacon details like rssi, uuid, txpower,majoe and minor..how to scan beacon value from nrf15,2 sdk? please help me out.thanks in advance  

Parents
  • Hi,

    Unfortunately, we do not have an example for scanning beacons. You can use any of the central examples from the SDK, but I suggest you to use the UART central example as a starting point. In your central application, you will get a BLE_GAP_EVT_ADV_REPORT event in the BLE event handler whenever you get an advertisement packet. You will need to extract the data(RSSI, UUID, tx power, major and minor) from the manufacturer spceific data.

  • hi.

     thanks..

    Here is my code

    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {

    ble_gap_evt_t const * p_gap_evt = &p_ble_evt->evt.gap_evt;
    uint8_t uuid[30];
    uint8_array_t adv_data;

    switch (p_ble_evt->header.evt_id)
    {
    case BLE_GAP_EVT_ADV_REPORT:
    {

    NRF_LOG_RAW_HEXDUMP_INFO (m_scan.scan_buffer.p_data, m_scan.scan_buffer.len);

    memmove(uuid, p_gap_evt->params.adv_report.data.p_data, p_gap_evt->params.adv_report.data.len);

    adv_data.size = p_gap_evt->params.adv_report.data.len;


    NRF_LOG_RAW_INFO("UUID: %02x%02x%02x%02x%02x%02x\n", uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5]);

    NRF_LOG_RAW_INFO("TX_POWER: %d\n", p_gap_evt->params.adv_report.tx_power);

    NRF_LOG_RAW_INFO("RSSI2: %d\n", p_gap_evt->params.adv_report.rssi);

    }

    I m gettinng Rssi value ,UUID..but m not getting TX POWER properly..constantly i get some value...

    please review my code..

Reply
  • hi.

     thanks..

    Here is my code

    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {

    ble_gap_evt_t const * p_gap_evt = &p_ble_evt->evt.gap_evt;
    uint8_t uuid[30];
    uint8_array_t adv_data;

    switch (p_ble_evt->header.evt_id)
    {
    case BLE_GAP_EVT_ADV_REPORT:
    {

    NRF_LOG_RAW_HEXDUMP_INFO (m_scan.scan_buffer.p_data, m_scan.scan_buffer.len);

    memmove(uuid, p_gap_evt->params.adv_report.data.p_data, p_gap_evt->params.adv_report.data.len);

    adv_data.size = p_gap_evt->params.adv_report.data.len;


    NRF_LOG_RAW_INFO("UUID: %02x%02x%02x%02x%02x%02x\n", uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5]);

    NRF_LOG_RAW_INFO("TX_POWER: %d\n", p_gap_evt->params.adv_report.tx_power);

    NRF_LOG_RAW_INFO("RSSI2: %d\n", p_gap_evt->params.adv_report.rssi);

    }

    I m gettinng Rssi value ,UUID..but m not getting TX POWER properly..constantly i get some value...

    please review my code..

Children
No Data
Related