Merge branch 'feature/ring_led' of sqozz/sem6000 into master

This commit is contained in:
sqozz 2020-05-08 20:34:15 +02:00 committed by Gitea
commit 95983d464f

View file

@ -105,6 +105,22 @@ class SEMSocket():
self.authenticated = self.authenticated and success
return success
def setIcon(self, iconIdx):
cmd = bytearray([0x0f])
payload = bytearray([0x00, 0x03, iconIdx, 0x00, 0x00, 0x00, 0x00])
msg = self.BTLEMessage(self, cmd, payload)
success = msg.send()
return success
def enableLED(self, status):
cmd = bytearray([0x0f])
payload = bytearray([0x00, 0x05, status, 0x00, 0x00, 0x00, 0x00])
msg = self.BTLEMessage(self, cmd, payload)
success = msg.send()
return success
@property
def name(self):
self._name = self._name_char.read().decode("UTF-8")
@ -293,7 +309,13 @@ class SEMSocket():
else:
print("5th byte of login-response is > 1:", data)
elif message_type == 0x0f: #set icon response
if not data[3:] == b'\x00\x03\x00\x13\xff\xff':
if data[3:6] == b'\x00\x03\x00':
# LED set successfully
pass
elif data[3:6] == b'\x00\x05\x00':
# Icon set successfully
pass
else:
print("Unknown response for setting icon: ", end="")
print(data[3:])
else: