user_advertise_data.

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support。We’ll be fixing bugs / optimising the searching and tagging over the coming days.
12 posts / 0 new
Last post
Ruchi Patel.
Offline
最后一次露面:2 years 6 months ago
Joined:2017-03-29 10:50
user_advertise_data.

Hello Dialog_Support,

1.我们将DA14580 MCU配置为a广播公司模式。所以我们需要动态改变user_advertise_data.字符串发送动态更改的数据。但是此User_Advertise_Data在User_Config.h文件中定义,因此我们无法修改它。是否有任何规定,因此我们可以在我们的用户定义函数中修改User_Advertise_data?

2. Can we define more than one USER_ADVERTISE_DATA?
for example
#define USER_ADVERTISE_DATA ("\x03"\
ADV_TYPE_COMPLETE_LIST_16BIT_SERVICE_IDS\
ADV_UUID_DEVICE_INFORMATION_SERVICE\
“\ x11”\
ADV_TYPE_COMPLETE_LIST_128BIT_SERVICE_IDS\
"\x2F\x2A\x93\xA6\xBD\xD8\x41\x52\xAC\x03\x00\x0F\xCA\xEA\x80\x7F")

#define USER_ADVERTISE_DATA1 ("\x03"\
ADV_TYPE_COMPLETE_LIST_16BIT_SERVICE_IDS\
ADV_UUID_DEVICE_INFORMATION_SERVICE\
“\ x11”\
ADV_TYPE_COMPLETE_LIST_128BIT_SERVICE_IDS\
“\ x2f \ x2a \ x93 \ xa6 \ xbd \ xd8 \ x41 \ x52 \ xac \ x03 \ x00 \ x0f \ xca \ xea \ x80 \ x00”)

The above mention code snippet is possible or not?

3.如果我们想发送超过广告ckets with different payloads then do you have any example code?

4. How to change advertisement packet transmission rate?

Device:
PM_DIALOG.
Offline
最后一次露面:15 hours 33 min ago
Staff
Joined:2018-02-08 11:03
Hi Ruchi Patel

Hi Ruchi Patel

请检查SDK的BLE_APP_BAREBONE示例,该示例演示了用户广告数据的动态变化。是的,您可以发送超过1个具有不同有效载荷的广告数据包。BLE_APP_BAREBONE示例也展示了该功能。广告字符串应具有特定格式,如。您发布的代码块具有此格式,因此可以执行此操作。广告分组传输速率可以在user_undirected_advertise_conf结构中定制
user_config.h文件。广告数据包以特定的广告间隔传输,该间隔可以在该结构中更改

Thanks PM_dialog

Ruchi Patel.
Offline
最后一次露面:2 years 6 months ago
Joined:2017-03-29 10:50
Hello PM_Dialog,

Hello PM_Dialog,

Thank you for your prompt reply. It was helpful.
我还有很少有问题。
1.I have checked ble_app_barebone example. In that, only manufacturing advertising data are changing. If we want to modify other bytes of advertising data in user files then how we can modify? Do you have any example program for this?
2. I have not found user_undirected_advertise_conf structure in ble_app_barebone example so can you tell me in which example this structure is defined?
3.I want to configure one broadcaster which transmits advertising packets. This advertising packet we can modify. We should able to modify more than 1 bytes of advertising data. So can you guide me how to start this?

Thanks and Regards,
Ruchi Patel.

PM_DIALOG.
Offline
最后一次露面:15 hours 33 min ago
Staff
Joined:2018-02-08 11:03
嗨Ruchi Patel,

嗨Ruchi Patel,

您可以通过更改user_adc_conf结构的.intv_min或.intv_max engers来配置广告分组传输速率。通过这种方式,您可以定义广告的最小和最大间隔。关于广告数据,您不仅可以修改制造广告数据。您还可以修改超过1个字节的广告数据。SDK的BLE_APP_BAREBONE示例可动态更改广告字符串的适当数据。特定示例中的完整数据具有2个字节的长度,但可以更改它们的长度。在广告字符串中,您可以将特定数据追加并从应用程序中更新它们。广告消息是在app_easy_gap_undirected_advertise_start_create_msg()函数中创建的,然后在调用app_easy_gap_undirected_advertise_get_active()函数时保存在CMD结构中。CMD指针将有一条完整的消息,您可以发送到堆栈的堆栈,包括从user_advertise_data拍摄的一些默认的adv数据,因此您可以做的是在app_easy_gap_undirected_advertise_get_active()返回之后,针对保存广告数据的CMD指针中的数组。(cmd-> info.host.adv_data)并根据需要更改它们 - 您的数据必须根据BLE规范。

Thanks PM_dialog

Ruchi Patel.
Offline
最后一次露面:2 years 6 months ago
Joined:2017-03-29 10:50
Hello PM_dialog,

Hello PM_dialog,

