Skip to content

Commit

Permalink
refactor: Return detailed save changes response.
Browse files Browse the repository at this point in the history
* Include possible error codes/types when failing so save keymap
  changes.
  • Loading branch information
petejohanson committed Oct 3, 2024
1 parent 6115f13 commit 6cb4c28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
7 changes: 0 additions & 7 deletions proto/zmk/behaviors.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ message GetBehaviorDetailsResponse {
repeated BehaviorBindingParametersSet metadata = 3;
}

enum BehaviorBindingParameterStandardDomain {
NIL = 0;
HID_USAGE = 1;
LAYER_ID = 2;
// HSV_VALUE = 3;
}

message BehaviorBindingParametersSet {
repeated BehaviorParameterValueDescription param1 = 1;
repeated BehaviorParameterValueDescription param2 = 2;
Expand Down
16 changes: 15 additions & 1 deletion proto/zmk/keymap.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ message Response {
Keymap get_keymap = 1;
SetLayerBindingResponse set_layer_binding = 2;
bool check_unsaved_changes = 3;
bool save_changes = 4;
SaveChangesResponse save_changes = 4;
bool discard_changes = 5;
PhysicalLayouts get_physical_layouts = 6;
SetActivePhysicalLayoutResponse set_active_physical_layout = 7;
Expand All @@ -42,6 +42,20 @@ message Notification {
}
}

message SaveChangesResponse {
oneof result {
bool ok = 1;
SaveChangesErrorCode err = 2;
}
}

enum SaveChangesErrorCode {
SAVE_CHANGES_ERR_OK = 0;
SAVE_CHANGES_ERR_GENERIC = 1;
SAVE_CHANGES_ERR_NOT_SUPPORTED = 2;
SAVE_CHANGES_ERR_NO_SPACE = 3;
}

enum SetLayerBindingResponse {
SET_LAYER_BINDING_RESP_OK = 0;
SET_LAYER_BINDING_RESP_INVALID_LOCATION = 1;
Expand Down

0 comments on commit 6cb4c28

Please sign in to comment.