Skip to content

Commit f538062

Browse files
committed
small indent issue
1 parent 2e178e8 commit f538062

1 file changed

Lines changed: 31 additions & 31 deletions

File tree

src/meshcore/reader.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -942,36 +942,36 @@ async def handle_rx(self, data: bytearray):
942942
await self.dispatcher.dispatch(
943943
Event(EventType.DISCOVER_RESPONSE, ndr, attributes)
944944
)
945-
elif packet_type_value == PacketType.CONTACT_DELETED.value:
946-
# N01: PUSH_CODE_CONTACT_DELETED (0x8F) — 1-byte code + 32-byte pubkey
947-
# Emitted by MyMesh::onContactOverwrite() (MyMesh.cpp:325-334)
948-
if len(data) < 33:
949-
logger.debug("CONTACT_DELETED frame too short (%d bytes, need 33)", len(data))
950-
return
951-
pubkey = data[1:33].hex()
952-
await self.dispatcher.dispatch(
953-
Event(EventType.CONTACT_DELETED, {"pubkey": pubkey}, {"pubkey": pubkey})
954-
)
955-
956-
elif packet_type_value == PacketType.CONTACTS_FULL.value:
957-
# N02: PUSH_CODE_CONTACTS_FULL (0x90) — 1-byte push, no payload
958-
# Emitted by MyMesh::onContactsFull() (MyMesh.cpp:336)
959-
await self.dispatcher.dispatch(Event(EventType.CONTACTS_FULL, {}))
960-
961-
elif packet_type_value == PacketType.TUNING_PARAMS.value:
962-
# N03: RESP_CODE_TUNING_PARAMS (23) — response to CMD_GET_TUNING_PARAMS (43)
963-
# Format: 1-byte code + 4-byte rx_delay (LE) + 4-byte airtime_factor (LE) = 9 bytes
964-
# Emitted by MyMesh.cpp:1307-1313
965-
if len(data) < 9:
966-
logger.debug("TUNING_PARAMS frame too short (%d bytes, need 9)", len(data))
967-
await self.dispatcher.dispatch(
968-
Event(EventType.ERROR, {"reason": "invalid_frame_length"})
969-
)
970-
return
971-
rx_delay = int.from_bytes(data[1:5], byteorder="little")
972-
airtime_factor = int.from_bytes(data[5:9], byteorder="little")
973-
res = {"rx_delay": rx_delay, "airtime_factor": airtime_factor}
974-
await self.dispatcher.dispatch(Event(EventType.TUNING_PARAMS, res))
945+
elif packet_type_value == PacketType.CONTACT_DELETED.value:
946+
# N01: PUSH_CODE_CONTACT_DELETED (0x8F) — 1-byte code + 32-byte pubkey
947+
# Emitted by MyMesh::onContactOverwrite() (MyMesh.cpp:325-334)
948+
if len(data) < 33:
949+
logger.debug("CONTACT_DELETED frame too short (%d bytes, need 33)", len(data))
950+
return
951+
pubkey = data[1:33].hex()
952+
await self.dispatcher.dispatch(
953+
Event(EventType.CONTACT_DELETED, {"pubkey": pubkey}, {"pubkey": pubkey})
954+
)
955+
956+
elif packet_type_value == PacketType.CONTACTS_FULL.value:
957+
# N02: PUSH_CODE_CONTACTS_FULL (0x90) — 1-byte push, no payload
958+
# Emitted by MyMesh::onContactsFull() (MyMesh.cpp:336)
959+
await self.dispatcher.dispatch(Event(EventType.CONTACTS_FULL, {}))
960+
961+
elif packet_type_value == PacketType.TUNING_PARAMS.value:
962+
# N03: RESP_CODE_TUNING_PARAMS (23) — response to CMD_GET_TUNING_PARAMS (43)
963+
# Format: 1-byte code + 4-byte rx_delay (LE) + 4-byte airtime_factor (LE) = 9 bytes
964+
# Emitted by MyMesh.cpp:1307-1313
965+
if len(data) < 9:
966+
logger.debug("TUNING_PARAMS frame too short (%d bytes, need 9)", len(data))
967+
await self.dispatcher.dispatch(
968+
Event(EventType.ERROR, {"reason": "invalid_frame_length"})
969+
)
970+
return
971+
rx_delay = int.from_bytes(data[1:5], byteorder="little")
972+
airtime_factor = int.from_bytes(data[5:9], byteorder="little")
973+
res = {"rx_delay": rx_delay, "airtime_factor": airtime_factor}
974+
await self.dispatcher.dispatch(Event(EventType.TUNING_PARAMS, res))
975975

976976
else:
977977
logger.debug(f"Unhandled data received {data}")
@@ -983,4 +983,4 @@ async def handle_rx(self, data: bytearray):
983983
e,
984984
data.hex(),
985985
traceback.format_exc(),
986-
)
986+
)

0 commit comments

Comments
 (0)