Struct EspAt

Source
pub struct EspAt<S> { /* private fields */ }
Expand description

esp-at driver for ESP32, ESP8266, ESP8285.

Implementations§

Source§

impl<S, ER, EW> EspAt<S>
where S: Read<u8, Error = ER> + Write<u8, Error = EW>,

Source

pub fn new(serial: S) -> Self

Source

pub fn send_command(&mut self, cmd: &str) -> Result<(), EspAtError<ER, EW>>

Source

pub fn last_read(&self) -> &str

Source

pub fn read_response(&mut self) -> Result<&str, EspAtError<ER, EW>>

Source

pub fn skip_to_next(&mut self)

Source

pub fn echo_off(&mut self) -> Result<(), EspAtError<ER, EW>>

ATE0

Source

pub fn echo_on(&mut self) -> Result<(), EspAtError<ER, EW>>

ATE1

Source

pub fn ifconfig(&mut self) -> Result<(&str, &str, &str), EspAtError<ER, EW>>

(ip, gateway, netmask)

Source

pub fn iwconfig(&mut self) -> Result<(&str, &str, u8), EspAtError<ER, EW>>

,,,,<pci_en>,<reconn_interval>,<listen_interval>,<scan_mode>

Source

pub fn cwjap( &mut self, ssid: &str, password: &str, ) -> Result<(), EspAtError<ER, EW>>

Source

pub fn ping(&mut self, host: &str) -> Result<u32, EspAtError<ER, EW>>

AT+PING

Source

pub fn tcp_send( &mut self, host: &str, port: u16, buf: &[u8], ) -> Result<(), EspAtError<ER, EW>>

Source

pub fn connect_tcp( &mut self, host: &str, port: u16, ) -> Result<(), EspAtError<ER, EW>>

Source

pub fn send(&mut self, data: &[u8]) -> Result<(), EspAtError<ER, EW>>

AT+CIPSEND=x

Source

pub fn skip_read(&mut self) -> Result<(), EspAtError<ER, EW>>

Skip all possible data. Skip and send “AT”, if it returns OK, then all read data is received.

Source

pub fn read(&mut self) -> Result<&[u8], EspAtError<ER, EW>>

Read a packet

Source

pub fn close(&mut self) -> Result<(), EspAtError<ER, EW>>

AT+CIPCLOSE

Source

pub fn http_get(&mut self, url: &str) -> Result<&str, EspAtError<ER, EW>>

AT+HTTPCLIENT

Source

pub fn http_post( &mut self, url: &str, data: &str, ) -> Result<&str, EspAtError<ER, EW>>

Auto Trait Implementations§

§

impl<S> Freeze for EspAt<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for EspAt<S>
where S: RefUnwindSafe,

§

impl<S> Send for EspAt<S>
where S: Send,

§

impl<S> Sync for EspAt<S>
where S: Sync,

§

impl<S> Unpin for EspAt<S>
where S: Unpin,

§

impl<S> UnwindSafe for EspAt<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.