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

advertisers names

i am using/ ble_app_multilink/ example present in central folder..i am beginner to this ,,so i have few doubts in it

1)so where actually advertisers(which are advertising) names stored in the / ble_app_multilink/ code ......

2)And i want to find out the rssi value of particular device like mobile ,so i know there is target name in code called m_target_periph_name[]="mobile name",(i am providing 4 length word)but i am not able to connect to that mobile

3)so i need the exact location where actually comparison is going on,so that i can understand and do changes...

thank you

i need @least explaination of 1 quesition i asked to solve my problem

Parents
  • Hello,

    What SDK version are you using? The reason I ask is that the advertising report events are moved from main.c to it's own file, so to ease the communication, it is easier if we look at the same SDK version.

    For now, I will refer to SDK15.3.0.

     

    1)so where actually advertisers(which are advertising) names stored in the / ble_app_multilink/ code ......

     In the ble_app_multilink_central example, the m_target_periph_name is passed on in the initialization of the scanning, through nrf_ble_scan_filter_set().

    Whenever you receive an advertisement, the event BLE_GAP_EVT_ADV_REPORT() occurs in nrf_ble_scan.c, which calls nrf_ble_scan_on_adv_report(). 

    This function, nrf_ble_scan_on_adv_report() will check what filters that are enabled, and check for a name match in adv_name_compare() (also in nrf_ble_scan.c).


    2)And i want to find out the rssi value of particular device like mobile ,so i know there is target name in code called m_target_periph_name[]="mobile name",(i am providing 4 length word)but i am not able to connect to that mobile

     Do you mean that you are trying to connect to your mobile phone?

    Are you sure that it is advertising? And what do you mean by 4 length word? Remember that an advertisement packet is only 31 bytes long (in total), so the advertisement name is probably not that long. Did you mean QWORD (16 bytes)?

    You can see the RSSI value of advertisement packets using the int8_t p_adv_report->rssi inside the advertising report event.

    3)so i need the exact location where actually comparison is going on,so that i can understand and do changes...

     -

     

    i need @least explaination of 1 quesition i asked to solve my problem

     2/3 is not bad. But I hope that I covered covered question 3 in 1 and 2.

    Let me know if anything was unclear, or if you can't find the locations in your SDK version.

    Best regards,

    Edvin 

  • sir i am able to find #include nrf_ble_scan.h but not nrf_ble_scan.c and the functions what you said are not available ...,i m using same 15.3.0 sdk ,sir @least please help me to find to print advertsing names with rssi values...i am able to print rssi values but not with their names ..,so how  to print advertiser names ?

Reply Children
  • What do you mean by "the functions that you said are not available"?

    They are used in the ble_app_multilink_central example. Are you able to compile this example?

    Maybe what confuses you is that .c files aren't included by text, like the .h files are. They are included in the project file, and visible in the project explorer.

     

    Umesh said:
    @least please help me to find to print advertsing names with rssi values...i am able to print rssi values but not with their names ..,so how  to print advertiser names ?

     Not all devices advertise with their names. But you can look at the ble_advdata_name_find function in ble_advdata.c, which is called from adv_name_compare() in nrf_ble_scan.c. Setting a breakpoint on where the ble_advdata_name_find returns true, you can see how it finds the name:

    Advertising packets consists of several elements. Each element starts with one byte telling you the length of the rest of the element. The next byte is the element type. In this case, the advertising packet is:

    0x031900000201060e094e6f726469635f426c696e6b79711fd03e78f4837325

    So 03 is the length of the first element: 0x03190000. 0x19 is the type of this element, and 0x0000 is the payload.

    Second element: 020106. Length 02, type 01, payload 06

    third element: 0x0e094e6f726469635f426c696e6b79: 

    So the third element has length = 0x0e=14, element type=0x09 = advertising name, payload= 0x4e6f726469635f426c696e6b79 = "Nordic_Blinky".

    So you can parse these packets yourself, or you can use this function.

    Also worth mentioning that element type 0x08 is a shortened advertising name.

    Did you find the nrf_ble_scan.c?

  • yaa i am able to find ,,,,thank you for that ....in below pic ,i am able to find rssi value by that structure ....Is there any possibilty to find out advertiser name 

    and can i know what is the datatype of data in below structure liike for rssi its %d and for data?

  • Umesh said:
    Is there any possibilty to find out advertiser name

     Did you read my previous reply regarding advertising names?

    RSSI is a signed int. Did you try: NRF_LOG_INFO("%d", p_ble_evt-> ... .rssi);?

Related