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
鲁奇帕特尔
Offline
最后一次见到:2年6个月前
Joined:2017-03-29 10:50
USER_ADVERTISE_DATA

Hello Dialog_Support,

1我们正在将DA14580 MCU配置为广播员模式。所以我们需要动态地改变USER_ADVERTISE_DATA字符串以发送动态更改的数据。但是这个用户数据是在USER\u config.h文件中定义的,所以我们不能修改它。是否有任何规定,以便我们可以修改用户定义函数中的用户数据?

2. Can we define more than one USER_ADVERTISE_DATA?
例如
#define USER_ADVERTISE_DATA ("\x03"\
adv_type_complete_list_16bit_service_ids \
avd_uuid_device_information_service \
“\x11”\
adv_type_complete_list_128bit_service_ids \
“\ x2f \ x2a \ x93 \ xa6 \ xbd \ xd8 \ x41 \ x52 \ xac \ x03 \ x00 \ x0f \ x03 \ x x00 \ x0f \ xca \ xea \ x80 \ x7f”)

#define user_advertise_data1(“\ x03”\
adv_type_complete_list_16bit_service_ids \
avd_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”)

上面提到代码片段是可能的吗?

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

4.如何更改广告数据包传输速率?

设备:
PM\U对话框
Offline
最后一次见到:13小时1分钟前
Staff
Joined:2018-02-08 11:03
嗨Ruchi Patel.

嗨Ruchi Patel.

请查看SDK的ble\u app\u barebone示例,它演示了用户广告数据的动态变化。是的,您可以用不同的有效负载发送1个以上的广告包。ble\u app\u barebone示例也演示了该功能。广告字符串应该有一个特定的格式,如。您发布的代码块具有这种格式,因此可以这样做。广告包传输速率可以在的用户无向广告配置结构中定制
用户配置.h文件。广告分组在特定的广告间隔中传输,该广告间隔可以在该结构中改变

谢谢pm_dialog.

鲁奇帕特尔
Offline
最后一次见到:2年6个月前
Joined:2017-03-29 10:50
你好pm_dialog,

你好pm_dialog,

感谢您的及时答复。这很有帮助。
我还有几个问题。
1.我已经检查了BLE_APP_BAREBONE示例。在此,只有制造广告数据正在发生变化。如果我们想在用户文件中修改其他字节的广告数据,那么我们如何修改?你有这个例子吗?
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.我想配置一个传输广告数据包的广播公司。我们可以修改此广告数据包。我们应该能够修改超过1个字节的广告数据。所以你能引导我如何开始这个吗?

感谢致敬,
鲁奇帕特尔

PM\U对话框
Offline
最后一次见到:13小时1分钟前
Staff
Joined:2018-02-08 11:03
你好,鲁奇·帕特尔,

你好,鲁奇·帕特尔,

您可以通过更改user\u adv\u conf结构(在user\u config.h中定义)的.intv\u min或.intv\u max成员来配置播发数据包传输速率。这样,您就可以定义播发的最小和最大间隔。关于广告数据,您不仅可以修改生产广告数据。您还可以修改超过1字节的广告数据。SDK的ble\u app\u barebone示例动态更改广告字符串的适当性数据。在特定示例中,property数据的长度为2字节,但其长度可以更改。在广告字符串中,您可以附加特定的数据并从应用程序中更新它们。广告消息在app\u easy\u gap\u undirected\u advertise\u start\u create\u msg()函数中创建,然后在调用app\u easy\u gap\u undirected\u advertise\u get\u active()函数时保存在cmd结构中。cmd指针将有一个完整的消息,您可以将它发送到堆栈,其中包括一些默认的adv数据,这些数据取自用户的adv数据,因此您可以做的是,在app\u easy\u gap\u undirected\u ADVERTISE\u get\u active()返回后,以cmd指针中保存广告数据的数组为目标(cmd->info.host.adv\u数据)你想怎么换就怎么换–您的数据必须符合BLE规范。

谢谢pm_dialog.

鲁奇帕特尔
Offline
最后一次见到:2年6个月前
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?

感谢致敬,
Ruchi.

PM\U对话框
Offline
最后一次见到:13小时1分钟前
Staff
Joined:2018-02-08 11:03
你好,鲁奇·帕特尔,

你好,鲁奇·帕特尔,

关于NMI_handler是独立于你dual-role application. The NMI_handler will be issued due to the WatchDog timer. Please check where the Watchdog hits into your application. Regarding the switching between broadcasting and observer mode, you shouldn’t do any additional changes. In the case of the broadcasting are you advertising as a non-connectable device? If not, you can use the app_easy_gap_non_connectable_advertise_start API to create the advertising message for non-connectable advertising. Also, I suggest you to use the .app_on_adv_nonconn_complete callback function when the advertising is done since this callback is triggered when advertising as a non-connectable device.

谢谢pm_dialog.

鲁奇帕特尔
Offline
最后一次见到:2年6个月前
Joined:2017-03-29 10:50
Hello Dialog_Support,

Hello Dialog_Support,

感谢你的回复。现在我能够将角色从观察者切换到广播公司,反之亦然。

1我在我的第一篇文章中问过我们可以定义多个用户数据吗?. 我可以在user\u config.h文件中定义它。但是怎么称呼呢?我的意思是nvds.c文件具有nvds\u data\u struct结构,在该结构中调用了用户数据。但是如果我想调用USER\u adversed\u DATA和USER\u adversed\u DATA1,那么我可以在哪里调用用户空间呢?由于nvds.c文件是SDK的公共文件,所以我不能修改它。

