哈伊盖兹,
如何从python应用程序通过蓝牙发送AT-command?
操作系统:fedora 8
有没有人能用代码治好我?
我需要导入哪个包?
我可以从哪里下载?
发布于 2010-03-10 17:51:44
我觉得这样更好......
import bluetooth
sockfd = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
sockfd.connect(('00:24:7E:9E:55:0D', 1)) # BT Address
sockfd.send('ATZ\r')
time.sleep(1)
sockfd.send(chr(26))
sockfd.close()发布于 2010-01-30 01:45:31
要通过蓝牙连接到IP调制解调器,您需要使用蓝牙rfcomm驱动程序:
michael@challenger:~> cat /etc/bluetooth/rfcomm.conf
rfcomm0 {
# Automatically bind the device at startup
bind yes;
# Bluetooth address of the device
device 00:1C:CC:XX:XX:XX;
# RFCOMM channel for the connection
channel 1;
# Description of the connection
comment "Blackberry";
}这是我使用的设置- YMMV。
michael@challenger:~> cu -l /dev/rfcomm0
Connected.
ATI
Research in Motion BlackBerry IP Modem
OK一旦拥有了rfcomm0端口,您就可以将该端口作为标准串行端口来使用了。
https://stackoverflow.com/questions/2161365
复制相似问题