Skip to content

Commit 9aaa1d0

Browse files
feat: add grpc flash command
1 parent 39de0a7 commit 9aaa1d0

File tree

7 files changed

+667
-47
lines changed

7 files changed

+667
-47
lines changed

rpc/cc/arduino/flasher/v1/commands.pb.go

Lines changed: 343 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rpc/cc/arduino/flasher/v1/commands.proto

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ option go_package = "github.com/arduino/arduino-flasher-cli/rpc/cc/arduino/flash
2424
service Flasher {
2525
rpc List(ListRequest) returns (ListResponse) {};
2626
rpc Download(DownloadRequest) returns (stream DownloadResponse);
27+
rpc Flash(FlashRequest) returns (stream FlashResponse);
2728
}
2829

2930
message ListRequest {}
@@ -55,3 +56,28 @@ message DownloadResponse {
5556
Result result = 2;
5657
}
5758
}
59+
60+
message FlashRequest {
61+
// The version of the Debian image to download.
62+
string version = 1;
63+
// The path in which the image will be downloaded and extracted.
64+
string temp_path = 2;
65+
// Preserve user partition if possible.
66+
bool preserve_user = 3;
67+
}
68+
69+
message FlashResponse {
70+
message Result {
71+
// Empty message, reserved for future expansion.
72+
}
73+
oneof message {
74+
// Progress of the download.
75+
DownloadProgress download_progress = 1;
76+
// Progress of the extraction.
77+
TaskProgress extraction_progress = 2;
78+
// Progress of qdl flashing.
79+
TaskProgress flash_progress = 3;
80+
// Download result.
81+
Result result = 4;
82+
}
83+
}

rpc/cc/arduino/flasher/v1/commands_grpc.pb.go

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rpc/cc/arduino/flasher/v1/common.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ func (d DownloadProgressCB) End(success bool, message string) {
5353
},
5454
})
5555
}
56+
57+
// TaskProgressCB is a callback to receive progress messages
58+
type TaskProgressCB func(msg *TaskProgress)

rpc/cc/arduino/flasher/v1/common.pb.go

Lines changed: 104 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rpc/cc/arduino/flasher/v1/common.proto

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,14 @@ message DownloadProgressEnd {
5151
// "File xxx already downloaded" or "Connection timeout".
5252
string message = 2;
5353
}
54+
55+
message TaskProgress {
56+
// Description of the task.
57+
string name = 1;
58+
// Additional information about the task.
59+
string message = 2;
60+
// Whether the task is complete.
61+
bool completed = 3;
62+
// Amount in percent of the task completion (optional).
63+
float percent = 4;
64+
}

0 commit comments

Comments
 (0)