diff --git a/pyproject.toml b/pyproject.toml index 05a1620..baf7136 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "meshcore" -version = "1.9.15" +version = "1.9.16" authors = [ { name="Florent de Lamotte", email="florent@frizoncorrea.fr" }, { name="Alex Wolden", email="awolden@gmail.com" }, diff --git a/src/meshcore/binary_commands.py b/src/meshcore/binary_commands.py index e523f72..446c636 100644 --- a/src/meshcore/binary_commands.py +++ b/src/meshcore/binary_commands.py @@ -69,7 +69,7 @@ class BinaryCommandHandler : def dispatcher(self): return self.commands.dispatcher - async def req_binary (self, contact, request) : + async def req_binary (self, contact, request, timeout_override=0) : res = await self.commands.send_binary_req(contact, request) logger.debug(res) if res.type == EventType.ERROR: @@ -77,7 +77,7 @@ class BinaryCommandHandler : return None else: exp_tag = res.payload["expected_ack"].hex() - timeout = res.payload["suggested_timeout"] / 1000 + timeout = res.payload["suggested_timeout"]/800 if timeout_override == 0 else timeout_override res2 = await self.dispatcher.wait_for_event(EventType.BINARY_RESPONSE, attribute_filters={"tag": exp_tag}, timeout=timeout) logger.debug(res2) if res2 is None : @@ -85,31 +85,31 @@ class BinaryCommandHandler : else: return res2.payload - async def req_telemetry (self, contact) : + async def req_telemetry (self, contact, timeout_override=0) : code = BinaryReqType.TELEMETRY.value req = code.to_bytes(1, 'little', signed=False) - res = await self.req_binary(contact, req) + res = await self.req_binary(contact, req, timeout_override) if (res is None) : return None else: return lpp_parse(bytes.fromhex(res["data"])) - async def req_mma (self, contact, start, end) : + async def req_mma (self, contact, start, end, timeout_override=0) : code = BinaryReqType.MMA.value req = code.to_bytes(1, 'little', signed=False)\ + start.to_bytes(4, 'little', signed = False)\ + end.to_bytes(4, 'little', signed=False)\ + b"\0\0" - res = await self.req_binary(contact, req) + res = await self.req_binary(contact, req, timeout_override) if (res is None) : return None else: return lpp_parse_mma(bytes.fromhex(res["data"])[4:]) - async def req_acl (self, contact) : + async def req_acl (self, contact, timeout_override=0) : code = BinaryReqType.ACL.value req = code.to_bytes(1, 'little', signed=False) + b"\0\0" - res = await self.req_binary(contact, req) + res = await self.req_binary(contact, req, timeout_override) if (res is None) : return None else: