JSON configs describe network and node MACs; scenarios run command sequences with expect checks. Share UART client API across CLI and tests. Co-authored-by: Cursor <cursoragent@cursor.com>
27 lines
580 B
Go
27 lines
580 B
Go
package main
|
|
|
|
import (
|
|
"encoding/hex"
|
|
"fmt"
|
|
)
|
|
|
|
func runClients(sp *serialPort) error {
|
|
clients, err := sp.listClients()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if len(clients) == 0 {
|
|
fmt.Println("no clients registered")
|
|
return nil
|
|
}
|
|
|
|
fmt.Printf("clients (%d):\n", len(clients))
|
|
for i, c := range clients {
|
|
mac := hex.EncodeToString(c.GetMac())
|
|
fmt.Printf(" [%d] id=%d mac=%s ver=%d available=%v used=%v last_ping=%d last_success_ping=%d\n",
|
|
i, c.GetId(), mac, c.GetVersion(), c.GetAvailable(), c.GetUsed(),
|
|
c.GetLastPing(), c.GetLastSuccessPing())
|
|
}
|
|
return nil
|
|
}
|