Skip to content

Commit

Permalink
Add the update status "canceled"
Browse files Browse the repository at this point in the history
  • Loading branch information
sylane committed Oct 12, 2024
1 parent c4b14ef commit 0340735
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/grisp_connect_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,19 @@ release name and version and if update is enabled.
| relvsn | string or null | required | The version of the release running currently on the device |
| update_enabled | boolean | required | If updating is enbaled on the device |
| boot_source | map | optional | `{"type": "system", "id": ID}` or `{"type": "removable"}` |
| update_status | string | optional | `"ready"`, `"updating"`, `"failed"`, or `"updated"` |
| update_status | string | optional | `"ready"`, `"updating"`, `"canceled"`, `"failed"`, or `"updated"`|
| update_progress | integer | optional | The progress as a percentage |
| update_message | string | optional | Message describing the current state of the system |
| action_required | boolean | optional | `null`, `"reboot"`, `"remove_sdcard_and_reboot"` or `"validate"` |
| action_required | boolean | optional | `"reboot"`, `"remove_sdcard_and_reboot"` or `"validate"` |

Meaning of the status:

| key | description |
|-------------------|--------------------------------------------------------------------------------------------|
| `"ready"` | The system is ready for initiating an update |
| `"updating"` | The system is in the process of updating |
| `"failed"` | The update failed, but a new update can be initiated |
| `"canceled"` | The update was canceled, a new update can be initiated |
| `"failed"` | The update failed, a new update can be initiated |
| `"updated"` | The update succeed, but actions are required like "reboot" or "validate" |

</p>
Expand Down
6 changes: 6 additions & 0 deletions src/grisp_connect_updater.erl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ update_info() ->
update_progress => Percent,
update_message => <<"Device is updating">>};
% Update Failed
{{error, canceled}, Boot, _, _} ->
#{update_enabled => true,
boot_source => Boot,
update_status => canceled,
update_message => <<"Device update canceled">>};
% Update Failed
{{error, _Reason}, Boot, _, _} ->
#{update_enabled => true,
boot_source => Boot,
Expand Down

0 comments on commit 0340735

Please sign in to comment.