meshcore-cli 1.6.6__tar.gz → 1.6.8__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.6 → meshcore_cli-1.6.8}/PKG-INFO +1 -1
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/pyproject.toml +1 -1
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/src/meshcore_cli/meshcore_cli.py +126 -10
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/.github/funding.yml +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/.gitignore +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/LICENSE +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/README.md +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/flake.lock +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/flake.nix +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/scripts/README.md +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/scripts/ask_mepo_coords +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/scripts/contact_markers.sh +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/scripts/getpos.py +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/scripts/neighbour_map.sh +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/src/meshcore_cli/__init__.py +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/src/meshcore_cli/__main__.py +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/sxmo/sxmo_accel.sh +0 -0
- {meshcore_cli-1.6.6 → meshcore_cli-1.6.8}/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.8
|
|
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
|
|
@@ -35,7 +35,7 @@ except ImportError:
|
|
|
35
35
|
from meshcore import MeshCore, EventType, logger
|
|
36
36
|
|
|
37
37
|
# Version
|
|
38
|
-
VERSION = "v1.6.
|
|
38
|
+
VERSION = "v1.6.8"
|
|
39
39
|
|
|
40
40
|
# default ble address is stored in a config file
|
|
41
41
|
MCCLI_CONFIG_DIR = os.path.expanduser("~/.config/meshcore/")
|
|
@@ -154,6 +154,8 @@ LC_DISPLAY_TYPES = [1, 2, 3, 4]
|
|
|
154
154
|
LC_OUTPUT_FORMAT = "tkah"
|
|
155
155
|
LC_SORT_ORDER = ""
|
|
156
156
|
|
|
157
|
+
LAST_DISCOVERED_NODES = []
|
|
158
|
+
|
|
157
159
|
def time_ago_from_timestamp (timestamp):
|
|
158
160
|
if timestamp == 0:
|
|
159
161
|
return "0"
|
|
@@ -653,7 +655,7 @@ class MyNestedCompleter(NestedCompleter):
|
|
|
653
655
|
opts = self.options.keys()
|
|
654
656
|
completer = WordCompleter(
|
|
655
657
|
opts, ignore_case=self.ignore_case,
|
|
656
|
-
pattern=re.compile(r"([a-zA-Z0-9_
|
|
658
|
+
pattern=re.compile(r"([a-zA-Z0-9_\\/\#\?@\.]+|[^a-zA-Z0-9_\s\#\?@\.]+)"))
|
|
657
659
|
yield from completer.get_completions(document, complete_event)
|
|
658
660
|
else: # normal behavior for remainder
|
|
659
661
|
yield from super().get_completions(document, complete_event)
|
|
@@ -663,6 +665,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
663
665
|
pending = pending or {}
|
|
664
666
|
contact_list = {}
|
|
665
667
|
pending_list = {}
|
|
668
|
+
discovered_list = {"-a":None}
|
|
666
669
|
to_list = {}
|
|
667
670
|
|
|
668
671
|
to_list["~"] = None
|
|
@@ -683,6 +686,8 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
683
686
|
for c in pit :
|
|
684
687
|
pending_list[c[1]['public_key']] = None
|
|
685
688
|
|
|
689
|
+
for n in LAST_DISCOVERED_NODES:
|
|
690
|
+
discovered_list[n['pubkey'][:16]] = None
|
|
686
691
|
to_list.update(contact_list)
|
|
687
692
|
|
|
688
693
|
to_list["ch"] = None
|
|
@@ -725,7 +730,9 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
725
730
|
"path": contact_list,
|
|
726
731
|
"disc_path" : contact_list,
|
|
727
732
|
"advert_path" : contact_list | pending_list,
|
|
728
|
-
"node_discover": {"
|
|
733
|
+
"node_discover": {"-tall":None, "-tsens":None, "-trep":None, "-tcomp":None, "-troom":None, "-tcli":None},
|
|
734
|
+
"list_discovered": None,
|
|
735
|
+
"add_discovered": discovered_list,
|
|
729
736
|
"trace" : None,
|
|
730
737
|
"reset_path" : contact_list,
|
|
731
738
|
"change_path" : contact_list,
|
|
@@ -767,6 +774,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
767
774
|
"pin" : None,
|
|
768
775
|
"radio" : {",,,":None, "f,bw,sf,cr":None},
|
|
769
776
|
"tx" : None,
|
|
777
|
+
"freq": None,
|
|
770
778
|
"tuning" : {",", "af,tx_d"},
|
|
771
779
|
"lat" : None,
|
|
772
780
|
"lon" : None,
|
|
@@ -801,6 +809,26 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
801
809
|
"path_hash_mode":{"0":None, "1":None, "2":None},
|
|
802
810
|
"path.hash.mode":{"0":None, "1":None, "2":None},
|
|
803
811
|
"default_scope": None,
|
|
812
|
+
"tz.offset": None,
|
|
813
|
+
"radio.rxgain": None,
|
|
814
|
+
"radio.fem.rxgain": None,
|
|
815
|
+
"radio.fem.txgain": None,
|
|
816
|
+
"dutycycle": None,
|
|
817
|
+
"int.thresh": None,
|
|
818
|
+
"cad": None,
|
|
819
|
+
"agc.reset.interval": None,
|
|
820
|
+
"multi.acks": None,
|
|
821
|
+
"pin": None,
|
|
822
|
+
"wifi.status": None,
|
|
823
|
+
"wifi.ssid": None,
|
|
824
|
+
"wifi.pwd": None,
|
|
825
|
+
"ui.show_clock": None,
|
|
826
|
+
"ui.auto_off_delay": None,
|
|
827
|
+
"ui.backlight_delay": None,
|
|
828
|
+
"ui.backlight_on_keys": None,
|
|
829
|
+
"ui.backlight_on_msgs": None,
|
|
830
|
+
"ui.auto_off_blank": None,
|
|
831
|
+
"ui.max_partial": None,
|
|
804
832
|
},
|
|
805
833
|
"get" : {"name":None,
|
|
806
834
|
"bat":None,
|
|
@@ -847,6 +875,26 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
847
875
|
"path_hash_mode":None,
|
|
848
876
|
"path.hash.mode":None,
|
|
849
877
|
"default_scope":None,
|
|
878
|
+
"tz.offset": None,
|
|
879
|
+
"radio.rxgain": None,
|
|
880
|
+
"radio.fem.rxgain": None,
|
|
881
|
+
"radio.fem.txgain": None,
|
|
882
|
+
"dutycycle": None,
|
|
883
|
+
"int.thresh": None,
|
|
884
|
+
"cad": None,
|
|
885
|
+
"agc.reset.interval": None,
|
|
886
|
+
"multi.acks": None,
|
|
887
|
+
"pin": None,
|
|
888
|
+
"wifi.status": None,
|
|
889
|
+
"wifi.ssid": None,
|
|
890
|
+
"wifi.pwd": None,
|
|
891
|
+
"ui.show_clock": None,
|
|
892
|
+
"ui.auto_off_delay": None,
|
|
893
|
+
"ui.backlight_delay": None,
|
|
894
|
+
"ui.backlight_on_keys": None,
|
|
895
|
+
"ui.backlight_on_msgs": None,
|
|
896
|
+
"ui.auto_off_blank": None,
|
|
897
|
+
"ui.max_partial": None,
|
|
850
898
|
},
|
|
851
899
|
"?get":None,
|
|
852
900
|
"?set":None,
|
|
@@ -2373,6 +2421,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
2373
2421
|
"""
|
|
2374
2422
|
global ARROW_HEAD, SLASH_START, SLASH_END, INVERT_SLASH, LAST_HANDLER_ID
|
|
2375
2423
|
global LC_DISPLAY_TYPES, LC_OUTPUT_FORMAT, LC_SORT_ORDER
|
|
2424
|
+
global LAST_DISCOVERED_NODES
|
|
2376
2425
|
output_str = ""
|
|
2377
2426
|
try :
|
|
2378
2427
|
argnum = 0
|
|
@@ -2767,7 +2816,8 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
2767
2816
|
vname = cmds[1]
|
|
2768
2817
|
res = await mc.commands.set_custom_var(vname, cmds[2])
|
|
2769
2818
|
if res.type == EventType.ERROR:
|
|
2770
|
-
|
|
2819
|
+
logger.debug(f"No config found by that {res}, trying to exec line as cli")
|
|
2820
|
+
return (None, output_str)
|
|
2771
2821
|
elif json_output :
|
|
2772
2822
|
output_str += json.dumps({"result" : "set", "var" : vname, "value" : cmds[2]})+end
|
|
2773
2823
|
else :
|
|
@@ -3084,10 +3134,8 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
3084
3134
|
vname = cmds[1]
|
|
3085
3135
|
val = res.payload[vname]
|
|
3086
3136
|
except KeyError:
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
else :
|
|
3090
|
-
output_str += f"Unknown var {cmds[1]}{end}"
|
|
3137
|
+
logger.debug(f"No config found by that name, trying to exec line as cli")
|
|
3138
|
+
return (None, output_str)
|
|
3091
3139
|
else:
|
|
3092
3140
|
if json_output :
|
|
3093
3141
|
output_str += json.dumps({"var" : vname, "value" : val})+end
|
|
@@ -3500,6 +3548,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
3500
3548
|
else:
|
|
3501
3549
|
exp_tag = res.payload["tag"].to_bytes(4, "little").hex()
|
|
3502
3550
|
dn = []
|
|
3551
|
+
LAST_DISCOVERED_NODES = []
|
|
3503
3552
|
while True:
|
|
3504
3553
|
r = await mc.wait_for_event(
|
|
3505
3554
|
EventType.DISCOVER_RESPONSE,
|
|
@@ -3509,7 +3558,12 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
3509
3558
|
if r is None or r.type == EventType.ERROR:
|
|
3510
3559
|
break
|
|
3511
3560
|
else:
|
|
3512
|
-
|
|
3561
|
+
n = r.payload
|
|
3562
|
+
dn.append(n)
|
|
3563
|
+
if len(n['pubkey']) == 64:
|
|
3564
|
+
contact = mc.get_contact_by_key_prefix(n['pubkey'])
|
|
3565
|
+
if contact is None:
|
|
3566
|
+
LAST_DISCOVERED_NODES.append(n)
|
|
3513
3567
|
|
|
3514
3568
|
if json_output:
|
|
3515
3569
|
output_str += json.dumps(dn)+end
|
|
@@ -3528,6 +3582,57 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
3528
3582
|
|
|
3529
3583
|
output_str += f" {name:28} {type:>4} SNR: {n['SNR_in']:6,.2f}->{n['SNR']:6,.2f} RSSI: ->{n['RSSI']:4}\n"
|
|
3530
3584
|
|
|
3585
|
+
case "list_discovered" :
|
|
3586
|
+
output_str += json.dumps(LAST_DISCOVERED_NODES, indent=4) + end
|
|
3587
|
+
|
|
3588
|
+
case "add_discovered" :
|
|
3589
|
+
name = None
|
|
3590
|
+
args = cmds[1:]
|
|
3591
|
+
add_all = False
|
|
3592
|
+
argnum = 1
|
|
3593
|
+
|
|
3594
|
+
while len(args) > 0 and args[0][0] == "-":
|
|
3595
|
+
if args[0].startswith('-n'): # name
|
|
3596
|
+
name = args[0][2:]
|
|
3597
|
+
|
|
3598
|
+
if args[0].startswith('-a'):
|
|
3599
|
+
add_all = True
|
|
3600
|
+
argnum = argnum - 1
|
|
3601
|
+
|
|
3602
|
+
argnum += 1
|
|
3603
|
+
args = args[1:]
|
|
3604
|
+
|
|
3605
|
+
if not add_all:
|
|
3606
|
+
prefix = args[0]
|
|
3607
|
+
nodes = 0
|
|
3608
|
+
jout = []
|
|
3609
|
+
for n in LAST_DISCOVERED_NODES[:]:
|
|
3610
|
+
if add_all or n['pubkey'].startswith(prefix):
|
|
3611
|
+
LAST_DISCOVERED_NODES.remove(n)
|
|
3612
|
+
if add_all or name is None:
|
|
3613
|
+
name = n['pubkey'][0:8]
|
|
3614
|
+
contact = {
|
|
3615
|
+
"public_key": n['pubkey'],
|
|
3616
|
+
"type" : n['node_type'],
|
|
3617
|
+
"flags" : 0,
|
|
3618
|
+
"out_path_len" : -1,
|
|
3619
|
+
"out_path" : "",
|
|
3620
|
+
"out_path_hash_mode" : 0,
|
|
3621
|
+
"adv_name" : name,
|
|
3622
|
+
"adv_lat" : 0,
|
|
3623
|
+
"adv_lon" : 0,
|
|
3624
|
+
"last_advert" : 0,
|
|
3625
|
+
}
|
|
3626
|
+
res = await mc.commands.update_contact(contact)
|
|
3627
|
+
logger.debug(res)
|
|
3628
|
+
if res.type == EventType.ERROR:
|
|
3629
|
+
output_str += f"Error adding contact: {res}\n"
|
|
3630
|
+
else :
|
|
3631
|
+
jout.append(json.dumps({'name':name, 'pubkey':n['pubkey'], 'type':n['node_type']}))
|
|
3632
|
+
|
|
3633
|
+
await mc.commands.get_contacts() # reload contacts
|
|
3634
|
+
output_str += json.dumps([json.loads(x) for x in jout]) + end
|
|
3635
|
+
|
|
3531
3636
|
case "req_regions"|"rr":
|
|
3532
3637
|
argnum = 1
|
|
3533
3638
|
await mc.ensure_contacts()
|
|
@@ -4603,6 +4708,8 @@ def command_help():
|
|
|
4603
4708
|
wmt8 : wait for a msg (reply) with a timeout ]
|
|
4604
4709
|
req_status <name> : requests status from a node rs
|
|
4605
4710
|
req_neighbours <name> : requests for neighbours in binary form rn
|
|
4711
|
+
node_discover : lauch a local node discovery
|
|
4712
|
+
add_discovered <key> : add a discovered node (repeater) to the list
|
|
4606
4713
|
trace <path> : run a trace, path is comma separated""")
|
|
4607
4714
|
|
|
4608
4715
|
def usage () :
|
|
@@ -4664,7 +4771,7 @@ def get_help_for (cmdname, context="line") :
|
|
|
4664
4771
|
at t=2 rp login
|
|
4665
4772
|
""")
|
|
4666
4773
|
|
|
4667
|
-
elif cmdname == "node_discover" or cmdname == "nd" :
|
|
4774
|
+
elif cmdname == "node_discover" or cmdname == "nd" or cmdname == "list_discovered" or cmdname == "add_discovered" :
|
|
4668
4775
|
print("""node_discover [-t<filter>] [-f] : discovers 0-hop nodes and displays signal info
|
|
4669
4776
|
|
|
4670
4777
|
`-t` asks for nodes regarding filter.
|
|
@@ -4677,6 +4784,15 @@ def get_help_for (cmdname, context="line") :
|
|
|
4677
4784
|
`-f` or `-full`: will ask for the full key of the node
|
|
4678
4785
|
|
|
4679
4786
|
BEWARE: filter option have changed since v1.6.4, using -t is now mandatory !!!
|
|
4787
|
+
|
|
4788
|
+
Once node_discover has been performed with -f (to get full key) you can add the node using `add_discovered` or list them with `list_discovered`. The discovered list is emptied at each node discovery.
|
|
4789
|
+
|
|
4790
|
+
add_discovered [-n<name>] [-a] <pubkey_prefix>
|
|
4791
|
+
|
|
4792
|
+
`-n`: to give a name to the node
|
|
4793
|
+
`-a`: will add all found nodes (won't use the provided name though)
|
|
4794
|
+
<pubkey_prefix>: to identify the node to add if `-a` has not been used
|
|
4795
|
+
|
|
4680
4796
|
""")
|
|
4681
4797
|
|
|
4682
4798
|
elif cmdname == "get" :
|
|
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
|