
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
27 lines
570 B
Go
27 lines
570 B
Go
package driver
|
|
|
|
import (
|
|
"artNet/models"
|
|
|
|
json_dataModels "gitea.tecamino.com/paadi/tecamino-json_data/models"
|
|
)
|
|
|
|
func (d *ArtNetDriver) Subscribe(subs ...json_dataModels.Subscription) {
|
|
if d.Subscriptions == nil {
|
|
d.Subscriptions = models.NewSubscriptions()
|
|
}
|
|
|
|
for _, sub := range subs {
|
|
if drv, ok := (*sub.Drivers)[sub.Driver]; ok {
|
|
d.Subscriptions.AddSubscription(sub.Uuid, drv)
|
|
for _, bus := range drv.Buses {
|
|
for _, address := range bus.Address {
|
|
d.SetValue(bus.Name, address, uint8(sub.Value.(float64)))
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
d.SendData()
|
|
}
|