简体   繁体   English

使用bluez python dbus接口的蓝牙LE设备

[英]Bluetooth LE device using bluez python dbus interface

I use this BLE advertising example on my Raspberry Pi 我在我的Raspberry Pi上使用了BLE广告示例

https://scribles.net/running-ble-advertising-example-code-on-raspbian-stretch/ https://scribles.net/running-ble-advertising-example-code-on-raspbian-stretch/

My question is when the other central wants to connect with me, can I know who they are before they connect? 我的问题是,当另一个中心要与我联系时,在联系之前我能知道他们是谁吗? And can I reject the connection? 我可以拒绝连接吗?

Central device performs scan; 中央设备执行扫描; LE peripheral only advertises. LE外围设备仅做广告。 So, You can not do what you want. 因此,您不能做您想做的。 But., 但。,

Once the central device establish connection a DBus signal is emitted from org.freedesktop.DBus.ObjectManager interface with Connected Property of org.bluez.Device1 interface set to true. 一旦中央设备建立连接,就会从org.freedesktop.DBus.ObjectManager接口发出DBus信号,并将org.bluez.Device1接口的Connected属性设置为true。

You can use Blocked DBus property from org.bluez.Device1 interface to block connections from a central device from next connection. 您可以使用org.bluez.Device1接口中的Blocked DBus属性来阻止来自下一个连接的中央设备的连接。 This causes your hardware to ignore any connection request from that device. 这会导致您的硬件忽略来自该设备的任何连接请求。

But Bluetooth Low Energy random LE addressing feature makes it tough to block devices with particular MAC address. 但是蓝牙低功耗随机LE寻址功能使阻止具有特定MAC地址的设备变得困难。 Because central device can try to connect with random MAC on every connection. 因为中央设备可以在每个连接上尝试使用随机MAC连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM