From abea4dde3d30388f8338985e323203d8792dabeb Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Wed, 20 Dec 2023 10:09:05 +0100 Subject: [PATCH 1/5] docs: document most of esp-hosted driver --- embassy-net-esp-hosted/src/control.rs | 17 +++++++++++++++++ embassy-net-esp-hosted/src/lib.rs | 9 +++++++++ embassy-net-esp-hosted/src/proto.rs | 2 ++ 3 files changed, 28 insertions(+) diff --git a/embassy-net-esp-hosted/src/control.rs b/embassy-net-esp-hosted/src/control.rs index c86891bc3..b141bd6d2 100644 --- a/embassy-net-esp-hosted/src/control.rs +++ b/embassy-net-esp-hosted/src/control.rs @@ -5,6 +5,7 @@ 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 { @@ -13,30 +14,42 @@ pub enum 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 +78,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 +96,7 @@ impl<'a> Control<'a> { Ok(()) } + /// Get the current status. pub async fn get_status(&mut self) -> Result { let req = proto::CtrlMsgReqGetApConfig {}; ioctl!(self, ReqGetApConfig, RespGetApConfig, req, resp); @@ -95,6 +110,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 +124,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); diff --git a/embassy-net-esp-hosted/src/lib.rs b/embassy-net-esp-hosted/src/lib.rs index d61eaef3a..ce7f39dc1 100644 --- a/embassy-net-esp-hosted/src/lib.rs +++ b/embassy-net-esp-hosted/src/lib.rs @@ -97,12 +97,14 @@ enum InterfaceType { const MAX_SPI_BUFFER_SIZE: usize = 1600; const HEARTBEAT_MAX_GAP: Duration = Duration::from_secs(20); +/// Shared driver state. pub struct State { shared: Shared, ch: ch::State, } impl State { + /// Shared state for the pub fn new() -> Self { Self { shared: Shared::new(), @@ -111,8 +113,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 +151,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 +174,7 @@ where { async fn init(&mut self) {} + /// Run the packet processing. pub async fn run(mut self) -> ! { debug!("resetting..."); self.reset.set_low().unwrap(); diff --git a/embassy-net-esp-hosted/src/proto.rs b/embassy-net-esp-hosted/src/proto.rs index 8ceb1579d..b42ff62f1 100644 --- a/embassy-net-esp-hosted/src/proto.rs +++ b/embassy-net-esp-hosted/src/proto.rs @@ -1,3 +1,5 @@ +#![allow(missing_docs)] + use heapless::{String, Vec}; /// internal supporting structures for CtrlMsg From 89cfdcb9f554c835d1228c1b9a191786d065df6a Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Wed, 20 Dec 2023 12:06:49 +0100 Subject: [PATCH 2/5] fix suddenly ending comment --- embassy-net-esp-hosted/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/embassy-net-esp-hosted/src/lib.rs b/embassy-net-esp-hosted/src/lib.rs index ce7f39dc1..a5e9ddb4f 100644 --- a/embassy-net-esp-hosted/src/lib.rs +++ b/embassy-net-esp-hosted/src/lib.rs @@ -97,14 +97,14 @@ enum InterfaceType { const MAX_SPI_BUFFER_SIZE: usize = 1600; const HEARTBEAT_MAX_GAP: Duration = Duration::from_secs(20); -/// Shared driver state. +/// State for the esp-hosted driver. pub struct State { shared: Shared, ch: ch::State, } impl State { - /// Shared state for the + /// Create a new state. pub fn new() -> Self { Self { shared: Shared::new(), From 4dfae9328e75ea5e7797b32b9c3a42f1babf6e35 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Wed, 20 Dec 2023 12:18:02 +0100 Subject: [PATCH 3/5] add missing guards --- embassy-net-esp-hosted/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/embassy-net-esp-hosted/src/lib.rs b/embassy-net-esp-hosted/src/lib.rs index a5e9ddb4f..c78578bf1 100644 --- a/embassy-net-esp-hosted/src/lib.rs +++ b/embassy-net-esp-hosted/src/lib.rs @@ -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; From c3b827d8cd66ed64e22987ca27cf16e371755227 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Wed, 20 Dec 2023 12:24:51 +0100 Subject: [PATCH 4/5] fix: add readme and fix remaining warnings --- embassy-net-esp-hosted/Cargo.toml | 4 ++++ embassy-net-esp-hosted/README.md | 27 +++++++++++++++++++++++++++ embassy-net-esp-hosted/src/control.rs | 3 +++ 3 files changed, 34 insertions(+) create mode 100644 embassy-net-esp-hosted/README.md diff --git a/embassy-net-esp-hosted/Cargo.toml b/embassy-net-esp-hosted/Cargo.toml index 70b1bbe2a..b051b37ad 100644 --- a/embassy-net-esp-hosted/Cargo.toml +++ b/embassy-net-esp-hosted/Cargo.toml @@ -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 } diff --git a/embassy-net-esp-hosted/README.md b/embassy-net-esp-hosted/README.md new file mode 100644 index 000000000..3c9cc4c9e --- /dev/null +++ b/embassy-net-esp-hosted/README.md @@ -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. diff --git a/embassy-net-esp-hosted/src/control.rs b/embassy-net-esp-hosted/src/control.rs index b141bd6d2..c8cea8503 100644 --- a/embassy-net-esp-hosted/src/control.rs +++ b/embassy-net-esp-hosted/src/control.rs @@ -9,8 +9,11 @@ use crate::proto::{self, CtrlMsg}; #[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, } From 93bb34d8d1304a87ba62017834f4be848a1757e5 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Wed, 20 Dec 2023 13:39:45 +0100 Subject: [PATCH 5/5] fix: expose less --- embassy-net-esp-hosted/src/proto.rs | 110 ++++++++++++++-------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/embassy-net-esp-hosted/src/proto.rs b/embassy-net-esp-hosted/src/proto.rs index b42ff62f1..034d5bf84 100644 --- a/embassy-net-esp-hosted/src/proto.rs +++ b/embassy-net-esp-hosted/src/proto.rs @@ -1,12 +1,10 @@ -#![allow(missing_docs)] - use heapless::{String, Vec}; /// internal supporting structures for CtrlMsg #[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")] @@ -21,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")] @@ -31,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")] @@ -47,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")] @@ -60,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")] @@ -94,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")] @@ -122,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")] @@ -137,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")] @@ -146,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")] @@ -171,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")] @@ -190,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")] @@ -199,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")] @@ -214,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")] @@ -229,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, } #[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")] @@ -280,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")] @@ -293,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")] @@ -327,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")] @@ -336,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, } @@ -344,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, } #[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")] @@ -374,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, @@ -392,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), @@ -494,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, @@ -506,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, @@ -515,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, @@ -526,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, @@ -536,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))] @@ -562,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, @@ -575,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, @@ -587,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 *