forked from Elara6331/itd
Add context support and update lrpc
This commit is contained in:
20
api/get.go
20
api/get.go
@@ -1,11 +1,14 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.arsenm.dev/infinitime"
|
||||
)
|
||||
|
||||
func (c *Client) HeartRate() (out uint8, err error) {
|
||||
func (c *Client) HeartRate(ctx context.Context) (out uint8, err error) {
|
||||
err = c.client.Call(
|
||||
ctx,
|
||||
"ITD",
|
||||
"HeartRate",
|
||||
nil,
|
||||
@@ -14,8 +17,9 @@ func (c *Client) HeartRate() (out uint8, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) BatteryLevel() (out uint8, err error) {
|
||||
func (c *Client) BatteryLevel(ctx context.Context) (out uint8, err error) {
|
||||
err = c.client.Call(
|
||||
ctx,
|
||||
"ITD",
|
||||
"BatteryLevel",
|
||||
nil,
|
||||
@@ -24,8 +28,9 @@ func (c *Client) BatteryLevel() (out uint8, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) Motion() (out infinitime.MotionValues, err error) {
|
||||
func (c *Client) Motion(ctx context.Context) (out infinitime.MotionValues, err error) {
|
||||
err = c.client.Call(
|
||||
ctx,
|
||||
"ITD",
|
||||
"Motion",
|
||||
nil,
|
||||
@@ -34,8 +39,9 @@ func (c *Client) Motion() (out infinitime.MotionValues, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) StepCount() (out uint32, err error) {
|
||||
func (c *Client) StepCount(ctx context.Context) (out uint32, err error) {
|
||||
err = c.client.Call(
|
||||
ctx,
|
||||
"ITD",
|
||||
"StepCount",
|
||||
nil,
|
||||
@@ -44,8 +50,9 @@ func (c *Client) StepCount() (out uint32, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) Version() (out string, err error) {
|
||||
func (c *Client) Version(ctx context.Context) (out string, err error) {
|
||||
err = c.client.Call(
|
||||
ctx,
|
||||
"ITD",
|
||||
"Version",
|
||||
nil,
|
||||
@@ -54,8 +61,9 @@ func (c *Client) Version() (out string, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) Address() (out string, err error) {
|
||||
func (c *Client) Address(ctx context.Context) (out string, err error) {
|
||||
err = c.client.Call(
|
||||
ctx,
|
||||
"ITD",
|
||||
"Address",
|
||||
nil,
|
||||
|
||||
Reference in New Issue
Block a user