forked from sqozz/sem6000
Add function to set icon
This commit is contained in:
parent
6cc5804017
commit
f488869f3d
1 changed files with 15 additions and 1 deletions
16
sem6000.py
16
sem6000.py
|
@ -105,6 +105,14 @@ class SEMSocket():
|
||||||
self.authenticated = self.authenticated and success
|
self.authenticated = self.authenticated and success
|
||||||
return 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
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
self._name = self._name_char.read().decode("UTF-8")
|
self._name = self._name_char.read().decode("UTF-8")
|
||||||
|
@ -293,7 +301,13 @@ class SEMSocket():
|
||||||
else:
|
else:
|
||||||
print("5th byte of login-response is > 1:", data)
|
print("5th byte of login-response is > 1:", data)
|
||||||
elif message_type == 0x0f: #set icon response
|
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("Unknown response for setting icon: ", end="")
|
||||||
print(data[3:])
|
print(data[3:])
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue