macro_rules! at_response {
($size:expr, $at_resp:expr; $a1:expr) => { ... };
($size:expr, $at_resp:expr; $a1:expr, $a2:expr) => { ... };
($size:expr, $at_resp:expr; $a1:expr, $a2:expr, $a3:expr) => { ... };
($size:expr, $at_resp:expr; $a1:expr, $a2:expr, $a3:expr, $a4:expr) => { ... };
($size:expr, $at_resp:expr; $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr) => { ... };
($size:expr, $at_resp:expr; $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr, $a6:expr) => { ... };
}Expand description
Macro to format an AT response with 1–6 comma-separated parameters.
Constructs an osal_rs::utils::Bytes buffer by formatting the given
prefix string (AT_RESP) followed by the arguments separated by commas.
§Syntax
ⓘ
at_response!(SIZE, AT_RESP; arg1, arg2, ..., arg6)SIZE—const usizefor the response buffer capacity (must match the capacity used by the surroundingAtContextimpl)AT_RESP— the AT response prefix string literal (e.g."+ECHO: ")arg1..arg6— values to append, comma-separated; any type implementingcore::fmt::Displayis accepted, includingat_quoted!expressions
§Examples
use at_parser_rs::at_response;
const SIZE: usize = 64;
// Single boolean argument
let resp = at_response!(SIZE, "+ECHO: "; 1u8);
// buffer: "+ECHO: 1"
// Two arguments (state and brightness)
let resp = at_response!(SIZE, "+LED: "; 1u8, 75u8);
// buffer: "+LED: 1,75"
// Three arguments
let resp = at_response!(SIZE, "+NET: "; "192.168.1.1", 8080u16, 1u8);
// buffer: "+NET: 192.168.1.1,8080,1"Using at_quoted! inside the response:
use at_parser_rs::{at_response, at_quoted};
const SIZE: usize = 64;
let ssid = "MyNetwork";
let resp = at_response!(SIZE, "+WIFI: "; at_quoted!(ssid), -70i8);
// buffer: +WIFI: "MyNetwork",-70