写入设备名称(0x2a00)特性以更改设备名称

⚠️
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.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
11 posts / 0 new
Last post
stanley_yeh
Offline
Last seen:1 year 11 months ago
加入:2016-12-23 06:52
写入设备名称(0x2a00)特性以更改设备名称

Hi Dialog,

My customer want to use Device Name(0x2A00) characteristic of Generic Access(0x1800) to modify the device name.

I modified the user_gapm_conf in user_config.h as below...

。att_cfg = gapm_mask_att_svc_chg_en |gapm_mask_att_name_perm,

我还在“default_app_on_set_dev_info”函数中添加一些调试登录,但似乎不起作用。

Is there any wrong?

我的设备信息。DA14585,SDK:6.0.4

谢谢。

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

Hi stanley_yeh,

好吧,似乎在回调函数eapc_set_dev_info_req_ind_handler()发送确认是task_gapc而不是task_gapm的任务中的一个问题,也是回调实际上没有改变设备名称,所以只要您收到回调即可更改应用程序回调中的设备名称。我正在检查SDK团队,我会尽快让你知道一些反馈。

Thanks MT_dialog

stanley_yeh
Offline
Last seen:1 year 11 months ago
加入:2016-12-23 06:52
非常感谢!

非常感谢!

stanley_yeh
Offline
Last seen:1 year 11 months ago
加入:2016-12-23 06:52
嗨mt_dialog,

嗨mt_dialog,
I tried to print some messages in app_entry_point_handler and gapc_set_dev_info_req_ind_handler functions.
However, It seems that DA14585 did not receive any event.
Can I fix this issue by myself? Does this issue have to update the system_library.lib that I can't fix it?
谢谢。

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

Hi stanley_yeh,

当前实现允许您在某人在该特定特性写入时,您可以使用回调通知您,但在数据库中的名称中没有实际实现,这是SDK团队正在调查的。所以,如果您对刚刚在某人写在那些特定的特征时,您有兴趣才能在您所要做的所有特性写入的情况下是以下更改:

  1. 在GAPC_SET_DEV_INFO_REQ_IND_HANDLER()中将GAPC_SET_DEV_INFO_CFM()的目标任务从task_gapm更改为task_gapc。
  2. Then in the user_config.h file change the .att_cfg member of user_gapm_conf structure to GAPM_MASK_ATT_SVC_CHG_EN|0x01 in order to enable the write with no security to the specific characteristic.

After the above changes you should see the default_app_on_set_dev_info() callback to occur, but again this is only an indication that the central has written on that characteristic, this wont change the name in database.

Thanks MT_dialog

stanley_yeh
Offline
Last seen:1 year 11 months ago
加入:2016-12-23 06:52
嗨mt_dialog,

嗨mt_dialog,
Thank you very much. I can receive the event now.
I am sorry that I can't understand what's the meaning of following sentences:

1. "this wont change the name in database."
Could you tell me the risk and what will happen if the name in the database can not be changed?
Do you mean that the device name is a definition in SDK (#define USER_DEVICE_NAME "DA14585"), so there is no actual implementation to change it?
Actually, I have implemented a function that can store the device name into external flash. So the sentence you said has no effect to my case, right?

2.“为特定特征提供没有安全性的写入。”
我的客户表示写知必须具有安全性。我无法理解为什么GAPM_MASK_ATT_NAME_PERM不起作用?

Thanks a lot.

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

Hi stanley_yeh,

1) About what will happen, as the SDK is, at the moment whatever you write at the device the SDK will not store the name that you provided it will just send the value to the device, you will be able to get it, but the name of the device once you read it agan wont change and the device will report the same name as before. So, yes in the SDK there is no actual implementation to change it. I am not aware exactly what you mean by saying that you ve implemented a function that store's the device's name in an external flash. But in order to be able to change the name of the device via that characteristic you will have to apply changes to the SDK itself, apparently you will have to assign a pointer to the USER_DEVICE_NAME instead of a fixed name, the pointer will show to an array that will be used to store the actual device's name and whenever changing the name via writting to that characteristic you will have to copy the data from the writing to that array.

2)每个特征都具有一些安全功能,如果启用。这意味着,如果您已将0x03(GapM_Mask_Att_Name_Perm)的值分配给设备的名称特征,这意味着为了能够在该特征上写入设备,该设备需要通过身份验证来保护链接。因此,如果链接没有身份验证,这意味着设备不会允许您在该特定特征上写入,因为您不遵守设备已设置的要求。另一方面,如果您应用0x01的值,这意味着您可以启用特性的写作,而无需额外的安全性,这意味着连接到设备的人能够编写特征。

Thanks MT_dialog

stanley_yeh
Offline
Last seen:1 year 11 months ago
加入:2016-12-23 06:52
嗨mt_dialog,

嗨mt_dialog,
我非常感谢您的详细信息。
For the first question, I can save the device name by myself. That's no problem.
For the second question, I still need the security features, please let me know if there is any new SDK version.
Many thanks.

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

Hi stanley_yeh,

The most recent version of the SDK is the 6.0.6, and there is a project that implements security allready (ble_app_security), i dont quite get what is the problem exactly. If you apply the value GAPM_MASK_ATT_SVC_CHG_EN|0x03 then in order to write to the characteristic would require security, if pairing is not initiated then you wont be able to write to the characteristic. If you dont want protection for that characteristic then GAPM_MASK_ATT_SVC_CHG_EN|0x01 for the .att_cfg will allow you to write to the characteristic without security.

Thanks MT_dialog

stanley_yeh
Offline
Last seen:1 year 11 months ago
加入:2016-12-23 06:52
嗨mt_dialog,

嗨mt_dialog,
I am using SDK 6.0.6 now and I also set ".att_cfg = (GAPM_MASK_ATT_SVC_CHG_EN | 0x03)" for security.
First time I write a string to the characteristic, the app shows they're bonding.
绑定后,我仍然无法设置设备名称。该应用程序显示“错误0x5:gatt Insuf身份验证”
Should I modify the parameter from TASK_GAPM to TASK_GAPC in the "gapc_set_dev_info_req_ind_handler" function as below?
struct gapc_set_dev_info_cfm * cfm = ke_msg_alloc(gapc_set_dev_info_cfm,
TASK_GAPC,/*TASK_GAPM,*/
TASK_APP,
gapc_set_dev_info_cfm);
Could you give me some advice?
thanks a lot.

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

Hi stanley_yeh,

正如我上一篇文章中所说的那样SDK不实现更改设备的名称,但它会触发应用程序级别的指示,所以我想你已经应用了自定义修改,你也必须从task_gapm更改为task_gapc为了向您接受或不更改的对等设备发送验证。关于gatt_insuf_authentication这是您第一次尝试设置名称和中央发起的(在ble_app_security的情况下)的第一次,将发生回调(default_app_on_set_dev_info),您必须处理接收应用程序中的名称并决定接受或拒绝新名称,然后通过相应的状态发送填充填充_set_dev_info_cfm,以便正确发送确认您必须从task_gapm转换为task_gapc。

Thanks MT_dialog