meshcore-cli 1.6.0__tar.gz → 1.6.2__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.0 → meshcore_cli-1.6.2}/PKG-INFO +4 -2
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/README.md +2 -0
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/flake.nix +2 -2
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/pyproject.toml +2 -2
- meshcore_cli-1.6.2/scripts/getpos.py +144 -0
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/src/meshcore_cli/meshcore_cli.py +127 -42
- meshcore_cli-1.6.0/REPEATER_COMMANDS.md +0 -292
- meshcore_cli-1.6.0/scripts/getpos.py +0 -20
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/.github/funding.yml +0 -0
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/.gitignore +0 -0
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/LICENSE +0 -0
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/flake.lock +0 -0
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/scripts/README.md +0 -0
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/scripts/ask_mepo_coords +0 -0
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/scripts/contact_markers.sh +0 -0
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/scripts/neighbour_map.sh +0 -0
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/src/meshcore_cli/__init__.py +0 -0
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/src/meshcore_cli/__main__.py +0 -0
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/sxmo/sxmo_accel.sh +0 -0
- {meshcore_cli-1.6.0 → meshcore_cli-1.6.2}/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.2
|
|
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
|
|
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Requires-Python: >=3.10
|
|
13
13
|
Requires-Dist: bleak>=0.22
|
|
14
|
-
Requires-Dist: meshcore>=2.3.
|
|
14
|
+
Requires-Dist: meshcore>=2.3.9
|
|
15
15
|
Requires-Dist: prompt-toolkit>=3.0.50
|
|
16
16
|
Requires-Dist: requests>=2.28.0
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
@@ -136,6 +136,8 @@ Commands are given after arguments, they can be chained and some have shortcuts.
|
|
|
136
136
|
clock : get current time
|
|
137
137
|
clock sync : sync device clock st
|
|
138
138
|
node_discover <filter> : discovers nodes based on their type nd
|
|
139
|
+
cli <cmd> : executes cli command cmd
|
|
140
|
+
send_raw <pkt> : sends a raw packet (hex string)
|
|
139
141
|
Contacts
|
|
140
142
|
contacts / list : gets contact list lc
|
|
141
143
|
reload_contacts : force reloading all contacts rc
|
|
@@ -118,6 +118,8 @@ Commands are given after arguments, they can be chained and some have shortcuts.
|
|
|
118
118
|
clock : get current time
|
|
119
119
|
clock sync : sync device clock st
|
|
120
120
|
node_discover <filter> : discovers nodes based on their type nd
|
|
121
|
+
cli <cmd> : executes cli command cmd
|
|
122
|
+
send_raw <pkt> : sends a raw packet (hex string)
|
|
121
123
|
Contacts
|
|
122
124
|
contacts / list : gets contact list lc
|
|
123
125
|
reload_contacts : force reloading all contacts rc
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
meshcore = python3Packages.buildPythonPackage rec {
|
|
19
19
|
pname = "meshcore";
|
|
20
|
-
version = "2.3.
|
|
20
|
+
version = "2.3.9";
|
|
21
21
|
pyproject = true;
|
|
22
22
|
|
|
23
23
|
src = python3Packages.fetchPypi {
|
|
24
24
|
inherit pname version;
|
|
25
|
-
sha256 = "sha256-
|
|
25
|
+
sha256 = "sha256-sX0ozXspS6kGKp46RseoYdpBgQ8dfCBXBgO9GO3aXr0=";
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
build-system = [ python3Packages.hatchling ];
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "meshcore-cli"
|
|
7
|
-
version = "1.6.
|
|
7
|
+
version = "1.6.2"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
|
|
10
10
|
]
|
|
@@ -17,7 +17,7 @@ classifiers = [
|
|
|
17
17
|
]
|
|
18
18
|
license = "MIT"
|
|
19
19
|
license-files = ["LICEN[CS]E*"]
|
|
20
|
-
dependencies = [ "meshcore >= 2.3.
|
|
20
|
+
dependencies = [ "meshcore >= 2.3.9",
|
|
21
21
|
"bleak >= 0.22",
|
|
22
22
|
"prompt_toolkit >= 3.0.50",
|
|
23
23
|
"requests >= 2.28.0" ]
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Get the current position (latitude, longitude, accuracy/precision) via GeoClue2.
|
|
4
|
+
|
|
5
|
+
Requirements:
|
|
6
|
+
sudo apt install gir1.2-geoclue-2.0 python3-gi
|
|
7
|
+
GeoClue2 daemon (package "geoclue-2.0") must be installed and running.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import json
|
|
12
|
+
import sys
|
|
13
|
+
|
|
14
|
+
import gi
|
|
15
|
+
gi.require_version("Geoclue", "2.0")
|
|
16
|
+
from gi.repository import GLib, Geoclue
|
|
17
|
+
|
|
18
|
+
def get_current_position(app_id="my-python-app",
|
|
19
|
+
accuracy_level=Geoclue.AccuracyLevel.EXACT,
|
|
20
|
+
timeout_seconds=15,
|
|
21
|
+
max_accuracy_meters=None,
|
|
22
|
+
on_update=None):
|
|
23
|
+
loop = GLib.MainLoop()
|
|
24
|
+
result = {}
|
|
25
|
+
error_holder = {}
|
|
26
|
+
simple_holder = {}
|
|
27
|
+
|
|
28
|
+
def meets_threshold(location):
|
|
29
|
+
if max_accuracy_meters is None:
|
|
30
|
+
return True
|
|
31
|
+
accuracy = location.get_property("accuracy")
|
|
32
|
+
return accuracy is not None and accuracy <= max_accuracy_meters
|
|
33
|
+
|
|
34
|
+
def capture(location):
|
|
35
|
+
result["latitude"] = location.get_property("latitude")
|
|
36
|
+
result["longitude"] = location.get_property("longitude")
|
|
37
|
+
result["accuracy"] = location.get_property("accuracy")
|
|
38
|
+
if on_update is not None:
|
|
39
|
+
on_update(dict(result))
|
|
40
|
+
|
|
41
|
+
def on_location_notify(simple, param):
|
|
42
|
+
location = simple.get_location()
|
|
43
|
+
if location is None:
|
|
44
|
+
return
|
|
45
|
+
capture(location)
|
|
46
|
+
if meets_threshold(location):
|
|
47
|
+
loop.quit()
|
|
48
|
+
|
|
49
|
+
def on_client_ready(source, res, user_data=None):
|
|
50
|
+
try:
|
|
51
|
+
simple = Geoclue.Simple.new_finish(res)
|
|
52
|
+
except GLib.Error as e:
|
|
53
|
+
error_holder["error"] = e
|
|
54
|
+
loop.quit()
|
|
55
|
+
return
|
|
56
|
+
|
|
57
|
+
simple_holder["simple"] = simple
|
|
58
|
+
|
|
59
|
+
location = simple.get_location()
|
|
60
|
+
if location is not None:
|
|
61
|
+
capture(location)
|
|
62
|
+
if meets_threshold(location):
|
|
63
|
+
loop.quit()
|
|
64
|
+
return
|
|
65
|
+
|
|
66
|
+
simple.connect("notify::location", on_location_notify)
|
|
67
|
+
|
|
68
|
+
def on_timeout():
|
|
69
|
+
if "latitude" not in result:
|
|
70
|
+
error_holder["error"] = TimeoutError(
|
|
71
|
+
f"No location fix received within {timeout_seconds}s"
|
|
72
|
+
)
|
|
73
|
+
loop.quit()
|
|
74
|
+
return False
|
|
75
|
+
|
|
76
|
+
GLib.timeout_add_seconds(timeout_seconds, on_timeout)
|
|
77
|
+
|
|
78
|
+
Geoclue.Simple.new(app_id, accuracy_level, None, on_client_ready)
|
|
79
|
+
|
|
80
|
+
loop.run()
|
|
81
|
+
|
|
82
|
+
if "error" in error_holder:
|
|
83
|
+
raise error_holder["error"]
|
|
84
|
+
|
|
85
|
+
return result
|
|
86
|
+
|
|
87
|
+
def parse_args():
|
|
88
|
+
parser = argparse.ArgumentParser(
|
|
89
|
+
description="Get the current position via GeoClue2."
|
|
90
|
+
)
|
|
91
|
+
parser.add_argument(
|
|
92
|
+
"-t", "--timeout",
|
|
93
|
+
type=float,
|
|
94
|
+
default=15,
|
|
95
|
+
metavar="SECONDS",
|
|
96
|
+
help="max time to wait for a location fix (default: 15)",
|
|
97
|
+
)
|
|
98
|
+
parser.add_argument(
|
|
99
|
+
"-a", "--accuracy",
|
|
100
|
+
type=float,
|
|
101
|
+
default=600,
|
|
102
|
+
metavar="METERS",
|
|
103
|
+
help=("keep waiting for fixes until accuracy is reached"),
|
|
104
|
+
)
|
|
105
|
+
parser.add_argument(
|
|
106
|
+
"-v", "--verbose",
|
|
107
|
+
action="store_true",
|
|
108
|
+
help="print every position fix as it's acquired, not just the final one",
|
|
109
|
+
)
|
|
110
|
+
parser.add_argument(
|
|
111
|
+
"-vo", "--verbose-stdout",
|
|
112
|
+
action="store_true",
|
|
113
|
+
help=("print intermediate positions to stdout"),
|
|
114
|
+
)
|
|
115
|
+
return parser.parse_args()
|
|
116
|
+
|
|
117
|
+
def main():
|
|
118
|
+
args = parse_args()
|
|
119
|
+
if args.verbose_stdout:
|
|
120
|
+
args.verbose = True
|
|
121
|
+
|
|
122
|
+
def print_update(fix):
|
|
123
|
+
stream = sys.stdout if args.verbose_stdout else sys.stderr
|
|
124
|
+
print(json.dumps(fix), file=stream)
|
|
125
|
+
|
|
126
|
+
try:
|
|
127
|
+
loc = get_current_position(
|
|
128
|
+
accuracy_level=Geoclue.AccuracyLevel.EXACT,
|
|
129
|
+
timeout_seconds=args.timeout,
|
|
130
|
+
max_accuracy_meters=args.accuracy,
|
|
131
|
+
on_update=print_update if args.verbose else None,
|
|
132
|
+
)
|
|
133
|
+
except Exception as e:
|
|
134
|
+
print(f"Failed to get location: {e}", file=sys.stderr)
|
|
135
|
+
sys.exit(1)
|
|
136
|
+
|
|
137
|
+
print(json.dumps({
|
|
138
|
+
"lat": loc["latitude"],
|
|
139
|
+
"lon": loc["longitude"],
|
|
140
|
+
"accuracy": loc["accuracy"],
|
|
141
|
+
}))
|
|
142
|
+
|
|
143
|
+
if __name__ == "__main__":
|
|
144
|
+
main()
|
|
@@ -34,13 +34,23 @@ except ImportError:
|
|
|
34
34
|
from meshcore import MeshCore, EventType, logger
|
|
35
35
|
|
|
36
36
|
# Version
|
|
37
|
-
VERSION = "v1.6.
|
|
37
|
+
VERSION = "v1.6.2"
|
|
38
38
|
|
|
39
39
|
# default ble address is stored in a config file
|
|
40
40
|
MCCLI_CONFIG_DIR = os.path.expanduser("~/.config/meshcore/")
|
|
41
41
|
MCCLI_ADDRESS = MCCLI_CONFIG_DIR + "default_address"
|
|
42
42
|
MCCLI_HISTORY_FILE = MCCLI_CONFIG_DIR + "history"
|
|
43
43
|
MCCLI_INIT_SCRIPT = MCCLI_CONFIG_DIR + "init"
|
|
44
|
+
MCCLI_SCOPES_FILE = MCCLI_CONFIG_DIR + "scopes"
|
|
45
|
+
|
|
46
|
+
# Per channel scope overrides, one "<channel name> <scope>" per line.
|
|
47
|
+
SCOPES = {}
|
|
48
|
+
if os.path.exists(MCCLI_SCOPES_FILE) :
|
|
49
|
+
with open(MCCLI_SCOPES_FILE, "r") as lines:
|
|
50
|
+
for line in lines:
|
|
51
|
+
line = line.strip()
|
|
52
|
+
channel, scope = line.split()
|
|
53
|
+
SCOPES[channel] = scope
|
|
44
54
|
|
|
45
55
|
PAYLOAD_TYPENAMES = ["REQ", "RESPONSE", "TEXT_MSG", "ACK", "ADVERT", "GRP_TXT", "GRP_DATA", "ANON_REQ", "PATH", "TRACE", "MULTIPART", "CONTROL"]
|
|
46
56
|
ROUTE_TYPENAMES = ["TC_FLOOD", "FLOOD", "DIRECT", "TC_DIRECT"]
|
|
@@ -104,6 +114,9 @@ HANDLERS = { # dicts that will be indexed by numbers
|
|
|
104
114
|
LAST_HANDLER_ID = 0
|
|
105
115
|
HANDLER_QUEUE_SIZE = 100
|
|
106
116
|
|
|
117
|
+
# is the companion supposed to have cli
|
|
118
|
+
HAS_CLI_CMD = False
|
|
119
|
+
|
|
107
120
|
def enqueue_handler_event(handler_type, payload):
|
|
108
121
|
message = json.dumps(payload) + "\n"
|
|
109
122
|
for handler in HANDLERS[handler_type].values():
|
|
@@ -150,6 +163,29 @@ def split_first_token(line):
|
|
|
150
163
|
|
|
151
164
|
return target, command
|
|
152
165
|
|
|
166
|
+
def strip_outer_quotes(text):
|
|
167
|
+
if len(text) >= 2 and text[0] in ("'", '"') and text[-1] == text[0]:
|
|
168
|
+
return text[1:-1]
|
|
169
|
+
return text
|
|
170
|
+
|
|
171
|
+
def split_pipeline(pipeline):
|
|
172
|
+
lines, buf, quote = [], [], None
|
|
173
|
+
for c in pipeline:
|
|
174
|
+
if quote:
|
|
175
|
+
buf.append(c)
|
|
176
|
+
if c == quote:
|
|
177
|
+
quote = None
|
|
178
|
+
elif c in ('"', "'"):
|
|
179
|
+
quote = c
|
|
180
|
+
buf.append(c)
|
|
181
|
+
elif c == "|":
|
|
182
|
+
lines.append("".join(buf).strip())
|
|
183
|
+
buf = []
|
|
184
|
+
else:
|
|
185
|
+
buf.append(c)
|
|
186
|
+
lines.append("".join(buf).strip())
|
|
187
|
+
return lines
|
|
188
|
+
|
|
153
189
|
def escape_ansi(line):
|
|
154
190
|
ansi_escape = re.compile(r'(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]')
|
|
155
191
|
return ansi_escape.sub('', line)
|
|
@@ -481,7 +517,7 @@ class MyNestedCompleter(NestedCompleter):
|
|
|
481
517
|
opts = self.options.keys()
|
|
482
518
|
completer = WordCompleter(
|
|
483
519
|
opts, ignore_case=self.ignore_case,
|
|
484
|
-
pattern=re.compile(r"([a-zA-Z0-9_
|
|
520
|
+
pattern=re.compile(r"([a-zA-Z0-9_\\/\#\?@]+|[^a-zA-Z0-9_\s\#\?@]+)"))
|
|
485
521
|
yield from completer.get_completions(document, complete_event)
|
|
486
522
|
else: # normal behavior for remainder
|
|
487
523
|
yield from super().get_completions(document, complete_event)
|
|
@@ -533,6 +569,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
533
569
|
"infos" : None,
|
|
534
570
|
"advert" : None,
|
|
535
571
|
"floodadv" : None,
|
|
572
|
+
"cli" : None,
|
|
536
573
|
"msg" : contact_list,
|
|
537
574
|
"wait_ack" : None,
|
|
538
575
|
"time" : None,
|
|
@@ -585,7 +622,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
585
622
|
"apply_to": None,
|
|
586
623
|
"at": None,
|
|
587
624
|
"scope": None,
|
|
588
|
-
"
|
|
625
|
+
"send_raw": None,
|
|
589
626
|
"set" : {
|
|
590
627
|
"name" : None,
|
|
591
628
|
"pin" : None,
|
|
@@ -1176,8 +1213,7 @@ async def process_redirected_line(mc, line, contact=None, scope="*", prev_contac
|
|
|
1176
1213
|
|
|
1177
1214
|
async def process_pipeline(mc, pipeline, contact=None, scope="*", prev_contact=None, prev_scope="*", json_output=False, sink=sys.stdout, end="\n"):
|
|
1178
1215
|
|
|
1179
|
-
|
|
1180
|
-
lines = [match.group(0).strip() for match in re.finditer(pattern, pipeline)]
|
|
1216
|
+
lines = split_pipeline(pipeline)
|
|
1181
1217
|
|
|
1182
1218
|
last_ack = True
|
|
1183
1219
|
for line in lines:
|
|
@@ -1202,7 +1238,9 @@ async def process_line(mc, line, contact=None, scope="*", prev_contact=None, pre
|
|
|
1202
1238
|
if line.startswith("$$") :
|
|
1203
1239
|
try :
|
|
1204
1240
|
args = shlex.split(line[2:], posix=True)
|
|
1205
|
-
await process_cmds(mc, args, json_output=json_output, sink=sink)
|
|
1241
|
+
res = await process_cmds(mc, args, json_output=json_output, sink=sink)
|
|
1242
|
+
if not res:
|
|
1243
|
+
logger.error(f"Problem while executing {args}")
|
|
1206
1244
|
except ValueError:
|
|
1207
1245
|
logger.error(f"Error parsing line {line[1:]}")
|
|
1208
1246
|
|
|
@@ -1210,6 +1248,9 @@ async def process_line(mc, line, contact=None, scope="*", prev_contact=None, pre
|
|
|
1210
1248
|
|
|
1211
1249
|
line = line.rstrip("\r\n")
|
|
1212
1250
|
|
|
1251
|
+
if line in ["~", "/"]:
|
|
1252
|
+
line = "/to ~"
|
|
1253
|
+
|
|
1213
1254
|
if line.startswith("/scope") or\
|
|
1214
1255
|
line.startswith("scope") and contact is None:
|
|
1215
1256
|
if not scope is None:
|
|
@@ -1236,6 +1277,8 @@ async def process_line(mc, line, contact=None, scope="*", prev_contact=None, pre
|
|
|
1236
1277
|
if '%' in dest and scope!=None :
|
|
1237
1278
|
dest_scope = dest.split("%")[-1]
|
|
1238
1279
|
dest = dest[:-len(dest_scope)-1]
|
|
1280
|
+
elif dest in SCOPES.keys():
|
|
1281
|
+
dest_scope = SCOPES[dest]
|
|
1239
1282
|
nc = await get_contact_from_arg(mc, dest)
|
|
1240
1283
|
if nc is None:
|
|
1241
1284
|
if dest == "public" :
|
|
@@ -1264,16 +1307,21 @@ async def process_line(mc, line, contact=None, scope="*", prev_contact=None, pre
|
|
|
1264
1307
|
nc = {"adv_name": chan["channel_name"],
|
|
1265
1308
|
"type": 0,
|
|
1266
1309
|
"chan_nb": chan["channel_idx"],}
|
|
1267
|
-
if
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1310
|
+
if not contact is None and dest_scope is None \
|
|
1311
|
+
and contact["adv_name"] in SCOPES and scope == SCOPES[contact["adv_name"]]:
|
|
1312
|
+
# if the scope was associated with that channel
|
|
1313
|
+
# then reset scope to default
|
|
1314
|
+
dest_scope = ""
|
|
1315
|
+
if dest_scope is None: # still None ... keep it as it was
|
|
1272
1316
|
dest_scope = scope
|
|
1273
|
-
if not scope is None and dest_scope != scope:
|
|
1317
|
+
if not scope is None and dest_scope != scope: # has scope changed
|
|
1274
1318
|
prev_scope = scope
|
|
1275
1319
|
if not dest_scope is None:
|
|
1276
1320
|
scope = await set_scope(mc, dest_scope)
|
|
1321
|
+
if nc != contact :
|
|
1322
|
+
last_ack = True
|
|
1323
|
+
prev_contact = contact
|
|
1324
|
+
contact = nc
|
|
1277
1325
|
|
|
1278
1326
|
elif line == "to" or line == "/to" :
|
|
1279
1327
|
if contact is None :
|
|
@@ -1306,8 +1354,17 @@ async def process_line(mc, line, contact=None, scope="*", prev_contact=None, pre
|
|
|
1306
1354
|
# commands are passed through if at root
|
|
1307
1355
|
elif contact is None or line.startswith(".") :
|
|
1308
1356
|
try:
|
|
1309
|
-
|
|
1310
|
-
|
|
1357
|
+
if line.startswith(":"):
|
|
1358
|
+
args = ["cli", line[1:].strip()]
|
|
1359
|
+
res = await process_cmds(mc, args, json_output=json_output, sink=sink,end=end)
|
|
1360
|
+
else:
|
|
1361
|
+
args = shlex.split(line, posix=True)
|
|
1362
|
+
res = await process_cmds(mc, args, json_output=json_output, sink=sink,end=end)
|
|
1363
|
+
if not res and HAS_CLI_CMD: # if command was not found, try cli
|
|
1364
|
+
args = ["cli", line[1:].strip()]
|
|
1365
|
+
res = await process_cmds(mc, args, json_output=json_output, sink=sink,end=end)
|
|
1366
|
+
if not res :
|
|
1367
|
+
logger.error(f"Problem while running {args}")
|
|
1311
1368
|
except ValueError:
|
|
1312
1369
|
logger.error(f"Error processing {line}")
|
|
1313
1370
|
|
|
@@ -1327,16 +1384,18 @@ async def process_line(mc, line, contact=None, scope="*", prev_contact=None, pre
|
|
|
1327
1384
|
|
|
1328
1385
|
elif line.startswith("send") or line.startswith("\"") :
|
|
1329
1386
|
if line.startswith("send") :
|
|
1330
|
-
line = line[5:]
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1387
|
+
line = line[5:].strip()
|
|
1388
|
+
line = strip_outer_quotes(line)
|
|
1389
|
+
if contact["type"] == 0 : # channel, send msg to channel
|
|
1390
|
+
await send_chan_msg(mc, contact["chan_nb"], strip_outer_quotes(line))
|
|
1391
|
+
else:
|
|
1392
|
+
last_ack = await msg_ack(mc, contact, line)
|
|
1334
1393
|
|
|
1335
1394
|
elif contact["type"] == 0 : # channel, send msg to channel
|
|
1336
|
-
await send_chan_msg(mc, contact["chan_nb"], line)
|
|
1395
|
+
await send_chan_msg(mc, contact["chan_nb"], strip_outer_quotes(line))
|
|
1337
1396
|
|
|
1338
1397
|
elif contact["type"] == 1 : # chat, send to recipient and wait ack
|
|
1339
|
-
last_ack = await msg_ack(mc, contact, line)
|
|
1398
|
+
last_ack = await msg_ack(mc, contact, strip_outer_quotes(line))
|
|
1340
1399
|
|
|
1341
1400
|
elif contact["type"] == 2 or\
|
|
1342
1401
|
contact["type"] == 3 or\
|
|
@@ -1636,7 +1695,10 @@ async def process_contact_chat_line(mc, contact, line, inside=False, json_output
|
|
|
1636
1695
|
cmds[0] == "cf" or cmds[0] == "change_flags" or\
|
|
1637
1696
|
cmds[0] == "req_binary" or\
|
|
1638
1697
|
cmds[0] == "login" :
|
|
1639
|
-
|
|
1698
|
+
text = cmds[1]
|
|
1699
|
+
if cmds[0] == "msg":
|
|
1700
|
+
text = strip_outer_quotes(text)
|
|
1701
|
+
args = [cmds[0], contact['adv_name'], text]
|
|
1640
1702
|
await process_cmds(mc, args, json_output=json_output, sink=sink)
|
|
1641
1703
|
return True
|
|
1642
1704
|
|
|
@@ -1773,10 +1835,8 @@ async def apply_command_to_contacts(mc, contact_filter, line, json_output=False,
|
|
|
1773
1835
|
|
|
1774
1836
|
elif line.startswith("send") or line.startswith("\"") :
|
|
1775
1837
|
if line.startswith("send") :
|
|
1776
|
-
line = line[5:]
|
|
1777
|
-
|
|
1778
|
-
line = line[1:]
|
|
1779
|
-
await msg_ack(mc, contact, line)
|
|
1838
|
+
line = line[5:].strip()
|
|
1839
|
+
await msg_ack(mc, contact, strip_outer_quotes(line))
|
|
1780
1840
|
|
|
1781
1841
|
elif contact["type"] == 2 or\
|
|
1782
1842
|
contact["type"] == 3 or\
|
|
@@ -2170,6 +2230,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
2170
2230
|
if res.payload["fw ver"] >= 3:
|
|
2171
2231
|
output_str += f" Model: {res.payload['model']}\n"
|
|
2172
2232
|
output_str += f" Version: {res.payload['ver']}\n"
|
|
2233
|
+
output_str += f" Comp. radio protocol: {res.payload['fw ver']}\n"
|
|
2173
2234
|
output_str += f" Build date: {res.payload['fw_build']}\n"
|
|
2174
2235
|
if "repeat" in res.payload :
|
|
2175
2236
|
output_str += f" Repeat: {'on' if res.payload['repeat'] else 'off'}{end}"
|
|
@@ -2980,14 +3041,9 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
2980
3041
|
argnum = 2
|
|
2981
3042
|
dest = None
|
|
2982
3043
|
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
except ValueError:
|
|
2987
|
-
dest = None
|
|
2988
|
-
|
|
2989
|
-
if dest is None:
|
|
2990
|
-
dest = await get_contact_from_arg(mc, cmds[1])
|
|
3044
|
+
# force getting contacts, as we don't know the type
|
|
3045
|
+
# might add rpt_cmd that assumes the contact is a repeater
|
|
3046
|
+
dest = await get_contact_from_arg(mc, cmds[1])
|
|
2991
3047
|
|
|
2992
3048
|
if dest is None:
|
|
2993
3049
|
if json_output :
|
|
@@ -3637,7 +3693,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
3637
3693
|
else:
|
|
3638
3694
|
output_str += f"Unknown contact {cmds[1]}{end}"
|
|
3639
3695
|
else:
|
|
3640
|
-
res = await mc.commands.change_contact_flags(contact, int(cmds[2]))
|
|
3696
|
+
res = await mc.commands.change_contact_flags(contact, int(cmds[2], 0))
|
|
3641
3697
|
logger.debug(res)
|
|
3642
3698
|
if res.type == EventType.ERROR:
|
|
3643
3699
|
output_str += f"Error setting path: {res}{end}"
|
|
@@ -3843,6 +3899,24 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
3843
3899
|
else:
|
|
3844
3900
|
output_str += f"Advert sent{end}"
|
|
3845
3901
|
|
|
3902
|
+
case "cli":
|
|
3903
|
+
argnum = 1
|
|
3904
|
+
res = await mc.commands.run_cli_command(cmds[1])
|
|
3905
|
+
logger.debug(res)
|
|
3906
|
+
if res.type == EventType.ERROR:
|
|
3907
|
+
output_str += f"Error sending cli command: {res}{end}"
|
|
3908
|
+
elif json_output:
|
|
3909
|
+
output_str += json.dumps(res.payload) + end
|
|
3910
|
+
else:
|
|
3911
|
+
output_str += res.payload['text'] + end
|
|
3912
|
+
|
|
3913
|
+
case "send_raw":
|
|
3914
|
+
argnum = 1
|
|
3915
|
+
res = await mc.commands.send_raw_packet(cmds[1])
|
|
3916
|
+
logger.debug(res)
|
|
3917
|
+
if res.type == EventType.ERROR:
|
|
3918
|
+
output_str += f"Error sending raw packet [{cmds[1]}]: {res}{end}"
|
|
3919
|
+
|
|
3846
3920
|
case "flood_advert" | "floodadv":
|
|
3847
3921
|
res = await mc.commands.send_advert(flood=True)
|
|
3848
3922
|
logger.debug(res)
|
|
@@ -4045,7 +4119,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4045
4119
|
pass
|
|
4046
4120
|
|
|
4047
4121
|
case _ :
|
|
4048
|
-
logger.
|
|
4122
|
+
logger.debug(f"Unknown command : {cmd}, {cmds} not executed ...")
|
|
4049
4123
|
return (None, output_str)
|
|
4050
4124
|
|
|
4051
4125
|
logger.debug(f"cmd {cmds[0:argnum+1]} processed ...")
|
|
@@ -4053,14 +4127,14 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4053
4127
|
|
|
4054
4128
|
except IndexError:
|
|
4055
4129
|
logger.error("Error in parameters")
|
|
4056
|
-
return (
|
|
4130
|
+
return ([], "")
|
|
4057
4131
|
except (EOFError, KeyboardInterrupt):
|
|
4058
4132
|
logger.error("Cancelled")
|
|
4059
|
-
return (
|
|
4133
|
+
return ([], "")
|
|
4060
4134
|
except Exception as e:
|
|
4061
4135
|
logger.error(f"Unexpected error while processing '{cmds[0]}': {e}")
|
|
4062
4136
|
logger.debug(traceback.format_exc())
|
|
4063
|
-
return (
|
|
4137
|
+
return ([], "")
|
|
4064
4138
|
|
|
4065
4139
|
async def process_cmds (mc, cmds, json_output=False, sink=sys.stdout, end="\n") :
|
|
4066
4140
|
while cmds and len(cmds) > 0 :
|
|
@@ -4068,7 +4142,9 @@ async def process_cmds (mc, cmds, json_output=False, sink=sys.stdout, end="\n")
|
|
|
4068
4142
|
if not cur_output is None:
|
|
4069
4143
|
sink.write(cur_output)
|
|
4070
4144
|
sink.flush()
|
|
4071
|
-
|
|
4145
|
+
if cmds is None:
|
|
4146
|
+
return False
|
|
4147
|
+
return True
|
|
4072
4148
|
|
|
4073
4149
|
async def process_script(mc, file, json_output=False, sink=sys.stdout):
|
|
4074
4150
|
output_str = ""
|
|
@@ -4092,7 +4168,9 @@ async def process_script(mc, file, json_output=False, sink=sys.stdout):
|
|
|
4092
4168
|
logger.debug(f"processing {line}")
|
|
4093
4169
|
try :
|
|
4094
4170
|
cmds = shlex.split(line, posix=True)
|
|
4095
|
-
await process_cmds(mc, cmds, json_output=json_output, sink=sink)
|
|
4171
|
+
res = await process_cmds(mc, cmds, json_output=json_output, sink=sink)
|
|
4172
|
+
if not res:
|
|
4173
|
+
logger.error(f"Problem executing {cmds}")
|
|
4096
4174
|
except ValueError:
|
|
4097
4175
|
logger.error(f"Error processing {line}")
|
|
4098
4176
|
return output_str
|
|
@@ -4141,6 +4219,8 @@ def command_help():
|
|
|
4141
4219
|
clock : get current time
|
|
4142
4220
|
clock sync : sync device clock st
|
|
4143
4221
|
node_discover <filter> : discovers nodes based on their type nd
|
|
4222
|
+
cli <cmd> : executes cli command cmd
|
|
4223
|
+
send_raw <pkt> : sends a raw packet (hex string)
|
|
4144
4224
|
Contacts
|
|
4145
4225
|
contacts / list : gets contact list lc
|
|
4146
4226
|
reload_contacts : force reloading all contacts rc
|
|
@@ -4918,6 +4998,7 @@ async def repeater_loop(ser):
|
|
|
4918
4998
|
|
|
4919
4999
|
async def main(argv):
|
|
4920
5000
|
""" Do the job """
|
|
5001
|
+
global HAS_CLI_CMD
|
|
4921
5002
|
json_output = JSON
|
|
4922
5003
|
debug = False
|
|
4923
5004
|
address = ADDRESS
|
|
@@ -5183,8 +5264,10 @@ async def main(argv):
|
|
|
5183
5264
|
if (json_output or quiet) :
|
|
5184
5265
|
logger.setLevel(logging.ERROR)
|
|
5185
5266
|
else :
|
|
5267
|
+
if res.payload["fw ver"] >= 14 :
|
|
5268
|
+
HAS_CLI_CMD = True
|
|
5186
5269
|
if res.payload["fw ver"] > 2 :
|
|
5187
|
-
logger.info(f"Connected to {mc.self_info['name']} running on a {res.payload['ver']} fw.")
|
|
5270
|
+
logger.info(f"Connected to {mc.self_info['name']} running on a {res.payload['ver']} ({res.payload['fw ver']}) fw.")
|
|
5188
5271
|
else :
|
|
5189
5272
|
logger.info(f"Connected to {mc.self_info['name']}.")
|
|
5190
5273
|
|
|
@@ -5203,7 +5286,9 @@ async def main(argv):
|
|
|
5203
5286
|
if args[-1] == "interactive" or args[-1] == "chat" or args[-1] == "im":
|
|
5204
5287
|
force_interactive = True
|
|
5205
5288
|
|
|
5206
|
-
await process_cmds(mc, args, json_output=json_output, sink=sys.stdout)
|
|
5289
|
+
res = await process_cmds(mc, args, json_output=json_output, sink=sys.stdout)
|
|
5290
|
+
if not res :
|
|
5291
|
+
logger.error(f"Problem while executing {args}")
|
|
5207
5292
|
|
|
5208
5293
|
if len(args) == 0 or force_interactive :
|
|
5209
5294
|
await interactive_loop(mc, json_output=json_output)
|
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
# Repeater Commands Reference
|
|
2
|
-
|
|
3
|
-
meshcore-cli can interact with repeaters through two fundamentally different paths, each exposing a different set of commands.
|
|
4
|
-
|
|
5
|
-
## Connection Paths
|
|
6
|
-
|
|
7
|
-
### Serial direct (`-r -s <port>`)
|
|
8
|
-
|
|
9
|
-
Connects USB directly to the repeater hardware. The CLI talks to the firmware's text CLI — raw text in, raw text out over UART. This gives access to the firmware's full serial command set.
|
|
10
|
-
|
|
11
|
-
### Client mode (`to <repeater>`)
|
|
12
|
-
|
|
13
|
-
Connects to your companion client node (via BLE, TCP or serial without `-r`), then sends commands to the repeater over the mesh radio network using encrypted MeshCore `cmd` messages. The repeater firmware processes these through its mesh command handler, which is more limited than the serial interface.
|
|
14
|
-
|
|
15
|
-
The transport between you and your companion node (BLE, TCP or serial) does not matter — all three use the same MeshCore API and the same mesh protocol to reach the repeater.
|
|
16
|
-
|
|
17
|
-
<pre>
|
|
18
|
-
+------------------+
|
|
19
|
-
-r -s (serial) ------->| Firmware text CLI | (raw UART)
|
|
20
|
-
| on repeater |
|
|
21
|
-
+------------------+
|
|
22
|
-
|
|
23
|
-
+--------------+ +-------------------+
|
|
24
|
-
BLE -----+ | | mesh | Firmware mesh cmd |
|
|
25
|
-
TCP -----+--> MeshCore --> Companion +------->| handler on |
|
|
26
|
-
Serial --+ (same API) | node | radio | repeater |
|
|
27
|
-
+--------------+ +-------------------+
|
|
28
|
-
</pre>
|
|
29
|
-
|
|
30
|
-
## Commands Available in Both Modes
|
|
31
|
-
|
|
32
|
-
The following commands work regardless of how you connect to the repeater. In serial mode they are sent as raw text. In client mode they are wrapped in a `cmd` message and sent over the mesh.
|
|
33
|
-
|
|
34
|
-
### Information
|
|
35
|
-
|
|
36
|
-
<pre>
|
|
37
|
-
ver - Firmware version
|
|
38
|
-
board - Board name
|
|
39
|
-
clock - Show current time
|
|
40
|
-
</pre>
|
|
41
|
-
|
|
42
|
-
### Statistics
|
|
43
|
-
|
|
44
|
-
<pre>
|
|
45
|
-
stats-core - Core stats (uptime, battery, queue)
|
|
46
|
-
stats-radio - Radio stats (RSSI, SNR, noise floor)
|
|
47
|
-
stats-packets - Packet statistics (sent/recv counts)
|
|
48
|
-
clear stats - Reset all statistics
|
|
49
|
-
</pre>
|
|
50
|
-
|
|
51
|
-
### Network
|
|
52
|
-
|
|
53
|
-
<pre>
|
|
54
|
-
neighbors - Show neighboring repeaters (zero-hop)
|
|
55
|
-
neighbor.remove <n> - Remove a specific neighbor
|
|
56
|
-
discover.neighbors - Actively discover neighbors
|
|
57
|
-
advert - Send advertisement now
|
|
58
|
-
</pre>
|
|
59
|
-
|
|
60
|
-
### Logging
|
|
61
|
-
|
|
62
|
-
<pre>
|
|
63
|
-
log start - Enable packet logging
|
|
64
|
-
log stop - Disable packet logging
|
|
65
|
-
</pre>
|
|
66
|
-
|
|
67
|
-
Note: after `log start` in client mode, log data streams back as `RX_LOG_DATA` events and is processed with rich packet parsing (headers, routes, paths, channel/advert echoes). In serial mode, log data is printed as raw firmware text.
|
|
68
|
-
|
|
69
|
-
### Configuration (get/set)
|
|
70
|
-
|
|
71
|
-
<pre>
|
|
72
|
-
get name - Node name
|
|
73
|
-
get role - Node role
|
|
74
|
-
get radio - Radio params (freq,bw,sf,cr)
|
|
75
|
-
get freq - Frequency
|
|
76
|
-
get tx - TX power (dBm)
|
|
77
|
-
get af - Antenna factor
|
|
78
|
-
get repeat - Repeat mode on/off
|
|
79
|
-
get public.key - Node public key
|
|
80
|
-
get lat - Latitude
|
|
81
|
-
get lon - Longitude
|
|
82
|
-
get advert.interval - Advertisement interval (minutes)
|
|
83
|
-
get flood.advert.interval - Flood advertisement interval
|
|
84
|
-
get flood.max - Maximum flood hops
|
|
85
|
-
get guest.password - Guest password
|
|
86
|
-
get allow.read.only - Read-only access mode
|
|
87
|
-
get owner.info - Owner information
|
|
88
|
-
get acl - Access control list
|
|
89
|
-
get rxdelay - RX delay
|
|
90
|
-
get txdelay - TX delay
|
|
91
|
-
get direct.txdelay - Direct TX delay
|
|
92
|
-
|
|
93
|
-
set name <name> - Set node name
|
|
94
|
-
set radio f,bw,sf,cr - Set radio params (reboot to apply)
|
|
95
|
-
set freq <freq> - Set frequency
|
|
96
|
-
set tx <power> - Set TX power (dBm)
|
|
97
|
-
set af <value> - Set antenna factor
|
|
98
|
-
set repeat on|off - Enable/disable repeating
|
|
99
|
-
set lat <value> - Set latitude
|
|
100
|
-
set lon <value> - Set longitude
|
|
101
|
-
set advert.interval <min> - Set advert interval (60-240 min)
|
|
102
|
-
set flood.advert.interval <min> - Set flood advert interval
|
|
103
|
-
set flood.max <value> - Set max flood hops
|
|
104
|
-
set guest.password <pwd> - Set guest password
|
|
105
|
-
set allow.read.only on|off - Set read-only access
|
|
106
|
-
set owner.info <info> - Set owner information
|
|
107
|
-
set rxdelay <value> - Set RX delay
|
|
108
|
-
set txdelay <value> - Set TX delay
|
|
109
|
-
set direct.txdelay <val> - Set direct TX delay
|
|
110
|
-
</pre>
|
|
111
|
-
|
|
112
|
-
### Bridge Configuration (get/set)
|
|
113
|
-
|
|
114
|
-
<pre>
|
|
115
|
-
get bridge.enabled - Bridge enabled state
|
|
116
|
-
get bridge.delay - Bridge delay
|
|
117
|
-
get bridge.source - Bridge source
|
|
118
|
-
get bridge.baud - Bridge baud rate
|
|
119
|
-
get bridge.secret - Bridge secret
|
|
120
|
-
|
|
121
|
-
set bridge.enabled on|off - Enable/disable bridge
|
|
122
|
-
set bridge.delay <value> - Set bridge delay
|
|
123
|
-
set bridge.source <value> - Set bridge source
|
|
124
|
-
set bridge.baud <value> - Set bridge baud rate
|
|
125
|
-
set bridge.secret <value> - Set bridge secret
|
|
126
|
-
</pre>
|
|
127
|
-
|
|
128
|
-
### Region Management
|
|
129
|
-
|
|
130
|
-
<pre>
|
|
131
|
-
region - Display currently configured regions
|
|
132
|
-
region save - Save current region config to flash
|
|
133
|
-
region home - Get/set home region
|
|
134
|
-
region get - Get info (and parent) for a region
|
|
135
|
-
region put - Add or update a region
|
|
136
|
-
region remove - Remove a region definition
|
|
137
|
-
region allowf - Give flood permission to a region
|
|
138
|
-
region denyf - Remove flood permission from a region
|
|
139
|
-
</pre>
|
|
140
|
-
|
|
141
|
-
### GPS
|
|
142
|
-
|
|
143
|
-
<pre>
|
|
144
|
-
gps on|off - Enable/disable GPS
|
|
145
|
-
gps sync - Sync GPS
|
|
146
|
-
gps setloc - Set location from GPS
|
|
147
|
-
gps advert none|share|prefs - GPS advertisement mode
|
|
148
|
-
</pre>
|
|
149
|
-
|
|
150
|
-
### Sensors
|
|
151
|
-
|
|
152
|
-
<pre>
|
|
153
|
-
sensor list - List sensors
|
|
154
|
-
sensor get - Get sensor value
|
|
155
|
-
sensor set - Set sensor value
|
|
156
|
-
</pre>
|
|
157
|
-
|
|
158
|
-
### Other
|
|
159
|
-
|
|
160
|
-
<pre>
|
|
161
|
-
password <pwd> - Set admin password
|
|
162
|
-
powersaving on|off - Toggle power saving mode
|
|
163
|
-
setperm <key> <perm> - Set permissions for a node
|
|
164
|
-
time <epoch> - Set time to given epoch
|
|
165
|
-
reboot - Reboot device
|
|
166
|
-
erase - Erase filesystem
|
|
167
|
-
</pre>
|
|
168
|
-
|
|
169
|
-
## Commands Available Only in Serial Mode (`-r`)
|
|
170
|
-
|
|
171
|
-
These commands only work over the serial text CLI. They return "Unknown command" when sent via mesh `cmd`.
|
|
172
|
-
|
|
173
|
-
### Logging (serial only)
|
|
174
|
-
|
|
175
|
-
<pre>
|
|
176
|
-
log - Dump stored log file to console
|
|
177
|
-
log erase - Erase log file
|
|
178
|
-
</pre>
|
|
179
|
-
|
|
180
|
-
The bare `log` command streams stored log data over the serial output, which doesn't fit the mesh command request/response model. `log erase` is similarly a serial-only operation.
|
|
181
|
-
|
|
182
|
-
### Region File Transfer (serial only)
|
|
183
|
-
|
|
184
|
-
These are meshcore-cli convenience commands that handle file I/O over the serial link:
|
|
185
|
-
|
|
186
|
-
<pre>
|
|
187
|
-
region upload <file> - Upload regions config from local file to node
|
|
188
|
-
region load <file> - Alias for region upload
|
|
189
|
-
region download <file> - Download regions config from node to local file
|
|
190
|
-
region list - List allowed/denied regions
|
|
191
|
-
</pre>
|
|
192
|
-
|
|
193
|
-
### Other Serial-Only Commands
|
|
194
|
-
|
|
195
|
-
<pre>
|
|
196
|
-
tempradio - Temporary radio configuration
|
|
197
|
-
script <file> - Execute a local script file (lines sent one by one)
|
|
198
|
-
clock sync - Sync repeater clock to host time (alias: st, sync_time)
|
|
199
|
-
</pre>
|
|
200
|
-
|
|
201
|
-
Note: `clock sync` in serial mode is intercepted by meshcore-cli, which reads the host clock and sends `time <epoch>` to the firmware. In client mode, `clock sync` is available as a meshcore-cli command on the companion node (not sent to the repeater).
|
|
202
|
-
|
|
203
|
-
## Commands Available Only in Client Mode (`to <repeater>`)
|
|
204
|
-
|
|
205
|
-
These are meshcore-cli commands that use the MeshCore protocol to query repeaters. They are not raw firmware commands — they use dedicated binary protocol messages.
|
|
206
|
-
|
|
207
|
-
### Repeater Management
|
|
208
|
-
|
|
209
|
-
<pre>
|
|
210
|
-
login <pwd> - Log into repeater with password l
|
|
211
|
-
logout - Log out of repeater
|
|
212
|
-
req_status - Request status from repeater rs
|
|
213
|
-
req_neighbours - Request neighbours in binary form rn
|
|
214
|
-
req_regions - Request regions list rr
|
|
215
|
-
req_owner - Request owner information ro
|
|
216
|
-
req_clock - Request repeater timestamp (for sync)
|
|
217
|
-
req_acl - Request access control list ra
|
|
218
|
-
trace - Run a trace to this repeater tr
|
|
219
|
-
dtrace - Discover path and trace dt
|
|
220
|
-
</pre>
|
|
221
|
-
|
|
222
|
-
### Contact Operations (on the repeater contact)
|
|
223
|
-
|
|
224
|
-
<pre>
|
|
225
|
-
contact_info - Print contact info for this repeater ci
|
|
226
|
-
path - Display path to this repeater
|
|
227
|
-
disc_path - Discover new path and display dp
|
|
228
|
-
reset_path - Reset path to flood rp
|
|
229
|
-
change_path <path> - Change the path to this repeater cp
|
|
230
|
-
change_flags <flags> - Change contact flags cf
|
|
231
|
-
share_contact - Share this repeater's contact sc
|
|
232
|
-
export_contact - Export this repeater's URI ec
|
|
233
|
-
req_telemetry - Request telemetry data rt
|
|
234
|
-
forget_password - Remove stored password for repeater fp
|
|
235
|
-
set timeout <value> - Set command timeout for this repeater
|
|
236
|
-
get timeout - Get command timeout for this repeater
|
|
237
|
-
</pre>
|
|
238
|
-
|
|
239
|
-
### Special Operations
|
|
240
|
-
|
|
241
|
-
<pre>
|
|
242
|
-
clkreboot - Clock-aware reboot
|
|
243
|
-
start ota - Start OTA (over-the-air) update
|
|
244
|
-
get telemetry - Alias for req_telemetry
|
|
245
|
-
get status - Alias for req_status
|
|
246
|
-
get acl - Alias for req_acl
|
|
247
|
-
</pre>
|
|
248
|
-
|
|
249
|
-
### Prefix Shortcuts
|
|
250
|
-
|
|
251
|
-
<pre>
|
|
252
|
-
: <cmd> - Force send as raw cmd (e.g. ":ver")
|
|
253
|
-
send <msg> / "<msg> - Send a text message to repeater (room)
|
|
254
|
-
</pre>
|
|
255
|
-
|
|
256
|
-
## Quick Reference Table
|
|
257
|
-
|
|
258
|
-
| Command | Serial (`-r`) | Client (`to`) | Notes |
|
|
259
|
-
| --- | :---: | :---: | --- |
|
|
260
|
-
| ver, board, clock | Yes | Yes | |
|
|
261
|
-
| stats-core/radio/packets | Yes | Yes | |
|
|
262
|
-
| clear stats | Yes | Yes | |
|
|
263
|
-
| neighbors | Yes | Yes | |
|
|
264
|
-
| neighbor.remove | Yes | Yes | |
|
|
265
|
-
| discover.neighbors | Yes | Yes | |
|
|
266
|
-
| advert | Yes | Yes | |
|
|
267
|
-
| log start / log stop | Yes | Yes | Client receives data via RX_LOG_DATA events |
|
|
268
|
-
| log (dump) | Yes | **No** | Serial streaming, no mesh equivalent |
|
|
269
|
-
| log erase | Yes | **No** | Serial only |
|
|
270
|
-
| get/set (all params) | Yes | Yes | |
|
|
271
|
-
| region (get/put/remove/save/home/allowf/denyf) | Yes | Yes | |
|
|
272
|
-
| region upload/download | Yes | **No** | Requires serial file transfer |
|
|
273
|
-
| region list | Yes | **No** | Serial only |
|
|
274
|
-
| gps | Yes | Yes | |
|
|
275
|
-
| sensor | Yes | Yes | |
|
|
276
|
-
| password | Yes | Yes | |
|
|
277
|
-
| powersaving | Yes | Yes | |
|
|
278
|
-
| setperm | Yes | Yes | Client mode resolves contact names to keys |
|
|
279
|
-
| time, reboot, erase | Yes | Yes | |
|
|
280
|
-
| tempradio | Yes | **No** | Serial only |
|
|
281
|
-
| clock sync | Yes | **No** | CLI intercepts and sends `time <epoch>` |
|
|
282
|
-
| script | Yes | **No** | Reads local file, sends lines over serial |
|
|
283
|
-
| login/logout | **No** | Yes | MeshCore protocol commands |
|
|
284
|
-
| req_status | **No** | Yes | Binary protocol request |
|
|
285
|
-
| req_neighbours | **No** | Yes | Binary protocol request |
|
|
286
|
-
| req_regions | **No** | Yes | Binary protocol request |
|
|
287
|
-
| req_owner | **No** | Yes | Binary protocol request |
|
|
288
|
-
| req_clock | **No** | Yes | Binary protocol request |
|
|
289
|
-
| req_acl | **No** | Yes | Binary protocol request |
|
|
290
|
-
| trace/dtrace | **No** | Yes | Path tracing via mesh |
|
|
291
|
-
| contact management | **No** | Yes | CLI-level operations on companion node |
|
|
292
|
-
| clkreboot, start ota | **No** | Yes | Mesh protocol commands |
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/python
|
|
2
|
-
# queries geoclue for current position of a linux device and print coordinates
|
|
3
|
-
|
|
4
|
-
import gi
|
|
5
|
-
gi.require_version('Geoclue', '2.0')
|
|
6
|
-
from gi.repository import Geoclue
|
|
7
|
-
|
|
8
|
-
# Initialisation du client Geoclue simple
|
|
9
|
-
clue = Geoclue.Simple.new_sync('mon-app-id', Geoclue.AccuracyLevel.EXACT, None)
|
|
10
|
-
|
|
11
|
-
# Récupération de l'objet de localisation (proxy D-Bus)
|
|
12
|
-
loc = clue.get_location()
|
|
13
|
-
|
|
14
|
-
# Extraction des propriétés réelles de l'objet
|
|
15
|
-
latitude = loc.get_property('latitude')
|
|
16
|
-
longitude = loc.get_property('longitude')
|
|
17
|
-
altitude = loc.get_property('altitude')
|
|
18
|
-
|
|
19
|
-
# Affichage des coordonnées numériques
|
|
20
|
-
print(f"{latitude},{longitude}")
|
|
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
|