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

Advertising init

Hi everyone. I am making an application which combines two services (ANCS and Nordic UART). I compare the advertising_init() function from the two provided examples (ble_app_ancs_c and ble_app_uart) and see the difference inside advertising_init function:

In the ble_app_ancs_c example: (1): err_code = ble_advertising_init(&advdata, NULL, &options, on_adv_evt, NULL);

In the ble_app_uart example: (2): err_code = ble_advertising_init(&advdata, &scanrsp, &options, on_adv_evt, NULL); where "scanrsp" variable is declared as ble_advdata_t scanrsp;

Could you please tell me what is difference between them ? when should we choose (1), when should we use like (2). If I combine ANCS and Nordic UART service, which one should I choose ? Thank you very much !

Parents
  • In some cases, other devices will require more information about a device than whats contained within the advertisement packet. This is done by sending a "SCAN_REQ" packet to a device which is advertising (note that this only applies for the advertising types ADV_IND and ADV_SCAN_IND/ADV_DISCOVER_IND.

    If you don't care about providing more information in the "SCAN_RSP" packet, or your advertisement is of a non-scannable type, you do not have to provide scan response data to the advertising initialization.

    This is valid for scannable advertisement types as well, and will result in a "SCAN_RSP" with no data being sent.

    (1) does not provide scan response data, whilst (2) does. If you want to provide some extra information from your advertiser without connecting, you should use (2) and place the extra data in the scan response. Otherwise you should/could use (1).

    Note that there might be some convention/desired way of doing this that I'm not aware of.

Reply
  • In some cases, other devices will require more information about a device than whats contained within the advertisement packet. This is done by sending a "SCAN_REQ" packet to a device which is advertising (note that this only applies for the advertising types ADV_IND and ADV_SCAN_IND/ADV_DISCOVER_IND.

    If you don't care about providing more information in the "SCAN_RSP" packet, or your advertisement is of a non-scannable type, you do not have to provide scan response data to the advertising initialization.

    This is valid for scannable advertisement types as well, and will result in a "SCAN_RSP" with no data being sent.

    (1) does not provide scan response data, whilst (2) does. If you want to provide some extra information from your advertiser without connecting, you should use (2) and place the extra data in the scan response. Otherwise you should/could use (1).

    Note that there might be some convention/desired way of doing this that I'm not aware of.

Children
No Data
Related