仅允许将请求与PIN码配对

⚠️
你好。。谢谢你来参加论坛。令人兴奋的消息!我们现在正在移动到我们的新论坛平台,将提供更好的功能,并包含在主对话网站的过程。所有帖子和账号都已迁移。我们现在只接受新论坛上的流量-请在//www.xmece.com/support. 我们将在未来几天内修复bug/优化搜索和标记。
16 posts / 0 new
最后一篇文章
阿普杜雷特
离线
最后一次见到:1 year 6 months ago
已加入:2017-09-22 08:33
仅允许将请求与PIN码配对

你好,

I have a question regarding pairing in the SDK.
我们板上的软件正在等待配对请求。
A smartphone app connects to the board and starts the pairing request.
对话框板的IO功能配置为“仅显示”。

So currently the phone can do a pairing request using the PIN code displayed by the board, and it works correctly.
但问题是,手机也可以在没有PIN码的情况下进行配对请求,而且也能正常工作。
Is it possible to accept only pairing requests with PIN code and deny the others?

Thanks,
Andy

Device:
MT\u对话框
离线
最后一次见到:2个月4周前
工作人员
已加入:2015-06-08 11:34
嗨,阿普杜雷特,

嗨,阿普杜雷特,

你说手机不用pin就可以连接是什么意思?例如,如果设备要求您输入pin码,而您只是从电话端忽略它,那么在您发出断开连接之前,设备仍然保持连接?或者几秒钟后设备就断开了?设备将接受连接,如果实现需要安全性,那么安全性请求将在连接时发生,如果链接的安全性要求与设备的要求不匹配,则只会断开连接,您可以以SDK的bms项目为例,因为它需要密钥,如果设备在30秒内没有收到配对响应,它将断开连接。

谢谢你的对话

阿普杜雷特
离线
最后一次见到:1 year 6 months ago
已加入:2017-09-22 08:33
你好,

你好,

我的BLE服务中的特征是使用权限ATT\ U PERM\ U WRITE\ U ENCRYPT而不是ATT\ U PERM\ U WRITE\ U AUTH创建的。因此,一些设备可以在不输入PIN码的情况下配对(“just works”配对)。

不过,我还有一个问题。有时我希望用户能够在没有配对的情况下编写这个特征,有时我希望他只有在配对的情况下才能这样做。
I tried to use the function ble_gatts_set_characteristic_prop to change the permission of the characteristic (switching between ATT_PERM_WRITE and ATT_PERM_WRITE_AUTH). However when I do this my characteristic becomes invalid. If I check with nRF Connect for example, I can see that the characteristic UUID changed. Because of this the smartphone can not find the characteristic anymore (since it looks up for it using it's UUID).
使用ble\U gatts\U set\U prop时有什么我应该知道的吗?初始的UUID是128位的UUID,在这个函数调用之后,它就变成了16位的UUID。

我正在寻找解决这个问题的方法:是否可以销毁我的服务并重新创建它?

MT\u对话框
离线
最后一次见到:2个月4周前
工作人员
已加入:2015-06-08 11:34
嗨,阿普杜雷特,

嗨,阿普杜雷特,

Seems that there is something wrong with the functions ble_gatts_set_characteristic_prop() and ble_gatts_get_characteristic_prop() (on the 1.0.12 SDK), i am checking with the SDK team on this, i will let you know as soon as i ve got more info on this. As far as i am aware there is no valid API that would allow you to easily destroy and recreate the database this time using the required permissions during runtime, i am also checking this with the team.

谢谢你的对话

阿普杜雷特
离线
最后一次见到:1 year 6 months ago
已加入:2017-09-22 08:33
Thank you for your answer, it

感谢您的回答,如果您有更多关于这个问题的信息(或解决方法)时能给我回电,那将是非常好的。

MT\u对话框
离线
最后一次见到:2个月4周前
工作人员
已加入:2015-06-08 11:34
嗨,阿普杜雷特,

嗨,阿普杜雷特,

我已经发布了一个内部罚单,我会尽快回复SDK团队的答复。

谢谢你的对话

阿普杜雷特
离线
最后一次见到:1 year 6 months ago
已加入:2017-09-22 08:33
你好,

你好,

你对这个问题有任何更新吗?

Thanks

MT\u对话框
离线
最后一次见到:2个月4周前
工作人员
已加入:2015-06-08 11:34
嗨,阿普杜雷特,

嗨,阿普杜雷特,

不,SDK团队仍然没有消息,这可能需要一段时间。

谢谢你的对话

MT\u对话框
离线
最后一次见到:2个月4周前
工作人员
已加入:2015-06-08 11:34
嗨,阿普杜雷特,

嗨,阿普杜雷特,

Just had some feedback on that please make following changes in the below functions:

  1. ble\u mgr\u gatts\u service\u characteristic\u set\u prop\u cmd\u handler()
  2. ble\u mgr\u gatts\u service\u characteristic\u get\u prop\u cmd\u handler()

在上述函数中,您将发现以下代码行:

gcmd->handle = cmd->handle + 1;please replace that line with thisgcmd->handle=cmd->handle;显然函数请求并设置了错误的句柄,这应该可以解决问题。

谢谢你的对话

阿普杜雷特
离线
最后一次见到:1 year 6 months ago
已加入:2017-09-22 08:33
Hello MT_dialog,

Hello MT_dialog,

In this case when I call the ble_gatts_set_characteristic_prop() function, should I give the characteristic handle or the attribute value handle?

I did your change on the SDK but my problem remains.
-如果我给出特征句柄,则不会发生任何事情,权限不会更改
-如果我给属性值handle,权限会改变,但特征UUID也会改变(它变成16位UUID)

Thanks

MT\u对话框
离线
最后一次见到:2个月4周前
工作人员
已加入:2015-06-08 11:34
嗨,阿普杜雷特,

嗨,阿普杜雷特,

我没有在中央端测试这个,只是通过DK上的调试器来检查权限是否更改,在中央设备上测试我可以重现您的问题并查看您提到的内容,更改会影响特性的UUID,仍然在检查解决方案。应该传递给函数的句柄是值的属性。

Thanks MT_Dialog

阿普杜雷特
离线
最后一次见到:1 year 6 months ago
已加入:2017-09-22 08:33
Hello MT_dialog,

Hello MT_dialog,

Thanks for your answer.
我很高兴如果你能回到我当你有一个关于UUID问题的解决方案。

Thanks

MT\u对话框
离线
最后一次见到:2个月4周前
工作人员
已加入:2015-06-08 11:34
嗨,阿普杜雷特,

嗨,阿普杜雷特,

仍然没有新s from the SDK team on this for a proper fix, but i trust that we have found a work around in order to be able to change the permissions and properties of a characteristic without messing with the UUID, instead of using the ble_gatts_set_characteristic_prop() function please check the 3 lines of code below for changing permissions and properties of a characteristic.

att_perm_type test_perm;
结构附件;

test_perm=prop_to rwperm(GATT_prop_READ | GATT_prop_WRITE | GATT_prop_NOTIFY)| perm_to rwperm(ATT_perm_READ_AUTH | ATT_perm_WRITE)|
(PERM_UUID_128<status = attmdb_get_attribute(mcs_glob->mc_var_value_h, &elmt); //Get the attribute
elmt.info.att->perm=测试\u perm//为目标属性设置一组新权限。

I hope this will help.

谢谢你的对话

阿普杜雷特
离线
最后一次见到:1 year 6 months ago
已加入:2017-09-22 08:33
谢谢你的对话, your

谢谢你的对话, your workaround works like a charm.
你知道在描述符上是否也可以做同样的事情吗?

MT\u对话框
离线
最后一次见到:2个月4周前
工作人员
已加入:2015-06-08 11:34
嗨,阿普杜雷特,

嗨,阿普杜雷特,

差不多了,我有这个工作在我这边的描述符:

test\ u perm=perm\ to\ u rwperm(ATT\ u perm\ u READ\ u AUTH);
status = attmdb_get_attribute(mcs_glob->mc_descriptor, &elmt);
elmt.info.att->perm=测试\u perm;

谢谢你的对话

阿普杜雷特
离线
最后一次见到:1 year 6 months ago
已加入:2017-09-22 08:33
Thank you MT_dialog this is

谢谢你,这是完美的工作。