Thank you for the reply. Now I am able to send more than 1 bytes in USER_ADVERTISE_DATA. Next I want to do role switch between observer and broadcaster. I have two individual applications: one as a broadcaster and other as a observer. Previously i have done role switching between peripheral and central. So i have tried to configure this but my application goes into nmi_handler as i run the application. Can you suggest me that is there any extra changes required?

Thanks and Regards,
Ruchi

PM_DIALOG.
Offline
最后一次露面:15 hours 33 min ago
Staff
Joined:2018-02-08 11:03
嗨Ruchi Patel,

嗨Ruchi Patel,

关于NMI_Handler独立于双角色应用程序。由于看门狗定时器,将发出NMI_Handler。请检查看门狗击中您的应用程序。关于广播和观察者模式之间的切换,您不应该做任何其他更改。在广播的情况下,您是作为不可连接的设备进行广告吗?如果没有,可以使用app_easy_gap_non_connectable_advertise_start API为不可连接的广告创建广告消息。此外,我建议您使用.App_on_adv_nonconn_complete回调函数,因为在广告作为不可连接的设备时触发此回调时,从而触发。

Thanks PM_dialog

Ruchi Patel.
Offline
最后一次露面:2 years 6 months ago
Joined:2017-03-29 10:50
Hello Dialog_Support,

Hello Dialog_Support,

Thank you for your reply. Now i am able to switch the role from observer to broadcaster and vice versa.

1.我已经要求在my first post that我们可以定义多个user_advertise_data吗?。我能够在user_config.h文件中定义它。但是怎么称呼它?我的意思是nvds.c文件具有user_advertise_data的nvds_data_struct结构。但如果我想调用user_advertise_data和user_advertise_data1,那么我可以在用户空间中调用的地方?由于nvds.c文件是SDK的常用文件,所以我无法修改它。

2. I have one broadcasting device in which i am modifying manufacture data which is part of USER_ADVERTISE_DATA and start advertising. At the other end I have another device which is observer. At observer side I am getting USER_ADVERTISE_DATA packets but in that I am not getting manufacture data. I have checked using BLE Scanner App, In that i am getting manufacture data. How to receive this manufacture data at observer device side?

Thanks and Regards,
Ruchi

PM_DIALOG.
Offline
最后一次露面:15 hours 33 min ago
Staff
Joined:2018-02-08 11:03
嗨Ruchi Pate,

嗨Ruchi Pate,

The #define “USER_ADVERTISE_DATA” is appended into the .NVDS_TAG_APP_BLE_ADV_DATA item of nvds_data_storage structure as you said in your post. You can define more than one USER_ADVERTISE_DATA, but only one of that can be appended in that structure due to the unique .NVDS_TAG_APP_BLE_ADV_DATA item. If you want to have more than one advertising data, you are able to do it but with a different way. I suggest you to define the USER_ADVERTISE_DATA as empty, and then append your different advertising data dynamically. When the device starts advertising, the user_app_adv_start() is executed and then the cmd is created by app_easy_gap_undirected_advertise_get_active(). The app_easy_gap_undirected_advertise_get_active() function returns the app_easy_gap_undirected_advertise_start_create_msg() function which creates the advertising message for a connectable undirected event. The advertising message includes the user advertising configurations, the advertising data and other data. The app_easy_gap_adv_read_from_NVDS() function reads USER_ADVERTISE_DATA from the nvds_data_storage structure, so if you have empty the USER_ADVERTISE_DATA define, your advertising data will be empty. By this way, you are able to append your different advertising data depending on your application dynamically by using app_add_ad_struct() in the user_app_adv_start() function.

Regarding the manufacturer data, when the device is in observer mode, the .app_on_adv_report_ind ind callback function (in user_callback_config.h file) will executed, so it shouldn’t be NULL and you should define a function to be triggered. When a GAPM_ADV_REPORT_IND is received, the gapm_adv_report_ind_handler() will executed which is executes the .app_on_adv_report_ind ind callback. This handler has input parameter the gapm_adv_report_ind structure, which includes the adv_report structure. The manufacturer data should be at the data[ADV_DATA_LEN] item of the adv_report scucture. So how do you actually check that the manufacturer data are not being received and all the other data received properly?

Thanks PM_dialog

Ruchi Patel.
Offline
最后一次露面:2 years 6 months ago
Joined:2017-03-29 10:50
Hello PM_Dialog,

Hello PM_Dialog,

1.In user_config.h file, I will keep USER_ADVERTISE_DATA as empty and later I will add advertising data dynamically. But is it possible to add large number of bytes(approximately 16-20 bytes) into single USER_ADVERTISE_DATA? Let's consider I am able to broadcast large number of bytes but at the observer side, can I receive more than 31 bytes data? Right now, if broadcaster has large number of bytes in USER_ADVERTISE_DATA then at observer side I am not able to receive advertising data bytes more than 31 bytes.

