at_parser_rs/
context.rs

1use crate::{Args, AtError, AtResult};
2
3/// Trait that defines the context for AT command execution.
4/// Implementations of this trait handle the actual logic for each AT command form.
5pub trait AtContext {
6
7    /// Execute command (AT+CMD)
8    /// This is called when a command is invoked without any suffix.
9    fn exec(&self) -> AtResult<'static> {
10        Err(AtError::NotSupported)
11    }
12
13    /// Query command (AT+CMD?)
14    /// This is called to retrieve the current value/state of a command.
15    fn query(&mut self) -> AtResult<'static> {
16        Err(AtError::NotSupported)
17    }
18    
19    /// Test command (AT+CMD=?)
20    /// This is called to check if a command is supported or to get valid parameter ranges.
21    fn test(&mut self) -> AtResult<'static> {
22        Err(AtError::NotSupported)
23    }
24
25    /// Set command (AT+CMD=args)
26    /// This is called to set parameters for a command.
27    fn set(&mut self, _args: Args) -> AtResult<'static> {
28        Err(AtError::NotSupported)
29    }
30
31}