Skip to content

[skip changelog] gRPC "client_example" refresh #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 3, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func createCliCommandTree(cmd *cobra.Command) {
cmd.AddCommand(version.NewCommand())

cmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Print the logs on the standard output.")
cmd.PersistentFlags().StringVar(&globals.LogLevel, "log-level", defaultLogLevel, "Messages with this level and above will be logged (default: warn).")
cmd.PersistentFlags().StringVar(&globals.LogLevel, "log-level", defaultLogLevel, "Messages with this level and above will be logged.")
cmd.PersistentFlags().StringVar(&logFile, "log-file", "", "Path to the file where logs will be written.")
cmd.PersistentFlags().StringVar(&logFormat, "log-format", "text", "The output format for the logs, can be [text|json].")
cmd.PersistentFlags().StringVar(&globals.OutputFormat, "format", "text", "The output format, can be [text|json].")
Expand Down
2 changes: 1 addition & 1 deletion cli/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const (
func NewCommand() *cobra.Command {
return &cobra.Command{
Use: "daemon",
Short: "Run as a daemon",
Short: fmt.Sprintf("Run as a daemon on port %s", port),
Long: "Running as a daemon the initialization of cores and libraries is done only once.",
Example: " " + os.Args[0] + " daemon",
Args: cobra.NoArgs,
Expand Down
2 changes: 1 addition & 1 deletion client_example/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/arduino/arduino-cli/client_example

go 1.12
go 1.13

require (
github.com/arduino/arduino-cli v0.0.0-20190826141027-35722fda467d
Expand Down
13 changes: 9 additions & 4 deletions client_example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ func initInstance(client rpc.ArduinoCoreClient) *rpc.Instance {
// the data folder.
initRespStream, err := client.Init(context.Background(), &rpc.InitReq{
Configuration: &rpc.Configuration{
DataDir: dataDir,
DataDir: dataDir,
SketchbookDir: dataDir,
DownloadsDir: dataDir,
},
})
if err != nil {
Expand Down Expand Up @@ -368,11 +370,12 @@ func callBoardsDetails(client rpc.ArduinoCoreClient, instance *rpc.Instance) {
}

func callBoardAttach(client rpc.ArduinoCoreClient, instance *rpc.Instance) {
currDir, _ := os.Getwd()
boardattachresp, err := client.BoardAttach(context.Background(),
&rpc.BoardAttachReq{
Instance: instance,
BoardUri: "/dev/ttyACM0",
SketchPath: filepath.Join(dataDir, "hello.ino"),
SketchPath: filepath.Join(currDir, "hello.ino"),
})

if err != nil {
Expand Down Expand Up @@ -402,11 +405,12 @@ func callBoardAttach(client rpc.ArduinoCoreClient, instance *rpc.Instance) {
}

func callCompile(client rpc.ArduinoCoreClient, instance *rpc.Instance) {
currDir, _ := os.Getwd()
compRespStream, err := client.Compile(context.Background(),
&rpc.CompileReq{
Instance: instance,
Fqbn: "arduino:samd:mkr1000",
SketchPath: "hello.ino",
SketchPath: filepath.Join(currDir, "hello.ino"),
Verbose: true,
})

Expand Down Expand Up @@ -440,11 +444,12 @@ func callCompile(client rpc.ArduinoCoreClient, instance *rpc.Instance) {
}

func callUpload(client rpc.ArduinoCoreClient, instance *rpc.Instance) {
currDir, _ := os.Getwd()
uplRespStream, err := client.Upload(context.Background(),
&rpc.UploadReq{
Instance: instance,
Fqbn: "arduino:samd:mkr1000",
SketchPath: "hello.ino",
SketchPath: filepath.Join(currDir, "hello.ino"),
Port: "/dev/ttyACM0",
Verbose: true,
})
Expand Down