Skip to content

Commit

Permalink
TO BE REMOVED: client_example tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Jun 23, 2021
1 parent 3a17f7f commit 7c630e7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions client_example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand All @@ -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
}

Expand Down

0 comments on commit 7c630e7

Please sign in to comment.