This commit is contained in:
2026-01-09 11:56:40 +01:00
parent 1ee0afa088
commit 4ab192418e
30 changed files with 3455 additions and 16 deletions

View File

@@ -7,6 +7,8 @@ import (
"strconv"
"strings"
"time"
. "git.rouggy.com/rouggy/ShackMaster/internal/devices"
)
type Client struct {
@@ -65,8 +67,14 @@ func (c *Client) sendCommand(cmd string) (string, error) {
}
}
// Get next command ID from global counter
cmdID := GetGlobalCommandID().GetNextID()
// Format command with ID: C<id>|<command>
fullCmd := fmt.Sprintf("C%d%s", cmdID, cmd)
// Send command
_, err := c.conn.Write([]byte(cmd))
_, err := c.conn.Write([]byte(fullCmd))
if err != nil {
c.conn = nil
return "", fmt.Errorf("failed to send command: %w", err)