Enabling and disabling advertising after advertising string modificaiton

10 posts / 0 new
Last post
asalhuv
Offline
Last seen:2年8个月前
Joined:2015-10-22 09:49
Enabling and disabling advertising after advertising string modificaiton

Hi
I am using an external processor in order to control the DA14580 (based on the SPS device code), the external processor program the DA14580 and then need to modify the advertise string while running.
在我通过UART端口收集数据后,我正在尝试使用“app_adv_stop()”取消广告,然后调用“app_adv_start()”并将数据修改为* cmd指针。问题是广告不是再次开始。
If I am calling the app_adv_stop() at the start of the data reception instead of in the end, the advertise does stop and start again, but the data is left unchanged (the transmitted data- in cmd->data i see that data does changed).

我的问题如果需要修改其他东西,或者还有另一种方式来改变广告字符串。

顺便说一句:我已经改变了“cmd-> info.host.adv_data_len”的长度到我的数据长度并在评论中设置了这个过程,所以长度将很好:

if (device_name_avail_space > 0)
{
// Get the Device Name to add in the Advertising Data (Default one or NVDS one)
#if (NVDS_SUPPORT)
device_name_length = NVDS_LEN_DEVICE_NAME;
如果(nvds_get (NVDS_TAG_DEVICE_NAME &device_name_length, &device_name_temp_buf[0]) != NVDS_OK)
#endif //(NVDS_SUPPORT)
{
// Get default Device Name (No name if not enough space)
device_name_length = strlen(APP_DFLT_DEVICE_NAME);
memcpy(&device_name_temp_buf[0], APP_DFLT_DEVICE_NAME, device_name_length);
}

if(device_name_length > 0)
{
// Check available space
device_name_length = co_min(device_name_length, device_name_avail_space);

// Fill Length
cmd->info.host.adv_data[cmd->info.host.adv_data_len] = device_name_length + 1;
// Fill Device Name Flag
cmd->info.host.adv_data[cmd->info.host.adv_data_len + 1] = '\x09';
// Copy device name
memcpy(&cmd->info.host.adv_data[cmd->info.host.adv_data_len + 2], device_name_temp_buf, device_name_length);
// Update Advertising Data Length
cmd->info.host.adv_data_len += (device_name_length + 2);
}
}

Device:
MT_dialog
Offline
Last seen:1 month 4 weeks ago
Staff
Joined:2015-06-08 11:34
嗨Asalhuv,

嗨Asalhuv,

没有其他功能来修改广告。您可以调试功能以检查Device_name_temp_buf中的值是什么。我无法在代码中看到任何内容,都会更改device_name_temp_buf数组的值。如果使用NVDS,则将从NVDS中加载名称,否则它将加载默认名称。

Thanks MT_dialog

asalhuv
Offline
Last seen:2年8个月前
Joined:2015-10-22 09:49
Hi and thanks, maybe I didn't

Hi and thanks, maybe I didn't explain my question well, so I try to ask it in a different way:
when I call the function "app_adv_stop()", how long do I need to wait until the kernel consume the message.
the same question goes for "app_adv_start()" . The reason I am asking is because I need to do quick changes in the advertise string following a MCU message, but if call the function "app_adv_stop()" and then immediately call "app_adv_start()" it wont start the advertising again. only if I am calling the app_adv_stop() in an earlier procedure. (when getting a last byte of a string at UART port). Also if I am calling the function "app_adv_start()" right after i'm sending a byte using the "uart_txdata_setf()" function ,the advertising string will be not updated ( I am calling the advertise start function and updating the "&cmd->info.host.adv_data[6]".
thanks

MT_dialog
Offline
Last seen:1 month 4 weeks ago
Staff
Joined:2015-06-08 11:34
嗨Asalhuv,

嗨Asalhuv,

它难以知道内核将执行停止通告命令的时间有多大时间,这取决于操作系统在此刻做了什么。您可以做的是发出停止advertise命令,然后捕获停止宣传请求的完整处理程序。在完整的请求中,您可以更改广告字符串并重新启动通告。请查看app_add_undirect_complete_function()中的灯塔ref设计。

Thanks MT_dialog

asalhuv
Offline
Last seen:2年8个月前
Joined:2015-10-22 09:49
Hi and thanks for your reply,

Hi and thanks for your reply, do you mean "app_adv_undirect_complete(uint8_t status)" right?
标志指示是(status == gap_err_canceled)?这表明广告已经停止了?

I must say that very hard to understand the flow of the OS, seems like if trying to modify the state machine it has many issues. do you have a suggestion of a document which describe the state machine of the OS?

thanks

MT_dialog
Offline
Last seen:1 month 4 weeks ago
Staff
Joined:2015-06-08 11:34
嗨Asalhuv,

嗨Asalhuv,

Thats right, the handler is executed whenever you stop the advertising. What do you mean with OS state machine ? What is the part of code that you refer to ?

Thanks MT_dialog

asalhuv
Offline
Last seen:2年8个月前
Joined:2015-10-22 09:49
Hi , thanks for your reply, I

Hi , thanks for your reply, I meant the kernel tasks. I don't know how to follow the flow of the system. for example: after connection, which handles are called? what is the routine of the kernel.
关于SPS项目的另外两个问题:
1. There is an SDK for the SPS android/IOS app, I would to implement something similar in a new app.
2. How can I modify the local device name in advertising mode, i see that if I am setting a beacon string there is no room left for the device name, is it possible to add it somehow?
thanks

MT_dialog
Offline
Last seen:1 month 4 weeks ago
Staff
Joined:2015-06-08 11:34
嗨Asalhuv,

嗨Asalhuv,

The handlers that are called after connection are depended on the message you get from the host and eventually from the ble stack, for instance if you receive a connection request from the master the gapc_connection_req_ind_handler() callback should be called. You can have an idea about the messages exchanged in connection procedures by checking out the RW_BLE_GAP_IS. The kernel just schedules the messages it receives from the stack and from the application task.

1)我不确定我不确定您的问题,但没有SDK为DSP开发特别是Android或iOS应用程序,但如果您有兴趣,我们可以为Android / IOS DSPS应用程序提供源代码。

2)广告字符串限制为31个字节,并且已全部保留3个字节,但我想您可以更改信标识别模式并发出扫描响应,并将设备名称放在扫描响应字符串中。

Thanks MT_dialog

asalhuv
Offline
Last seen:2年8个月前
Joined:2015-10-22 09:49
Hi and thanks for your

Hi and thanks for your answers
1) Yes, I meant the source code for the App (Android and IOS), where can I get this ?
2) Will do , thanks

MT_dialog
Offline
Last seen:1 month 4 weeks ago
Staff
Joined:2015-06-08 11:34
嗨Asalhuv,

嗨Asalhuv,

Mail sent.

Thanks MT_dialog