|
22 | 22 | from meshcore import MeshCore, EventType, logger |
23 | 23 |
|
24 | 24 | # Version |
25 | | -VERSION = "v1.0.0rc2" |
| 25 | +VERSION = "v0.8.2" |
26 | 26 |
|
27 | 27 | # default ble address is stored in a config file |
28 | 28 | MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/" |
@@ -238,6 +238,7 @@ def make_completion_dict(contacts, to=None): |
238 | 238 | "path": contact_list, |
239 | 239 | "reset_path" : contact_list, |
240 | 240 | "change_path" : contact_list, |
| 241 | + "change_flags" : contact_list, |
241 | 242 | "remove_contact" : contact_list, |
242 | 243 | "import_contact" : {"meshcore://":None}, |
243 | 244 | "login" : contact_list, |
@@ -296,6 +297,7 @@ def make_completion_dict(contacts, to=None): |
296 | 297 | "upload_contact" : None, |
297 | 298 | "reset_path" : None, |
298 | 299 | "change_path" : None, |
| 300 | + "change_flags" : None, |
299 | 301 | "req_telemetry" : None, |
300 | 302 | }) |
301 | 303 |
|
@@ -550,6 +552,7 @@ def _(event): |
550 | 552 | # same but for commands with a parameter |
551 | 553 | elif contact["type"] > 0 and (line.startswith("cmd ") or\ |
552 | 554 | line.startswith("cp ") or line.startswith("change_path ") or\ |
| 555 | + line.startswith("cf ") or line.startswith("change_flags ") or\ |
553 | 556 | line.startswith("login ")) : |
554 | 557 | cmds = line.split(" ", 1) |
555 | 558 | args = [cmds[0], contact['adv_name'], cmds[1]] |
@@ -1209,6 +1212,24 @@ async def next_cmd(mc, cmds, json_output=False): |
1209 | 1212 | print(json.dumps(res.payload, indent=4)) |
1210 | 1213 | await mc.commands.get_contacts() |
1211 | 1214 |
|
| 1215 | + case "change_flags" | "cf": |
| 1216 | + argnum = 2 |
| 1217 | + await mc.ensure_contacts() |
| 1218 | + contact = mc.get_contact_by_name(cmds[1]) |
| 1219 | + if contact is None: |
| 1220 | + if json_output : |
| 1221 | + print(json.dumps({"error" : "contact unknown", "name" : cmds[1]})) |
| 1222 | + else: |
| 1223 | + print(f"Unknown contact {cmds[1]}") |
| 1224 | + else: |
| 1225 | + res = await mc.commands.change_contact_flags(contact, int(cmds[2])) |
| 1226 | + logger.debug(res) |
| 1227 | + if res.type == EventType.ERROR: |
| 1228 | + print(f"Error setting path: {res}") |
| 1229 | + elif json_output : |
| 1230 | + print(json.dumps(res.payload, indent=4)) |
| 1231 | + await mc.commands.get_contacts() |
| 1232 | + |
1212 | 1233 | case "reset_path" | "rp" : |
1213 | 1234 | argnum = 1 |
1214 | 1235 | await mc.ensure_contacts() |
@@ -1546,6 +1567,7 @@ def command_help(): |
1546 | 1567 | remove_contact <ct> : removes a contact from this node |
1547 | 1568 | reset_path <ct> : resets path to a contact to flood rp |
1548 | 1569 | change_path <ct> <pth> : change the path to a contact cp |
| 1570 | + change_flags <ct> <f> : change contact flags (tel_l|tel_a|star)cf |
1549 | 1571 | req_telemetry <ct> : prints telemetry data as json rt |
1550 | 1572 | Repeaters |
1551 | 1573 | login <name> <pwd> : log into a node (rep) with given pwd l |
|
0 commit comments