25 lines
976 B
Go
25 lines
976 B
Go
package sensor
|
|
|
|
import (
|
|
"context"
|
|
"sync"
|
|
|
|
"github.com/go-flucky/flucky/pkg/types"
|
|
)
|
|
|
|
// HumiditySensor is a interface to describe required functions to measure humidities
|
|
type HumiditySensor interface {
|
|
GetSensorModel() types.SensorModel
|
|
ReadHumidity() (*types.Humidity, error)
|
|
ReadHumidityWriteIntoChannel(humidityChannel chan<- *types.Humidity, errorChannel chan<- error, wg *sync.WaitGroup)
|
|
ReadHumidityContinously(ctx context.Context, humidityChannel chan<- *types.Humidity, errorChannel chan<- error)
|
|
}
|
|
|
|
// TemperatureSensor is a interface to describe required functions to measure temperatures
|
|
type TemperatureSensor interface {
|
|
GetSensorModel() types.SensorModel
|
|
ReadTemperature() (*types.Temperature, error)
|
|
ReadTemperatureWriteIntoChannel(temperatureChannel chan<- *types.Temperature, errorChannel chan<- error, wg *sync.WaitGroup)
|
|
ReadTemperatureContinously(ctx context.Context, temperatureChannel chan<- *types.Temperature, errorChannel chan<- error)
|
|
}
|