meshcore-cli 1.6.8__tar.gz → 1.6.9__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.8 → meshcore_cli-1.6.9}/PKG-INFO +1 -1
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/pyproject.toml +1 -1
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/src/meshcore_cli/meshcore_cli.py +43 -48
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/.github/funding.yml +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/.gitignore +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/LICENSE +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/README.md +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/flake.lock +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/flake.nix +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/scripts/README.md +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/scripts/ask_mepo_coords +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/scripts/contact_markers.sh +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/scripts/getpos.py +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/scripts/neighbour_map.sh +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/src/meshcore_cli/__init__.py +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/src/meshcore_cli/__main__.py +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/sxmo/sxmo_accel.sh +0 -0
- {meshcore_cli-1.6.8 → meshcore_cli-1.6.9}/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.9
|
|
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.9"
|
|
39
39
|
|
|
40
40
|
# default ble address is stored in a config file
|
|
41
41
|
MCCLI_CONFIG_DIR = os.path.expanduser("~/.config/meshcore/")
|
|
@@ -2238,62 +2238,57 @@ async def get_channel_by_name (mc, name):
|
|
|
2238
2238
|
|
|
2239
2239
|
return None
|
|
2240
2240
|
|
|
2241
|
-
async def get_contacts
|
|
2241
|
+
async def get_contacts(mc, anim=False, lastomod=0, timeout=5):
|
|
2242
2242
|
if mc._contacts:
|
|
2243
2243
|
return
|
|
2244
2244
|
|
|
2245
2245
|
if anim:
|
|
2246
2246
|
print("Fetching contacts ", end="", flush=True)
|
|
2247
2247
|
|
|
2248
|
-
|
|
2248
|
+
loop = asyncio.get_running_loop()
|
|
2249
|
+
result = loop.create_future()
|
|
2250
|
+
state = {"n": 0, "activity": False}
|
|
2249
2251
|
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
)
|
|
2256
|
-
futures.append(future)
|
|
2252
|
+
def on_next(event):
|
|
2253
|
+
state["n"] += 1
|
|
2254
|
+
state["activity"] = True
|
|
2255
|
+
if anim:
|
|
2256
|
+
print(".", end="", flush=True)
|
|
2257
2257
|
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
)
|
|
2258
|
+
def on_end(event):
|
|
2259
|
+
logger.debug(f"get_contacts: got {event.type}")
|
|
2260
|
+
if not result.done():
|
|
2261
|
+
result.set_result(event)
|
|
2263
2262
|
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
future = asyncio.create_task( # and recreate NEXT_CONTACT
|
|
2294
|
-
mc.wait_for_event(EventType.NEXT_CONTACT, {}, timeout)
|
|
2295
|
-
)
|
|
2296
|
-
futures.append(future)
|
|
2263
|
+
subs = [
|
|
2264
|
+
mc.subscribe(EventType.NEXT_CONTACT, on_next),
|
|
2265
|
+
mc.subscribe(EventType.CONTACTS, on_end),
|
|
2266
|
+
mc.subscribe(EventType.ERROR, on_end),
|
|
2267
|
+
]
|
|
2268
|
+
|
|
2269
|
+
try:
|
|
2270
|
+
await mc.commands.get_contacts_async()
|
|
2271
|
+
|
|
2272
|
+
while True:
|
|
2273
|
+
state["activity"] = False
|
|
2274
|
+
try:
|
|
2275
|
+
# shield so the timeout doesn't cancel the future itself
|
|
2276
|
+
event = await asyncio.wait_for(asyncio.shield(result), timeout)
|
|
2277
|
+
except asyncio.TimeoutError:
|
|
2278
|
+
if state["activity"]:
|
|
2279
|
+
continue # still receiving contacts, keep waiting
|
|
2280
|
+
logger.debug("Timeout while getting contacts")
|
|
2281
|
+
return None
|
|
2282
|
+
|
|
2283
|
+
if anim:
|
|
2284
|
+
if event.type == EventType.CONTACTS:
|
|
2285
|
+
print(max(len(event.payload) - state["n"], 0) * "." + " Done")
|
|
2286
|
+
else:
|
|
2287
|
+
print(" Error")
|
|
2288
|
+
return event
|
|
2289
|
+
finally:
|
|
2290
|
+
for s in subs:
|
|
2291
|
+
s.unsubscribe()
|
|
2297
2292
|
|
|
2298
2293
|
async def get_channels (mc, anim=False) :
|
|
2299
2294
|
if hasattr(mc, 'channels') :
|
|
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
|