modify and add new fields for drivers
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user