mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
autoadd_config
This commit is contained in:
parent
3b46986dfa
commit
d57162375a
4 changed files with 18 additions and 0 deletions
|
|
@ -143,3 +143,12 @@ class ContactCommands(CommandHandlerBase):
|
|||
|
||||
async def change_contact_flags(self, contact, flags) -> Event:
|
||||
return await self.update_contact(contact, flags=flags)
|
||||
|
||||
async def set_autoadd_config(self, flag : int) -> Event:
|
||||
data = b"\x3A" + flag.to_bytes(1, "little", signed=False)
|
||||
return await self.send(data, [EventType.OK, EventType.ERROR])
|
||||
|
||||
async def get_autoadd_config(self) -> Event:
|
||||
data = b"\x3B"
|
||||
return await self.send(data, [EventType.AUTOADD_CONFIG, EventType.ERROR])
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class EventType(Enum):
|
|||
MSG_SENT = "message_sent"
|
||||
NEW_CONTACT = "new_contact"
|
||||
NEXT_CONTACT = "next_contact"
|
||||
AUTOADD_CONFIG = "autoadd_config"
|
||||
|
||||
# Push notifications
|
||||
ADVERTISEMENT = "advertisement"
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class PacketType(Enum):
|
|||
SIGNATURE = 20
|
||||
CUSTOM_VARS = 21
|
||||
STATS = 24
|
||||
AUTOADD_CONFIG = 25
|
||||
BINARY_REQ = 50
|
||||
FACTORY_RESET = 51
|
||||
PATH_DISCOVERY = 52
|
||||
|
|
|
|||
|
|
@ -378,6 +378,13 @@ class MessageReader:
|
|||
logger.error(f"Unknown stats type: {stats_type}, data: {data.hex()}")
|
||||
await self.dispatcher.dispatch(Event(EventType.ERROR, {"reason": f"unknown_stats_type: {stats_type}"}))
|
||||
|
||||
elif packet_type_value == PacketType.AUTOADD_CONFIG.value:
|
||||
logger.debug(f"received autoadd config response: {data.hex()}")
|
||||
|
||||
res = {}
|
||||
res["config"] = dbuf.read(1)[0]
|
||||
await self.dispatcher.dispatch(Event(EventType.AUTOADD_CONFIG, res, res))
|
||||
|
||||
elif packet_type_value == PacketType.CHANNEL_INFO.value:
|
||||
logger.debug(f"received channel info response: {data.hex()}")
|
||||
res = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue