meshcore-cli 1.2.10__py3-none-any.whl → 1.2.11__py3-none-any.whl
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/meshcore_cli.py +25 -17
- {meshcore_cli-1.2.10.dist-info → meshcore_cli-1.2.11.dist-info}/METADATA +1 -1
- meshcore_cli-1.2.11.dist-info/RECORD +8 -0
- meshcore_cli-1.2.10.dist-info/RECORD +0 -8
- {meshcore_cli-1.2.10.dist-info → meshcore_cli-1.2.11.dist-info}/WHEEL +0 -0
- {meshcore_cli-1.2.10.dist-info → meshcore_cli-1.2.11.dist-info}/entry_points.txt +0 -0
- {meshcore_cli-1.2.10.dist-info → meshcore_cli-1.2.11.dist-info}/licenses/LICENSE +0 -0
meshcore_cli/meshcore_cli.py
CHANGED
|
@@ -24,7 +24,6 @@ from prompt_toolkit.key_binding import KeyBindings
|
|
|
24
24
|
from prompt_toolkit.shortcuts import radiolist_dialog
|
|
25
25
|
from prompt_toolkit.completion.word_completer import WordCompleter
|
|
26
26
|
from prompt_toolkit.document import Document
|
|
27
|
-
from hashlib import sha256
|
|
28
27
|
from Crypto.Cipher import AES
|
|
29
28
|
from Crypto.Hash import HMAC, SHA256
|
|
30
29
|
|
|
@@ -33,7 +32,7 @@ import re
|
|
|
33
32
|
from meshcore import MeshCore, EventType, logger
|
|
34
33
|
|
|
35
34
|
# Version
|
|
36
|
-
VERSION = "v1.2.
|
|
35
|
+
VERSION = "v1.2.11"
|
|
37
36
|
|
|
38
37
|
# default ble address is stored in a config file
|
|
39
38
|
MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/"
|
|
@@ -720,6 +719,7 @@ Line starting with \"$\" or \".\" will issue a meshcli command.
|
|
|
720
719
|
prev_contact = None
|
|
721
720
|
|
|
722
721
|
scope = await set_scope(mc, "*")
|
|
722
|
+
prev_scope = scope
|
|
723
723
|
|
|
724
724
|
await get_contacts(mc, anim=True)
|
|
725
725
|
await get_channels(mc, anim=True)
|
|
@@ -772,13 +772,14 @@ Line starting with \"$\" or \".\" will issue a meshcli command.
|
|
|
772
772
|
prompt = f"{ANSI_INVERT}"
|
|
773
773
|
|
|
774
774
|
if print_name or contact is None :
|
|
775
|
-
|
|
775
|
+
if color:
|
|
776
|
+
prompt = prompt + f"{ANSI_BGRAY}"
|
|
776
777
|
prompt = prompt + f"{mc.self_info['name']}"
|
|
777
778
|
if contact is None: # display scope
|
|
778
779
|
if not scope is None:
|
|
779
780
|
prompt = prompt + f"|{scope}"
|
|
780
781
|
if classic :
|
|
781
|
-
prompt = prompt + "
|
|
782
|
+
prompt = prompt + "> "
|
|
782
783
|
else :
|
|
783
784
|
prompt = prompt + f"{ANSI_NORMAL}{ARROW_HEAD}{ANSI_INVERT}"
|
|
784
785
|
|
|
@@ -816,7 +817,7 @@ Line starting with \"$\" or \".\" will issue a meshcli command.
|
|
|
816
817
|
prompt = prompt + "|" + contact["out_path"]
|
|
817
818
|
|
|
818
819
|
if classic :
|
|
819
|
-
prompt = prompt + f"{ANSI_NORMAL}
|
|
820
|
+
prompt = prompt + f"{ANSI_NORMAL}> "
|
|
820
821
|
else:
|
|
821
822
|
prompt = prompt + f"{ANSI_NORMAL}{ARROW_HEAD}"
|
|
822
823
|
|
|
@@ -937,7 +938,7 @@ Line starting with \"$\" or \".\" will issue a meshcli command.
|
|
|
937
938
|
nc["adv_name"] = mc.channels[dest]["channel_name"]
|
|
938
939
|
elif dest == ".." : # previous recipient
|
|
939
940
|
nc = prev_contact
|
|
940
|
-
if dest_scope is None and not
|
|
941
|
+
if dest_scope is None and not prev_scope is None:
|
|
941
942
|
dest_scope = prev_scope
|
|
942
943
|
elif dest == "~" or dest == "/" or dest == mc.self_info['name']:
|
|
943
944
|
nc = None
|
|
@@ -1442,7 +1443,7 @@ async def set_channel (mc, chan, name, key=None):
|
|
|
1442
1443
|
return None
|
|
1443
1444
|
|
|
1444
1445
|
info = res.payload
|
|
1445
|
-
info["channel_hash"] =
|
|
1446
|
+
info["channel_hash"] = SHA256.new(info["channel_secret"]).hexdigest()[0:2]
|
|
1446
1447
|
info["channel_secret"] = info["channel_secret"].hex()
|
|
1447
1448
|
|
|
1448
1449
|
if hasattr(mc,'channels') :
|
|
@@ -1531,7 +1532,7 @@ async def get_channels (mc, anim=False) :
|
|
|
1531
1532
|
if res.type == EventType.ERROR:
|
|
1532
1533
|
break
|
|
1533
1534
|
info = res.payload
|
|
1534
|
-
info["channel_hash"] =
|
|
1535
|
+
info["channel_hash"] = SHA256.new(info["channel_secret"]).hexdigest()[0:2]
|
|
1535
1536
|
info["channel_secret"] = info["channel_secret"].hex()
|
|
1536
1537
|
mc.channels.append(info)
|
|
1537
1538
|
ch = ch + 1
|
|
@@ -2339,7 +2340,8 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
2339
2340
|
if json_output:
|
|
2340
2341
|
print(json.dumps(ev.payload, indent=2))
|
|
2341
2342
|
else :
|
|
2342
|
-
|
|
2343
|
+
color = process_event_message.color
|
|
2344
|
+
classic = interactive_loop.classic or not color
|
|
2343
2345
|
print("]",end="")
|
|
2344
2346
|
for t in ev.payload["path"]:
|
|
2345
2347
|
if classic :
|
|
@@ -2347,18 +2349,20 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
2347
2349
|
else:
|
|
2348
2350
|
print(f" {ANSI_INVERT}", end="")
|
|
2349
2351
|
snr = t['snr']
|
|
2350
|
-
if
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2352
|
+
if color:
|
|
2353
|
+
if snr >= 10 :
|
|
2354
|
+
print(ANSI_BGREEN, end="")
|
|
2355
|
+
elif snr <= 0:
|
|
2356
|
+
print(ANSI_BRED, end="")
|
|
2357
|
+
else :
|
|
2358
|
+
print(ANSI_BGRAY, end="")
|
|
2356
2359
|
print(f"{snr:.2f}",end="")
|
|
2357
2360
|
if classic :
|
|
2358
2361
|
print("→",end="")
|
|
2359
2362
|
else :
|
|
2360
2363
|
print(f"{ANSI_NORMAL}{ARROW_HEAD}",end="")
|
|
2361
|
-
|
|
2364
|
+
if color:
|
|
2365
|
+
print(ANSI_END, end="")
|
|
2362
2366
|
if "hash" in t:
|
|
2363
2367
|
print(f"[{t['hash']}]",end="")
|
|
2364
2368
|
else:
|
|
@@ -3142,6 +3146,7 @@ def usage () :
|
|
|
3142
3146
|
-D : debug
|
|
3143
3147
|
-S : scan for devices and show a selector
|
|
3144
3148
|
-l : list available ble/serial devices and exit
|
|
3149
|
+
-c <on/off> : disables most of color output if off
|
|
3145
3150
|
-T <timeout> : timeout for the ble scan (-S and -l) default 2s
|
|
3146
3151
|
-a <address> : specifies device address (can be a name)
|
|
3147
3152
|
-d <name> : filter meshcore devices with name or address
|
|
@@ -3209,9 +3214,12 @@ async def main(argv):
|
|
|
3209
3214
|
with open(MCCLI_ADDRESS, encoding="utf-8") as f :
|
|
3210
3215
|
address = f.readline().strip()
|
|
3211
3216
|
|
|
3212
|
-
opts, args = getopt.getopt(argv, "a:d:s:ht:p:b:fjDhvSlT:
|
|
3217
|
+
opts, args = getopt.getopt(argv, "a:d:s:ht:p:b:fjDhvSlT:Pc:")
|
|
3213
3218
|
for opt, arg in opts :
|
|
3214
3219
|
match opt:
|
|
3220
|
+
case "-c" :
|
|
3221
|
+
if arg == "off":
|
|
3222
|
+
process_event_message.color = False
|
|
3215
3223
|
case "-d" : # name specified on cmdline
|
|
3216
3224
|
address = arg
|
|
3217
3225
|
case "-a" : # address specified on cmdline
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshcore-cli
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.11
|
|
4
4
|
Summary: Command line interface to meshcore companion radios
|
|
5
5
|
Project-URL: Homepage, https://github.com/fdlamotte/meshcore-cli
|
|
6
6
|
Project-URL: Issues, https://github.com/fdlamotte/meshcore-cli/issues
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
meshcore_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
meshcore_cli/__main__.py,sha256=PfYgibmu2LEtC-OV7L1UgmvV3swJ5rQ4bbXHlwUFlgE,83
|
|
3
|
+
meshcore_cli/meshcore_cli.py,sha256=3_pEZET6KLP327yh99zKmRx8a_sfgyx4mVLnT430HP4,142190
|
|
4
|
+
meshcore_cli-1.2.11.dist-info/METADATA,sha256=bQTAr3A4YUZ3igdHJD7SgQp3DAPnN20TIVUlD6IKLS0,11658
|
|
5
|
+
meshcore_cli-1.2.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
6
|
+
meshcore_cli-1.2.11.dist-info/entry_points.txt,sha256=77V29Pyth11GteDk7tneBN3MMk8JI7bTlS-BGSmxCmI,103
|
|
7
|
+
meshcore_cli-1.2.11.dist-info/licenses/LICENSE,sha256=F9s987VtS0AKxW7LdB2EkLMkrdeERI7ICdLJR60A9M4,1066
|
|
8
|
+
meshcore_cli-1.2.11.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
meshcore_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
meshcore_cli/__main__.py,sha256=PfYgibmu2LEtC-OV7L1UgmvV3swJ5rQ4bbXHlwUFlgE,83
|
|
3
|
-
meshcore_cli/meshcore_cli.py,sha256=IH0LlN7z14UgiUMGRhJmzp055d9AJ1jvEKV3CrXBfCA,141831
|
|
4
|
-
meshcore_cli-1.2.10.dist-info/METADATA,sha256=p4qn8oBD1_Hlegrk4Gw4pQwd3_2_Mt5yDtX6pWt41DI,11658
|
|
5
|
-
meshcore_cli-1.2.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
6
|
-
meshcore_cli-1.2.10.dist-info/entry_points.txt,sha256=77V29Pyth11GteDk7tneBN3MMk8JI7bTlS-BGSmxCmI,103
|
|
7
|
-
meshcore_cli-1.2.10.dist-info/licenses/LICENSE,sha256=F9s987VtS0AKxW7LdB2EkLMkrdeERI7ICdLJR60A9M4,1066
|
|
8
|
-
meshcore_cli-1.2.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|