mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
Merge pull request #2330 from embassy-rs/embassy-net-esp-hosted-docs
Embassy net esp hosted docs
This commit is contained in:
commit
49005e955d
@ -2,6 +2,10 @@
|
||||
name = "embassy-net-esp-hosted"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "embassy-net driver for ESP-Hosted"
|
||||
keywords = ["embedded", "esp-hosted", "embassy-net", "embedded-hal-async", "wifi", "async"]
|
||||
categories = ["embedded", "hardware-support", "no-std", "network-programming", "async"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
defmt = { version = "0.3", optional = true }
|
||||
|
27
embassy-net-esp-hosted/README.md
Normal file
27
embassy-net-esp-hosted/README.md
Normal file
@ -0,0 +1,27 @@
|
||||
# ESP-Hosted `embassy-net` integration
|
||||
|
||||
[`embassy-net`](https://crates.io/crates/embassy-net) integration for Espressif SoCs running the the ESP-Hosted stack.
|
||||
|
||||
See [`examples`](https://github.com/embassy-rs/embassy/tree/main/examples/nrf52840) directory for usage examples with the nRF52840.
|
||||
|
||||
## Supported chips
|
||||
|
||||
- W5500
|
||||
- W5100S
|
||||
|
||||
## Interoperability
|
||||
|
||||
This crate can run on any executor.
|
||||
|
||||
It supports any SPI driver implementing [`embedded-hal-async`](https://crates.io/crates/embedded-hal-async).
|
||||
|
||||
|
||||
## License
|
||||
|
||||
This work is licensed under either of
|
||||
|
||||
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
http://www.apache.org/licenses/LICENSE-2.0)
|
||||
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
@ -5,38 +5,54 @@ use heapless::String;
|
||||
use crate::ioctl::Shared;
|
||||
use crate::proto::{self, CtrlMsg};
|
||||
|
||||
/// Errors reported by control.
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub enum Error {
|
||||
/// The operation failed with the given error code.
|
||||
Failed(u32),
|
||||
/// The operation timed out.
|
||||
Timeout,
|
||||
/// Internal error.
|
||||
Internal,
|
||||
}
|
||||
|
||||
/// Handle for managing the network and WiFI state.
|
||||
pub struct Control<'a> {
|
||||
state_ch: ch::StateRunner<'a>,
|
||||
shared: &'a Shared,
|
||||
}
|
||||
|
||||
/// WiFi mode.
|
||||
#[allow(unused)]
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
enum WifiMode {
|
||||
/// No mode.
|
||||
None = 0,
|
||||
/// Client station.
|
||||
Sta = 1,
|
||||
/// Access point mode.
|
||||
Ap = 2,
|
||||
/// Repeater mode.
|
||||
ApSta = 3,
|
||||
}
|
||||
|
||||
pub use proto::CtrlWifiSecProt as Security;
|
||||
|
||||
/// WiFi status.
|
||||
#[derive(Clone, Debug)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct Status {
|
||||
/// Service Set Identifier.
|
||||
pub ssid: String<32>,
|
||||
/// Basic Service Set Identifier.
|
||||
pub bssid: [u8; 6],
|
||||
/// Received Signal Strength Indicator.
|
||||
pub rssi: i32,
|
||||
/// WiFi channel.
|
||||
pub channel: u32,
|
||||
/// Security mode.
|
||||
pub security: Security,
|
||||
}
|
||||
|
||||
@ -65,6 +81,7 @@ impl<'a> Control<'a> {
|
||||
Self { state_ch, shared }
|
||||
}
|
||||
|
||||
/// Initialize device.
|
||||
pub async fn init(&mut self) -> Result<(), Error> {
|
||||
debug!("wait for init event...");
|
||||
self.shared.init_wait().await;
|
||||
@ -82,6 +99,7 @@ impl<'a> Control<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get the current status.
|
||||
pub async fn get_status(&mut self) -> Result<Status, Error> {
|
||||
let req = proto::CtrlMsgReqGetApConfig {};
|
||||
ioctl!(self, ReqGetApConfig, RespGetApConfig, req, resp);
|
||||
@ -95,6 +113,7 @@ impl<'a> Control<'a> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Connect to the network identified by ssid using the provided password.
|
||||
pub async fn connect(&mut self, ssid: &str, password: &str) -> Result<(), Error> {
|
||||
let req = proto::CtrlMsgReqConnectAp {
|
||||
ssid: unwrap!(String::try_from(ssid)),
|
||||
@ -108,6 +127,7 @@ impl<'a> Control<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Disconnect from any currently connected network.
|
||||
pub async fn disconnect(&mut self) -> Result<(), Error> {
|
||||
let req = proto::CtrlMsgReqGetStatus {};
|
||||
ioctl!(self, ReqDisconnectAp, RespDisconnectAp, req, resp);
|
||||
|
@ -1,4 +1,6 @@
|
||||
#![no_std]
|
||||
#![doc = include_str!("../README.md")]
|
||||
#![warn(missing_docs)]
|
||||
|
||||
use embassy_futures::select::{select4, Either4};
|
||||
use embassy_net_driver_channel as ch;
|
||||
@ -97,12 +99,14 @@ enum InterfaceType {
|
||||
const MAX_SPI_BUFFER_SIZE: usize = 1600;
|
||||
const HEARTBEAT_MAX_GAP: Duration = Duration::from_secs(20);
|
||||
|
||||
/// State for the esp-hosted driver.
|
||||
pub struct State {
|
||||
shared: Shared,
|
||||
ch: ch::State<MTU, 4, 4>,
|
||||
}
|
||||
|
||||
impl State {
|
||||
/// Create a new state.
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
shared: Shared::new(),
|
||||
@ -111,8 +115,13 @@ impl State {
|
||||
}
|
||||
}
|
||||
|
||||
/// Type alias for network driver.
|
||||
pub type NetDriver<'a> = ch::Device<'a, MTU>;
|
||||
|
||||
/// Create a new esp-hosted driver using the provided state, SPI peripheral and pins.
|
||||
///
|
||||
/// Returns a device handle for interfacing with embassy-net, a control handle for
|
||||
/// interacting with the driver, and a runner for communicating with the WiFi device.
|
||||
pub async fn new<'a, SPI, IN, OUT>(
|
||||
state: &'a mut State,
|
||||
spi: SPI,
|
||||
@ -144,6 +153,7 @@ where
|
||||
(device, Control::new(state_ch, &state.shared), runner)
|
||||
}
|
||||
|
||||
/// Runner for communicating with the WiFi device.
|
||||
pub struct Runner<'a, SPI, IN, OUT> {
|
||||
ch: ch::Runner<'a, MTU>,
|
||||
state_ch: ch::StateRunner<'a>,
|
||||
@ -166,6 +176,7 @@ where
|
||||
{
|
||||
async fn init(&mut self) {}
|
||||
|
||||
/// Run the packet processing.
|
||||
pub async fn run(mut self) -> ! {
|
||||
debug!("resetting...");
|
||||
self.reset.set_low().unwrap();
|
||||
|
@ -4,7 +4,7 @@ use heapless::{String, Vec};
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct ScanResult {
|
||||
pub(crate) struct ScanResult {
|
||||
#[noproto(tag = "1")]
|
||||
pub ssid: String<32>,
|
||||
#[noproto(tag = "2")]
|
||||
@ -19,7 +19,7 @@ pub struct ScanResult {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct ConnectedStaList {
|
||||
pub(crate) struct ConnectedStaList {
|
||||
#[noproto(tag = "1")]
|
||||
pub mac: String<32>,
|
||||
#[noproto(tag = "2")]
|
||||
@ -29,14 +29,14 @@ pub struct ConnectedStaList {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqGetMacAddress {
|
||||
pub(crate) struct CtrlMsgReqGetMacAddress {
|
||||
#[noproto(tag = "1")]
|
||||
pub mode: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespGetMacAddress {
|
||||
pub(crate) struct CtrlMsgRespGetMacAddress {
|
||||
#[noproto(tag = "1")]
|
||||
pub mac: String<32>,
|
||||
#[noproto(tag = "2")]
|
||||
@ -45,11 +45,11 @@ pub struct CtrlMsgRespGetMacAddress {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqGetMode {}
|
||||
pub(crate) struct CtrlMsgReqGetMode {}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespGetMode {
|
||||
pub(crate) struct CtrlMsgRespGetMode {
|
||||
#[noproto(tag = "1")]
|
||||
pub mode: u32,
|
||||
#[noproto(tag = "2")]
|
||||
@ -58,32 +58,32 @@ pub struct CtrlMsgRespGetMode {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqSetMode {
|
||||
pub(crate) struct CtrlMsgReqSetMode {
|
||||
#[noproto(tag = "1")]
|
||||
pub mode: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespSetMode {
|
||||
pub(crate) struct CtrlMsgRespSetMode {
|
||||
#[noproto(tag = "1")]
|
||||
pub resp: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqGetStatus {}
|
||||
pub(crate) struct CtrlMsgReqGetStatus {}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespGetStatus {
|
||||
pub(crate) struct CtrlMsgRespGetStatus {
|
||||
#[noproto(tag = "1")]
|
||||
pub resp: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqSetMacAddress {
|
||||
pub(crate) struct CtrlMsgReqSetMacAddress {
|
||||
#[noproto(tag = "1")]
|
||||
pub mac: String<32>,
|
||||
#[noproto(tag = "2")]
|
||||
@ -92,18 +92,18 @@ pub struct CtrlMsgReqSetMacAddress {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespSetMacAddress {
|
||||
pub(crate) struct CtrlMsgRespSetMacAddress {
|
||||
#[noproto(tag = "1")]
|
||||
pub resp: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqGetApConfig {}
|
||||
pub(crate) struct CtrlMsgReqGetApConfig {}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespGetApConfig {
|
||||
pub(crate) struct CtrlMsgRespGetApConfig {
|
||||
#[noproto(tag = "1")]
|
||||
pub ssid: String<32>,
|
||||
#[noproto(tag = "2")]
|
||||
@ -120,7 +120,7 @@ pub struct CtrlMsgRespGetApConfig {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqConnectAp {
|
||||
pub(crate) struct CtrlMsgReqConnectAp {
|
||||
#[noproto(tag = "1")]
|
||||
pub ssid: String<32>,
|
||||
#[noproto(tag = "2")]
|
||||
@ -135,7 +135,7 @@ pub struct CtrlMsgReqConnectAp {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespConnectAp {
|
||||
pub(crate) struct CtrlMsgRespConnectAp {
|
||||
#[noproto(tag = "1")]
|
||||
pub resp: u32,
|
||||
#[noproto(tag = "2")]
|
||||
@ -144,11 +144,11 @@ pub struct CtrlMsgRespConnectAp {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqGetSoftApConfig {}
|
||||
pub(crate) struct CtrlMsgReqGetSoftApConfig {}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespGetSoftApConfig {
|
||||
pub(crate) struct CtrlMsgRespGetSoftApConfig {
|
||||
#[noproto(tag = "1")]
|
||||
pub ssid: String<32>,
|
||||
#[noproto(tag = "2")]
|
||||
@ -169,7 +169,7 @@ pub struct CtrlMsgRespGetSoftApConfig {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqStartSoftAp {
|
||||
pub(crate) struct CtrlMsgReqStartSoftAp {
|
||||
#[noproto(tag = "1")]
|
||||
pub ssid: String<32>,
|
||||
#[noproto(tag = "2")]
|
||||
@ -188,7 +188,7 @@ pub struct CtrlMsgReqStartSoftAp {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespStartSoftAp {
|
||||
pub(crate) struct CtrlMsgRespStartSoftAp {
|
||||
#[noproto(tag = "1")]
|
||||
pub resp: u32,
|
||||
#[noproto(tag = "2")]
|
||||
@ -197,11 +197,11 @@ pub struct CtrlMsgRespStartSoftAp {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqScanResult {}
|
||||
pub(crate) struct CtrlMsgReqScanResult {}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespScanResult {
|
||||
pub(crate) struct CtrlMsgRespScanResult {
|
||||
#[noproto(tag = "1")]
|
||||
pub count: u32,
|
||||
#[noproto(repeated, tag = "2")]
|
||||
@ -212,11 +212,11 @@ pub struct CtrlMsgRespScanResult {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqSoftApConnectedSta {}
|
||||
pub(crate) struct CtrlMsgReqSoftApConnectedSta {}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespSoftApConnectedSta {
|
||||
pub(crate) struct CtrlMsgRespSoftApConnectedSta {
|
||||
#[noproto(tag = "1")]
|
||||
pub num: u32,
|
||||
#[noproto(repeated, tag = "2")]
|
||||
@ -227,43 +227,43 @@ pub struct CtrlMsgRespSoftApConnectedSta {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqOtaBegin {}
|
||||
pub(crate) struct CtrlMsgReqOtaBegin {}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespOtaBegin {
|
||||
pub(crate) struct CtrlMsgRespOtaBegin {
|
||||
#[noproto(tag = "1")]
|
||||
pub resp: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqOtaWrite {
|
||||
pub(crate) struct CtrlMsgReqOtaWrite {
|
||||
#[noproto(tag = "1")]
|
||||
pub ota_data: Vec<u8, 1024>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespOtaWrite {
|
||||
pub(crate) struct CtrlMsgRespOtaWrite {
|
||||
#[noproto(tag = "1")]
|
||||
pub resp: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqOtaEnd {}
|
||||
pub(crate) struct CtrlMsgReqOtaEnd {}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespOtaEnd {
|
||||
pub(crate) struct CtrlMsgRespOtaEnd {
|
||||
#[noproto(tag = "1")]
|
||||
pub resp: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqVendorIeData {
|
||||
pub(crate) struct CtrlMsgReqVendorIeData {
|
||||
#[noproto(tag = "1")]
|
||||
pub element_id: u32,
|
||||
#[noproto(tag = "2")]
|
||||
@ -278,7 +278,7 @@ pub struct CtrlMsgReqVendorIeData {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqSetSoftApVendorSpecificIe {
|
||||
pub(crate) struct CtrlMsgReqSetSoftApVendorSpecificIe {
|
||||
#[noproto(tag = "1")]
|
||||
pub enable: bool,
|
||||
#[noproto(tag = "2")]
|
||||
@ -291,32 +291,32 @@ pub struct CtrlMsgReqSetSoftApVendorSpecificIe {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespSetSoftApVendorSpecificIe {
|
||||
pub(crate) struct CtrlMsgRespSetSoftApVendorSpecificIe {
|
||||
#[noproto(tag = "1")]
|
||||
pub resp: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqSetWifiMaxTxPower {
|
||||
pub(crate) struct CtrlMsgReqSetWifiMaxTxPower {
|
||||
#[noproto(tag = "1")]
|
||||
pub wifi_max_tx_power: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespSetWifiMaxTxPower {
|
||||
pub(crate) struct CtrlMsgRespSetWifiMaxTxPower {
|
||||
#[noproto(tag = "1")]
|
||||
pub resp: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqGetWifiCurrTxPower {}
|
||||
pub(crate) struct CtrlMsgReqGetWifiCurrTxPower {}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespGetWifiCurrTxPower {
|
||||
pub(crate) struct CtrlMsgRespGetWifiCurrTxPower {
|
||||
#[noproto(tag = "1")]
|
||||
pub wifi_curr_tx_power: u32,
|
||||
#[noproto(tag = "2")]
|
||||
@ -325,7 +325,7 @@ pub struct CtrlMsgRespGetWifiCurrTxPower {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgReqConfigHeartbeat {
|
||||
pub(crate) struct CtrlMsgReqConfigHeartbeat {
|
||||
#[noproto(tag = "1")]
|
||||
pub enable: bool,
|
||||
#[noproto(tag = "2")]
|
||||
@ -334,7 +334,7 @@ pub struct CtrlMsgReqConfigHeartbeat {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgRespConfigHeartbeat {
|
||||
pub(crate) struct CtrlMsgRespConfigHeartbeat {
|
||||
#[noproto(tag = "1")]
|
||||
pub resp: u32,
|
||||
}
|
||||
@ -342,28 +342,28 @@ pub struct CtrlMsgRespConfigHeartbeat {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgEventEspInit {
|
||||
pub(crate) struct CtrlMsgEventEspInit {
|
||||
#[noproto(tag = "1")]
|
||||
pub init_data: Vec<u8, 64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgEventHeartbeat {
|
||||
pub(crate) struct CtrlMsgEventHeartbeat {
|
||||
#[noproto(tag = "1")]
|
||||
pub hb_num: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgEventStationDisconnectFromAp {
|
||||
pub(crate) struct CtrlMsgEventStationDisconnectFromAp {
|
||||
#[noproto(tag = "1")]
|
||||
pub resp: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsgEventStationDisconnectFromEspSoftAp {
|
||||
pub(crate) struct CtrlMsgEventStationDisconnectFromEspSoftAp {
|
||||
#[noproto(tag = "1")]
|
||||
pub resp: u32,
|
||||
#[noproto(tag = "2")]
|
||||
@ -372,7 +372,7 @@ pub struct CtrlMsgEventStationDisconnectFromEspSoftAp {
|
||||
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct CtrlMsg {
|
||||
pub(crate) struct CtrlMsg {
|
||||
/// msg_type could be req, resp or Event
|
||||
#[noproto(tag = "1")]
|
||||
pub msg_type: CtrlMsgType,
|
||||
@ -390,7 +390,7 @@ pub struct CtrlMsg {
|
||||
/// union of all msg ids
|
||||
#[derive(Debug, Clone, Eq, PartialEq, noproto::Oneof)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub enum CtrlMsgPayload {
|
||||
pub(crate) enum CtrlMsgPayload {
|
||||
/// * Requests *
|
||||
#[noproto(tag = "101")]
|
||||
ReqGetMacAddress(CtrlMsgReqGetMacAddress),
|
||||
@ -492,7 +492,7 @@ pub enum CtrlMsgPayload {
|
||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||
#[repr(u32)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub enum CtrlVendorIeType {
|
||||
pub(crate) enum CtrlVendorIeType {
|
||||
#[default]
|
||||
Beacon = 0,
|
||||
ProbeReq = 1,
|
||||
@ -504,7 +504,7 @@ pub enum CtrlVendorIeType {
|
||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||
#[repr(u32)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub enum CtrlVendorIeid {
|
||||
pub(crate) enum CtrlVendorIeid {
|
||||
#[default]
|
||||
Id0 = 0,
|
||||
Id1 = 1,
|
||||
@ -513,7 +513,7 @@ pub enum CtrlVendorIeid {
|
||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||
#[repr(u32)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub enum CtrlWifiMode {
|
||||
pub(crate) enum CtrlWifiMode {
|
||||
#[default]
|
||||
None = 0,
|
||||
Sta = 1,
|
||||
@ -524,7 +524,7 @@ pub enum CtrlWifiMode {
|
||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||
#[repr(u32)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub enum CtrlWifiBw {
|
||||
pub(crate) enum CtrlWifiBw {
|
||||
#[default]
|
||||
BwInvalid = 0,
|
||||
Ht20 = 1,
|
||||
@ -534,13 +534,15 @@ pub enum CtrlWifiBw {
|
||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||
#[repr(u32)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub enum CtrlWifiPowerSave {
|
||||
pub(crate) enum CtrlWifiPowerSave {
|
||||
#[default]
|
||||
PsInvalid = 0,
|
||||
MinModem = 1,
|
||||
MaxModem = 2,
|
||||
}
|
||||
|
||||
/// Wifi Security Settings
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||
#[repr(u32)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
@ -560,7 +562,7 @@ pub enum CtrlWifiSecProt {
|
||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||
#[repr(u32)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub enum CtrlStatus {
|
||||
pub(crate) enum CtrlStatus {
|
||||
#[default]
|
||||
Connected = 0,
|
||||
NotConnected = 1,
|
||||
@ -573,7 +575,7 @@ pub enum CtrlStatus {
|
||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||
#[repr(u32)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub enum CtrlMsgType {
|
||||
pub(crate) enum CtrlMsgType {
|
||||
#[default]
|
||||
MsgTypeInvalid = 0,
|
||||
Req = 1,
|
||||
@ -585,7 +587,7 @@ pub enum CtrlMsgType {
|
||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||
#[repr(u32)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub enum CtrlMsgId {
|
||||
pub(crate) enum CtrlMsgId {
|
||||
#[default]
|
||||
MsgIdInvalid = 0,
|
||||
/// * Request Msgs *
|
||||
|
Loading…
Reference in New Issue
Block a user