Python:通过蓝牙发送短信
- import bluetooth
- sockfd = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
- sockfd.connect(('00:00:00:00:00:00', 1)) # 蓝牙硬件设备地址
- sockfd.send('ATZ\r')
- sockfd.send('AT+CMGF=1\r')
- sockfd.send('AT+CSCA="+13535007000"\r') # 客户端 TIM ITA
- sockfd.send('AT+CMGS="+13866668888"\r') # 手机号码
- sockfd.send('This message send by bluetooth...\n') # 短信内容
- sockfd.send(chr(26)) # CTRL+Z,结束发送
- sockfd.close()
