modify and add new fields for drivers

This commit is contained in:
Adrian Zuercher
2025-07-29 12:05:03 +02:00
parent 2d6db85b8c
commit eabac1b11b
5 changed files with 110 additions and 23 deletions

View File

@@ -37,10 +37,31 @@ func (s *Set) New(path string, typ Type, value any, rights Rights) {
}
// sets new driver typ with bus and address
func (s *Set) NewDriver(typ, bus string, address uint) {
s.Driver = &Driver{
Type: typ,
Bus: bus,
Address: address,
func (s *Set) NewDriverAddress(typ, bus string, address uint) {
if s.Drivers == nil {
s.Drivers = &Drivers{}
}
drv := s.Drivers.AddDriver(typ)
b := drv.AddBus(bus)
b.AddAddress(address)
}
// sets new driver typ with bus and subscription
func (s *Set) NewDriverSubscribe(typ, bus string, sub string) {
if s.Drivers == nil {
s.Drivers = &Drivers{}
}
drv := s.Drivers.AddDriver(typ)
b := drv.AddBus(bus)
b.AddSubscription(sub)
}
// sets new driver typ with bus and publish
func (s *Set) NewDriverPublish(typ, bus string, pub string) {
if s.Drivers == nil {
s.Drivers = &Drivers{}
}
drv := s.Drivers.AddDriver(typ)
b := drv.AddBus(bus)
b.AddPublish(pub)
}