Return intial values in watch functions
This commit is contained in:
parent
367032ec7e
commit
df067d2c56
@ -338,6 +338,11 @@ func (i *Device) WatchHeartRate() (<-chan uint8, error) {
|
||||
return nil, err
|
||||
}
|
||||
out := make(chan uint8, 2)
|
||||
currentHeartRate, err := i.HeartRate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out <- currentHeartRate
|
||||
go func() {
|
||||
// For every event
|
||||
for event := range ch {
|
||||
@ -366,6 +371,11 @@ func (i *Device) WatchBatteryLevel() (<-chan uint8, error) {
|
||||
return nil, err
|
||||
}
|
||||
out := make(chan uint8, 2)
|
||||
currentBattLevel, err := i.BatteryLevel()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out <- currentBattLevel
|
||||
go func() {
|
||||
// For every event
|
||||
for event := range ch {
|
||||
|
Reference in New Issue
Block a user