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.
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).
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)).
参考项目:按钮 - 按下绑定到外围设备的绑定 --A project that allows any central device to initiate a scan, where the peripheral responds advertising as usual. - 参考项目具有自定义特征,即在其广告中包含一些外设运行时数据(单个字节是足够的,最初BTYE可能为0x00)。 - 开发人员首先将其应用程序配置为Fornon,以扫描某个名称的外围设备,然后查看该自定义特征(无需连接)中的数据。 - 开发人员将其应用程序配置为拒绝连接到任何外围设备的所有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.
嗨。的解决方案有不同的广告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.
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...
无论如何,要更改广告数据,请查看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.
Hi Motred,
Please refer to the GAP interface paper "RW-BLE-GAP-IS", in chapter 5.6 there is detailed description on bonding.
问候!
PY
如果我添加BD地址central device to whitelist, How can I reconnect to this central device ? Can or Not,which API?
作为其他人的说明,我已经仔细阅读了文档/论坛,查看了参考项目,读过白皮书,甚至直接联系对话框。毕竟这一点,我发现有一个关键点我相信他们未能沟通。如果我错了,这将是一个纠正我的好地方。
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个设备中的任何一个(如果它们有通用引脚)。
此外,iPhone / Android设备无法区分其连接的哪些设备(从一个到下一个的唯一区别是BD地址)。
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)).
所以,请告诉我我有这个错误。如果我错了,请告诉我,如果没有,这里是一个简单但非常有价值的参考项目的概要,即我预期的将有助于一些打算使用iPhone / Android作为中央的开发人员:
参考项目:按钮 - 按下绑定到外围设备的绑定
--A project that allows any central device to initiate a scan, where the peripheral responds advertising as usual.
- 参考项目具有自定义特征,即在其广告中包含一些外设运行时数据(单个字节是足够的,最初BTYE可能为0x00)。
- 开发人员首先将其应用程序配置为Fornon,以扫描某个名称的外围设备,然后查看该自定义特征(无需连接)中的数据。
- 开发人员将其应用程序配置为拒绝连接到任何外围设备的所有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.
最后,所有真正需要的是开发人员写下自定义特征,以执行上述我所描述的,这是我现在正在执行的过程中。如果我难以这样做,请告诉我。如果其他人看到这个想法的价值,并希望对话框放在一起参考项目,请在此处评论。我打赌他们的一个人可以在不到一个小时内完成这一点。对我来说,我会看到它是怎么回事....
干杯 - klim.
嗨。的解决方案有不同的广告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标题中使用某些字段来存储此信息。这样,您可以使用相同的应用程序代码。
嗨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...
所以对我来说,最简单的解决方案是我上面描述的,你足以确认的是一个常见的要求 - “对于”可连接“设备的不同的广告数据以及只有粘合设备应该连接的设备事实上很常见。“这就是我希望听到这是一个常见的足够要求,这对话将看到他们的开发人员一个小时或可能更少地进入参考设计中的意义,这是在外围设备上的按钮时简单地改变广告数据被按下。
再次感谢您对此JoaCimWe的输入,我希望我不要求您和对话团队的某些东西发现非常微不足道,并且在进一步的关注之下。我已经尝试过这个论坛,每当我处于职位时,我会帮助他人,我感谢您的时间和帮助,并将继续向前支付。
干杯 - klim.
你好,我们又见面了。我不幸的是没有直接代码,而是一些提示。
关于白名单。存储OTP中的地址不是必须的。如果在rw-ble-bap中查看 - 是,GAPM_WHITE_LIST_MGT_CMD中有一些API,用于从白色列表中添加/删除设备。出于某种原因,您仍然只有3个设备......但是由于大多数手机使用可解析随机地址,因此此解决方案非常毫无价值。
如果要阻止连接到您的未知中心,则需要使用GAPM_RESOLV_ADDR_CMD功能,其中响应为您提供GAPM_ADDR_SOLVED_IND消息(除非有人欺骗地址,否则您仍然需要加密以确定如果您想要安全性),或者使用Status Gap_Err_Not_Found的Gapm_cmp_evt,如果不,则可以断开链接连接。
我不知道你的用例,但似乎你真的不需要安全吗?
无论如何,要更改广告数据,请查看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.
嗨Joacimwe,
感谢提示,我将探讨更改广告数据的方法,似乎是我问题的最佳解决方案。
欢呼,克林