diff --git a/pyproject.toml b/pyproject.toml index 798629d..9a13da7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "meshcore-cli" -version = "1.1.17" +version = "1.1.18" authors = [ { name="Florent de Lamotte", email="florent@frizoncorrea.fr" }, ] diff --git a/src/meshcore_cli/meshcore_cli.py b/src/meshcore_cli/meshcore_cli.py index 2c47ae9..acd57db 100644 --- a/src/meshcore_cli/meshcore_cli.py +++ b/src/meshcore_cli/meshcore_cli.py @@ -8,7 +8,7 @@ import time, datetime import getopt, json, shlex, re import logging import requests -from bleak import BleakScanner +from bleak import BleakScanner, BleakClient import serial.tools.list_ports from pathlib import Path import traceback @@ -19,12 +19,11 @@ from prompt_toolkit.history import FileHistory from prompt_toolkit.formatted_text import ANSI from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.shortcuts import radiolist_dialog -from bleak import BleakClient from meshcore import MeshCore, EventType, logger # Version -VERSION = "v1.1.17" +VERSION = "v1.1.18" # default ble address is stored in a config file MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/" @@ -1567,7 +1566,7 @@ async def next_cmd(mc, cmds, json_output=False): inp = inp if inp != "" else "direct" print(f"Path for {contact['adv_name']}: out {outp}, in {inp}") - case "req_tele2" : + case "req_btele" : argnum = 1 await mc.ensure_contacts() contact = mc.get_contact_by_name(cmds[1]) @@ -1581,6 +1580,20 @@ async def next_cmd(mc, cmds, json_output=False): else : print(json.dumps(res)) + case "req_bstatus" : + argnum = 1 + await mc.ensure_contacts() + contact = mc.get_contact_by_name(cmds[1]) + timeout = 0 if not "timeout" in contact else contact["timeout"] + res = await mc.commands.req_status(contact, timeout) + if res is None : + if json_output : + print(json.dumps({"error" : "Getting data"})) + else: + print("Error getting data") + else : + print(json.dumps(res, indent=4)) + case "req_mma" | "rm": argnum = 3 await mc.ensure_contacts()