meshcore-cli 1.6.8__tar.gz → 1.6.10__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.8
3
+ Version: 1.6.10
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 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "meshcore-cli"
7
- version = "1.6.8"
7
+ version = "1.6.10"
8
8
  authors = [
9
9
  { name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
10
10
  ]
@@ -35,7 +35,7 @@ except ImportError:
35
35
  from meshcore import MeshCore, EventType, logger
36
36
 
37
37
  # Version
38
- VERSION = "v1.6.8"
38
+ VERSION = "v1.6.10"
39
39
 
40
40
  # default ble address is stored in a config file
41
41
  MCCLI_CONFIG_DIR = os.path.expanduser("~/.config/meshcore/")
@@ -769,6 +769,8 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
769
769
  "at": None,
770
770
  "scope": None,
771
771
  "send_raw": None,
772
+ "gps" : {"on":None,"off":None,"sync":None,"once":None,"diag":None,"fix":None,"fix_stats":None,"period":None,
773
+ },
772
774
  "set" : {
773
775
  "name" : None,
774
776
  "pin" : None,
@@ -829,6 +831,8 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
829
831
  "ui.backlight_on_msgs": None,
830
832
  "ui.auto_off_blank": None,
831
833
  "ui.max_partial": None,
834
+ "ui.nd_name": None,
835
+ "ui.gps_action": {"toggle":None, "once":None,},
832
836
  },
833
837
  "get" : {"name":None,
834
838
  "bat":None,
@@ -974,7 +978,8 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
974
978
  "req_clock" :None,
975
979
  "setperm":contact_list,
976
980
  "region" : {"get":None, "allowf": None, "denyf": None, "put": None, "remove": None, "save": None, "home": None},
977
- "gps" : {"on":None,"off":None,"sync":None,"setloc":None,
981
+ "gps" : {"on":None,"off":None,"sync":None,"once":None,"diag":None,"fix":None,"fix_stats":None,"period":None,
982
+ "setloc":None,
978
983
  "advert" : {"none": None, "share": None, "prefs": None},
979
984
  },
980
985
  "powersaving" : {"on":None,"off":None},
@@ -990,6 +995,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
990
995
  "flood.advert.interval" : None,
991
996
  "flood.max":None,
992
997
  "advert.interval" : None,
998
+ "advert.loc" : None,
993
999
  "guest.password" : None,
994
1000
  "owner.info":None,
995
1001
  "rxdelay": None,
@@ -1019,6 +1025,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
1019
1025
  "flood.advert.interval" : None,
1020
1026
  "flood.max" : None,
1021
1027
  "advert.interval" : None,
1028
+ "advert.loc" : {"none": None, "shared": None, "prefs": None},
1022
1029
  "guest.password" : None,
1023
1030
  "owner.info":None,
1024
1031
  "allow.read.only" : {"on": None, "off": None},
@@ -2238,62 +2245,57 @@ async def get_channel_by_name (mc, name):
2238
2245
 
2239
2246
  return None
2240
2247
 
2241
- async def get_contacts (mc, anim=False, lastomod=0, timeout=5) :
2248
+ async def get_contacts(mc, anim=False, lastomod=0, timeout=5):
2242
2249
  if mc._contacts:
2243
2250
  return
2244
2251
 
2245
2252
  if anim:
2246
2253
  print("Fetching contacts ", end="", flush=True)
2247
2254
 
2248
- await mc.commands.get_contacts_async()
2255
+ loop = asyncio.get_running_loop()
2256
+ result = loop.create_future()
2257
+ state = {"n": 0, "activity": False}
2249
2258
 
2250
- futures = []
2251
- contact_nb = 0
2252
- for event_type in [EventType.ERROR, EventType.NEXT_CONTACT, EventType.CONTACTS] :
2253
- future = asyncio.create_task(
2254
- mc.wait_for_event(event_type, {}, timeout=timeout)
2255
- )
2256
- futures.append(future)
2259
+ def on_next(event):
2260
+ state["n"] += 1
2261
+ state["activity"] = True
2262
+ if anim:
2263
+ print(".", end="", flush=True)
2257
2264
 
2258
- while True:
2259
- # Wait for the first event to complete or all to timeout
2260
- done, pending = await asyncio.wait(
2261
- futures, timeout=timeout, return_when=asyncio.FIRST_COMPLETED
2262
- )
2265
+ def on_end(event):
2266
+ logger.debug(f"get_contacts: got {event.type}")
2267
+ if not result.done():
2268
+ result.set_result(event)
2263
2269
 
2264
- # Check if any future completed successfully
2265
- if len(done) == 0:
2266
- logger.debug("Timeout while getting contacts")
2267
- for future in pending: # cancel all futures
2268
- future.cancel()
2269
- return None
2270
-
2271
- for future in done:
2272
- event = await future
2273
-
2274
- if event:
2275
- if event.type == EventType.NEXT_CONTACT:
2276
- if anim:
2277
- contact_nb = contact_nb+1
2278
- print(".", end="", flush=True)
2279
- else: # Done or Error ... cancel pending and return
2280
- if anim:
2281
- if event.type == EventType.CONTACTS:
2282
- print ((len(event.payload)-contact_nb)*"." + " Done")
2283
- else :
2284
- print(" Error")
2285
- for future in pending:
2286
- future.cancel()
2287
- return event
2270
+ subs = [
2271
+ mc.subscribe(EventType.NEXT_CONTACT, on_next),
2272
+ mc.subscribe(EventType.CONTACTS, on_end),
2273
+ mc.subscribe(EventType.ERROR, on_end),
2274
+ ]
2288
2275
 
2289
- futures = []
2290
- for future in pending: # put back pending
2291
- futures.append(future)
2276
+ try:
2277
+ await mc.commands.get_contacts_async()
2292
2278
 
2293
- future = asyncio.create_task( # and recreate NEXT_CONTACT
2294
- mc.wait_for_event(EventType.NEXT_CONTACT, {}, timeout)
2295
- )
2296
- futures.append(future)
2279
+ while True:
2280
+ state["activity"] = False
2281
+ try:
2282
+ # shield so the timeout doesn't cancel the future itself
2283
+ event = await asyncio.wait_for(asyncio.shield(result), timeout)
2284
+ except asyncio.TimeoutError:
2285
+ if state["activity"]:
2286
+ continue # still receiving contacts, keep waiting
2287
+ logger.debug("Timeout while getting contacts")
2288
+ return None
2289
+
2290
+ if anim:
2291
+ if event.type == EventType.CONTACTS:
2292
+ print(max(len(event.payload) - state["n"], 0) * "." + " Done")
2293
+ else:
2294
+ print(" Error")
2295
+ return event
2296
+ finally:
2297
+ for s in subs:
2298
+ s.unsubscribe()
2297
2299
 
2298
2300
  async def get_channels (mc, anim=False) :
2299
2301
  if hasattr(mc, 'channels') :
@@ -2758,7 +2760,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
2758
2760
  auc = (cmds[2] == "on") or (cmds[2] == "true") or (cmds[2] == "yes") or (cmds[2] == "1")
2759
2761
  mc.auto_update_contacts=auc
2760
2762
  case "telemetry_mode_base":
2761
- if (cmds[2] == "2") or (cmds[2] == "all") or (cmds[2] == "yes") or (cmds[2] == "on") :
2763
+ if (cmds[2] == "2") or (cmds[2].startswith("al")) or (cmds[2] == "yes") or (cmds[2] == "on") :
2762
2764
  mode = 2
2763
2765
  elif (cmds[2] == "1") or (cmds[2] == "selected") or (cmds[2] == "dev") :
2764
2766
  mode = 1
@@ -5519,8 +5521,8 @@ async def main(argv):
5519
5521
  first_device = False
5520
5522
  quiet = False
5521
5523
  force_interactive = False
5522
- serial_dtr = True
5523
- serial_rts = False
5524
+ serial_dtr = None
5525
+ serial_rts = None
5524
5526
 
5525
5527
  # basic logger configuration (was removed from meshcore_py)
5526
5528
  logging.basicConfig(level=logging.INFO)
File without changes
File without changes
File without changes
File without changes
File without changes