Added some basic command handling for the devices

This commit is contained in:
2025-12-22 23:06:33 +00:00
parent b3c3d4fbac
commit af3322bc9f
7 changed files with 176 additions and 50 deletions
+15
View File
@@ -1,8 +1,23 @@
// Package helper
package helper
import (
"bytes"
"encoding/binary"
)
func B32(s string) [32]byte {
var b [32]byte
copy(b[:], s)
return b
}
func StructToBytes(s any) ([]byte, error) {
var buf bytes.Buffer
err := binary.Write(&buf, binary.LittleEndian, s)
if err != nil {
return []byte{}, err
}
return buf.Bytes(), nil
}