You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
777 B
Plaintext
49 lines
777 B
Plaintext
package sensor
|
|
|
|
// do sensor and methods
|
|
|
|
import (
|
|
pb "FRMS/internal/pkg/grpc"
|
|
"sync"
|
|
)
|
|
|
|
type DOManager struct {
|
|
// do sensor manager
|
|
*Atlas // atlas helper
|
|
*SensorManager `mapstructure:",squash"`
|
|
|
|
sync.RWMutex
|
|
Status int
|
|
Name string
|
|
}
|
|
|
|
func NewDOManager(device *pb.Device) *DOManager {
|
|
a := NewAtlasManager()
|
|
sm := NewSensorManager(device*pb.Device, a.Read)
|
|
|
|
m := &DOManager{
|
|
SensorManager: sm,
|
|
Atlas: a,
|
|
}
|
|
return m
|
|
}
|
|
|
|
func (m *DOManager) Start() error {
|
|
// start sm
|
|
if err := m.SensorManager.Start(); err != nil {
|
|
return err
|
|
}
|
|
// start taking samples
|
|
go m.Monitor(m.Address, m.Atlas.Read)
|
|
return nil
|
|
}
|
|
|
|
func (m *DOManager) GetDefaultName() string {
|
|
return "DO Sensor"
|
|
}
|
|
|
|
func (m *DOManager) String() string {
|
|
// TODO
|
|
return ""
|
|
}
|