powerpods/goTool/cmd_unicast.go
simon d24b0cb5c3 Add goTool autotest with bench configs and UART scenarios.
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>
2026-05-18 23:36:28 +02:00

27 lines
616 B
Go

package main
import (
"flag"
"fmt"
)
func runUnicastTest(sp *serialPort, args []string) error {
fs := flag.NewFlagSet("unicast-test", flag.ExitOnError)
clientID := fs.Uint("client", 0, "slave client id from `clients`")
seq := fs.Uint("seq", 1, "test sequence number")
if err := fs.Parse(args); err != nil {
return err
}
if *clientID == 0 {
return fmt.Errorf("client id required (see `gotool clients`)")
}
r, err := sp.espnowUnicastTest(uint32(*clientID), uint32(*seq))
if err != nil {
return err
}
fmt.Printf("unicast test sent: success=%v seq=%d\n", r.GetSuccess(), r.GetSeq())
return nil
}