Network layer implementation/client for ESP-AT implementing embedded-nal based on ATAT.
Currently, this crates offers the following features * Joining an WIFI access point, s. wifi module * TCP client stack (multi socket), s. stack module
Here's a simple example using a mocked AtClient:
````rust use std::str::FromStr; use embeddednal::{SocketAddr, TcpClientStack}; use espatnal::example::ExampleTimer; use espatnal::wifi::{Adapter, WifiAdapter}; use crate::espat_nal::example::ExampleAtClient as AtClient;
let client = AtClient::default(); // Creating adapter with 1024 bytes TX and 256 RX block size let mut adapter: Adapter<_, _, 1_000_000, 1024, 256> = Adapter::new(client, ExampleTimer::default());
// Joining WIFI access point let state = adapter.join("test_wifi", "secret").unwrap(); assert!(state.connected);
// Creating a TCP connection let mut socket = adapter.socket().unwrap(); adapter.connect(&mut socket, SocketAddr::from_str("10.0.0.1:21").unwrap()).unwrap();
// Sending some data adapter.send(&mut socket, b"hallo!").unwrap(); ````
To see a real-world example that runs on Linux, check out examples/linux.rs
:
# For logging
export RUST_LOG=trace
cargo run --example linux --features "atat/log" -- \
/dev/ttyUSB0 115200 mywifi hellopasswd123
Any form of support is greatly appreciated. Feel free to create issues and PRs. See DEVELOPMENT for more details.
Licensed under either of
Each contributor agrees that his/her contribution covers both licenses.