meshcore 1.9.8.dev6__tar.gz → 1.9.9__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-1.9.8.dev6 → meshcore-1.9.9}/PKG-INFO +1 -1
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/pyproject.toml +1 -1
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/src/meshcore/commands.py +35 -10
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/src/meshcore/lpp_json_encoder.py +3 -3
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/src/meshcore/reader.py +1 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/.gitignore +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/LICENSE +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/README.md +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/ble_chat.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/ble_t1000_chan_msg.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/ble_t1000_custom_vars.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/ble_t1000_infos.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/ble_t1000_msg.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/ble_t1000_set_cv.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/mepo_mc_gps.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/pubsub_example.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/rf_packet_monitor.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/serial_battery_monitor.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/serial_chat.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/serial_contacts.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/serial_infos.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/serial_msg.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/serial_repeater_status.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/serial_repeater_telemetry.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/serial_trace.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/tcp_chat.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/tcp_login_status.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/tcp_mchome_contacts.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/tcp_mchome_infos.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/tcp_mchome_msg.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/examples/tcp_mchome_readmsgs.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/pytest.ini +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/src/meshcore/__init__.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/src/meshcore/ble_cx.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/src/meshcore/events.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/src/meshcore/meshcore.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/src/meshcore/packets.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/src/meshcore/serial_cx.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/src/meshcore/tcp_cx.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/tests/README.md +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/tests/unit/test_commands.py +0 -0
- {meshcore-1.9.8.dev6 → meshcore-1.9.9}/tests/unit/test_events.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshcore
|
|
3
|
-
Version: 1.9.
|
|
3
|
+
Version: 1.9.9
|
|
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
|
|
@@ -196,8 +196,8 @@ class CommandHandler:
|
|
|
196
196
|
+ int(0).to_bytes(1, 'little')\
|
|
197
197
|
+ int(0).to_bytes(1, 'little'), [EventType.OK, EventType.ERROR])
|
|
198
198
|
|
|
199
|
-
async def set_other_params(self, manual_add_contacts : bool, telemetry_mode_base : int, telemetry_mode_loc : int) :
|
|
200
|
-
telemetry_mode = (telemetry_mode_base & 0b11) | ((telemetry_mode_loc & 0b11) << 2)
|
|
199
|
+
async def set_other_params(self, manual_add_contacts : bool, telemetry_mode_base : int, telemetry_mode_loc : int, telemetry_mode_env : int) :
|
|
200
|
+
telemetry_mode = (telemetry_mode_base & 0b11) | ((telemetry_mode_loc & 0b11) << 2) | ((telemetry_mode_env & 0b11) << 4)
|
|
201
201
|
data = b"\x26" + manual_add_contacts.to_bytes(1) + telemetry_mode.to_bytes(1)
|
|
202
202
|
return await self.send(data, [EventType.OK, EventType.ERROR])
|
|
203
203
|
|
|
@@ -206,21 +206,32 @@ class CommandHandler:
|
|
|
206
206
|
return await self.set_other_params(
|
|
207
207
|
infos["manual_add_contacts"],
|
|
208
208
|
telemetry_mode_base,
|
|
209
|
-
infos["telemetry_mode_loc"]
|
|
209
|
+
infos["telemetry_mode_loc"],
|
|
210
|
+
infos["telemetry_mode_env"])
|
|
210
211
|
|
|
211
212
|
async def set_telemetry_mode_loc(self, telemetry_mode_loc : int) :
|
|
212
213
|
infos = (await self.send_appstart()).payload
|
|
213
214
|
return await self.set_other_params(
|
|
214
215
|
infos["manual_add_contacts"],
|
|
215
216
|
infos["telemetry_mode_base"],
|
|
216
|
-
telemetry_mode_loc
|
|
217
|
+
telemetry_mode_loc,
|
|
218
|
+
infos["telemetry_mode_env"])
|
|
219
|
+
|
|
220
|
+
async def set_telemetry_mode_env(self, telemetry_mode_env : int) :
|
|
221
|
+
infos = (await self.send_appstart()).payload
|
|
222
|
+
return await self.set_other_params(
|
|
223
|
+
infos["manual_add_contacts"],
|
|
224
|
+
infos["telemetry_mode_base"],
|
|
225
|
+
infos["telemetry_mode_loc"],
|
|
226
|
+
telemetry_mode_env)
|
|
217
227
|
|
|
218
228
|
async def set_manual_add_contacts(self, manual_add_contacts:bool) :
|
|
219
229
|
infos = (await self.send_appstart()).payload
|
|
220
230
|
return await self.set_other_params(
|
|
221
231
|
manual_add_contacts,
|
|
222
232
|
infos["telemetry_mode_base"],
|
|
223
|
-
infos["telemetry_mode_loc"]
|
|
233
|
+
infos["telemetry_mode_loc"],
|
|
234
|
+
infos["telemetry_mode_env"])
|
|
224
235
|
|
|
225
236
|
async def set_devicepin(self, pin: int) -> Event:
|
|
226
237
|
logger.debug(f"Setting device PIN to: {pin}")
|
|
@@ -262,17 +273,25 @@ class CommandHandler:
|
|
|
262
273
|
logger.debug(f"Removing contact: {key_bytes.hex()}")
|
|
263
274
|
data = b"\x0f" + key_bytes
|
|
264
275
|
return await self.send(data, [EventType.OK, EventType.ERROR])
|
|
265
|
-
|
|
266
|
-
async def
|
|
267
|
-
|
|
268
|
-
|
|
276
|
+
|
|
277
|
+
async def update_contact (self, contact, path=None, flags=None) -> Event:
|
|
278
|
+
if path is None :
|
|
279
|
+
out_path_hex = contact["out_path"]
|
|
280
|
+
out_path_len = contact["out_path_len"]
|
|
281
|
+
else :
|
|
282
|
+
out_path_hex = path
|
|
283
|
+
out_path_len = int(len(path) / 2)
|
|
269
284
|
out_path_hex = out_path_hex + (128-len(out_path_hex)) * "0"
|
|
285
|
+
|
|
286
|
+
if flags is None :
|
|
287
|
+
flags = contact["flags"]
|
|
288
|
+
|
|
270
289
|
adv_name_hex = contact["adv_name"].encode().hex()
|
|
271
290
|
adv_name_hex = adv_name_hex + (64-len(adv_name_hex)) * "0"
|
|
272
291
|
data = b"\x09" \
|
|
273
292
|
+ bytes.fromhex(contact["public_key"])\
|
|
274
293
|
+ contact["type"].to_bytes(1)\
|
|
275
|
-
+
|
|
294
|
+
+ flags.to_bytes(1)\
|
|
276
295
|
+ out_path_len.to_bytes(1, 'little', signed=True)\
|
|
277
296
|
+ bytes.fromhex(out_path_hex)\
|
|
278
297
|
+ bytes.fromhex(adv_name_hex)\
|
|
@@ -280,6 +299,12 @@ class CommandHandler:
|
|
|
280
299
|
+ int(contact["adv_lat"]*1e6).to_bytes(4, 'little', signed=True)\
|
|
281
300
|
+ int(contact["adv_lon"]*1e6).to_bytes(4, 'little', signed=True)
|
|
282
301
|
return await self.send(data, [EventType.OK, EventType.ERROR])
|
|
302
|
+
|
|
303
|
+
async def change_contact_path (self, contact, path) -> Event:
|
|
304
|
+
return await self.update_contact(contact, path)
|
|
305
|
+
|
|
306
|
+
async def change_contact_flags (self, contact, flags) -> Event:
|
|
307
|
+
return await self.update_contact(contact, flags=flags)
|
|
283
308
|
|
|
284
309
|
async def get_msg(self, timeout: Optional[float] = 1) -> Event:
|
|
285
310
|
logger.debug("Requesting pending messages")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from cayennelpp import LppFrame, LppData
|
|
2
2
|
from cayennelpp.lpp_type import LppType
|
|
3
3
|
|
|
4
|
-
# type name "how to display
|
|
4
|
+
# Format : type name "how to display value"
|
|
5
5
|
# display : None: (use lib default), []: only one value to display, ["field1", "field2" ...]: meaning of each field
|
|
6
6
|
my_lpp_types = {
|
|
7
7
|
0: ('digital input', []),
|
|
@@ -33,7 +33,7 @@ my_lpp_types = {
|
|
|
33
33
|
142: ('switch', []),
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
def lpp_json_encoder (obj) :
|
|
36
|
+
def lpp_json_encoder (obj, types = my_lpp_types) :
|
|
37
37
|
"""Encode LppType, LppData, and LppFrame to JSON."""
|
|
38
38
|
if isinstance(obj, LppFrame):
|
|
39
39
|
return obj.data
|
|
@@ -53,4 +53,4 @@ def lpp_json_encoder (obj) :
|
|
|
53
53
|
i = i + 1
|
|
54
54
|
d["value"] = val_dict
|
|
55
55
|
return d
|
|
56
|
-
raise TypeError(repr(obj) + " is not JSON serialized")
|
|
56
|
+
raise TypeError(repr(obj) + " is not JSON serialized")
|
|
@@ -74,6 +74,7 @@ class MessageReader:
|
|
|
74
74
|
self_info["public_key"] = data[4:36].hex()
|
|
75
75
|
self_info["adv_lat"] = int.from_bytes(data[36:40], byteorder='little', signed=True)/1e6
|
|
76
76
|
self_info["adv_lon"] = int.from_bytes(data[40:44], byteorder='little', signed=True)/1e6
|
|
77
|
+
self_info["telemetry_mode_env"] = (data[46] >> 4) & 0b11
|
|
77
78
|
self_info["telemetry_mode_loc"] = (data[46] >> 2) & 0b11
|
|
78
79
|
self_info["telemetry_mode_base"] = (data[46]) & 0b11
|
|
79
80
|
self_info["manual_add_contacts"] = data[47] > 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
|