fix(pkg/types): use measured values as struct instead interface
This commit is contained in:
@ -12,9 +12,9 @@ import (
|
||||
)
|
||||
|
||||
// Read measured values from sensors
|
||||
func Read(ctx context.Context, sensors []Sensor) ([]types.MeasuredValue, error) {
|
||||
func Read(ctx context.Context, sensors []Sensor) ([]*types.MeasuredValue, error) {
|
||||
|
||||
measuredValuesChannel := make(chan []types.MeasuredValue, len(sensors))
|
||||
measuredValuesChannel := make(chan []*types.MeasuredValue, len(sensors))
|
||||
errorChannel := make(chan error, len(sensors))
|
||||
|
||||
ReadChannel(ctx, sensors, measuredValuesChannel, errorChannel)
|
||||
@ -31,7 +31,7 @@ func Read(ctx context.Context, sensors []Sensor) ([]types.MeasuredValue, error)
|
||||
|
||||
// ReadChannel reads the measured values from sensors and writes them to a
|
||||
// channel.
|
||||
func ReadChannel(ctx context.Context, sensors []Sensor, measuredValuesChannel chan<- []types.MeasuredValue, errorChannel chan<- error) {
|
||||
func ReadChannel(ctx context.Context, sensors []Sensor, measuredValuesChannel chan<- []*types.MeasuredValue, errorChannel chan<- error) {
|
||||
|
||||
wg := new(sync.WaitGroup)
|
||||
wg.Add(len(sensors))
|
||||
@ -45,7 +45,7 @@ func ReadChannel(ctx context.Context, sensors []Sensor, measuredValuesChannel ch
|
||||
|
||||
// ReadContinuously reads the measured values continously from sensors and writes
|
||||
// them to a channel.
|
||||
func ReadContinuously(ctx context.Context, sensors []Sensor, measuredValuesChannel chan<- []types.MeasuredValue, errorChannel chan<- error) {
|
||||
func ReadContinuously(ctx context.Context, sensors []Sensor, measuredValuesChannel chan<- []*types.MeasuredValue, errorChannel chan<- error) {
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
|
Reference in New Issue
Block a user