fix(pkg/sensor): use context to terminate go routines
This commit is contained in:
@ -1,15 +1,24 @@
|
||||
package sensor
|
||||
|
||||
import "github.com/go-flucky/flucky/pkg/types"
|
||||
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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user