2. I am observing data in user_on_adv_report_ind function. Here i am attaching code snippet of that function.
void user_on_adv_report_ind(struct gapm_adv_report_ind const * param)
{
易失性静态UINT8_T PARAM_DATA [ADV_DATA_LEN];

ARCH_PRINTF(“%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x \ n \ r”,
param->report.adv_addr.addr[5],
param->report.adv_addr.addr[4],
param->report.adv_addr.addr[3],
param-> eport.adddr.addr [2],
param - > report.adv_addr.addr [1],
param->report.adv_addr.addr[0],
param_data[0] = param->report.data[0],
param_data [1] = Param-> Report.data [1],
param_data [2] = param-> report.data [2],
param_data[3] = param->report.data[3],
param_data[4] = param->report.data[4],
param_data[5] = param->report.data[5],

就像这个我正在读31个字节的数据。我不知道其他读取数据的方法。在广播方面,在26个字节之后,附加制造数据。如果我在制造数据字符串处修改我的自定义数据,并且广告数据长度更像是31个字节,那么我在观察者侧获得00,但如果我在原始数据部分中的BLE扫描仪应用中检查相同,我会得到相同的数据已经修改过。你能解释一下我为什么会发生这种情况吗?如果您有任何其他方法来读取user_advertise_data,那么请告诉我。

Thanks and Regards,
Ruchi

PM_DIALOG.
Offline
最后一次露面:15 hours 33 min ago
Staff
Joined:2018-02-08 11:03
嗨Ruchi Patel,

嗨Ruchi Patel,

Depending how you are using the SDK and which example you are using be aware that the SDK will append any extra data that don’t fit in the advertising string in the scan response data, so make sure that the data that you are interested in is in the advertising string and not the scan response data. In the first indication (advertising indication) the advertising data will populate the data member of the adv_report struct, and then in the second indication (scan response indication) the scan response data will populate the struct. In order to catch the scan response data, you should configure your device as GAPM_SCAN_ACTIVE to get a scan response. If you configure your device as GAPM_SCAN_PASSIVE, the observer only receives advertising data and doesn’t send a scan request to receive a scan response, so you will not able to read your scan response data. I’ve also tested this using an observer and the ble_app_barebone, I was able to get the increment in the advertising string or in the scan response data.

Thanks PM_dialog

Ruchi Patel.
Offline
最后一次露面:2 years 6 months ago
Joined:2017-03-29 10:50
Hello PM_Dialog,

Hello PM_Dialog,

Thank you for the response. I am developing my application by taking reference of ble_app_peripheral and ble_app_barebone example. Now i want to send my custom data into USER_ADVERTISE_DATA but that data don't fit into USER_ADVERTISE_DATA so as i asked in my previous post that can we define multiple USER_ADVERTISE_DATA and broadcast it? But as USER_ADVERTISE_DATA is invoked in nvds.c file which is DSK's common file so I can't modify it. As you have suggested that update USER_ADVERTISE_DATA but i am not able to implement that so can you provide me any code snippet or example code which is doing exactly same.

简而言之,我想一次播放28个字节到4个不同的观察者。因此,如果我可以在每次广告包和4个广告数据包发送7个字节,我想一次播放,那么我需要遵循哪些配置?请帮帮我。

Thanks and Regards,
Ruchi Patel.

PM_DIALOG.
Offline
最后一次露面:15 hours 33 min ago
Staff
Joined:2018-02-08 11:03
嗨Ruchi Patel,

嗨Ruchi Patel,

As I have pointed out in a previous post, you are not able to define more than one USER_ADVERTISE_DATA, because the #define “USER_ADVERTISE_DATA” is appended into the .NVDS_TAG_APP_BLE_ADV_DATA item of nvds_data_storage structure. The advertising string has 31 byte length, but 3 bytes of them are reserved from the stack, the advertising filter policy and the advertising data length, so you are able to use up to 28bytes. The data that are appended into the advertising string will be populated by user_app_adv_start with the procedure I have already mentioned in a previous post. In case you want to add your custom data into the advertising string you should copy them into the correct array of the cmd which is into user_app_adv_start() function. The cmd is created by app_easy_gap_undirected_advertise_get_active(). In your application you can have the USER_ADVERTISE_DATA empty and copy your data into the advertising string. The custom data should be valid and should follow the structure of USER_ADVERTISE_DATA, as in order to start advertising correctly. You should have 2bytes as length and flag into your data, so finally you are able to append up to 26bytes into the advertising string. In the following code, I will present you how you can do that.

void user_app_adv_start(void)
{

UINT8_T ADVDATA [28] = {0x1B,0xFF,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x36,0x37,0x38,0x39,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38};

//安排下一个广告数据更新
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_undirected_advertise_get_active();

memcpy(cmd->info.host.adv_data, advdata , 28);

//动态添加制造商特定数据
//mnf_data_update();
app_add_ad_struct(cmd,&mnf_data,sizeof(struct mnf_specific_data_ad_structure));

app_easy_gap_undirected_advertise_start();
}

如果将26bytes数据添加到广告字符串并希望填充其他数据,则可以将它们追加到扫描响应数据中,但在另一侧,观察者应配置为GAPM_SCAN_ACTIVE才能发送扫描请求。

Thanks PM_dialog