2022-04-23 00:12:30 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
2022-05-01 22:22:28 +00:00
|
|
|
"context"
|
|
|
|
|
2022-04-23 00:12:30 +00:00
|
|
|
"go.arsenm.dev/infinitime"
|
|
|
|
)
|
|
|
|
|
2022-05-01 22:22:28 +00:00
|
|
|
func (c *Client) FirmwareUpgrade(ctx context.Context, upgType UpgradeType, files ...string) (chan infinitime.DFUProgress, error) {
|
2022-05-01 18:36:28 +00:00
|
|
|
progressCh := make(chan infinitime.DFUProgress, 5)
|
|
|
|
err := c.client.Call(
|
2022-05-01 22:22:28 +00:00
|
|
|
ctx,
|
2022-05-01 18:36:28 +00:00
|
|
|
"ITD",
|
2022-04-23 00:12:30 +00:00
|
|
|
"FirmwareUpgrade",
|
|
|
|
FwUpgradeData{
|
|
|
|
Type: upgType,
|
|
|
|
Files: files,
|
|
|
|
},
|
2022-05-02 03:40:30 +00:00
|
|
|
progressCh,
|
2022-04-23 00:12:30 +00:00
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return progressCh, nil
|
|
|
|
}
|