explicit _sync calls for binary, deprecating old ones with an error (non blocking)

This commit is contained in:
Florent de Lamotte 2025-09-05 10:08:46 +02:00
parent 5c01a4390c
commit 0c40cf917e

View file

@ -11,6 +11,10 @@ class BinaryCommandHandler(CommandHandlerBase):
"""Helper functions to handle binary requests through binary commands"""
async def req_status(self, contact, timeout=0):
logger.error("*** please consider using req_status_sync instead of req_status")
return await self.req_status_sync(contact, timeout)
async def req_status_sync(self, contact, timeout=0):
res = await self.send_binary_req(
contact,
BinaryReqType.STATUS,
@ -34,6 +38,10 @@ class BinaryCommandHandler(CommandHandlerBase):
return status_event.payload if status_event else None
async def req_telemetry(self, contact, timeout=0):
logger.error("*** please consider using req_telemetry_sync instead of req_telemetry")
return await self.req_telemetry_sync(contact, timeout)
async def req_telemetry_sync(self, contact, timeout=0):
res = await self.send_binary_req(
contact,
BinaryReqType.TELEMETRY,
@ -56,7 +64,11 @@ class BinaryCommandHandler(CommandHandlerBase):
return telem_event.payload["lpp"] if telem_event else None
async def req_mma(self, contact, start, end, timeout=0):
async def req_mma(self, contact, timeout=0):
logger.error("*** please consider using req_mma_sync instead of req_mma")
return await self.req_mma_sync(contact, start, end, timeout)
async def req_mma_sync(self, contact, start, end, timeout=0):
req = (
start.to_bytes(4, "little", signed=False)
+ end.to_bytes(4, "little", signed=False)
@ -86,6 +98,10 @@ class BinaryCommandHandler(CommandHandlerBase):
return mma_event.payload["mma_data"] if mma_event else None
async def req_acl(self, contact, timeout=0):
logger.error("*** please consider using req_acl_sync instead of req_acl")
return await self.req_acl_sync(contact, timeout)
async def req_acl_sync(self, contact, timeout=0):
req = b"\0\0"
res = await self.send_binary_req(
contact,