meshcore-cli 1.6.2__tar.gz → 1.6.3__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_cli-1.6.2 → meshcore_cli-1.6.3}/PKG-INFO +1 -1
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/pyproject.toml +1 -1
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/src/meshcore_cli/meshcore_cli.py +33 -18
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/.github/funding.yml +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/.gitignore +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/LICENSE +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/README.md +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/flake.lock +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/flake.nix +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/scripts/README.md +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/scripts/ask_mepo_coords +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/scripts/contact_markers.sh +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/scripts/getpos.py +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/scripts/neighbour_map.sh +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/src/meshcore_cli/__init__.py +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/src/meshcore_cli/__main__.py +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/sxmo/sxmo_accel.sh +0 -0
- {meshcore_cli-1.6.2 → meshcore_cli-1.6.3}/sxmo/sxmo_mc.sh +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: meshcore-cli
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.3
|
|
4
4
|
Summary: Command line interface to meshcore companion radios and repeaters
|
|
5
5
|
Project-URL: Homepage, https://github.com/fdlamotte/meshcore-cli
|
|
6
6
|
Project-URL: Issues, https://github.com/fdlamotte/meshcore-cli/issues
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
import asyncio
|
|
7
|
-
import os, sys, io, platform
|
|
7
|
+
import os, sys, io, platform, shutil
|
|
8
8
|
import string
|
|
9
9
|
import time, datetime
|
|
10
10
|
import getopt, json, shlex, re
|
|
@@ -34,7 +34,7 @@ except ImportError:
|
|
|
34
34
|
from meshcore import MeshCore, EventType, logger
|
|
35
35
|
|
|
36
36
|
# Version
|
|
37
|
-
VERSION = "v1.6.
|
|
37
|
+
VERSION = "v1.6.3"
|
|
38
38
|
|
|
39
39
|
# default ble address is stored in a config file
|
|
40
40
|
MCCLI_CONFIG_DIR = os.path.expanduser("~/.config/meshcore/")
|
|
@@ -48,9 +48,14 @@ SCOPES = {}
|
|
|
48
48
|
if os.path.exists(MCCLI_SCOPES_FILE) :
|
|
49
49
|
with open(MCCLI_SCOPES_FILE, "r") as lines:
|
|
50
50
|
for line in lines:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
try:
|
|
52
|
+
line = line.strip()
|
|
53
|
+
if line == "" or line.startswith(";"):
|
|
54
|
+
continue
|
|
55
|
+
channel, scope = line.split()
|
|
56
|
+
SCOPES[channel] = scope
|
|
57
|
+
except ValueError as e:
|
|
58
|
+
logger.error(f"while reading scope file {MCCLI_SCOPES_FILE}: {e} ... proceeding")
|
|
54
59
|
|
|
55
60
|
PAYLOAD_TYPENAMES = ["REQ", "RESPONSE", "TEXT_MSG", "ACK", "ADVERT", "GRP_TXT", "GRP_DATA", "ANON_REQ", "PATH", "TRACE", "MULTIPART", "CONTROL"]
|
|
56
61
|
ROUTE_TYPENAMES = ["TC_FLOOD", "FLOOD", "DIRECT", "TC_DIRECT"]
|
|
@@ -170,8 +175,16 @@ def strip_outer_quotes(text):
|
|
|
170
175
|
|
|
171
176
|
def split_pipeline(pipeline):
|
|
172
177
|
lines, buf, quote = [], [], None
|
|
178
|
+
escaped = False
|
|
179
|
+
|
|
173
180
|
for c in pipeline:
|
|
174
|
-
if
|
|
181
|
+
if escaped:
|
|
182
|
+
buf.append(c)
|
|
183
|
+
escaped = False
|
|
184
|
+
elif c == "\\" and quote != "'":
|
|
185
|
+
buf.append(c)
|
|
186
|
+
escaped = True
|
|
187
|
+
elif quote:
|
|
175
188
|
buf.append(c)
|
|
176
189
|
if c == quote:
|
|
177
190
|
quote = None
|
|
@@ -330,7 +343,7 @@ async def handle_log_rx(event):
|
|
|
330
343
|
message = "-- unhandled --"
|
|
331
344
|
|
|
332
345
|
if chan_name != "" :
|
|
333
|
-
width =
|
|
346
|
+
width = shutil.get_terminal_size(fallback=(80, 24)).columns
|
|
334
347
|
cars = width - 13 - len(event.payload["path"]) - len(chan_name) - 1
|
|
335
348
|
dispmsg = message.replace("\n","")[0:cars]
|
|
336
349
|
txt = f"{ANSI_LIGHT_GRAY}{chan_name} {ANSI_DGREEN}{dispmsg+(cars-len(dispmsg))*' '} {ANSI_START}{width-11-len(event.payload['path'])}G{ANSI_YELLOW}[{event.payload['path']}]{ANSI_LIGHT_GRAY}{event.payload['snr']:6,.2f}{event.payload['rssi']:4}{ANSI_END}"
|
|
@@ -1361,7 +1374,7 @@ async def process_line(mc, line, contact=None, scope="*", prev_contact=None, pre
|
|
|
1361
1374
|
args = shlex.split(line, posix=True)
|
|
1362
1375
|
res = await process_cmds(mc, args, json_output=json_output, sink=sink,end=end)
|
|
1363
1376
|
if not res and HAS_CLI_CMD: # if command was not found, try cli
|
|
1364
|
-
args = ["cli", line
|
|
1377
|
+
args = ["cli", line.strip()]
|
|
1365
1378
|
res = await process_cmds(mc, args, json_output=json_output, sink=sink,end=end)
|
|
1366
1379
|
if not res :
|
|
1367
1380
|
logger.error(f"Problem while running {args}")
|
|
@@ -2259,12 +2272,13 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
2259
2272
|
output_str += f"Time synced{end}"
|
|
2260
2273
|
else:
|
|
2261
2274
|
res = await mc.commands.get_time()
|
|
2262
|
-
|
|
2263
|
-
if res.type == EventType.ERROR:
|
|
2275
|
+
if res is None or res.type == EventType.ERROR:
|
|
2264
2276
|
output_str += f"Error getting time: {res}{end}"
|
|
2265
2277
|
elif json_output :
|
|
2278
|
+
timestamp = res.payload["time"]
|
|
2266
2279
|
output_str += json.dumps(res.payload, indent=4)+end
|
|
2267
2280
|
else :
|
|
2281
|
+
timestamp = res.payload["time"]
|
|
2268
2282
|
output_str += 'Current time :'\
|
|
2269
2283
|
+ f' {datetime.datetime.fromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S")}'\
|
|
2270
2284
|
+ f' ({timestamp})'\
|
|
@@ -2903,13 +2917,13 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
2903
2917
|
case "self_telemetry" | "t":
|
|
2904
2918
|
res = await mc.commands.get_self_telemetry()
|
|
2905
2919
|
logger.debug(res)
|
|
2906
|
-
if res
|
|
2907
|
-
output_str += f"Error while requesting telemetry{end}"
|
|
2908
|
-
elif res is None:
|
|
2920
|
+
if res is None:
|
|
2909
2921
|
if json_output :
|
|
2910
2922
|
output_str += json.dumps({"error" : "Timeout waiting telemetry"})+end
|
|
2911
2923
|
else:
|
|
2912
2924
|
output_str += "Timeout waiting telemetry" + end
|
|
2925
|
+
elif res.type == EventType.ERROR:
|
|
2926
|
+
output_str += f"Error while requesting telemetry{end}"
|
|
2913
2927
|
else :
|
|
2914
2928
|
output_str += json.dumps(res.payload, indent=4)+end
|
|
2915
2929
|
|
|
@@ -3467,7 +3481,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
3467
3481
|
if json_output:
|
|
3468
3482
|
output_str += json.dumps(res, indent=4)+end
|
|
3469
3483
|
else:
|
|
3470
|
-
width =
|
|
3484
|
+
width = shutil.get_terminal_size(fallback=(80, 24)).columns
|
|
3471
3485
|
output_str += f"Got {res['results_count']} neighbours out of {res['neighbours_count']} from {contact['adv_name']}:\n"
|
|
3472
3486
|
first = True
|
|
3473
3487
|
for n in res['neighbours']:
|
|
@@ -4020,9 +4034,9 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4020
4034
|
else:
|
|
4021
4035
|
file_name = await prompt_for_file()
|
|
4022
4036
|
|
|
4023
|
-
file_name = file_name.strip()
|
|
4024
|
-
fn = file_name
|
|
4025
4037
|
if not file_name is None:
|
|
4038
|
+
file_name = file_name.strip()
|
|
4039
|
+
fn = file_name
|
|
4026
4040
|
file_name = os.path.expanduser(file_name)
|
|
4027
4041
|
if not os.path.exists(file_name) :
|
|
4028
4042
|
if os.path.exists(MCCLI_CONFIG_DIR + file_name) :
|
|
@@ -5261,11 +5275,12 @@ async def main(argv):
|
|
|
5261
5275
|
if os.path.isdir(MCCLI_CONFIG_DIR) :
|
|
5262
5276
|
log_message.file = MCCLI_CONFIG_DIR + (mc.self_info["name"].replace("/","")) + ".msgs"
|
|
5263
5277
|
|
|
5278
|
+
if res.payload["fw ver"] >= 14 :
|
|
5279
|
+
HAS_CLI_CMD = True
|
|
5280
|
+
|
|
5264
5281
|
if (json_output or quiet) :
|
|
5265
5282
|
logger.setLevel(logging.ERROR)
|
|
5266
5283
|
else :
|
|
5267
|
-
if res.payload["fw ver"] >= 14 :
|
|
5268
|
-
HAS_CLI_CMD = True
|
|
5269
5284
|
if res.payload["fw ver"] > 2 :
|
|
5270
5285
|
logger.info(f"Connected to {mc.self_info['name']} running on a {res.payload['ver']} ({res.payload['fw ver']}) fw.")
|
|
5271
5286
|
else :
|
|
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
|