2017-05-19 183 views

回答

0

您可以按照以下命令直接检查设备的“连接”属性。可能你需要使用编程方式调用相应的python GDBUS方法。

dbus-send --system --print-reply --type=method_call --dest=org.bluez /org/bluez/hci0/dev_44_D8_84_02_A3_17 org.freedesktop.DBus.Properties.Get string:"org.bluez.Device1" string:"Connected" 

另外一个最好的选择是观看下面配置了“PropertiesChanged”信号,

Interface: org.freedesktop.DBus.Properties 
Object Path: /org/bluez/hci0/dev_44_D8_84_02_A3_17 
Signal : PropertiesChanged 
Method: g_dbus_connection_signal_subscribe <<== with function pointer in callback mode 

这使得该通知时,该设备是断开的,你可以在回调函数异步处理。

相关问题