This commit is contained in:
karl.hudgell 2021-10-26 15:54:18 +01:00
parent 7440fe2aed
commit 4f8d4ac222

View File

@ -49,14 +49,16 @@ def hello():
hex = hex.replace("#", "") hex = hex.replace("#", "")
str = "56" + hex + "00f0aa" str = "56" + hex + "00f0aa"
# try: try:
result = subprocess.run( result = subprocess.run(
[f"gatttool -i hci0 -b b2:3b:03:00:14:d6 --char-write-req -a 0x0009 -n {str}"], [f"gatttool -i hci0 -b b2:3b:03:00:14:d6 --char-write-req -a 0x0009 -n {str}"],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
shell=True, shell=True,
).stdout.decode("utf-8") ).stdout.decode("utf-8")
print(result) print(result)
if "Characteristic value was written successfully" not in result: if "Characteristic value was written successfully" not in result:
raise Exception raise Exception
else: else:
return request.query_string return request.query_string
except:
raise Exception