-
-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TO BE REMOVED: client_example tweaks
- Loading branch information
Showing
1 changed file
with
13 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,8 +66,12 @@ func main() { | |
|
||
settingsClient := settings.NewSettingsServiceClient(conn) | ||
|
||
callUpload(client, initInstance(client)) | ||
return | ||
// Now we can call various methods of the API... | ||
|
||
log.Println("calling LibraryDownload([email protected])") | ||
callLibDownload(client, initInstance(client)) | ||
return | ||
// `Version` can be called without any setup or init procedure. | ||
log.Println("calling Version") | ||
callVersion(client) | ||
|
@@ -635,12 +639,11 @@ func callUpload(client rpc.ArduinoCoreServiceClient, instance *rpc.Instance) { | |
uplRespStream, err := client.Upload(context.Background(), | ||
&rpc.UploadRequest{ | ||
Instance: instance, | ||
Fqbn: "arduino:samd:mkr1000", | ||
Fqbn: "MegaCoreX:megaavr:4809", | ||
SketchPath: filepath.Join(currDir, "hello"), | ||
Port: "/dev/ttyACM0", | ||
Verbose: true, | ||
}) | ||
|
||
if err != nil { | ||
log.Fatalf("Upload error: %s\n", err) | ||
} | ||
|
@@ -654,6 +657,13 @@ func callUpload(client rpc.ArduinoCoreServiceClient, instance *rpc.Instance) { | |
|
||
if err != nil { | ||
log.Fatalf("Upload error: %s", err) | ||
s, _ := status.FromError(err) | ||
log.Printf(`CODE=%s`, s.Code()) | ||
log.Printf(`MSG="%+v"`, s.Message()) | ||
for _, d := range s.Details() { | ||
_, ok := d.(*rpc.ProgrammerIsRequiredForUploadError) | ||
log.Printf(`DETAILS=Programmer required? %v`, ok) | ||
} | ||
break | ||
} | ||
|
||
|