change override_timeout to timeout

This commit is contained in:
Florent de Lamotte
2025-07-16 17:14:17 +02:00
parent 837ff3af89
commit 742c498a14

View File

@@ -69,7 +69,7 @@ class BinaryCommandHandler :
def dispatcher(self): def dispatcher(self):
return self.commands.dispatcher return self.commands.dispatcher
async def req_binary (self, contact, request, timeout_override=0) : async def req_binary (self, contact, request, timeout=0) :
res = await self.commands.send_binary_req(contact, request) res = await self.commands.send_binary_req(contact, request)
logger.debug(res) logger.debug(res)
if res.type == EventType.ERROR: if res.type == EventType.ERROR:
@@ -77,7 +77,7 @@ class BinaryCommandHandler :
return None return None
else: else:
exp_tag = res.payload["expected_ack"].hex() exp_tag = res.payload["expected_ack"].hex()
timeout = res.payload["suggested_timeout"]/800 if timeout_override == 0 else timeout_override timeout = res.payload["suggested_timeout"]/800 if timeout == 0 else timeout
res2 = await self.dispatcher.wait_for_event(EventType.BINARY_RESPONSE, attribute_filters={"tag": exp_tag}, timeout=timeout) res2 = await self.dispatcher.wait_for_event(EventType.BINARY_RESPONSE, attribute_filters={"tag": exp_tag}, timeout=timeout)
logger.debug(res2) logger.debug(res2)
if res2 is None : if res2 is None :
@@ -85,31 +85,31 @@ class BinaryCommandHandler :
else: else:
return res2.payload return res2.payload
async def req_telemetry (self, contact, timeout_override=0) : async def req_telemetry (self, contact, timeout=0) :
code = BinaryReqType.TELEMETRY.value code = BinaryReqType.TELEMETRY.value
req = code.to_bytes(1, 'little', signed=False) req = code.to_bytes(1, 'little', signed=False)
res = await self.req_binary(contact, req, timeout_override) res = await self.req_binary(contact, req, timeout)
if (res is None) : if (res is None) :
return None return None
else: else:
return lpp_parse(bytes.fromhex(res["data"])) return lpp_parse(bytes.fromhex(res["data"]))
async def req_mma (self, contact, start, end, timeout_override=0) : async def req_mma (self, contact, start, end, timeout=0) :
code = BinaryReqType.MMA.value code = BinaryReqType.MMA.value
req = code.to_bytes(1, 'little', signed=False)\ req = code.to_bytes(1, 'little', signed=False)\
+ start.to_bytes(4, 'little', signed = False)\ + start.to_bytes(4, 'little', signed = False)\
+ end.to_bytes(4, 'little', signed=False)\ + end.to_bytes(4, 'little', signed=False)\
+ b"\0\0" + b"\0\0"
res = await self.req_binary(contact, req, timeout_override) res = await self.req_binary(contact, req, timeout)
if (res is None) : if (res is None) :
return None return None
else: else:
return lpp_parse_mma(bytes.fromhex(res["data"])[4:]) return lpp_parse_mma(bytes.fromhex(res["data"])[4:])
async def req_acl (self, contact, timeout_override=0) : async def req_acl (self, contact, timeout=0) :
code = BinaryReqType.ACL.value code = BinaryReqType.ACL.value
req = code.to_bytes(1, 'little', signed=False) + b"\0\0" req = code.to_bytes(1, 'little', signed=False) + b"\0\0"
res = await self.req_binary(contact, req, timeout_override) res = await self.req_binary(contact, req, timeout)
if (res is None) : if (res is None) :
return None return None
else: else: