Crates.io | arduino-cli-client |
lib.rs | arduino-cli-client |
version | 0.1.2 |
source | src |
created_at | 2020-11-16 16:51:44.650683 |
updated_at | 2020-11-17 17:17:15.38783 |
description | gRPC client for arduino cli |
homepage | https://github.com/marcelbuesing/arduino-cli-client |
repository | https://github.com/marcelbuesing/arduino-cli-client.git |
max_upload_size | |
id | 312981 |
size | 20,452,873 |
gRPC bindings for arduino-cli. Bindings are generated based on the protobuf definitions defined here.
This examples demonstrates retrieving the list of connected boards.
Make sure you run arduino-cli daemon
before running this example.
You can run the example via cargo run --example list_boards
.
use arduino_cli_client::commands::arduino_core_client::ArduinoCoreClient;
use arduino_cli_client::commands::{BoardListReq, InitReq};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = ArduinoCoreClient::connect("http://localhost:50051").await?;
// Start a new instance of the Arduino Core Service
let mut init_stream = client
.init(InitReq {
library_manager_only: false,
})
.await?
.into_inner();
let resp_instance = init_stream.message().await?.expect("Failed to init");
// List the boards currently connected to the computer.
let resp_boards = client
.board_list(BoardListReq {
instance: resp_instance.instance,
})
.await?
.into_inner();
print!("Boards: {:?}", resp_boards.ports);
Ok(())
}
The examples/
folder contains a client example that is analogue to arduino-cli/client-example
.