Add responses to cancellation requests
This commit is contained in:
parent
ff8ce1b2a5
commit
46a891d852
@ -136,6 +136,7 @@ func handleConnection(conn net.Conn, dev *infinitime.Device) {
|
|||||||
case types.ReqTypeCancelHeartRate:
|
case types.ReqTypeCancelHeartRate:
|
||||||
// Stop heart rate notifications
|
// Stop heart rate notifications
|
||||||
heartRateDone <- struct{}{}
|
heartRateDone <- struct{}{}
|
||||||
|
json.NewEncoder(conn).Encode(types.Response{})
|
||||||
case types.ReqTypeBattLevel:
|
case types.ReqTypeBattLevel:
|
||||||
// Get battery level from watch
|
// Get battery level from watch
|
||||||
battLevel, err := dev.BatteryLevel()
|
battLevel, err := dev.BatteryLevel()
|
||||||
@ -174,6 +175,7 @@ func handleConnection(conn net.Conn, dev *infinitime.Device) {
|
|||||||
case types.ReqTypeCancelBattLevel:
|
case types.ReqTypeCancelBattLevel:
|
||||||
// Stop battery level notifications
|
// Stop battery level notifications
|
||||||
battLevelDone <- struct{}{}
|
battLevelDone <- struct{}{}
|
||||||
|
json.NewEncoder(conn).Encode(types.Response{})
|
||||||
case types.ReqTypeMotion:
|
case types.ReqTypeMotion:
|
||||||
// Get battery level from watch
|
// Get battery level from watch
|
||||||
motionVals, err := dev.Motion()
|
motionVals, err := dev.Motion()
|
||||||
@ -212,6 +214,7 @@ func handleConnection(conn net.Conn, dev *infinitime.Device) {
|
|||||||
case types.ReqTypeCancelMotion:
|
case types.ReqTypeCancelMotion:
|
||||||
// Stop motion notifications
|
// Stop motion notifications
|
||||||
motionDone <- struct{}{}
|
motionDone <- struct{}{}
|
||||||
|
json.NewEncoder(conn).Encode(types.Response{})
|
||||||
case types.ReqTypeStepCount:
|
case types.ReqTypeStepCount:
|
||||||
// Get battery level from watch
|
// Get battery level from watch
|
||||||
stepCount, err := dev.StepCount()
|
stepCount, err := dev.StepCount()
|
||||||
@ -250,6 +253,7 @@ func handleConnection(conn net.Conn, dev *infinitime.Device) {
|
|||||||
case types.ReqTypeCancelStepCount:
|
case types.ReqTypeCancelStepCount:
|
||||||
// Stop step count notifications
|
// Stop step count notifications
|
||||||
stepCountDone <- struct{}{}
|
stepCountDone <- struct{}{}
|
||||||
|
json.NewEncoder(conn).Encode(types.Response{})
|
||||||
case types.ReqTypeFwVersion:
|
case types.ReqTypeFwVersion:
|
||||||
// Get firmware version from watch
|
// Get firmware version from watch
|
||||||
version, err := dev.Version()
|
version, err := dev.Version()
|
||||||
|
Loading…
Reference in New Issue
Block a user