ADV_TYPE_FLAGS not working

7 posts / 0 new
Last post
uta_lc
Offline
Last seen:1 year 4 weeks ago
加入:2016-05-03 07:39
ADV_TYPE_FLAGS not working

Dear Dialogue support,

I'm trying to modify advertising data (user_config.h) based on prox_reporter as follows:

/// Advertising service data
/// Advertising AD type flags, shall not be set in advertising data
#define USER_ADVERTISE_DATA "\x02"\
ADV_TYPE_FLAGS\
"\x05"
//where 0x5 = 0x1 | 0x4-
//ADV_FLAG_LE_LIMITED_DISCOVERABLE | ADV_FLAG_BREDR_NOT_SUPPORTED

/// Advertising data length - maximum 28 bytes, 3 bytes are reserved to set
#define USER_ADVERTISE_DATA_LEN (sizeof(USER_ADVERTISE_DATA)-1)
/// Advertising name
#define USER_DEVICE_NAME "DevName"
/// Advertising name Length
#define USER_DEVICE_NAME_LEN (sizeof(USER_DEVICE_NAME)-1)
/// Scan response data
#define USER_ADVERTISE_SCAN_RESPONSE_DATA "\x04"\
ADV_TYPE_MANUFACTURER_SPECIFIC_DATA\
"CO" \
"\x1"

/// Scan response data length- maximum 31 bytes
#define USER_ADVERTISE_SCAN_RESPONSE_DATA_LEN (sizeof(USER_ADVERTISE_SCAN_RESPONSE_DATA)-1)

But I cannot see the node advertising using above configuration.

It works well when switching to original advertising data configuration. Am I doing anything wrong? Can someone at Dialogue please try ADV_TYPE_FLAGS? It only takes a couple of minutes to try it out - by simply replacing the above section in user_config.h.

Please note that I've changed the above 0x5 to 0x1 or 0x4 but neither worked.

Best Regards,
uta_lc

Device:
uta_lc
Offline
Last seen:1 year 4 weeks ago
加入:2016-05-03 07:39
FYI - the reason we want to

FYI - the reason we want to use ADV_TYPE_FLAGS is we want to keep ADV data minimum to save power.

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi uta_lc,

Hi uta_lc,

You cant change the AD flags explicitly, those flags are populated by the stack. After those flags are populated by the stack you can keep your advertising string empty and there will be no data in the advertising event (set the length of yoru device's name adv data and scan response data to 0). If you want to place the 0x05 in your advertising string (limited discoverable and BR/EDR not supported) just set the user_undirected_advertising_mode to GAP_LIM_DISCOVERABLE and the stack will take care of the rest. Regarding keeping the advertising string to minimum for less power consumption it will not make any difference.

Thanks MT_dialog

uta_lc
Offline
Last seen:1 year 4 weeks ago
加入:2016-05-03 07:39
Thanks MT, issue resolved.

Thanks MT, issue resolved.

uta_lc
Offline
Last seen:1 year 4 weeks ago
加入:2016-05-03 07:39
Hi, one more related question

Hi, one more related question:

In the above definition:
#define USER_ADVERTISE_SCAN_RESPONSE_DATA "\x04"\
ADV_TYPE_MANUFACTURER_SPECIFIC_DATA\
"CO" \
"\x1"

How to dynamically change the last bye, e.g., change '\x1' to '\x2' depending on system state?

I can see that USER_ADVERTISE_SCAN_RESPONSE_DATA is only referred in nvds.c:

const struct nvds_data_struct nvds_data_storage __attribute__((section("nvds_data_storage_area")))
................
.NVDS_TAG_APP_BLE_SCAN_RESP_DATA = USER_ADVERTISE_SCAN_RESPONSE_DATA,
...................

Can you please let me how to update the field on the fly?

Thanks,
uta_lc

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi uta_lc,

Hi uta_lc,

The scan response data have the same functionallity as the advertising data, you have to stop the advertising procedure and change scan response data string before start the advertising again, and feed the stack with the changed scan response data. In the default functionallity of the SDK, the scan response data are provided from the NVDS structure. In order to change the scan response data you can use the app_easy_gap_undirected_advertise_get_active() function and then create an additional function that will append the additional data to your default NVDS data. Please make sure that the lengths are proper in the advertising and scan response data strings otherwise the stack will refuse to start the advertising procedure. You can check the app_ble_barebone project where the advertising string changes, the procedure is the same for the scan response data as well.

Thanks MT_dialog

uta_lc
Offline
Last seen:1 year 4 weeks ago
加入:2016-05-03 07:39
Thanks MT, resolved.

Thanks MT, resolved.

Topic locked