From d67aaece28f245f4e4a674a136b1e899ce59ea1d Mon Sep 17 00:00:00 2001 From: Florent de Lamotte Date: Mon, 16 Jun 2025 09:54:44 +0200 Subject: [PATCH] update to path command and doc --- README.md | 28 +++++++++++++++++----------- src/meshcore_cli/meshcore_cli.py | 15 ++++++++++----- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index a1786ff..5ac5fd8 100644 --- a/README.md +++ b/README.md @@ -36,16 +36,18 @@ Arguments mostly deals with ble connection
     -h : prints this help
-    -j : json output
-    -D : print debug messages
-    -S : BLE device selector
-    -l : lists BLE devices
-    -a <address>    : specifies device address (can be a name)
-    -d <name>       : filter meshcore devices with name or address
-    -t <hostname>   : connects via tcp/ip
-    -p <port>       : specifies tcp port (default 5000)
-    -s <port>       : use serial port <port>
-    -b <baudrate>   : specify baudrate
+    -v : prints version
+    -j : json output (disables init file)
+    -D : debug
+    -S : performs a ble scan and ask for device
+    -l : list available ble devices and exit
+    -T <timeout>    : timeout for the ble scan (-S and -l) default 2s
+    -a <address>    : specifies device address (can be a name)
+    -d <name>       : filter meshcore devices with name or address
+    -t <hostname>   : connects via tcp/ip
+    -p <port>       : specifies tcp port (default 5000)
+    -s <port>       : use serial port <port>
+    -b <baudrate>   : specify baudrate
 
### Available Commands @@ -58,6 +60,7 @@ Commands are given after arguments, they can be chained and some have shortcuts. chat_to <ct> : enter chat with contact to script <filename> : execute commands in filename infos : print informations about the node i + self_telemetry : print own telemtry t card : export this node URI e ver : firmware version v reboot : reboots node @@ -72,6 +75,8 @@ Commands are given after arguments, they can be chained and some have shortcuts. wait_msg : wait for a message and read it wm sync_msgs : gets all unread msgs from the node sm msgs_subscribe : display msgs as they arrive ms + get_channel <n> : get info for channel n + set_channel n nm k : set channel info (nb, name, key) Management advert : sends advert a floodadv : flood advert @@ -80,13 +85,14 @@ Commands are given after arguments, they can be chained and some have shortcuts. time <epoch> : sets time to given epoch clock : get current time clock sync : sync device clock st - cli : send a cmd to node's cli (if avail) @ Contacts contacts / list : gets contact list lc + contact_info <ct> : prints information for contact ct ci share_contact <ct> : share a contact with others sc export_contact <ct> : get a contact's URI ec import_contact <URI> : import a contactt from its URI ic remove_contact <ct> : removes a contact from this node + path <ct> : diplays path for a contact reset_path <ct> : resets path to a contact to flood rp change_path <ct> <pth> : change the path to a contact cp change_flags <ct> <f> : change contact flags (tel_l|tel_a|star)cf diff --git a/src/meshcore_cli/meshcore_cli.py b/src/meshcore_cli/meshcore_cli.py index f2d176d..bd4a9a7 100644 --- a/src/meshcore_cli/meshcore_cli.py +++ b/src/meshcore_cli/meshcore_cli.py @@ -1228,15 +1228,19 @@ async def next_cmd(mc, cmds, json_output=False): else: print(f"Unknown contact {cmds[1]}") else: - res = contact["out_path"] + path = contact["out_path"] + path_len = contact["out_path_len"] if json_output : print(json.dumps({"adv_name" : contact["adv_name"], - "out_path" : res})) + "out_path_len" : path_len, + "out_path" : path})) else: - if (res == "") : + if (path_len == 0) : print("0 hop") + elif (path_len == -1) : + print("Path not set") else: - print(res) + print(path) case "contact_info" | "ci": argnum = 1 @@ -1617,13 +1621,14 @@ def command_help(): time : sets time to given epoch clock : get current time clock sync : sync device clock st - cli : send a cmd to node's cli (if avail) @ Contacts contacts / list : gets contact list lc + contact_info : prints information for contact ct ci share_contact : share a contact with others sc export_contact : get a contact's URI ec import_contact : import a contactt from its URI ic remove_contact : removes a contact from this node + path : diplays path for a contact reset_path : resets path to a contact to flood rp change_path : change the path to a contact cp change_flags : change contact flags (tel_l|tel_a|star)cf