-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlooMsgAm.py
More file actions
30 lines (26 loc) · 800 Bytes
/
FlooMsgAm.py
File metadata and controls
30 lines (26 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from FlooMessage import FlooMessage
class FlooMsgAm(FlooMessage):
"""
BC:AM
BC:AM=xx xx:
Bit 0~1:
00 high quality, 01 gaming, 02 broadcast
AM=xx
Bit 7:
0: hardware variant FMA120
1: hardware variant FMA121
"""
HEADER = "AM"
def __init__(self, isSend, mode = None):
self.mode = mode
if mode != None:
modStr = "%02X" % mode
super().__init__(isSend, FlooMsgAm.HEADER, bytes(modStr, 'ascii'))
else:
super().__init__(isSend, FlooMsgAm.HEADER)
@classmethod
def create_valid_msg(cls, payload: bytes):
msgLen = len(payload)
if msgLen < 5:
return None
return cls(False, int(payload[3:5].decode('utf-8'), 16))