diff --git a/modjam.py b/modjam.py index a708eb9..a9dbe18 100644 --- a/modjam.py +++ b/modjam.py @@ -21,6 +21,24 @@ type SpreadFactor = Literal[5,6,7,8,9,10,11,12] type CodingRate = Literal[5,6,7,8] type Station = Literal['A','B','C','D'] +class TextMessageApp(TypedDict): + portnum: Literal['TEXT_MESSAGE_APP'] + payload: bytes + bitfield: Literal[0,1] + text: str + +Packet = TypedDict('Packet', { + 'from': int, + 'to': int, + 'decoded': TextMessageApp, + 'id': int, + 'rxSnr': float, + 'rxRssi': int, + 'raw': object, + 'fromId': str | None, + 'toId': str, +}) + class Config(TypedDict): test_case_duration : int test_case_padding : int @@ -238,6 +256,8 @@ def onReceiveText (packet, interface): event = 'received', packet_id = packet['id'], text = packet['decoded']['payload'].decode('utf-8'), + rx_snr = packet['rxSnr'], + rx_rssi = packet['rxRssi'], )