mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
-l to list ble devices
This commit is contained in:
parent
093a2a7c2c
commit
ec44c93659
3 changed files with 16 additions and 4 deletions
|
|
@ -37,6 +37,9 @@ Arguments mostly deals with ble connection
|
|||
<pre>
|
||||
-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
|
||||
|
|
@ -70,8 +73,8 @@ Commands are given after arguments, they can be chained and some have shortcuts.
|
|||
Management
|
||||
advert : sends advert a
|
||||
floodadv : flood advert
|
||||
get <param> : gets a param, \"get help\" for more
|
||||
set <param> <value> : sets a param, \"set help\" for more
|
||||
get <param> : gets a param, "get help" for more
|
||||
set <param> <value> : sets a param, "set help" for more
|
||||
time <epoch> : sets time to given epoch
|
||||
clock : get current time
|
||||
clock sync : sync device clock st
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||
|
||||
[project]
|
||||
name = "meshcore-cli"
|
||||
version = "0.6.16"
|
||||
version = "0.6.17"
|
||||
authors = [
|
||||
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1269,6 +1269,7 @@ def usage () :
|
|||
-j : json output
|
||||
-D : debug
|
||||
-S : performs a ble scan and ask for device
|
||||
-l : list available ble devices and exit
|
||||
-a <address> : specifies device address (can be a name)
|
||||
-d <name> : filter meshcore devices with name or address
|
||||
-t <hostname> : connects via tcp/ip
|
||||
|
|
@ -1294,7 +1295,7 @@ async def main(argv):
|
|||
with open(MCCLI_ADDRESS, encoding="utf-8") as f :
|
||||
address = f.readline().strip()
|
||||
|
||||
opts, args = getopt.getopt(argv, "a:d:s:ht:p:b:jDhS")
|
||||
opts, args = getopt.getopt(argv, "a:d:s:ht:p:b:jDhSl")
|
||||
for opt, arg in opts :
|
||||
match opt:
|
||||
case "-d" : # name specified on cmdline
|
||||
|
|
@ -1317,6 +1318,14 @@ async def main(argv):
|
|||
case "-h" :
|
||||
usage()
|
||||
return
|
||||
case "-l" :
|
||||
devices = await BleakScanner.discover()
|
||||
if len(devices) == 0:
|
||||
logger.error("No ble device found")
|
||||
for d in devices :
|
||||
if d.name.startswith("MeshCore-"):
|
||||
print(f"{d.address} {d.name}")
|
||||
return
|
||||
case "-S" :
|
||||
devices = await BleakScanner.discover()
|
||||
choices = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue