Crates.io | esp-at-nal |
lib.rs | esp-at-nal |
version | 0.3.0 |
source | src |
created_at | 2022-10-07 21:35:05.908215 |
updated_at | 2024-02-08 14:02:21.725115 |
description | Network layer client for ESP-AT modems |
homepage | |
repository | https://github.com/pegasus-aero/rt-esp-at-nal |
max_upload_size | |
id | 683078 |
size | 191,925 |
Network layer implementation/client for ESP-AT implementing embedded-nal based on ATAT.
Currently, this crates offers the following features
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
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.