How to remove flags from advertisement packet

Learn MoreFAQsTutorials

5 posts / 0 new
Last post
anushiya
Offline
Last seen:4 months 15 hours ago
加入:2017-12-20 02:30
How to remove flags from advertisement packet

Hi,

How to remove flags from advertisement packet? I am in non-connectable mode continuously transmitting.

By default The flag part of the payload has: 020106 (size 2 bytes, type - 01 flags, flag value - 06)

instead I want the advertisemnet packet to be 1FFF....... (size 1F = 31 in decimal, type FF - Manufacturer data)

Thank you,

Anushiya

Device:
PM_Dialog
Offline
Last seen:39 min 58 sec ago
Staff
加入:2018-02-08 11:03
Hi anushiya,

Hi anushiya,

Can you please clarify your question? Please check the ble_app_noncon example of the SDK which is located under 6.0.10.511\projects\target_apps\misc path. The app_easy_gap_non_connectable_advertise_get_active() API makes the correct command for non-connectable advertising. Please check the user_app_adv_start() callback function. The appropriate message in created by app_easy_gap_non_connectable_advertise_start_create_msg(). The advertising data will be sorted into info.host.adv_data member of gapm_start_advertise_cmd structure. The device name will be stored in the advertising string as well. I would suggest youto have a look at the source code of app_easy_gap_non_connectable_advertise_start_create_msg().

You could modify the USER_ADVERTISE_DATA macro in user_config.h header file in order to store the information you what in the advertising data. For example if you would like to store the BD address into the advertising data, you could do the following:

The advertising string should have a specific format. You can use the ADV_TYPE_MANUFACTURER_SPECIFIC_DATA flag and append the MAC address into the manufacturer data of the advertising string. For example let’s say that your BD address is: x00 x01 x02 x03 x04 x05 So your advertising data will be like below

#define BLE_MAC_ADDR "\x00\x01\x02\x03\x04\x05"

#define BLE_MAC_ADDR_LEN "\x07"

#define USER_ADVERTISE_DATA BLE_MAC_ADDR_LEN\

ADV_TYPE_MANUFACTURER_SPECIFIC_DATA\

BLE_MAC_ADDR

However, could you please indicate what you want to populate into the advertising data?

Thanks, PM_Dialog

anushiya
Offline
Last seen:4 months 15 hours ago
加入:2017-12-20 02:30
In the advertisement packet,

In the advertisement packet, I do not want to send the flags. I want to use all 31 bytes for manufacturer data. The above setting you mentioned above does not control the flags.

I am in non-connectable mode continuously transmitting.

The user_config.h has a comment "The Flags data type may be omitted". How do I do that is my question.

* - ADV_NONCONN_IND: Non-connectable undirected advertising event.

* - The maximum length of the user defined advertising data shall be 31 bytes.

* - The Flags data type may be omitted, hence the user can use all the 31 bytes for

* data.

* - The scan response data shall be empty.

anushiya
Offline
Last seen:4 months 15 hours ago
加入:2017-12-20 02:30
OK. In the sugested answer

OK. I have found the solution. In the sugested answer for making ble_app_sleepmode to non-connectable (continuously transmitting),

https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-hardware-device-reference-designs/mnfdata-update#comment-24179

The last parameter need to be changed to zero as

// adv_connectable Connectable advertising event or not parameter set to 0.

app_add_ad_struct(cmd, &mnf_data, sizeof(struct mnf_specific_data_ad_structure), 0);

void user_app_adv_start(void)

{

// Schedule the next advertising data update

app_adv_data_update_timer_used = app_easy_timer(APP_ADV_DATA_UPDATE_TO, adv_data_update_timer_cb);

struct gapm_start_advertise_cmd* cmd;

cmd = app_easy_gap_non_connectable_advertise_get_active(); // undirected -> non_connectable

// Add manufacturer data to initial advertising or scan response data, if there is enough space

// adv_connectable Connectable advertising event or not parameter set to 0.

app_add_ad_struct(cmd, &mnf_data, sizeof(struct mnf_specific_data_ad_structure), 0);

// Set extended sleep with OTP copy during advertising

arch_set_extended_sleep(true);

app_easy_gap_non_connectable_advertise_start(); // undirected -> non_connectable

}

PM_Dialog
Offline
Last seen:39 min 58 sec ago
Staff
加入:2018-02-08 11:03
Hi anushiya,

Hi anushiya,

Glad that you figured your issue out and thanks for you indication regarding the app_add_ad_struct().

Thanks, PM_Dialog