Skip to content

Embedded network layer for ESP-AT modems

License

MIT and 2 other licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

atlas-aero/rt-esp-at-nal

no_std ESP-AT network layer

License License Crates.io Actions Status

Network layer implementation/client for ESP-AT implementing embedded-nal based on ATAT.

Currently, this crates offers the following features

Example

Here's a simple example using a mocked AtClient:

use std::str::FromStr;
use embedded_nal::{SocketAddr, TcpClientStack};
use esp_at_nal::example::ExampleTimer;
use esp_at_nal::wifi::{Adapter, WifiAdapter};
use crate::esp_at_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

Development

Any form of support is greatly appreciated. Feel free to create issues and PRs. See DEVELOPMENT for more details.

License

Licensed under either of

Each contributor agrees that his/her contribution covers both licenses.