rot finished

This commit is contained in:
2026-01-09 11:56:40 +01:00
parent 1ee0afa088
commit ac99f291a7
30 changed files with 5581 additions and 293 deletions

View File

@@ -0,0 +1,35 @@
package devices
import "sync"
// CommandIDManager manages the global command ID counter for 4O3A devices
// All 4O3A devices share the same command ID sequence
type CommandIDManager struct {
mu sync.Mutex
counter int
}
var globalCommandID = &CommandIDManager{
counter: 0,
}
// GetNextID returns the next command ID and increments the counter
func (m *CommandIDManager) GetNextID() int {
m.mu.Lock()
defer m.mu.Unlock()
m.counter++
return m.counter
}
// Reset resets the counter to 0 (useful for testing or restart)
func (m *CommandIDManager) Reset() {
m.mu.Lock()
defer m.mu.Unlock()
m.counter = 0
}
// GetGlobalCommandID returns the global command ID manager
func GetGlobalCommandID() *CommandIDManager {
return globalCommandID
}