fix(pkg/sensor): reduce interface functions for better error handling

This commit is contained in:
2020-01-10 19:42:19 +01:00
parent ca4269fff8
commit 95fb1f6745
12 changed files with 159 additions and 93 deletions

View File

@ -1,15 +1,12 @@
package sensor
import (
"context"
"sync"
"github.com/go-flucky/flucky/pkg/types"
"time"
)
type Sensor interface {
GetSensorModel() types.SensorModel
ID() string
Read() ([]*types.MeasuredValue, error)
ReadChannel(measuredValueChannel chan<- *types.MeasuredValue, errorChannel chan<- error, wg *sync.WaitGroup)
ReadContinously(ctx context.Context, measuredValueChannel chan<- *types.MeasuredValue, errorChannel chan<- error)
Ticker() *time.Ticker
}