Slaves forward configured tap kinds to the master; goTool exposes CLI, dashboard, REST, and WebSocket with separate notify vs receive and 2s display cache. Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
771 B
Go
35 lines
771 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 tap=%s/%s/%s\n",
|
|
i, c.GetId(), mac, c.GetVersion(), c.GetAvailable(), c.GetUsed(),
|
|
c.GetLastPing(), c.GetLastSuccessPing(),
|
|
boolFlag(c.GetTapNotifySingle()), boolFlag(c.GetTapNotifyDouble()), boolFlag(c.GetTapNotifyTriple()))
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func boolFlag(v bool) string {
|
|
if v {
|
|
return "on"
|
|
}
|
|
return "off"
|
|
}
|