3 releases

0.1.2 Nov 17, 2020
0.1.1 Nov 16, 2020
0.1.0 Nov 16, 2020

#34 in #arduino

GPL-3.0 license

7MB
45K SLoC

Go 38K SLoC // 0.2% comments C++ 3.5K SLoC // 0.2% comments Python 2K SLoC // 0.3% comments Arduino C++ 1K SLoC // 0.2% comments Shell 246 SLoC // 0.1% comments PO File 234 SLoC // 0.3% comments JavaScript 39 SLoC // 0.0% comments Rust 36 SLoC Processing 8 SLoC HCL 8 SLoC // 0.2% comments INI 8 SLoC // 0.5% comments

arduino-cli-client

gRPC bindings for arduino-cli. Bindings are generated based on the protobuf definitions defined here.

Example

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(())
}

Example - Client

The examples/ folder contains a client example that is analogue to arduino-cli/client-example.

Dependencies

~8.5MB
~150K SLoC