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.

41 lines
606 B
Go

3 years ago
package sensor
import (
3 years ago
"sync"
"FRMS/internal/pkg/I2C"
3 years ago
)
type Manager struct {
3 years ago
Addr int
Type string
Status bool
Kill chan<- bool
3 years ago
mu sync.Mutex
3 years ago
}
3 years ago
func (m *Manager) GetStatus() bool{
m.mu.Lock()
defer m.mu.Unlock()
return m.Status
}
func (m *Manager) GetType() string{
m.mu.Lock()
defer m.mu.Unlock()
return m.Type
}
func NewSensorManager(addr int) *Manager {
return &Manager{Addr:addr}
}
func (m *Manager) Start() {
types := map[int]string{97:"DO Sensor",99:"pH Sensor",102:"RTD Sensor"}
m.Type = types[m.Addr]
m.Status = true
}
3 years ago