Struct atat::digest::AtDigester
source · pub struct AtDigester<P: Parser> { /* private fields */ }
Expand description
A Digester that tries to implement the basic AT standard. This digester should work for most usecases of ATAT.
Implements a request-response AT digester capable of working with or without AT echo enabled.
Buffer can contain (‘…’ meaning arbitrary data):
- ‘…AT<CMD>\r\r\n<RESPONSE>\r\n<RESPONSE CODE>\r\n…’ (Echo enabled)
- ‘…AT<CMD>\r\r\n<CMD>: <PARAMETERS>\r\n<RESPONSE CODE>\r\n…’ (Echo enabled)
- ‘…AT<CMD>\r\r\n<RESPONSE CODE>\r\n…’ (Echo enabled)
- ‘…<CMD>:<PARAMETERS>\r\n<RESPONSE CODE>\r\n…’ (Echo disabled)
- ‘…<RESPONSE>\r\n<RESPONSE CODE>\r\n…’ (Echo disabled)
- ‘…<URC>\r\n…’ (Unsolicited response code)
- ‘…<URC>:<PARAMETERS>\r\n…’ (Unsolicited response code)
- ‘…<PROMPT>’ (Prompt for data)
Goal of the digester is to extract these into:
DigestResult::Response(Result\<RESPONS
E>)DigestResult::Urc(\<UR
C>)DigestResult::Prompt(\<CHA
R>)DigestResult::None
Usually <RESPONSE CODE> is one of [‘OK’, ‘ERROR’, ‘CME ERROR: <NUMBER/STRING>’, ‘CMS ERROR: <NUMBER/STRING>’], but can be others as well depending on manufacturer.
Usually <PROMPT> can be one of [‘>’, ‘@’], and is command specific and only valid for few selected commands.
Implementations§
source§impl<P: Parser> AtDigester<P>
impl<P: Parser> AtDigester<P>
pub const fn new() -> Self
pub fn with_custom_success( self, f: fn(_: &[u8]) -> Result<(&[u8], usize), ParseError> ) -> Self
pub fn with_custom_error( self, f: fn(_: &[u8]) -> Result<(&[u8], usize), ParseError> ) -> Self
pub fn with_custom_prompt( self, f: fn(_: &[u8]) -> Result<(u8, usize), ParseError> ) -> Self
Trait Implementations§
source§impl<P: Parser> Default for AtDigester<P>
impl<P: Parser> Default for AtDigester<P>
Auto Trait Implementations§
impl<P> Freeze for AtDigester<P>
impl<P> RefUnwindSafe for AtDigester<P>where
P: RefUnwindSafe,
impl<P> Send for AtDigester<P>where
P: Send,
impl<P> Sync for AtDigester<P>where
P: Sync,
impl<P> Unpin for AtDigester<P>where
P: Unpin,
impl<P> UnwindSafe for AtDigester<P>where
P: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more