Bonding with a central device

8 posts / 0 new
最后一篇
motred
离线
最后一次露面:5 years 4 months ago
Expert
加入:2014-01-20 21:48
Bonding with a central device

I would like an Android phone to be able to bond to a DA14580 device such that no other phones can connect to it. I can pair with my device using an app, but the bonding process fails.

What do I need to do in order to support bonding with a DA14580? Is there documentation for this available?

py_dialog.
离线
最后一次露面:2 years 8 months ago
职员
加入:2014-08-25 09:59
Hi Motred,

Hi Motred,

Please refer to the GAP interface paper "RW-BLE-GAP-IS", in chapter 5.6 there is detailed description on bonding.

Regards!
PY

mansonhui
离线
最后一次露面:1 year 3 months ago
加入:2014-07-15 10:33
如果我添加BD地址

如果我添加BD地址central device to whitelist, How can I reconnect to this central device ? Can or Not,which API?

klim9531
离线
最后一次露面:4年3个月前
加入:2015-01-28 23:52
As a note for others, I have

As a note for others, I have perused the docs/ forums, looked at reference projects, read through white papers, even contacted Dialog directly. After all this, I find there is a key point that I believe that they have failed to communicate. If I am wrong, this would be a GREAT place to correct me.

I ASSERT, that if you want to have an EXCLUSIVE connection between either an iPhone or an Android device, the BD address of that device MUST BE KNOWN AT COMPILE TIME (and added to a whitelist).

也就是说,您可以使用需要一个需要PIN的粘合过程。至少对我来说,该问题是针对外围设备的每个实例都是相同的。

因此,如果在同一房间中有5个设备,任何带我的应用程序的人都可以连接到5个设备中的任何一个(如果它们有通用引脚)。

Moreover, the iPhone/Android device would have NO WAY to distinguish WHICH of my devices it was connected to (the only difference from one to the next would be the BD Address).

For my design, I want a user to be able to connect HIS phone to HIS own device, ignoring other user's devices in the same vicinity. I also DO NOT want other user's phones to be able to connect to each other's devices, only to one that they have previously established a 'BIND' with (not a BOND, which is a process of paring/encrypting using the PIN we discussed above)).

So, please tell me that I HAVE THIS WRONG. If I am wrong, tell me, if not , here is an outline of a simple, but extremely VALUABLE reference project that I anticipate will help pretty much any developer that intends to use an iPhone/Android as the Central:

参考项目:按钮 - 按下绑定到外围设备的绑定
--A project that allows any central device to initiate a scan, where the peripheral responds advertising as usual.
--The Reference project has a custom characteristic that, in its advertising, contains some peripheral runtime data (a single byte would be sufficient, initially the btye could be 0x00).
--The developer configures his app, at first ever turnon, to scan for peripherals of a certain name, then look at the data in that custom characteristic (without connecting).
- 开发人员将其应用程序配置为拒绝连接到任何外围设备的所有BD地址,直到该特性中的数据读取特定值(例如0xFF)。
--The Reference project is configured to change the value of the custom characteristic to 0xFF for 10 seconds, when a button on the device is pressed.
- 开发人员将其应用程序配置为读取并存储外围设备的BD地址,该地址显示0xFF的自定义特性。
- 开发人员配置他的应用程序,以便在启动时,它读取存储的BD地址列表,此后允许连接到与存储的BD地址匹配的外围设备。

And the problem is now solved. Granted, another app developer could potentially write his app to connect to any user's device, despite the value of the custom characteristic. So it's not a 'secure' connection. But if we don't need it to be, and all we need is for multiple peripheral/central devices to be operating in the same area, this solve the problem nicely. Even better, it makes it possible for a user to connect his iPhone/Android to multiple peripheral devices, as long as the user had were previously performed a "BIND" on each peripheral.

And we can always later configure the app/peripheral to do the above but also, perform a BOND, at which point the connection is now secure.

最后,所有真正需要的是开发人员写下自定义特征,以执行上述我所描述的,这是我现在正在执行的过程中。如果我难以这样做,请告诉我。如果其他人看到这个想法的价值,并希望对话框放在一起参考项目,请在此处评论。我打赌他们的一个人可以在不到一个小时内完成这一点。对我来说,我会看到它是怎么回事....

Cheers --klim

Joacimwe
离线
最后一次露面:1 year 3 months ago
Guru
加入:2014-01-14 06:45
嗨。The solution to have

嗨。的解决方案有不同的广告ata for a "connectable" device and a device that only bonded devices should connect to is in fact quite common. This can be implemented in any way such that the advertisement data is different. For example, advertise a service data item containing a 0 or 1. I guess using the "manufacturer data" type is more common.

我认为蓝牙4.0标准并没有真正考虑过。存在“定向广告”解决方案,该解决方案应该仅用于通过广告分组中的中央的BD地址连接到已知的中心。但是,自从Android和iOS使用“可解析的私人地址”以来,它今天非常无用。这意味着您首先必须在外设可以解决地址之前建立连接,并查看它是否是已知的。蓝牙4.2将改变此功能。

