mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-06-11 11:56:18 +00:00
autoadd_config
This commit is contained in:
@@ -143,3 +143,12 @@ class ContactCommands(CommandHandlerBase):
|
|||||||
|
|
||||||
async def change_contact_flags(self, contact, flags) -> Event:
|
async def change_contact_flags(self, contact, flags) -> Event:
|
||||||
return await self.update_contact(contact, flags=flags)
|
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"
|
MSG_SENT = "message_sent"
|
||||||
NEW_CONTACT = "new_contact"
|
NEW_CONTACT = "new_contact"
|
||||||
NEXT_CONTACT = "next_contact"
|
NEXT_CONTACT = "next_contact"
|
||||||
|
AUTOADD_CONFIG = "autoadd_config"
|
||||||
|
|
||||||
# Push notifications
|
# Push notifications
|
||||||
ADVERTISEMENT = "advertisement"
|
ADVERTISEMENT = "advertisement"
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class PacketType(Enum):
|
|||||||
SIGNATURE = 20
|
SIGNATURE = 20
|
||||||
CUSTOM_VARS = 21
|
CUSTOM_VARS = 21
|
||||||
STATS = 24
|
STATS = 24
|
||||||
|
AUTOADD_CONFIG = 25
|
||||||
BINARY_REQ = 50
|
BINARY_REQ = 50
|
||||||
FACTORY_RESET = 51
|
FACTORY_RESET = 51
|
||||||
PATH_DISCOVERY = 52
|
PATH_DISCOVERY = 52
|
||||||
|
|||||||
@@ -378,6 +378,13 @@ class MessageReader:
|
|||||||
logger.error(f"Unknown stats type: {stats_type}, data: {data.hex()}")
|
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}"}))
|
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:
|
elif packet_type_value == PacketType.CHANNEL_INFO.value:
|
||||||
logger.debug(f"received channel info response: {data.hex()}")
|
logger.debug(f"received channel info response: {data.hex()}")
|
||||||
res = {}
|
res = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user