In PacketReader.parse_packet(), we have a check for packet length which is:
if len(packet) == 244: # If the full data payload is received, proceed parsing it
timestamp = int.from_bytes(packet[240:244], self.config.endian, signed=False) / (2 ** 16)
# .... and other stuff to process the packet
if self.handles[packet_type] in [
"Mic 1",
"Cmd Decline",
"Sleep State",
"Info Message",
]:
self._parse_info_packet(self.handles[packet_type], packet, previous_timestamp)
But, in a discussion with @tommasopolonelli yesterday whilst looking at the C code, I followed that the packet length transmitted may not be the full 244 bytes... and yet this seems to work!
We should close the loop to check if I understood correctly. And if I did, is [ "Mic 1", "Cmd Decline", "Sleep State", "Info Message"] the exclusive list of non-244 packets that are possible? Because if so then this works fine, otherwise we must be simply not processing packets.
In the case that we're not processing some packets, we should put the packet length onto the processing queue and check against the length.
Bug report
In
PacketReader.parse_packet()
, we have a check for packet length which is:But, in a discussion with @tommasopolonelli yesterday whilst looking at the C code, I followed that the packet length transmitted may not be the full 244 bytes... and yet this seems to work!
We should close the loop to check if I understood correctly. And if I did, is
[ "Mic 1", "Cmd Decline", "Sleep State", "Info Message"]
the exclusive list of non-244 packets that are possible? Because if so then this works fine, otherwise we must be simply not processing packets.In the case that we're not processing some packets, we should put the packet length onto the processing queue and check against the length.