我不明白你的意思是,为了拥有与中央的“独占”连接,您需要在编译时才知道中央的BD地址(因为它们使用随机可解析地址也没有意义)。并且关于与PIN配对,由DA14580的程序员达到应该配置它。请检查“RW-BLE-GAP-IS”和蓝牙规范。首先,IO功能设置定义如果引脚应在中央侧或外围侧输入。另一个应该示出使用显示器的随机引脚,或者用户可以在某种程度上找到大约一些设备的硬编码。如果要为每个设备具有不同的硬编码引脚,则可以例如在OTP标题中使用某些字段来存储此信息。这样,您可以使用相同的应用程序代码。

klim9531
离线
最后一次露面:4年3个月前
加入:2015-01-28 23:52
Hi Joacimwe,

Hi Joacimwe,

谢谢您的回复和您的洞察力,我在论坛中看到了您这里的许多评论和帖子,您将我击败为稳定的信息来源。

我还没有阅读所有不同的RW-BLE-XX API文档,这是一个令人生畏的过程。而且我确信对分层和抽象的更全面的了解对我来说是很大的好处,并协助成为一个BLE设备开发人员。

The truth is that I am a lone developer and as such I am tasked with developing everything on our device from the hardware design (4th gen prototype which is fully functional) to the app level development for our BLE device (in both iOS and in Android, currently, with Win to follow).

So I am a bit short on time that I can spend reading through the BLE API docs. That's why I have looked to the forum here for insight, and why I place such value on Dialog's very helpful reference designs. And that is also why I asked in my above comment if I was incorrect or missing something, it's very likely that I am. If so then it seems to me that this is the perfect place to have a correction posted, because I have not been able to find a solution to what I would think is a very common objective.

I will try to explain better my reference to the 'exclusive' connection to a central. I communicated the essence of what I wrote above to Dialog, they were good enough to send me a .pdf of their white paper on the subject of whitelisting. I read through the paper (I do not have it with me now) and my takeaway on the whitepaper was that while the whitelist strategy could be used to allow only a device with a known BD Address to connect, that BD Address must be known at the time of programming and put into the whitelist in OTP. So for me, the whitelist strategy would not work to limit the connection to a single device.

Writing a random number PIN to OTP does not work for me for two reasons, one, that I am booting from external flash and not programming the OTP, and more significantly, that I would then need to find a way to communicate that PIN to the end user so that when they set up their device for the first time, they were armed with the information to do so. Stamping the PIN onto the device or including it in some type of documentation that accompanies the device seems to be fraught with potential problems; What if the user loses the piece of paper? How might the correct PIN be emblazoned on the casing of the device? But perhaps i am missing an obvious solution...

所以对我来说,最简单的解决方案是我上面描述的,你足以确认的是一个常见的要求 - “对于”可连接“设备的不同的广告数据以及只有粘合设备应该连接的设备事实上很常见。“这就是我希望听到这是一个常见的足够要求,这对话将看到他们的开发人员一个小时或可能更少地进入参考设计中的意义,这是在外围设备上的按钮时简单地改变广告数据被按下。

Thanks again for your input on this Joacimwe, I hope that I am not asking for something that you and the Dialog team find to be terribly trivial and beneath further attention. I have tried on this forum to help out others whenever I am in the position, I appreciate your time and help and will continue to pay it forward.

Cheers --klim

Joacimwe
离线
最后一次露面:1 year 3 months ago
Guru
加入:2014-01-14 06:45
你好,我们又见面了。I unfortunately don

你好,我们又见面了。我不幸的是没有直接代码,而是一些提示。

关于白名单。存储OTP中的地址不是必须的。如果在rw-ble-bap中查看 - 是,GAPM_WHITE_LIST_MGT_CMD中有一些API,用于从白色列表中添加/删除设备。出于某种原因,您仍然只有3个设备......但是由于大多数手机使用可解析随机地址,因此此解决方案非常毫无价值。

快要失去希望的时候如果你想阻止中央、连接to you, you need to use the GAPM_RESOLV_ADDR_CMD functionality, which in response gives you a GAPM_ADDR_SOLVED_IND message if a known central was connecting (unless someone spoofs the address so you should still require encryption to be sure if you want security), or a GAPM_CMP_EVT with status GAP_ERR_NOT_FOUND if not, and if so you can disconnect the link.

我不知道你的用例,但似乎你真的不需要安全吗?

无论如何,要更改广告数据,请查看app_adv_func,如果您使用的是sdk3。在SDK5中,在BLE_APP_PROFILE示例中签出user_profile.c。
Then it's just a matter of restarting the advertisement whenever you want to.

klim9531
离线
最后一次露面:4年3个月前
加入:2015-01-28 23:52
Hi Joacimwe,

Hi Joacimwe,

感谢提示,我将探讨更改广告数据的方法,似乎是我问题的最佳解决方案。

欢呼,克林