package updater import "context" 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(ctx context.Context) (*UpdateStatus, error) { res := &UpdateStatus{} if err := c.ReqResp(ctx, 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 }