{"id":19204804,"url":"https://github.com/meshtastic/rust","last_synced_at":"2025-04-04T09:07:05.043Z","repository":{"id":190922655,"uuid":"683598526","full_name":"meshtastic/rust","owner":"meshtastic","description":"A Rust library for connecting to and configuring Meshtastic radios.","archived":false,"fork":false,"pushed_at":"2025-02-04T11:37:30.000Z","size":158,"stargazers_count":59,"open_issues_count":8,"forks_count":24,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-29T14:07:24.311Z","etag":null,"topics":["library","meshtastic","rust-lang"],"latest_commit_sha":null,"homepage":"https://meshtastic.org/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meshtastic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ajmcquilkin","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-08-27T05:05:53.000Z","updated_at":"2025-03-24T15:48:46.000Z","dependencies_parsed_at":"2023-12-25T01:09:13.872Z","dependency_job_id":"67e595c7-0078-4f50-a1ec-a3bafc36b829","html_url":"https://github.com/meshtastic/rust","commit_stats":{"total_commits":111,"total_committers":10,"mean_commits":11.1,"dds":"0.23423423423423428","last_synced_commit":"8b946cc0cc2d267c56c683acf7e73e670369ed40"},"previous_names":["ajmcquilkin/meshtastic-rust","meshtastic/rust"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meshtastic%2Frust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meshtastic%2Frust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meshtastic%2Frust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meshtastic%2Frust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meshtastic","download_url":"https://codeload.github.com/meshtastic/rust/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149500,"owners_count":20891954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","meshtastic","rust-lang"],"created_at":"2024-11-09T13:09:46.160Z","updated_at":"2025-04-04T09:07:05.025Z","avatar_url":"https://github.com/meshtastic.png","language":"Rust","funding_links":["https://github.com/sponsors/ajmcquilkin"],"categories":[],"sub_categories":[],"readme":"# Meshtastic.rs\n\n\u003e [!IMPORTANT] \n\u003e **📢 Meshtastic Rust needs a new platform owner / maintainer 📢**\n\u003e\n\u003e More details are available in [Issue #25](https://github.com/meshtastic/rust/issues/25).\n\n\n## Overview\n\nMeshtastic.rs is a crate that allows you to interact with Meshtastic devices in Rust. This crate is designed\nto be used on a desktop environment, and currently supports connecting to radios via USB serial and TCP.\n\nThis crate is designed to be used within the tokio asynchronous runtime.\n\n[![Crates.io](https://img.shields.io/crates/v/meshtastic)](https://crates.io/crates/meshtastic)\n[![Documentation](https://docs.rs/meshtastic/badge.svg)](https://docs.rs/meshtastic)\n[![License](https://img.shields.io/crates/l/meshtastic)](https://github.com/meshtastic/rust/blob/main/LICENSE)\n\n## Installation\n\nYou can add this crate to your project using the following command:\n\n```shell\ncargo add meshtastic\n```\n\nAlternatively, you can clone this repository to your own working directory:\n\n```shell\ngit clone https://github.com/meshtastic/rust.git\n```\n\nRecursively clone our Git submodules by running:\n\n```shell\ngit submodule update --init\n```\n\n## Usage\n\nThis crate provides basic TCP and serial connection examples within the `/examples` directory. You can run\nthese examples using the following commands:\n\n```bash\ncargo run --example basic_tcp\ncargo run --example basic_serial\n```\n\n### TCP Example\n\nThis example requires a Meshtastic with an exposed IP port, or a simulated radio via the Meshtastic Docker instance ([see here](https://meshtastic.org/docs/software/linux-native#usage-with-docker)).\n\n```rust\n/// This example connects to a TCP port on the radio, and prints out all received packets.\n/// This can be used with a simulated radio via the Meshtastic Docker firmware image.\n/// https://meshtastic.org/docs/software/linux-native#usage-with-docker\n\nuse std::io::{self, BufRead};\n\nuse meshtastic::api::StreamApi;\nuse meshtastic::utils;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let stream_api = StreamApi::new();\n\n    println!(\"Enter the address of a TCP port to connect to, in the form \\\"IP:PORT\\\":\");\n\n    let stdin = io::stdin();\n    let entered_address = stdin\n        .lock()\n        .lines()\n        .next()\n        .expect(\"Failed to find next line\")\n        .expect(\"Could not read next line\");\n\n    let tcp_stream = utils::stream::build_tcp_stream(entered_address).await?;\n    let (mut decoded_listener, stream_api) = stream_api.connect(tcp_stream).await;\n\n    let config_id = utils::generate_rand_id();\n    let stream_api = stream_api.configure(config_id).await?;\n\n    // This loop can be broken with ctrl+c, or by unpowering the radio.\n    while let Some(decoded) = decoded_listener.recv().await {\n        println!(\"Received: {:?}\", decoded);\n    }\n\n    // Note that in this specific example, this will only be called when\n    // the radio is disconnected, as the above loop will never exit.\n    // Typically you would allow the user to manually kill the loop,\n    // for example with tokio::select!.\n    let _stream_api = stream_api.disconnect().await?;\n\n    Ok(())\n}\n```\n\n### Serial Example\n\nThis example requires a powered and flashed Meshtastic radio connected to the host machine via a USB serial port.\n\n```rust\n/// This example connects to a radio via serial, and prints out all received packets.\n/// This example requires a powered and flashed Meshtastic radio.\n/// https://meshtastic.org/docs/supported-hardware\n\nuse std::io::{self, BufRead};\n\nuse meshtastic::api::StreamApi;\nuse meshtastic::utils;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let stream_api = StreamApi::new();\n\n    let available_ports = utils::stream::available_serial_ports()?;\n    println!(\"Available ports: {:?}\", available_ports);\n    println!(\"Enter the name of a port to connect to:\");\n\n    let stdin = io::stdin();\n    let entered_port = stdin\n        .lock()\n        .lines()\n        .next()\n        .expect(\"Failed to find next line\")\n        .expect(\"Could not read next line\");\n\n    let serial_stream = utils::stream::build_serial_stream(entered_port, None, None, None)?;\n    let (mut decoded_listener, stream_api) = stream_api.connect(serial_stream).await;\n\n    let config_id = utils::generate_rand_id();\n    let stream_api = stream_api.configure(config_id).await?;\n\n    // This loop can be broken with ctrl+c, or by disconnecting\n    // the attached serial port.\n    while let Some(decoded) = decoded_listener.recv().await {\n        println!(\"Received: {:?}\", decoded);\n    }\n\n    // Note that in this specific example, this will only be called when\n    // the radio is disconnected, as the above loop will never exit.\n    // Typically you would allow the user to manually kill the loop,\n    // for example with tokio::select!.\n    let _stream_api = stream_api.disconnect().await?;\n\n    Ok(())\n}\n```\n\n## Stats\n\n![Alt](https://repobeats.axiom.co/api/embed/18c638d36dc51fd03acfe5c2e52979ad67b04bc9.svg \"Repobeats analytics image\")\n\n## Contributing\n\nContributions are welcome! If you find a bug or want to propose a new feature, please open an issue or submit a pull request.\n\n## License\n\nThis project is licensed under the GPL-3.0 License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeshtastic%2Frust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeshtastic%2Frust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeshtastic%2Frust/lists"}