meshcore 2.3.20__tar.gz → 2.3.21__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.3.20 → meshcore-2.3.21}/PKG-INFO +1 -1
- {meshcore-2.3.20 → meshcore-2.3.21}/pyproject.toml +1 -1
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/commands/binary.py +45 -5
- {meshcore-2.3.20 → meshcore-2.3.21}/.github/funding.yml +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/.github/python-test.yml +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/.github/workflows/python-import.yml +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/.gitignore +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/LICENSE +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/README.md +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/.pubsub_example.py.swp +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/ble_chat.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/ble_pin_pairing_example.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/ble_private_key_export.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/ble_sign_example.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/ble_stats.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/ble_t1000_chan_msg.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/ble_t1000_custom_vars.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/ble_t1000_infos.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/ble_t1000_msg.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/ble_t1000_msg_retries.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/ble_t1000_set_cv.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/chan_recv_with_path.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/connection_events_example.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/mepo_mc_gps.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/pubsub_example.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/rf_packet_monitor.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/serial_battery_monitor.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/serial_channel_manager.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/serial_chat.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/serial_contacts.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/serial_infos.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/serial_meshcore_ollama.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/serial_msg.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/serial_pingbot.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/serial_repeater_status.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/serial_repeater_telemetry.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/serial_rss_bot.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/serial_trace.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/tcp_chat.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/tcp_login_status.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/tcp_mchome_contacts.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/tcp_mchome_infos.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/tcp_mchome_msg.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/examples/tcp_mchome_readmsgs.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/pytest.ini +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/__init__.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/ble_cx.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/commands/__init__.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/commands/base.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/commands/contact.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/commands/control_data.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/commands/device.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/commands/messaging.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/connection_manager.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/events.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/lpp_json_encoder.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/meshcore.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/meshcore_parser.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/packets.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/parsing.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/reader.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/serial_cx.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/src/meshcore/tcp_cx.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/README.md +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/test_ble_connection.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/test_ble_pin_pairing.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/test_meshcore_ble_pin.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_anon_req_device_path.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_asyncio_lifecycle.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_ble_device_and_disconnect.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_ble_dropped_client.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_ble_reconnect_cleanup.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_commands.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_connection_manager.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_dispatcher_stop.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_error_handling.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_events.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_keep_channel_secrets.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_log_privacy.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_lpp_parsing.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_parse_error_events.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_parse_status.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_path_discovery_response.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_private_key_export.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_protocol_surface_gaps.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_reader.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_reader_frame_lengths.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_request_helpers.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_rxlog_keyerror_regression.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_send_msg_with_retry.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_serial_connection.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_settings_without_appstart.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_standalone_fixes.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_telemetry_partial_lpp.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_transport_symmetry.py +0 -0
- {meshcore-2.3.20 → meshcore-2.3.21}/tests/unit/test_update_contact_round_trip.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: meshcore
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.21
|
|
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
|
|
@@ -335,8 +335,13 @@ class BinaryCommandHandler(CommandHandlerBase):
|
|
|
335
335
|
if lpptype is None:
|
|
336
336
|
raise ValueError(f"Unknown lpp type {datatype}")
|
|
337
337
|
datatype = lpptype
|
|
338
|
-
|
|
339
|
-
|
|
338
|
+
if datatype == 136: # LPP_GPS: value is the min movement radius (m)
|
|
339
|
+
buf.extend(bytes([channel, datatype]))
|
|
340
|
+
buf.extend(int(round(value * 1000)).to_bytes(4, "big")) # metres -> mm
|
|
341
|
+
buf.extend(bytes(5)) # unused rest of the 9-byte slot
|
|
342
|
+
else:
|
|
343
|
+
data = LppData(channel, datatype, (value))
|
|
344
|
+
buf.extend(data.to_bytes())
|
|
340
345
|
min_deltas = bytes(buf)
|
|
341
346
|
|
|
342
347
|
if not 3 <= len(min_deltas) <= 14:
|
|
@@ -360,15 +365,50 @@ class BinaryCommandHandler(CommandHandlerBase):
|
|
|
360
365
|
scope=data[4:].decode("utf-8", "ignore").rstrip("\x00"),
|
|
361
366
|
)
|
|
362
367
|
|
|
363
|
-
async def telemetry_subscribe(self, contact,
|
|
368
|
+
async def telemetry_subscribe(self, contact, duration: int, min_deltas: bytes | dict | list[dict],
|
|
369
|
+
push_tag: bytes | None = None, timeout=0, min_timeout=0):
|
|
364
370
|
""" subscribes to telemetry push and registers the tag for binary responses
|
|
365
371
|
"""
|
|
366
372
|
pubkey_prefix = _validate_destination(contact)
|
|
367
373
|
res = await self.req_subscribe_sync(contact, push_tag, duration, min_deltas, timeout, min_timeout)
|
|
368
374
|
|
|
369
|
-
if
|
|
370
|
-
|
|
375
|
+
if push_tag is None:
|
|
376
|
+
push_tag = random.randbytes(4)
|
|
377
|
+
while reader and push_tag.hex() in reader.pending_binary_requests:
|
|
378
|
+
push_tag = random.randbytes(4)
|
|
379
|
+
elif len(push_tag) != 4:
|
|
380
|
+
raise ValueError("push_tag must be 4 bytes")
|
|
381
|
+
tag = push_tag.hex()
|
|
382
|
+
|
|
383
|
+
# register before sending, so a push that overtakes the reply
|
|
384
|
+
# is still attributed to its sender
|
|
385
|
+
if reader:
|
|
386
|
+
reader.register_binary_request(
|
|
387
|
+
pubkey_prefix, tag, BinaryReqType.PUSHED_TELEMETRY,
|
|
388
|
+
duration, is_persistent=True,
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
try:
|
|
392
|
+
res = await self.req_subscribe_sync(
|
|
393
|
+
contact, push_tag, duration, min_deltas, timeout, min_timeout
|
|
394
|
+
)
|
|
395
|
+
except BaseException:
|
|
396
|
+
if reader:
|
|
397
|
+
reader.pending_binary_requests.pop(tag, None)
|
|
398
|
+
raise
|
|
399
|
+
|
|
400
|
+
if res is None or res["expiry_secs"] == 0:
|
|
401
|
+
if reader:
|
|
402
|
+
reader.pending_binary_requests.pop(tag, None)
|
|
403
|
+
return res
|
|
404
|
+
|
|
405
|
+
if reader: # the sensor may have granted less than asked for
|
|
406
|
+
reader.register_binary_request(
|
|
407
|
+
pubkey_prefix, tag, BinaryReqType.PUSHED_TELEMETRY,
|
|
408
|
+
res["expiry_secs"], is_persistent=True,
|
|
409
|
+
)
|
|
371
410
|
|
|
411
|
+
res["push_tag"] = push_tag
|
|
372
412
|
return res
|
|
373
413
|
|
|
374
414
|
async def req_unsubscribe_sync(self, contact, timeout=0, min_timeout=0):
|
|
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
|
|
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
|