2.我有一个广播设备,其中我正在修改作为user_advertise_data的一部分的制造数据并开始广告。在另一端我有另一个是观察者的设备。在观察者侧,我得到了user_advertise_data报文,但我没有得到制造数据。我使用BLE Scanner应用程序检查,在我获得制造数据。如何在观察者设备侧接收此制造数据?

感谢致敬,
Ruchi.

PM\U对话框
Offline
最后一次见到:13小时1分钟前
Staff
Joined:2018-02-08 11:03
嗨,鲁奇·帕特,

嗨,鲁奇·帕特,

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.

关于制造商数据,当设备处于Observer模式时,.app_on_adv_report_ind Ind Callback函数(在user_callback_config.h文件中)将执行,因此它不应该为null,您应该定义要触发的函数。收到GAPM_ADV_REPORT_IND时,将执行GAPM_ADV_REPORT_IND_HANDLER()执行.app_on_adv_report_ind IND回调。此处理程序具有输入参数The GapM_Adv_Report_ind结构,包括Adv_report结构。制造商数据应该是ADV_REPORT调节的数据[ADV_DATA_LEN]项。那么你如何检查没有收到制造商数据,并且所有其他数据都正确收到?

谢谢pm_dialog.

鲁奇帕特尔
Offline
最后一次见到:2年6个月前
Joined:2017-03-29 10:50
你好pm_dialog,

你好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.我在user_od_adv_report_ind函数中观察数据。在这里,我正在附加该函数的代码片段。
void user_on_adv_report_ind (struct gapm_adv_report_ind const * param)
{
volatile static uint8_t param_data[ADV_data_LEN];

拱形\u printf(“%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n\r”,
param-> eport.adddr.addr [5],
param-> eport.addr.addr [4],
param->report.adv_addr.addr[3],
参数->报告.adv\u地址.addr[2],
参数->报告.adv\u地址.addr[1],
param-> eport.addr.addr [0],
param_data [0] = param-> report.data [0],
param_data[1]=参数->报表.数据[1],
param_data[2]=参数->报表.数据[2],
param_data[3] = param->report.data[3],
param_data[4] = param->report.data[4],
param_data [5] = param-> report.data [5],

像这样,我正在读取31字节的数据。我不知道其他读取数据的方法。在广播端,在26字节之后,附加制造数据。如果我在manufacture data string修改我的自定义数据,并且广告数据长度超过31字节,那么我在observer端得到00,但是如果我在Raw data部分的BLE Scanner应用程序中选中相同的,我得到的是我修改过的相同数据。你能解释一下为什么会这样吗?如果您有任何其他方法读取用户数据,请告诉我。

感谢致敬,
Ruchi.

PM\U对话框
Offline
最后一次见到:13小时1分钟前
Staff
Joined:2018-02-08 11:03
你好,鲁奇·帕特尔,

你好,鲁奇·帕特尔,

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.

谢谢pm_dialog.

鲁奇帕特尔
Offline
最后一次见到:2年6个月前
Joined:2017-03-29 10:50
你好pm_dialog,

你好pm_dialog,

感谢您的答复。我正在参考BLE_APP_PERITELAL和BLE_APP_BAREBONE示例来开发我的申请。现在我想向user_advertise_data发送我的自定义数据,但该数据不适合user_advertise_data,以便我在我的前一篇文章中询问,我们可以定义多个user_advertise_data并广播它?但是在nvds.c文件中调用user_advertise_data,它是DSK的常用文件,所以我无法修改它。正如您所建议的那样,更新User_Advertise_Data,但我无法实现所以可以为我提供任何代码片段或示例代码,这些代码可以完全相同。

简而言之,我想一次向4个不同的观察者广播28个字节。所以,如果我可以发送7字节每个广告包和4个广告包,我想广播的时间,然后什么配置我需要遵循?请帮帮我。

感谢致敬,
鲁奇帕特尔

PM\U对话框
Offline
最后一次见到:13小时1分钟前
Staff
Joined:2018-02-08 11:03
你好,鲁奇·帕特尔,

你好,鲁奇·帕特尔,

正如我在上一篇文章中所指出的那样,您无法定义多个user_advertise_data,因为#define“user_advertise_data”将附加到.nvds_tag_app_ble_add_data项的nvds_data_storage结构。广告字符串具有31个字节长度,但它们的3个字节是从堆栈中保留的,广告过滤策略和广告数据长度,因此您可以使用最多28bytes。附加到广告字符串中的数据将由USER_APP_ADV_START填充,其中我在上一个帖子中已提及的过程。如果要将自定义数据添加到广告字符串中,则应将它们复制到CMD的正确数组中,该数组是user_app_adv_start()函数。cmd由app_easy_gap_undircted_advertise_get_active()创建。在您的应用程序中,您可以将user_advertise_data为空,并将数据复制到广告字符串中。自定义数据应该有效,并且应遵循user_advertise_data的结构,以便正确启动广告。您应该将2字节与长度和标志一起放入数据中,因此最终您能够将高达26字节追加到广告字符串中。在以下代码中,我会向您展示您如何做到这一点。

void user_app_adv_start(void)
{

uint8\u t advdata[28]={0x1B,0xFF,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38};

//安排下一次广告数据更新
app_add_data_update_timer_used = app_easy_timer(app_add_data_update_to,avd_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_undircated_advertise_start();
}

如果将26字节的数据添加到播发字符串中,并希望填充其他数据,则可以将它们附加到扫描响应数据中,但在另一侧,观察者应配置为GAPM\u scan\u ACTIVE,以便发送扫描请求。

谢谢pm_dialog.