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

Get device name in advertise data

HI, i would like to get device name and print to uart, but when i try to print the device name i got error character.

Here my snipet code and uart result

    const ble_gap_evt_adv_report_t *p_adv_report = &p_ble_evt->evt.gap_evt.params.adv_report;
    const ble_data_t *data = &p_adv_report->data;
    
    uint8_t *device_name = ble_advdata_parse(data->p_data, data->len, BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME);
    int8_t report = p_ble_evt->evt.gap_evt.params.adv_report.rssi;

    if(data->len == 0)
    {
      
    }
    else{
      printf("%d, %s \r\n",report,device_name);  
    }

Parents Reply Children
No Data
Related