
All checks were successful
Build ArtNet Driver / build (amd64, , linux) (push) Successful in 1m40s
Build ArtNet Driver / build (amd64, .exe, windows) (push) Successful in 1m41s
Build ArtNet Driver / build (arm, 6, , linux) (push) Successful in 1m39s
Build ArtNet Driver / build (arm64, , linux) (push) Successful in 1m38s
28 lines
590 B
Go
28 lines
590 B
Go
package models
|
|
|
|
import (
|
|
json_dataModels "gitea.tecamino.com/paadi/tecamino-json_data/models"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Subscriptions map[uuid.UUID][]Subscription
|
|
|
|
type Subscription struct {
|
|
Bus string
|
|
Address []uint
|
|
}
|
|
|
|
func NewSubscriptions() Subscriptions {
|
|
return make(Subscriptions)
|
|
}
|
|
|
|
func (s *Subscriptions) AddSubscription(uid uuid.UUID, drv *json_dataModels.Driver) {
|
|
subs := []Subscription{}
|
|
for _, bus := range drv.Buses {
|
|
sub := Subscription{Bus: bus.Name}
|
|
sub.Address = append(sub.Address, bus.Address...)
|
|
subs = append(subs, sub)
|
|
}
|
|
(*s)[uid] = subs
|
|
}
|