implement simpler setters for telemetry, adding contacts ...

This commit is contained in:
Florent de Lamotte 2025-05-15 16:15:48 +02:00
parent 865d42206b
commit 7ea3b04a05
2 changed files with 21 additions and 2 deletions

View file

@ -201,6 +201,27 @@ class CommandHandler:
data = b"\x26" + manual_add_contacts.to_bytes(1) + telemetry_mode.to_bytes(1)
return await self.send(data, [EventType.OK, EventType.ERROR])
async def set_telemetry_mode_base(self, telemetry_mode_base : int) :
infos = (await self.send_appstart()).payload
return await self.set_other_params(
infos["manual_add_contacts"],
telemetry_mode_base,
infos["telemetry_mode_loc"])
async def set_telemetry_mode_loc(self, telemetry_mode_loc : int) :
infos = (await self.send_appstart()).payload
return await self.set_other_params(
infos["manual_add_contacts"],
infos["telemetry_mode_base"],
telemetry_mode_loc)
async def set_manual_add_contacts(self, manual_add_contacts:bool) :
infos = (await self.send_appstart()).payload
return await self.set_other_params(
manual_add_contacts,
infos["telemetry_mode_base"],
infos["telemetry_mode_loc"])
async def set_devicepin(self, pin: int) -> Event:
logger.debug(f"Setting device PIN to: {pin}")
return await self.send(b"\x25" \
@ -314,7 +335,6 @@ class CommandHandler:
async def send_telemetry_req(self, dst: DestinationType) -> Event :
dst_bytes = _validate_destination(dst, prefix_length=32)
logger.debug(f"Asking telemetry to {dst_bytes.hex()}")
data = b"\x27\x00\x00\x00" + dst_bytes
return await self.send(data, [EventType.MSG_SENT, EventType.ERROR])

View file

@ -382,7 +382,6 @@ class MessageReader:
res["pubkey_pre"] = data[2:8].hex()
buf = data[8:]
res["data"] = buf.hex()
"""Parse a given byte string and return as a LppFrame object."""
i = 0