From 0c40cf917e851b77f9db7123a44ff0e4a6e73c27 Mon Sep 17 00:00:00 2001 From: Florent de Lamotte Date: Fri, 5 Sep 2025 10:08:46 +0200 Subject: [PATCH] explicit _sync calls for binary, deprecating old ones with an error (non blocking) --- src/meshcore/commands/binary.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/meshcore/commands/binary.py b/src/meshcore/commands/binary.py index 2f3138a..a07fb68 100644 --- a/src/meshcore/commands/binary.py +++ b/src/meshcore/commands/binary.py @@ -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,