mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
handle repeat mode
This commit is contained in:
parent
d254c8e6ff
commit
8c33c09ac1
3 changed files with 28 additions and 0 deletions
|
|
@ -287,3 +287,8 @@ class DeviceCommands(CommandHandlerBase):
|
|||
logger.debug("Getting packet statistics")
|
||||
# CMD_GET_STATS (56) + STATS_TYPE_PACKETS (2)
|
||||
return await self.send(b"\x38\x02", [EventType.STATS_PACKETS, EventType.ERROR])
|
||||
|
||||
async def get_allowed_repeat_freq(self) -> Event:
|
||||
logger.debug("Getting allowed repeat freqs")
|
||||
return await self.send(b"\x3c", [EventType.ALLOWED_REPEAT_FREQ, EventType.ERROR])
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class EventType(Enum):
|
|||
SIGN_START = "sign_start"
|
||||
SIGNATURE = "signature"
|
||||
ADVERT_RESPONSE = "advert_response"
|
||||
ALLOWED_REPEAT_FREQ = "allowed_repeat_freq"
|
||||
|
||||
# Command response types
|
||||
OK = "command_ok"
|
||||
|
|
|
|||
|
|
@ -607,6 +607,28 @@ class MessageReader:
|
|||
Event(EventType.TELEMETRY_RESPONSE, res, attributes)
|
||||
)
|
||||
|
||||
elif packet_type_value == PacketType.ALLOWED_REPEAT_FREQ.value:
|
||||
res = {}
|
||||
freqs = []
|
||||
|
||||
cont = True
|
||||
try:
|
||||
while cont:
|
||||
min = int.from_bytes(dbuf.read(4), "little", signed=False)
|
||||
max = int.from_bytes(dbuf.read(4), "little", signed=False)
|
||||
if min == 0 or max == 0:
|
||||
cont = False
|
||||
else:
|
||||
freqs.append({"min" : min, "max": max})
|
||||
except e:
|
||||
print(e)
|
||||
|
||||
res["freqs"] = freqs
|
||||
|
||||
await self.dispatcher.dispatch(
|
||||
Event(EventType.ALLOWED_REPEAT_FREQ, res)
|
||||
)
|
||||
|
||||
elif packet_type_value == PacketType.BINARY_RESPONSE.value:
|
||||
dbuf.read(1)
|
||||
tag = dbuf.read(4).hex()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue