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/update.go

27 lines
648 B
Go

package updater
const (
eventUpdate = "update"
eventOPKGUpdateResult = "opkg update result"
)
// UpdateStatus embeds informations about update status
type UpdateStatus struct {
Active bool `json:"active"`
Locked bool `json:"locked"`
State string `json:"state"`
}
// Update asks the ReachRS module to start an OPKG update
func (c *Client) Update() (*UpdateStatus, error) {
res := &UpdateStatus{}
if err := c.ReqResp(eventUpdate, nil, eventOPKGUpdateResult, res); err != nil {
return nil, err
}
c.Logf(
"opkg update result: active: %v, state: %v, locked: %v",
res.Active, res.State, res.Locked,
)
return res, nil
}