mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-06-11 11:56:18 +00:00
handle repeat mode
This commit is contained in:
@@ -287,3 +287,8 @@ class DeviceCommands(CommandHandlerBase):
|
|||||||
logger.debug("Getting packet statistics")
|
logger.debug("Getting packet statistics")
|
||||||
# CMD_GET_STATS (56) + STATS_TYPE_PACKETS (2)
|
# CMD_GET_STATS (56) + STATS_TYPE_PACKETS (2)
|
||||||
return await self.send(b"\x38\x02", [EventType.STATS_PACKETS, EventType.ERROR])
|
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"
|
SIGN_START = "sign_start"
|
||||||
SIGNATURE = "signature"
|
SIGNATURE = "signature"
|
||||||
ADVERT_RESPONSE = "advert_response"
|
ADVERT_RESPONSE = "advert_response"
|
||||||
|
ALLOWED_REPEAT_FREQ = "allowed_repeat_freq"
|
||||||
|
|
||||||
# Command response types
|
# Command response types
|
||||||
OK = "command_ok"
|
OK = "command_ok"
|
||||||
|
|||||||
@@ -607,6 +607,28 @@ class MessageReader:
|
|||||||
Event(EventType.TELEMETRY_RESPONSE, res, attributes)
|
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:
|
elif packet_type_value == PacketType.BINARY_RESPONSE.value:
|
||||||
dbuf.read(1)
|
dbuf.read(1)
|
||||||
tag = dbuf.read(4).hex()
|
tag = dbuf.read(4).hex()
|
||||||
|
|||||||
Reference in New Issue
Block a user