Bluetooth SSP

Note that is needs testing.
tildatorch
Alistair MacDonald 2018-08-27 23:41:33 +01:00 committed by GitHub
parent 2293aeb5f3
commit eb3ff46b88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 0 deletions

View File

@ -179,6 +179,9 @@ def power(onoroff, async):
command("AT+CSCS=\"8859-1\"")
# Enable DTMF detection
command("AT+DDET=1,0,1")
# Set up multichannel Bluetooth without transparent transmition
command("AT+BTSPPCFG=\"MC\",1")
command("AT+BTSPPCFG=\"TT\",0")
return isonnow
# Power on the SIM800 (returns true when on)
@ -600,6 +603,30 @@ def btoppaccept():
responce2 = extractval("+BTOPPPUSH:", response, 0)
return responce2=="1"
# Send data over a Bluetooth serial connection
def btsppwrite(connection, data):
response = command("AT+BTSPPSEND=" + str(connection) + "," + str(len(data)), 8000, None, ">")
if response[-1].startswith(">"):
return ispositive(command(data)[-1])
else:
return False
# Receive data from a Bluetooth serial connection
def btsppread(connection):
command()
request = "AT+BTSPPGET=3," + str(connection) + "\n"
uart.write(request)
data = uart.read()
while True:
time.sleep(uart_timeout/1000)
if uart.any()==0:
break
data += uart.read()
if not data.endswith("ERROR\r\n"):
return data[len(request)+2:-6]
else:
return None
# Reject an OPP object/file transfer
def btoppreject():
command("AT+BTOPPACPT=0")