aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2023-12-20 12:44:11 +0000
committerGitHub <[email protected]>2023-12-20 12:44:11 +0000
commit49005e955dbaa8fd951943dbfcd8c1d9a219badd (patch)
treedb06733542591b3a414ff18cb166ea0b79ac980a
parent70ea805af3fa80f815cbd2f1170b7488da0e52fe (diff)
parent93bb34d8d1304a87ba62017834f4be848a1757e5 (diff)
Merge pull request #2330 from embassy-rs/embassy-net-esp-hosted-docs
Embassy net esp hosted docs
-rw-r--r--embassy-net-esp-hosted/Cargo.toml4
-rw-r--r--embassy-net-esp-hosted/README.md27
-rw-r--r--embassy-net-esp-hosted/src/control.rs20
-rw-r--r--embassy-net-esp-hosted/src/lib.rs11
-rw-r--r--embassy-net-esp-hosted/src/proto.rs108
5 files changed, 117 insertions, 53 deletions
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 @@
2name = "embassy-net-esp-hosted" 2name = "embassy-net-esp-hosted"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5description = "embassy-net driver for ESP-Hosted"
6keywords = ["embedded", "esp-hosted", "embassy-net", "embedded-hal-async", "wifi", "async"]
7categories = ["embedded", "hardware-support", "no-std", "network-programming", "async"]
8license = "MIT OR Apache-2.0"
5 9
6[dependencies] 10[dependencies]
7defmt = { version = "0.3", optional = true } 11defmt = { 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 @@
1# ESP-Hosted `embassy-net` integration
2
3[`embassy-net`](https://crates.io/crates/embassy-net) integration for Espressif SoCs running the the ESP-Hosted stack.
4
5See [`examples`](https://github.com/embassy-rs/embassy/tree/main/examples/nrf52840) directory for usage examples with the nRF52840.
6
7## Supported chips
8
9- W5500
10- W5100S
11
12## Interoperability
13
14This crate can run on any executor.
15
16It supports any SPI driver implementing [`embedded-hal-async`](https://crates.io/crates/embedded-hal-async).
17
18
19## License
20
21This work is licensed under either of
22
23- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
24 http://www.apache.org/licenses/LICENSE-2.0)
25- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
26
27at your option.
diff --git a/embassy-net-esp-hosted/src/control.rs b/embassy-net-esp-hosted/src/control.rs
index c86891bc3..c8cea8503 100644
--- a/embassy-net-esp-hosted/src/control.rs
+++ b/embassy-net-esp-hosted/src/control.rs
@@ -5,38 +5,54 @@ use heapless::String;
5use crate::ioctl::Shared; 5use crate::ioctl::Shared;
6use crate::proto::{self, CtrlMsg}; 6use crate::proto::{self, CtrlMsg};
7 7
8/// Errors reported by control.
8#[derive(Copy, Clone, PartialEq, Eq, Debug)] 9#[derive(Copy, Clone, PartialEq, Eq, Debug)]
9#[cfg_attr(feature = "defmt", derive(defmt::Format))] 10#[cfg_attr(feature = "defmt", derive(defmt::Format))]
10pub enum Error { 11pub enum Error {
12 /// The operation failed with the given error code.
11 Failed(u32), 13 Failed(u32),
14 /// The operation timed out.
12 Timeout, 15 Timeout,
16 /// Internal error.
13 Internal, 17 Internal,
14} 18}
15 19
20/// Handle for managing the network and WiFI state.
16pub struct Control<'a> { 21pub struct Control<'a> {
17 state_ch: ch::StateRunner<'a>, 22 state_ch: ch::StateRunner<'a>,
18 shared: &'a Shared, 23 shared: &'a Shared,
19} 24}
20 25
26/// WiFi mode.
21#[allow(unused)] 27#[allow(unused)]
22#[derive(Copy, Clone, PartialEq, Eq, Debug)] 28#[derive(Copy, Clone, PartialEq, Eq, Debug)]
23#[cfg_attr(feature = "defmt", derive(defmt::Format))] 29#[cfg_attr(feature = "defmt", derive(defmt::Format))]
24enum WifiMode { 30enum WifiMode {
31 /// No mode.
25 None = 0, 32 None = 0,
33 /// Client station.
26 Sta = 1, 34 Sta = 1,
35 /// Access point mode.
27 Ap = 2, 36 Ap = 2,
37 /// Repeater mode.
28 ApSta = 3, 38 ApSta = 3,
29} 39}
30 40
31pub use proto::CtrlWifiSecProt as Security; 41pub use proto::CtrlWifiSecProt as Security;
32 42
43/// WiFi status.
33#[derive(Clone, Debug)] 44#[derive(Clone, Debug)]
34#[cfg_attr(feature = "defmt", derive(defmt::Format))] 45#[cfg_attr(feature = "defmt", derive(defmt::Format))]
35pub struct Status { 46pub struct Status {
47 /// Service Set Identifier.
36 pub ssid: String<32>, 48 pub ssid: String<32>,
49 /// Basic Service Set Identifier.
37 pub bssid: [u8; 6], 50 pub bssid: [u8; 6],
51 /// Received Signal Strength Indicator.
38 pub rssi: i32, 52 pub rssi: i32,
53 /// WiFi channel.
39 pub channel: u32, 54 pub channel: u32,
55 /// Security mode.
40 pub security: Security, 56 pub security: Security,
41} 57}
42 58
@@ -65,6 +81,7 @@ impl<'a> Control<'a> {
65 Self { state_ch, shared } 81 Self { state_ch, shared }
66 } 82 }
67 83
84 /// Initialize device.
68 pub async fn init(&mut self) -> Result<(), Error> { 85 pub async fn init(&mut self) -> Result<(), Error> {
69 debug!("wait for init event..."); 86 debug!("wait for init event...");
70 self.shared.init_wait().await; 87 self.shared.init_wait().await;
@@ -82,6 +99,7 @@ impl<'a> Control<'a> {
82 Ok(()) 99 Ok(())
83 } 100 }
84 101
102 /// Get the current status.
85 pub async fn get_status(&mut self) -> Result<Status, Error> { 103 pub async fn get_status(&mut self) -> Result<Status, Error> {
86 let req = proto::CtrlMsgReqGetApConfig {}; 104 let req = proto::CtrlMsgReqGetApConfig {};
87 ioctl!(self, ReqGetApConfig, RespGetApConfig, req, resp); 105 ioctl!(self, ReqGetApConfig, RespGetApConfig, req, resp);
@@ -95,6 +113,7 @@ impl<'a> Control<'a> {
95 }) 113 })
96 } 114 }
97 115
116 /// Connect to the network identified by ssid using the provided password.
98 pub async fn connect(&mut self, ssid: &str, password: &str) -> Result<(), Error> { 117 pub async fn connect(&mut self, ssid: &str, password: &str) -> Result<(), Error> {
99 let req = proto::CtrlMsgReqConnectAp { 118 let req = proto::CtrlMsgReqConnectAp {
100 ssid: unwrap!(String::try_from(ssid)), 119 ssid: unwrap!(String::try_from(ssid)),
@@ -108,6 +127,7 @@ impl<'a> Control<'a> {
108 Ok(()) 127 Ok(())
109 } 128 }
110 129
130 /// Disconnect from any currently connected network.
111 pub async fn disconnect(&mut self) -> Result<(), Error> { 131 pub async fn disconnect(&mut self) -> Result<(), Error> {
112 let req = proto::CtrlMsgReqGetStatus {}; 132 let req = proto::CtrlMsgReqGetStatus {};
113 ioctl!(self, ReqDisconnectAp, RespDisconnectAp, req, resp); 133 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..c78578bf1 100644
--- a/embassy-net-esp-hosted/src/lib.rs
+++ b/embassy-net-esp-hosted/src/lib.rs
@@ -1,4 +1,6 @@
1#![no_std] 1#![no_std]
2#![doc = include_str!("../README.md")]
3#![warn(missing_docs)]
2 4
3use embassy_futures::select::{select4, Either4}; 5use embassy_futures::select::{select4, Either4};
4use embassy_net_driver_channel as ch; 6use embassy_net_driver_channel as ch;
@@ -97,12 +99,14 @@ enum InterfaceType {
97const MAX_SPI_BUFFER_SIZE: usize = 1600; 99const MAX_SPI_BUFFER_SIZE: usize = 1600;
98const HEARTBEAT_MAX_GAP: Duration = Duration::from_secs(20); 100const HEARTBEAT_MAX_GAP: Duration = Duration::from_secs(20);
99 101
102/// State for the esp-hosted driver.
100pub struct State { 103pub struct State {
101 shared: Shared, 104 shared: Shared,
102 ch: ch::State<MTU, 4, 4>, 105 ch: ch::State<MTU, 4, 4>,
103} 106}
104 107
105impl State { 108impl State {
109 /// Create a new state.
106 pub fn new() -> Self { 110 pub fn new() -> Self {
107 Self { 111 Self {
108 shared: Shared::new(), 112 shared: Shared::new(),
@@ -111,8 +115,13 @@ impl State {
111 } 115 }
112} 116}
113 117
118/// Type alias for network driver.
114pub type NetDriver<'a> = ch::Device<'a, MTU>; 119pub type NetDriver<'a> = ch::Device<'a, MTU>;
115 120
121/// Create a new esp-hosted driver using the provided state, SPI peripheral and pins.
122///
123/// Returns a device handle for interfacing with embassy-net, a control handle for
124/// interacting with the driver, and a runner for communicating with the WiFi device.
116pub async fn new<'a, SPI, IN, OUT>( 125pub async fn new<'a, SPI, IN, OUT>(
117 state: &'a mut State, 126 state: &'a mut State,
118 spi: SPI, 127 spi: SPI,
@@ -144,6 +153,7 @@ where
144 (device, Control::new(state_ch, &state.shared), runner) 153 (device, Control::new(state_ch, &state.shared), runner)
145} 154}
146 155
156/// Runner for communicating with the WiFi device.
147pub struct Runner<'a, SPI, IN, OUT> { 157pub struct Runner<'a, SPI, IN, OUT> {
148 ch: ch::Runner<'a, MTU>, 158 ch: ch::Runner<'a, MTU>,
149 state_ch: ch::StateRunner<'a>, 159 state_ch: ch::StateRunner<'a>,
@@ -166,6 +176,7 @@ where
166{ 176{
167 async fn init(&mut self) {} 177 async fn init(&mut self) {}
168 178
179 /// Run the packet processing.
169 pub async fn run(mut self) -> ! { 180 pub async fn run(mut self) -> ! {
170 debug!("resetting..."); 181 debug!("resetting...");
171 self.reset.set_low().unwrap(); 182 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..034d5bf84 100644
--- a/embassy-net-esp-hosted/src/proto.rs
+++ b/embassy-net-esp-hosted/src/proto.rs
@@ -4,7 +4,7 @@ use heapless::{String, Vec};
4 4
5#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 5#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))] 6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7pub struct ScanResult { 7pub(crate) struct ScanResult {
8 #[noproto(tag = "1")] 8 #[noproto(tag = "1")]
9 pub ssid: String<32>, 9 pub ssid: String<32>,
10 #[noproto(tag = "2")] 10 #[noproto(tag = "2")]
@@ -19,7 +19,7 @@ pub struct ScanResult {
19 19
20#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 20#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
21#[cfg_attr(feature = "defmt", derive(defmt::Format))] 21#[cfg_attr(feature = "defmt", derive(defmt::Format))]
22pub struct ConnectedStaList { 22pub(crate) struct ConnectedStaList {
23 #[noproto(tag = "1")] 23 #[noproto(tag = "1")]
24 pub mac: String<32>, 24 pub mac: String<32>,
25 #[noproto(tag = "2")] 25 #[noproto(tag = "2")]
@@ -29,14 +29,14 @@ pub struct ConnectedStaList {
29 29
30#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 30#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
31#[cfg_attr(feature = "defmt", derive(defmt::Format))] 31#[cfg_attr(feature = "defmt", derive(defmt::Format))]
32pub struct CtrlMsgReqGetMacAddress { 32pub(crate) struct CtrlMsgReqGetMacAddress {
33 #[noproto(tag = "1")] 33 #[noproto(tag = "1")]
34 pub mode: u32, 34 pub mode: u32,
35} 35}
36 36
37#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 37#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
38#[cfg_attr(feature = "defmt", derive(defmt::Format))] 38#[cfg_attr(feature = "defmt", derive(defmt::Format))]
39pub struct CtrlMsgRespGetMacAddress { 39pub(crate) struct CtrlMsgRespGetMacAddress {
40 #[noproto(tag = "1")] 40 #[noproto(tag = "1")]
41 pub mac: String<32>, 41 pub mac: String<32>,
42 #[noproto(tag = "2")] 42 #[noproto(tag = "2")]
@@ -45,11 +45,11 @@ pub struct CtrlMsgRespGetMacAddress {
45 45
46#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 46#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
47#[cfg_attr(feature = "defmt", derive(defmt::Format))] 47#[cfg_attr(feature = "defmt", derive(defmt::Format))]
48pub struct CtrlMsgReqGetMode {} 48pub(crate) struct CtrlMsgReqGetMode {}
49 49
50#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 50#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
51#[cfg_attr(feature = "defmt", derive(defmt::Format))] 51#[cfg_attr(feature = "defmt", derive(defmt::Format))]
52pub struct CtrlMsgRespGetMode { 52pub(crate) struct CtrlMsgRespGetMode {
53 #[noproto(tag = "1")] 53 #[noproto(tag = "1")]
54 pub mode: u32, 54 pub mode: u32,
55 #[noproto(tag = "2")] 55 #[noproto(tag = "2")]
@@ -58,32 +58,32 @@ pub struct CtrlMsgRespGetMode {
58 58
59#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 59#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))] 60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61pub struct CtrlMsgReqSetMode { 61pub(crate) struct CtrlMsgReqSetMode {
62 #[noproto(tag = "1")] 62 #[noproto(tag = "1")]
63 pub mode: u32, 63 pub mode: u32,
64} 64}
65 65
66#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 66#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
67#[cfg_attr(feature = "defmt", derive(defmt::Format))] 67#[cfg_attr(feature = "defmt", derive(defmt::Format))]
68pub struct CtrlMsgRespSetMode { 68pub(crate) struct CtrlMsgRespSetMode {
69 #[noproto(tag = "1")] 69 #[noproto(tag = "1")]
70 pub resp: u32, 70 pub resp: u32,
71} 71}
72 72
73#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 73#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
74#[cfg_attr(feature = "defmt", derive(defmt::Format))] 74#[cfg_attr(feature = "defmt", derive(defmt::Format))]
75pub struct CtrlMsgReqGetStatus {} 75pub(crate) struct CtrlMsgReqGetStatus {}
76 76
77#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 77#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
78#[cfg_attr(feature = "defmt", derive(defmt::Format))] 78#[cfg_attr(feature = "defmt", derive(defmt::Format))]
79pub struct CtrlMsgRespGetStatus { 79pub(crate) struct CtrlMsgRespGetStatus {
80 #[noproto(tag = "1")] 80 #[noproto(tag = "1")]
81 pub resp: u32, 81 pub resp: u32,
82} 82}
83 83
84#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 84#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
85#[cfg_attr(feature = "defmt", derive(defmt::Format))] 85#[cfg_attr(feature = "defmt", derive(defmt::Format))]
86pub struct CtrlMsgReqSetMacAddress { 86pub(crate) struct CtrlMsgReqSetMacAddress {
87 #[noproto(tag = "1")] 87 #[noproto(tag = "1")]
88 pub mac: String<32>, 88 pub mac: String<32>,
89 #[noproto(tag = "2")] 89 #[noproto(tag = "2")]
@@ -92,18 +92,18 @@ pub struct CtrlMsgReqSetMacAddress {
92 92
93#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 93#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
94#[cfg_attr(feature = "defmt", derive(defmt::Format))] 94#[cfg_attr(feature = "defmt", derive(defmt::Format))]
95pub struct CtrlMsgRespSetMacAddress { 95pub(crate) struct CtrlMsgRespSetMacAddress {
96 #[noproto(tag = "1")] 96 #[noproto(tag = "1")]
97 pub resp: u32, 97 pub resp: u32,
98} 98}
99 99
100#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 100#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
101#[cfg_attr(feature = "defmt", derive(defmt::Format))] 101#[cfg_attr(feature = "defmt", derive(defmt::Format))]
102pub struct CtrlMsgReqGetApConfig {} 102pub(crate) struct CtrlMsgReqGetApConfig {}
103 103
104#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 104#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
105#[cfg_attr(feature = "defmt", derive(defmt::Format))] 105#[cfg_attr(feature = "defmt", derive(defmt::Format))]
106pub struct CtrlMsgRespGetApConfig { 106pub(crate) struct CtrlMsgRespGetApConfig {
107 #[noproto(tag = "1")] 107 #[noproto(tag = "1")]
108 pub ssid: String<32>, 108 pub ssid: String<32>,
109 #[noproto(tag = "2")] 109 #[noproto(tag = "2")]
@@ -120,7 +120,7 @@ pub struct CtrlMsgRespGetApConfig {
120 120
121#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 121#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
122#[cfg_attr(feature = "defmt", derive(defmt::Format))] 122#[cfg_attr(feature = "defmt", derive(defmt::Format))]
123pub struct CtrlMsgReqConnectAp { 123pub(crate) struct CtrlMsgReqConnectAp {
124 #[noproto(tag = "1")] 124 #[noproto(tag = "1")]
125 pub ssid: String<32>, 125 pub ssid: String<32>,
126 #[noproto(tag = "2")] 126 #[noproto(tag = "2")]
@@ -135,7 +135,7 @@ pub struct CtrlMsgReqConnectAp {
135 135
136#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 136#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
137#[cfg_attr(feature = "defmt", derive(defmt::Format))] 137#[cfg_attr(feature = "defmt", derive(defmt::Format))]
138pub struct CtrlMsgRespConnectAp { 138pub(crate) struct CtrlMsgRespConnectAp {
139 #[noproto(tag = "1")] 139 #[noproto(tag = "1")]
140 pub resp: u32, 140 pub resp: u32,
141 #[noproto(tag = "2")] 141 #[noproto(tag = "2")]
@@ -144,11 +144,11 @@ pub struct CtrlMsgRespConnectAp {
144 144
145#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 145#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
146#[cfg_attr(feature = "defmt", derive(defmt::Format))] 146#[cfg_attr(feature = "defmt", derive(defmt::Format))]
147pub struct CtrlMsgReqGetSoftApConfig {} 147pub(crate) struct CtrlMsgReqGetSoftApConfig {}
148 148
149#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 149#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
150#[cfg_attr(feature = "defmt", derive(defmt::Format))] 150#[cfg_attr(feature = "defmt", derive(defmt::Format))]
151pub struct CtrlMsgRespGetSoftApConfig { 151pub(crate) struct CtrlMsgRespGetSoftApConfig {
152 #[noproto(tag = "1")] 152 #[noproto(tag = "1")]
153 pub ssid: String<32>, 153 pub ssid: String<32>,
154 #[noproto(tag = "2")] 154 #[noproto(tag = "2")]
@@ -169,7 +169,7 @@ pub struct CtrlMsgRespGetSoftApConfig {
169 169
170#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 170#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
171#[cfg_attr(feature = "defmt", derive(defmt::Format))] 171#[cfg_attr(feature = "defmt", derive(defmt::Format))]
172pub struct CtrlMsgReqStartSoftAp { 172pub(crate) struct CtrlMsgReqStartSoftAp {
173 #[noproto(tag = "1")] 173 #[noproto(tag = "1")]
174 pub ssid: String<32>, 174 pub ssid: String<32>,
175 #[noproto(tag = "2")] 175 #[noproto(tag = "2")]
@@ -188,7 +188,7 @@ pub struct CtrlMsgReqStartSoftAp {
188 188
189#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 189#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
190#[cfg_attr(feature = "defmt", derive(defmt::Format))] 190#[cfg_attr(feature = "defmt", derive(defmt::Format))]
191pub struct CtrlMsgRespStartSoftAp { 191pub(crate) struct CtrlMsgRespStartSoftAp {
192 #[noproto(tag = "1")] 192 #[noproto(tag = "1")]
193 pub resp: u32, 193 pub resp: u32,
194 #[noproto(tag = "2")] 194 #[noproto(tag = "2")]
@@ -197,11 +197,11 @@ pub struct CtrlMsgRespStartSoftAp {
197 197
198#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 198#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
199#[cfg_attr(feature = "defmt", derive(defmt::Format))] 199#[cfg_attr(feature = "defmt", derive(defmt::Format))]
200pub struct CtrlMsgReqScanResult {} 200pub(crate) struct CtrlMsgReqScanResult {}
201 201
202#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 202#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
203#[cfg_attr(feature = "defmt", derive(defmt::Format))] 203#[cfg_attr(feature = "defmt", derive(defmt::Format))]
204pub struct CtrlMsgRespScanResult { 204pub(crate) struct CtrlMsgRespScanResult {
205 #[noproto(tag = "1")] 205 #[noproto(tag = "1")]
206 pub count: u32, 206 pub count: u32,
207 #[noproto(repeated, tag = "2")] 207 #[noproto(repeated, tag = "2")]
@@ -212,11 +212,11 @@ pub struct CtrlMsgRespScanResult {
212 212
213#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 213#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
214#[cfg_attr(feature = "defmt", derive(defmt::Format))] 214#[cfg_attr(feature = "defmt", derive(defmt::Format))]
215pub struct CtrlMsgReqSoftApConnectedSta {} 215pub(crate) struct CtrlMsgReqSoftApConnectedSta {}
216 216
217#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 217#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
218#[cfg_attr(feature = "defmt", derive(defmt::Format))] 218#[cfg_attr(feature = "defmt", derive(defmt::Format))]
219pub struct CtrlMsgRespSoftApConnectedSta { 219pub(crate) struct CtrlMsgRespSoftApConnectedSta {
220 #[noproto(tag = "1")] 220 #[noproto(tag = "1")]
221 pub num: u32, 221 pub num: u32,
222 #[noproto(repeated, tag = "2")] 222 #[noproto(repeated, tag = "2")]
@@ -227,43 +227,43 @@ pub struct CtrlMsgRespSoftApConnectedSta {
227 227
228#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 228#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
229#[cfg_attr(feature = "defmt", derive(defmt::Format))] 229#[cfg_attr(feature = "defmt", derive(defmt::Format))]
230pub struct CtrlMsgReqOtaBegin {} 230pub(crate) struct CtrlMsgReqOtaBegin {}
231 231
232#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 232#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
233#[cfg_attr(feature = "defmt", derive(defmt::Format))] 233#[cfg_attr(feature = "defmt", derive(defmt::Format))]
234pub struct CtrlMsgRespOtaBegin { 234pub(crate) struct CtrlMsgRespOtaBegin {
235 #[noproto(tag = "1")] 235 #[noproto(tag = "1")]
236 pub resp: u32, 236 pub resp: u32,
237} 237}
238 238
239#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 239#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
240#[cfg_attr(feature = "defmt", derive(defmt::Format))] 240#[cfg_attr(feature = "defmt", derive(defmt::Format))]
241pub struct CtrlMsgReqOtaWrite { 241pub(crate) struct CtrlMsgReqOtaWrite {
242 #[noproto(tag = "1")] 242 #[noproto(tag = "1")]
243 pub ota_data: Vec<u8, 1024>, 243 pub ota_data: Vec<u8, 1024>,
244} 244}
245 245
246#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 246#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
247#[cfg_attr(feature = "defmt", derive(defmt::Format))] 247#[cfg_attr(feature = "defmt", derive(defmt::Format))]
248pub struct CtrlMsgRespOtaWrite { 248pub(crate) struct CtrlMsgRespOtaWrite {
249 #[noproto(tag = "1")] 249 #[noproto(tag = "1")]
250 pub resp: u32, 250 pub resp: u32,
251} 251}
252 252
253#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 253#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
254#[cfg_attr(feature = "defmt", derive(defmt::Format))] 254#[cfg_attr(feature = "defmt", derive(defmt::Format))]
255pub struct CtrlMsgReqOtaEnd {} 255pub(crate) struct CtrlMsgReqOtaEnd {}
256 256
257#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 257#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
258#[cfg_attr(feature = "defmt", derive(defmt::Format))] 258#[cfg_attr(feature = "defmt", derive(defmt::Format))]
259pub struct CtrlMsgRespOtaEnd { 259pub(crate) struct CtrlMsgRespOtaEnd {
260 #[noproto(tag = "1")] 260 #[noproto(tag = "1")]
261 pub resp: u32, 261 pub resp: u32,
262} 262}
263 263
264#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 264#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
265#[cfg_attr(feature = "defmt", derive(defmt::Format))] 265#[cfg_attr(feature = "defmt", derive(defmt::Format))]
266pub struct CtrlMsgReqVendorIeData { 266pub(crate) struct CtrlMsgReqVendorIeData {
267 #[noproto(tag = "1")] 267 #[noproto(tag = "1")]
268 pub element_id: u32, 268 pub element_id: u32,
269 #[noproto(tag = "2")] 269 #[noproto(tag = "2")]
@@ -278,7 +278,7 @@ pub struct CtrlMsgReqVendorIeData {
278 278
279#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 279#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
280#[cfg_attr(feature = "defmt", derive(defmt::Format))] 280#[cfg_attr(feature = "defmt", derive(defmt::Format))]
281pub struct CtrlMsgReqSetSoftApVendorSpecificIe { 281pub(crate) struct CtrlMsgReqSetSoftApVendorSpecificIe {
282 #[noproto(tag = "1")] 282 #[noproto(tag = "1")]
283 pub enable: bool, 283 pub enable: bool,
284 #[noproto(tag = "2")] 284 #[noproto(tag = "2")]
@@ -291,32 +291,32 @@ pub struct CtrlMsgReqSetSoftApVendorSpecificIe {
291 291
292#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 292#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
293#[cfg_attr(feature = "defmt", derive(defmt::Format))] 293#[cfg_attr(feature = "defmt", derive(defmt::Format))]
294pub struct CtrlMsgRespSetSoftApVendorSpecificIe { 294pub(crate) struct CtrlMsgRespSetSoftApVendorSpecificIe {
295 #[noproto(tag = "1")] 295 #[noproto(tag = "1")]
296 pub resp: u32, 296 pub resp: u32,
297} 297}
298 298
299#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 299#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
300#[cfg_attr(feature = "defmt", derive(defmt::Format))] 300#[cfg_attr(feature = "defmt", derive(defmt::Format))]
301pub struct CtrlMsgReqSetWifiMaxTxPower { 301pub(crate) struct CtrlMsgReqSetWifiMaxTxPower {
302 #[noproto(tag = "1")] 302 #[noproto(tag = "1")]
303 pub wifi_max_tx_power: u32, 303 pub wifi_max_tx_power: u32,
304} 304}
305 305
306#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 306#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
307#[cfg_attr(feature = "defmt", derive(defmt::Format))] 307#[cfg_attr(feature = "defmt", derive(defmt::Format))]
308pub struct CtrlMsgRespSetWifiMaxTxPower { 308pub(crate) struct CtrlMsgRespSetWifiMaxTxPower {
309 #[noproto(tag = "1")] 309 #[noproto(tag = "1")]
310 pub resp: u32, 310 pub resp: u32,
311} 311}
312 312
313#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 313#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
314#[cfg_attr(feature = "defmt", derive(defmt::Format))] 314#[cfg_attr(feature = "defmt", derive(defmt::Format))]
315pub struct CtrlMsgReqGetWifiCurrTxPower {} 315pub(crate) struct CtrlMsgReqGetWifiCurrTxPower {}
316 316
317#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 317#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
318#[cfg_attr(feature = "defmt", derive(defmt::Format))] 318#[cfg_attr(feature = "defmt", derive(defmt::Format))]
319pub struct CtrlMsgRespGetWifiCurrTxPower { 319pub(crate) struct CtrlMsgRespGetWifiCurrTxPower {
320 #[noproto(tag = "1")] 320 #[noproto(tag = "1")]
321 pub wifi_curr_tx_power: u32, 321 pub wifi_curr_tx_power: u32,
322 #[noproto(tag = "2")] 322 #[noproto(tag = "2")]
@@ -325,7 +325,7 @@ pub struct CtrlMsgRespGetWifiCurrTxPower {
325 325
326#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 326#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
327#[cfg_attr(feature = "defmt", derive(defmt::Format))] 327#[cfg_attr(feature = "defmt", derive(defmt::Format))]
328pub struct CtrlMsgReqConfigHeartbeat { 328pub(crate) struct CtrlMsgReqConfigHeartbeat {
329 #[noproto(tag = "1")] 329 #[noproto(tag = "1")]
330 pub enable: bool, 330 pub enable: bool,
331 #[noproto(tag = "2")] 331 #[noproto(tag = "2")]
@@ -334,7 +334,7 @@ pub struct CtrlMsgReqConfigHeartbeat {
334 334
335#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 335#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
336#[cfg_attr(feature = "defmt", derive(defmt::Format))] 336#[cfg_attr(feature = "defmt", derive(defmt::Format))]
337pub struct CtrlMsgRespConfigHeartbeat { 337pub(crate) struct CtrlMsgRespConfigHeartbeat {
338 #[noproto(tag = "1")] 338 #[noproto(tag = "1")]
339 pub resp: u32, 339 pub resp: u32,
340} 340}
@@ -342,28 +342,28 @@ pub struct CtrlMsgRespConfigHeartbeat {
342 342
343#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 343#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
344#[cfg_attr(feature = "defmt", derive(defmt::Format))] 344#[cfg_attr(feature = "defmt", derive(defmt::Format))]
345pub struct CtrlMsgEventEspInit { 345pub(crate) struct CtrlMsgEventEspInit {
346 #[noproto(tag = "1")] 346 #[noproto(tag = "1")]
347 pub init_data: Vec<u8, 64>, 347 pub init_data: Vec<u8, 64>,
348} 348}
349 349
350#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 350#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
351#[cfg_attr(feature = "defmt", derive(defmt::Format))] 351#[cfg_attr(feature = "defmt", derive(defmt::Format))]
352pub struct CtrlMsgEventHeartbeat { 352pub(crate) struct CtrlMsgEventHeartbeat {
353 #[noproto(tag = "1")] 353 #[noproto(tag = "1")]
354 pub hb_num: u32, 354 pub hb_num: u32,
355} 355}
356 356
357#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 357#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
358#[cfg_attr(feature = "defmt", derive(defmt::Format))] 358#[cfg_attr(feature = "defmt", derive(defmt::Format))]
359pub struct CtrlMsgEventStationDisconnectFromAp { 359pub(crate) struct CtrlMsgEventStationDisconnectFromAp {
360 #[noproto(tag = "1")] 360 #[noproto(tag = "1")]
361 pub resp: u32, 361 pub resp: u32,
362} 362}
363 363
364#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 364#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
365#[cfg_attr(feature = "defmt", derive(defmt::Format))] 365#[cfg_attr(feature = "defmt", derive(defmt::Format))]
366pub struct CtrlMsgEventStationDisconnectFromEspSoftAp { 366pub(crate) struct CtrlMsgEventStationDisconnectFromEspSoftAp {
367 #[noproto(tag = "1")] 367 #[noproto(tag = "1")]
368 pub resp: u32, 368 pub resp: u32,
369 #[noproto(tag = "2")] 369 #[noproto(tag = "2")]
@@ -372,7 +372,7 @@ pub struct CtrlMsgEventStationDisconnectFromEspSoftAp {
372 372
373#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)] 373#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
374#[cfg_attr(feature = "defmt", derive(defmt::Format))] 374#[cfg_attr(feature = "defmt", derive(defmt::Format))]
375pub struct CtrlMsg { 375pub(crate) struct CtrlMsg {
376 /// msg_type could be req, resp or Event 376 /// msg_type could be req, resp or Event
377 #[noproto(tag = "1")] 377 #[noproto(tag = "1")]
378 pub msg_type: CtrlMsgType, 378 pub msg_type: CtrlMsgType,
@@ -390,7 +390,7 @@ pub struct CtrlMsg {
390/// union of all msg ids 390/// union of all msg ids
391#[derive(Debug, Clone, Eq, PartialEq, noproto::Oneof)] 391#[derive(Debug, Clone, Eq, PartialEq, noproto::Oneof)]
392#[cfg_attr(feature = "defmt", derive(defmt::Format))] 392#[cfg_attr(feature = "defmt", derive(defmt::Format))]
393pub enum CtrlMsgPayload { 393pub(crate) enum CtrlMsgPayload {
394 /// * Requests * 394 /// * Requests *
395 #[noproto(tag = "101")] 395 #[noproto(tag = "101")]
396 ReqGetMacAddress(CtrlMsgReqGetMacAddress), 396 ReqGetMacAddress(CtrlMsgReqGetMacAddress),
@@ -492,7 +492,7 @@ pub enum CtrlMsgPayload {
492#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)] 492#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
493#[repr(u32)] 493#[repr(u32)]
494#[cfg_attr(feature = "defmt", derive(defmt::Format))] 494#[cfg_attr(feature = "defmt", derive(defmt::Format))]
495pub enum CtrlVendorIeType { 495pub(crate) enum CtrlVendorIeType {
496 #[default] 496 #[default]
497 Beacon = 0, 497 Beacon = 0,
498 ProbeReq = 1, 498 ProbeReq = 1,
@@ -504,7 +504,7 @@ pub enum CtrlVendorIeType {
504#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)] 504#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
505#[repr(u32)] 505#[repr(u32)]
506#[cfg_attr(feature = "defmt", derive(defmt::Format))] 506#[cfg_attr(feature = "defmt", derive(defmt::Format))]
507pub enum CtrlVendorIeid { 507pub(crate) enum CtrlVendorIeid {
508 #[default] 508 #[default]
509 Id0 = 0, 509 Id0 = 0,
510 Id1 = 1, 510 Id1 = 1,
@@ -513,7 +513,7 @@ pub enum CtrlVendorIeid {
513#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)] 513#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
514#[repr(u32)] 514#[repr(u32)]
515#[cfg_attr(feature = "defmt", derive(defmt::Format))] 515#[cfg_attr(feature = "defmt", derive(defmt::Format))]
516pub enum CtrlWifiMode { 516pub(crate) enum CtrlWifiMode {
517 #[default] 517 #[default]
518 None = 0, 518 None = 0,
519 Sta = 1, 519 Sta = 1,
@@ -524,7 +524,7 @@ pub enum CtrlWifiMode {
524#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)] 524#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
525#[repr(u32)] 525#[repr(u32)]
526#[cfg_attr(feature = "defmt", derive(defmt::Format))] 526#[cfg_attr(feature = "defmt", derive(defmt::Format))]
527pub enum CtrlWifiBw { 527pub(crate) enum CtrlWifiBw {
528 #[default] 528 #[default]
529 BwInvalid = 0, 529 BwInvalid = 0,
530 Ht20 = 1, 530 Ht20 = 1,
@@ -534,13 +534,15 @@ pub enum CtrlWifiBw {
534#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)] 534#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
535#[repr(u32)] 535#[repr(u32)]
536#[cfg_attr(feature = "defmt", derive(defmt::Format))] 536#[cfg_attr(feature = "defmt", derive(defmt::Format))]
537pub enum CtrlWifiPowerSave { 537pub(crate) enum CtrlWifiPowerSave {
538 #[default] 538 #[default]
539 PsInvalid = 0, 539 PsInvalid = 0,
540 MinModem = 1, 540 MinModem = 1,
541 MaxModem = 2, 541 MaxModem = 2,
542} 542}
543 543
544/// Wifi Security Settings
545#[allow(missing_docs)]
544#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)] 546#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
545#[repr(u32)] 547#[repr(u32)]
546#[cfg_attr(feature = "defmt", derive(defmt::Format))] 548#[cfg_attr(feature = "defmt", derive(defmt::Format))]
@@ -560,7 +562,7 @@ pub enum CtrlWifiSecProt {
560#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)] 562#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
561#[repr(u32)] 563#[repr(u32)]
562#[cfg_attr(feature = "defmt", derive(defmt::Format))] 564#[cfg_attr(feature = "defmt", derive(defmt::Format))]
563pub enum CtrlStatus { 565pub(crate) enum CtrlStatus {
564 #[default] 566 #[default]
565 Connected = 0, 567 Connected = 0,
566 NotConnected = 1, 568 NotConnected = 1,
@@ -573,7 +575,7 @@ pub enum CtrlStatus {
573#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)] 575#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
574#[repr(u32)] 576#[repr(u32)]
575#[cfg_attr(feature = "defmt", derive(defmt::Format))] 577#[cfg_attr(feature = "defmt", derive(defmt::Format))]
576pub enum CtrlMsgType { 578pub(crate) enum CtrlMsgType {
577 #[default] 579 #[default]
578 MsgTypeInvalid = 0, 580 MsgTypeInvalid = 0,
579 Req = 1, 581 Req = 1,
@@ -585,7 +587,7 @@ pub enum CtrlMsgType {
585#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)] 587#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
586#[repr(u32)] 588#[repr(u32)]
587#[cfg_attr(feature = "defmt", derive(defmt::Format))] 589#[cfg_attr(feature = "defmt", derive(defmt::Format))]
588pub enum CtrlMsgId { 590pub(crate) enum CtrlMsgId {
589 #[default] 591 #[default]
590 MsgIdInvalid = 0, 592 MsgIdInvalid = 0,
591 /// * Request Msgs * 593 /// * Request Msgs *