#command #builder #at #no-std

no-std at-commands

AT Commands builder and parser for Rust #![no_std]

11 releases

0.5.5 Sep 26, 2024
0.5.4 Sep 18, 2023
0.5.3 Nov 9, 2022
0.5.2 Jul 27, 2022
0.2.1 May 20, 2020

#118 in Hardware support

Download history 167/week @ 2024-08-23 114/week @ 2024-08-30 70/week @ 2024-09-06 165/week @ 2024-09-13 265/week @ 2024-09-20 181/week @ 2024-09-27 98/week @ 2024-10-04 97/week @ 2024-10-11 143/week @ 2024-10-18 90/week @ 2024-10-25 133/week @ 2024-11-01 75/week @ 2024-11-08 75/week @ 2024-11-15 153/week @ 2024-11-22 174/week @ 2024-11-29 111/week @ 2024-12-06

519 downloads per month
Used in 6 crates

MIT/Apache

49KB
1K SLoC

AT Commands builder and parser for Rust #![no_std] crates.io Documentation

This crate can be used to build and parse at command style messages efficiently.

Help would be appreciated! Interested in new features, efficiency improvements and API improvements.

Usage

Builder:

use at_commands::builder::CommandBuilder;

let mut buffer = [0; 128];

// Make a query command
let result = CommandBuilder::create_query(&mut buffer, true)
    .named("+MYQUERY")
    .finish()
    .unwrap();

// Buffer now contains "AT+MYQUERY?"
// Copy or DMA the resulting slice to the device.

// Make a set command
let result = CommandBuilder::create_set(&mut buffer, false)
    .named("+MYSET")
    .with_int_parameter(42)
    .finish()
    .unwrap();

// Buffer now contains "+MYSET=42"
// Copy or DMA the resulting slice to the device.

Parser:

use at_commands::parser::CommandParser;

let (x, y, z) = CommandParser::parse(b"+SYSGPIOREAD:654,\"true\",-65154\r\nOK\r\n")
    .expect_identifier(b"+SYSGPIOREAD:")
    .expect_int_parameter()
    .expect_string_parameter()
    .expect_int_parameter()
    .expect_identifier(b"\r\nOK\r\n")
    .finish() 
    .unwrap();

// x = 654
// y = "true"
// z = -65154

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~160KB