2022-04-23 00:12:30 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.arsenm.dev/infinitime"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (c *Client) WatchHeartRate() (<-chan uint8, func(), error) {
|
2022-05-01 18:36:28 +00:00
|
|
|
outCh := make(chan uint8, 2)
|
|
|
|
err := c.client.Call(
|
|
|
|
"ITD",
|
2022-04-23 00:12:30 +00:00
|
|
|
"WatchHeartRate",
|
|
|
|
nil,
|
2022-05-01 18:36:28 +00:00
|
|
|
outCh,
|
2022-04-23 00:12:30 +00:00
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
return nil, nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
doneFn := func() {
|
2022-05-01 18:36:28 +00:00
|
|
|
close(outCh)
|
2022-04-23 00:12:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return outCh, doneFn, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Client) WatchBatteryLevel() (<-chan uint8, func(), error) {
|
2022-05-01 18:36:28 +00:00
|
|
|
outCh := make(chan uint8, 2)
|
|
|
|
err := c.client.Call(
|
|
|
|
"ITD",
|
2022-04-23 00:12:30 +00:00
|
|
|
"WatchBatteryLevel",
|
|
|
|
nil,
|
2022-05-01 18:36:28 +00:00
|
|
|
outCh,
|
2022-04-23 00:12:30 +00:00
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
return nil, nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
doneFn := func() {
|
2022-05-01 18:36:28 +00:00
|
|
|
close(outCh)
|
2022-04-23 00:12:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return outCh, doneFn, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Client) WatchStepCount() (<-chan uint32, func(), error) {
|
2022-05-01 18:36:28 +00:00
|
|
|
outCh := make(chan uint32, 2)
|
|
|
|
err := c.client.Call(
|
|
|
|
"ITD",
|
2022-04-23 00:12:30 +00:00
|
|
|
"WatchStepCount",
|
|
|
|
nil,
|
2022-05-01 18:36:28 +00:00
|
|
|
outCh,
|
2022-04-23 00:12:30 +00:00
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
return nil, nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
doneFn := func() {
|
2022-05-01 18:36:28 +00:00
|
|
|
close(outCh)
|
2022-04-23 00:12:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return outCh, doneFn, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Client) WatchMotion() (<-chan infinitime.MotionValues, func(), error) {
|
2022-05-01 18:36:28 +00:00
|
|
|
outCh := make(chan infinitime.MotionValues, 2)
|
|
|
|
err := c.client.Call(
|
|
|
|
"ITD",
|
2022-04-23 00:12:30 +00:00
|
|
|
"WatchMotion",
|
|
|
|
nil,
|
2022-05-01 18:36:28 +00:00
|
|
|
outCh,
|
2022-04-23 00:12:30 +00:00
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
return nil, nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
doneFn := func() {
|
2022-05-01 18:36:28 +00:00
|
|
|
close(outCh)
|
2022-04-23 00:12:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return outCh, doneFn, nil
|
|
|
|
}
|