meshcore 2.2.25__tar.gz → 2.2.27__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {meshcore-2.2.25 → meshcore-2.2.27}/PKG-INFO +1 -1
- {meshcore-2.2.25 → meshcore-2.2.27}/pyproject.toml +1 -1
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/commands/contact.py +6 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/events.py +10 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/packets.py +2 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/reader.py +19 -2
- {meshcore-2.2.25 → meshcore-2.2.27}/.github/python-test.yml +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/.gitignore +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/LICENSE +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/README.md +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/.pubsub_example.py.swp +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/ble_chat.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/ble_pin_pairing_example.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/ble_private_key_export.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/ble_sign_example.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/ble_stats.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/ble_t1000_chan_msg.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/ble_t1000_custom_vars.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/ble_t1000_infos.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/ble_t1000_msg.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/ble_t1000_msg_retries.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/ble_t1000_set_cv.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/chan_recv_with_path.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/connection_events_example.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/mepo_mc_gps.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/pubsub_example.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/rf_packet_monitor.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/serial_battery_monitor.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/serial_channel_manager.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/serial_chat.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/serial_contacts.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/serial_infos.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/serial_meshcore_ollama.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/serial_msg.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/serial_pingbot.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/serial_repeater_status.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/serial_repeater_telemetry.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/serial_rss_bot.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/serial_trace.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/tcp_chat.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/tcp_login_status.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/tcp_mchome_contacts.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/tcp_mchome_infos.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/tcp_mchome_msg.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/examples/tcp_mchome_readmsgs.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/pytest.ini +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/__init__.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/ble_cx.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/commands/__init__.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/commands/base.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/commands/binary.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/commands/control_data.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/commands/device.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/commands/messaging.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/connection_manager.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/lpp_json_encoder.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/meshcore.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/parsing.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/serial_cx.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/src/meshcore/tcp_cx.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/tests/README.md +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/tests/test_ble_connection.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/tests/test_ble_pin_pairing.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/tests/test_meshcore_ble_pin.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/tests/unit/test_commands.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/tests/unit/test_events.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/tests/unit/test_private_key_export.py +0 -0
- {meshcore-2.2.25 → meshcore-2.2.27}/tests/unit/test_reader.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshcore
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.27
|
|
4
4
|
Summary: Base classes for communicating with meshcore companion radios
|
|
5
5
|
Project-URL: Homepage, https://github.com/fdlamotte/meshcore_py
|
|
6
6
|
Project-URL: Issues, https://github.com/fdlamotte/meshcore_py/issues
|
|
@@ -182,3 +182,9 @@ class ContactCommands(CommandHandlerBase):
|
|
|
182
182
|
async def get_autoadd_config(self) -> Event:
|
|
183
183
|
data = b"\x3B"
|
|
184
184
|
return await self.send(data, [EventType.AUTOADD_CONFIG, EventType.ERROR])
|
|
185
|
+
|
|
186
|
+
async def get_advert_path(self, key: DestinationType) -> Event:
|
|
187
|
+
key_bytes = _validate_destination(key, prefix_length=32)
|
|
188
|
+
logger.debug(f"getting advert path for: {key} {key_bytes.hex()}")
|
|
189
|
+
data = b"\x2a\0" + key_bytes
|
|
190
|
+
return await self.send(data, [EventType.ADVERT_PATH, EventType.ERROR])
|
|
@@ -23,6 +23,7 @@ class EventType(Enum):
|
|
|
23
23
|
NEW_CONTACT = "new_contact"
|
|
24
24
|
NEXT_CONTACT = "next_contact"
|
|
25
25
|
AUTOADD_CONFIG = "autoadd_config"
|
|
26
|
+
ADVERT_PATH = "advert_path"
|
|
26
27
|
|
|
27
28
|
# Push notifications
|
|
28
29
|
ADVERTISEMENT = "advertisement"
|
|
@@ -63,6 +64,15 @@ class EventType(Enum):
|
|
|
63
64
|
CONNECTED = "connected"
|
|
64
65
|
DISCONNECTED = "disconnected"
|
|
65
66
|
|
|
67
|
+
# a dict to associate a message to an error code
|
|
68
|
+
ErrorMessages = {
|
|
69
|
+
1: "ERR_CODE_UNSUPPORTED_CMD",
|
|
70
|
+
2: "ERR_CODE_NOT_FOUND",
|
|
71
|
+
3: "ERR_CODE_TABLE_FULL",
|
|
72
|
+
4: "ERR_CODE_BAD_STATE",
|
|
73
|
+
5: "ERR_CODE_FILE_IO_ERROR",
|
|
74
|
+
6: "ERR_CODE_ILLEGAL_ARG",
|
|
75
|
+
}
|
|
66
76
|
|
|
67
77
|
@dataclass
|
|
68
78
|
class Event:
|
|
@@ -4,7 +4,7 @@ import struct
|
|
|
4
4
|
import time
|
|
5
5
|
import io
|
|
6
6
|
from typing import Any, Dict
|
|
7
|
-
from .events import Event, EventType, EventDispatcher
|
|
7
|
+
from .events import Event, EventType, EventDispatcher, ErrorMessages
|
|
8
8
|
from .packets import BinaryReqType, PacketType, ControlType
|
|
9
9
|
from .parsing import lpp_parse, lpp_parse_mma, parse_acl, parse_status
|
|
10
10
|
from cayennelpp import LppFrame, LppData
|
|
@@ -80,7 +80,10 @@ class MessageReader:
|
|
|
80
80
|
|
|
81
81
|
elif packet_type_value == PacketType.ERROR.value:
|
|
82
82
|
if len(data) > 1:
|
|
83
|
-
result = {
|
|
83
|
+
result = {
|
|
84
|
+
"error_code": data[1],
|
|
85
|
+
"code_string": ErrorMessages[data[1]],
|
|
86
|
+
}
|
|
84
87
|
else:
|
|
85
88
|
result = {}
|
|
86
89
|
|
|
@@ -123,6 +126,20 @@ class MessageReader:
|
|
|
123
126
|
await self.dispatcher.dispatch(Event(EventType.NEXT_CONTACT, c))
|
|
124
127
|
self.contacts[c["public_key"]] = c
|
|
125
128
|
|
|
129
|
+
elif packet_type_value == PacketType.ADVERT_PATH.value :
|
|
130
|
+
r = {}
|
|
131
|
+
r["timestamp"] = int.from_bytes(dbuf.read(4), "little", signed=False)
|
|
132
|
+
plen = int.from_bytes(dbuf.read(1), "little", signed=False)
|
|
133
|
+
if plen == 255: # flood, should not happen
|
|
134
|
+
r["path_hash_mode"] = -1
|
|
135
|
+
r["path_len"] = -1
|
|
136
|
+
else:
|
|
137
|
+
r["path_hash_mode"] = plen >> 6 # 2 upper bytes
|
|
138
|
+
r["path_len"] = plen & 0x3F
|
|
139
|
+
r["path"] = dbuf.read().replace(b"\0", b"").hex()
|
|
140
|
+
|
|
141
|
+
await self.dispatcher.dispatch(Event(EventType.ADVERT_PATH, r))
|
|
142
|
+
|
|
126
143
|
elif packet_type_value == PacketType.CONTACT_END.value:
|
|
127
144
|
lastmod = int.from_bytes(dbuf.read(4), byteorder="little")
|
|
128
145
|
attributes = {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|