3333from meshcore import MeshCore , EventType , logger
3434
3535# Version
36- VERSION = "v1.2.7 "
36+ VERSION = "v1.2.8 "
3737
3838# default ble address is stored in a config file
3939MCCLI_CONFIG_DIR = str (Path .home ()) + "/.config/meshcore/"
@@ -711,7 +711,7 @@ async def interactive_loop(mc, to=None) :
711711 prev_contact = None
712712
713713 res = await mc .commands .set_flood_scope ("0" )
714- if res is None or res .type == EventType .ERROR :
714+ if res is None or res .type == EventType .ERROR :
715715 scope = None
716716 prev_scope = None
717717 else :
@@ -2419,6 +2419,7 @@ async def next_cmd(mc, cmds, json_output=False):
24192419
24202420 case "node_discover" | "nd" :
24212421 argnum = 1
2422+ prefix_only = True
24222423 try : # try to decode type as int
24232424 types = int (cmds [1 ])
24242425 except ValueError :
@@ -2435,7 +2436,10 @@ async def next_cmd(mc, cmds, json_output=False):
24352436 if "sens" in cmds [1 ]:
24362437 types = types | 16
24372438
2438- res = await mc .commands .send_node_discover_req (types )
2439+ if "full" in cmds [1 ]:
2440+ prefix_only = False
2441+
2442+ res = await mc .commands .send_node_discover_req (types , prefix_only = prefix_only )
24392443 if res is None or res .type == EventType .ERROR :
24402444 print ("Error sending discover request" )
24412445 else :
@@ -2458,10 +2462,20 @@ async def next_cmd(mc, cmds, json_output=False):
24582462 await mc .ensure_contacts ()
24592463 print (f"Discovered { len (dn )} nodes:" )
24602464 for n in dn :
2461- name = mc .get_contact_by_key_prefix (n [" pubkey" ])['adv_name' ]
2465+ name = f" { n [ 'pubkey' ][ 0 : 2 ] } { mc .get_contact_by_key_prefix (n [' pubkey' ])['adv_name' ]} "
24622466 if name is None :
2463- name = n ["pubkey" ][0 :12 ]
2464- print (f" { name :12} type { n ['node_type' ]} SNR: { n ['SNR_in' ]:6,.2f} ->{ n ['SNR' ]:6,.2f} RSSI: ->{ n ['RSSI' ]:4} " )
2467+ name = n ["pubkey" ][0 :16 ]
2468+ type = f"t:{ n ['node_type' ]} "
2469+ if n ['node_type' ] == 1 :
2470+ type = "cli"
2471+ elif n ['node_type' ] == 2 :
2472+ type = "rep"
2473+ elif n ['node_type' ] == 3 :
2474+ type = "room"
2475+ elif n ['node_type' ] == 4 :
2476+ type = "sens"
2477+
2478+ print (f" { name :16} { type :>4} SNR: { n ['SNR_in' ]:6,.2f} ->{ n ['SNR' ]:6,.2f} RSSI: ->{ n ['RSSI' ]:4} " )
24652479
24662480 case "req_btelemetry" | "rbt" :
24672481 argnum = 1
0 commit comments