This repository has been archived on 2024-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
orion/emlid/updater/receiver_upgrade.go

24 lines
775 B
Go
Raw Permalink Normal View History

package updater
import "context"
const (
eventIsReceiverUpgradeAvailable = "is receiver upgrade available"
eventReceiverUpgradeAvailable = "receiver upgrade available"
)
type receiverUpgreAvailable struct {
Available bool `json:"available"`
Running bool `json:"running"`
}
// ReceiverUpgradeAvailable checks if an upgrade is avaialable/running for the ReachRS module
func (c *Client) ReceiverUpgradeAvailable(ctx context.Context) (bool, bool, error) {
res := &receiverUpgreAvailable{}
if err := c.ReqResp(ctx, eventIsReceiverUpgradeAvailable, nil, eventReceiverUpgradeAvailable, res); err != nil {
return false, false, err
}
c.Logf("receiver upgrade result: available: %v, running: %v", res.Available, res.Running)
return res.Available, res.Running, nil
}