meshcore-cli 1.6.5__tar.gz → 1.6.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: meshcore-cli
3
- Version: 1.6.5
3
+ Version: 1.6.6
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
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.10
13
13
  Requires-Dist: bleak>=0.22
14
- Requires-Dist: meshcore>=2.3.15
14
+ Requires-Dist: meshcore>=2.3.16
15
15
  Requires-Dist: prompt-toolkit>=3.0.50
16
16
  Requires-Dist: requests>=2.28.0
17
17
  Description-Content-Type: text/markdown
@@ -17,12 +17,12 @@
17
17
 
18
18
  meshcore = python3Packages.buildPythonPackage rec {
19
19
  pname = "meshcore";
20
- version = "2.3.15";
20
+ version = "2.3.16";
21
21
  pyproject = true;
22
22
 
23
23
  src = python3Packages.fetchPypi {
24
24
  inherit pname version;
25
- sha256 = "sha256-YIR8IdclmhOmi4kAgpYiO0N8Odauwten370gjYQ50FA=";
25
+ sha256 = "sha256-HU3D2oJKwtecMJHv7zGUjIuuk+hPfRBZQTMaSNamR9A=";
26
26
  };
27
27
 
28
28
  build-system = [ python3Packages.hatchling ];
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "meshcore-cli"
7
- version = "1.6.5"
7
+ version = "1.6.6"
8
8
  authors = [
9
9
  { name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
10
10
  ]
@@ -17,7 +17,7 @@ classifiers = [
17
17
  ]
18
18
  license = "MIT"
19
19
  license-files = ["LICEN[CS]E*"]
20
- dependencies = [ "meshcore >= 2.3.15",
20
+ dependencies = [ "meshcore >= 2.3.16",
21
21
  "bleak >= 0.22",
22
22
  "prompt_toolkit >= 3.0.50",
23
23
  "requests >= 2.28.0" ]
@@ -35,7 +35,7 @@ except ImportError:
35
35
  from meshcore import MeshCore, EventType, logger
36
36
 
37
37
  # Version
38
- VERSION = "v1.6.5"
38
+ VERSION = "v1.6.6"
39
39
 
40
40
  # default ble address is stored in a config file
41
41
  MCCLI_CONFIG_DIR = os.path.expanduser("~/.config/meshcore/")
@@ -3244,11 +3244,30 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
3244
3244
  output_str += json.dumps(res.payload, indent=4)+end
3245
3245
 
3246
3246
  case "chan_data" :
3247
- argnum = 3 # chan/datatype/payload (path will be an option -p...)
3248
- if cmds[1].isnumeric() :
3249
- nb = int(cmds[1])
3247
+ argnum = 3 # [-p path:hash_mode] chan datatype payload
3248
+ path_hash_mode = 0
3249
+ path = None
3250
+
3251
+ args = cmds[1:]
3252
+ while len(args) > 0 and args[0][0] == "-":
3253
+ arg = args[0]
3254
+
3255
+ if arg.startswith("-p"): # path comes as hex string with mode after `:`
3256
+ path_str = arg[2:]
3257
+ if ":" in path_str:
3258
+ path_hash_mode = int(path_str.split(":")[1])
3259
+ if path_str.split(":")[0] == "0": # 0-hop message
3260
+ path = bytes([])
3261
+ else:
3262
+ path = bytes.fromhex(path_str.split(":")[0])
3263
+
3264
+ argnum += 1
3265
+ args = args[1:] # next argument
3266
+
3267
+ if args[0].isnumeric() :
3268
+ nb = int(args[0])
3250
3269
  else:
3251
- chan = await get_channel_by_name(mc, cmds[1])
3270
+ chan = await get_channel_by_name(mc, args[0])
3252
3271
  if chan is None:
3253
3272
  nb = None
3254
3273
  else:
@@ -3257,7 +3276,8 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
3257
3276
  logger.error("Invalid channel")
3258
3277
  else:
3259
3278
  res = await mc.commands.send_channel_data(
3260
- nb, int(cmds[2]), bytes.fromhex(cmds[3]))
3279
+ nb, int(args[1],0), bytes.fromhex(args[2]),
3280
+ path = path, path_hash_mode = path_hash_mode)
3261
3281
  logger.debug(res)
3262
3282
  if res.type == EventType.ERROR:
3263
3283
  output_str += f"Error sending chan data: {res}{end}"
@@ -3439,32 +3459,41 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
3439
3459
  output_str += f"Path for {contact['adv_name']}: out {outp}, in {inp}{end}"
3440
3460
 
3441
3461
  case "node_discover"|"nd" :
3442
- argnum = 1
3462
+ argnum = 0
3463
+ types = 0xFF
3443
3464
  prefix_only = True
3465
+ filter_args = False
3444
3466
 
3445
- if len(cmds) == 1:
3446
- argnum = 0
3447
- types = 0xFF
3448
- else:
3449
- try: # try to decode type as int
3450
- types = int(cmds[1])
3451
- except ValueError:
3452
- if "all" in cmds[1]:
3453
- types = 0xFF
3454
- else :
3455
- types = 0
3456
- if "rep" in cmds[1] or "rpt" in cmds[1]:
3457
- types = types | 4
3458
- if "cli" in cmds[1] or "comp" in cmds[1]:
3459
- types = types | 2
3460
- if "room" in cmds[1]:
3461
- types = types | 8
3462
- if "sens" in cmds[1]:
3463
- types = types | 16
3464
-
3465
- if "full" in cmds[1]:
3467
+ args = cmds[1:]
3468
+ while len(args) > 0 and args[0][0] == "-": # Breaking change ...
3469
+
3470
+ if args[0].startswith('-f'): # -f or -full
3466
3471
  prefix_only = False
3467
3472
 
3473
+ if args[0].startswith('-t'): # same as before but with -t
3474
+ arg = args[0][2:]
3475
+ if not filter_args:
3476
+ filter_args = True
3477
+ types = 0
3478
+
3479
+ try: # try to decode type as int
3480
+ types = int(arg)
3481
+ except ValueError:
3482
+ if "all" in arg:
3483
+ types = 0xFF
3484
+ else :
3485
+ if "rep" in arg or "rpt" in arg:
3486
+ types = types | 4
3487
+ if "cli" in arg or "comp" in arg:
3488
+ types = types | 2
3489
+ if "room" in arg:
3490
+ types = types | 8
3491
+ if "sens" in arg:
3492
+ types = types | 16
3493
+
3494
+ argnum += 1
3495
+ args = args[1:]
3496
+
3468
3497
  res = await mc.commands.send_node_discover_req(types, prefix_only=prefix_only)
3469
3498
  if res is None or res.type == EventType.ERROR:
3470
3499
  output_str += "Error sending discover request" + end
@@ -4636,15 +4665,18 @@ def get_help_for (cmdname, context="line") :
4636
4665
  """)
4637
4666
 
4638
4667
  elif cmdname == "node_discover" or cmdname == "nd" :
4639
- print("""node_discover <filter> : discovers 0-hop nodes and displays signal info
4668
+ print("""node_discover [-t<filter>] [-f] : discovers 0-hop nodes and displays signal info
4640
4669
 
4641
- filter can be "all" for all types or nodes or a comma separated list consisting of :
4670
+ `-t` asks for nodes regarding filter.
4671
+ filter can be an integer value or "all" for all types or nodes or a comma separated list consisting of :
4642
4672
  - cli or comp for companions
4643
4673
  - rep for repeaters
4644
4674
  - sens for sensors
4645
4675
  - room for chat rooms
4646
4676
 
4647
- nd can be used with no filter parameter ... !!! BEWARE WITH CHAINING !!!
4677
+ `-f` or `-full`: will ask for the full key of the node
4678
+
4679
+ BEWARE: filter option have changed since v1.6.4, using -t is now mandatory !!!
4648
4680
  """)
4649
4681
 
4650
4682
  elif cmdname == "get" :
File without changes
File without changes
File without changes
File without changes