aboutsummaryrefslogtreecommitdiff
path: root/embassy-net-esp-hosted
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-06-21 18:13:19 +0200
committerDario Nieuwenhuis <[email protected]>2023-06-22 21:12:10 +0200
commitec2c095a76a0f55a031093e98a5283cff0daa576 (patch)
treeab4986ff6c3101c9a3d3860c728083b170eefa21 /embassy-net-esp-hosted
parent6c123596b7d48ee66ea93e8b1515e91231e9bced (diff)
esp-hosted: print events.
Diffstat (limited to 'embassy-net-esp-hosted')
-rw-r--r--embassy-net-esp-hosted/src/control.rs7
-rw-r--r--embassy-net-esp-hosted/src/ioctl.rs4
-rw-r--r--embassy-net-esp-hosted/src/lib.rs36
-rw-r--r--embassy-net-esp-hosted/src/proto.rs54
4 files changed, 90 insertions, 11 deletions
diff --git a/embassy-net-esp-hosted/src/control.rs b/embassy-net-esp-hosted/src/control.rs
index 2381c6b84..ec51933b3 100644
--- a/embassy-net-esp-hosted/src/control.rs
+++ b/embassy-net-esp-hosted/src/control.rs
@@ -112,6 +112,8 @@ impl<'a> Control<'a> {
112 } 112 }
113 113
114 async fn ioctl(&mut self, req: CtrlMsg) -> CtrlMsg { 114 async fn ioctl(&mut self, req: CtrlMsg) -> CtrlMsg {
115 debug!("ioctl req: {:?}", &req);
116
115 let mut buf = [0u8; 128]; 117 let mut buf = [0u8; 128];
116 118
117 let req_len = noproto::write(&req, &mut buf).unwrap(); 119 let req_len = noproto::write(&req, &mut buf).unwrap();
@@ -136,6 +138,9 @@ impl<'a> Control<'a> {
136 138
137 ioctl.defuse(); 139 ioctl.defuse();
138 140
139 noproto::read(&buf[..resp_len]).unwrap() 141 let res = noproto::read(&buf[..resp_len]).unwrap();
142 debug!("ioctl resp: {:?}", &res);
143
144 res
140 } 145 }
141} 146}
diff --git a/embassy-net-esp-hosted/src/ioctl.rs b/embassy-net-esp-hosted/src/ioctl.rs
index 59bdabf37..689dd2a88 100644
--- a/embassy-net-esp-hosted/src/ioctl.rs
+++ b/embassy-net-esp-hosted/src/ioctl.rs
@@ -94,7 +94,7 @@ impl IoctlState {
94 } 94 }
95 95
96 pub async fn do_ioctl(&self, buf: &mut [u8], req_len: usize) -> usize { 96 pub async fn do_ioctl(&self, buf: &mut [u8], req_len: usize) -> usize {
97 debug!("IOCTL Request: {:02x}", Bytes(&buf[..req_len])); 97 trace!("ioctl req bytes: {:02x}", Bytes(&buf[..req_len]));
98 98
99 self.state.set(IoctlStateInner::Pending(PendingIoctl { buf, req_len })); 99 self.state.set(IoctlStateInner::Pending(PendingIoctl { buf, req_len }));
100 self.wake_runner(); 100 self.wake_runner();
@@ -103,7 +103,7 @@ impl IoctlState {
103 103
104 pub fn ioctl_done(&self, response: &[u8]) { 104 pub fn ioctl_done(&self, response: &[u8]) {
105 if let IoctlStateInner::Sent { buf } = self.state.get() { 105 if let IoctlStateInner::Sent { buf } = self.state.get() {
106 debug!("IOCTL Response: {:02x}", Bytes(response)); 106 trace!("ioctl resp bytes: {:02x}", Bytes(response));
107 107
108 // TODO fix this 108 // TODO fix this
109 (unsafe { &mut *buf }[..response.len()]).copy_from_slice(response); 109 (unsafe { &mut *buf }[..response.len()]).copy_from_slice(response);
diff --git a/embassy-net-esp-hosted/src/lib.rs b/embassy-net-esp-hosted/src/lib.rs
index 2cf05a7df..084009966 100644
--- a/embassy-net-esp-hosted/src/lib.rs
+++ b/embassy-net-esp-hosted/src/lib.rs
@@ -8,6 +8,7 @@ use embedded_hal::digital::{InputPin, OutputPin};
8use embedded_hal_async::digital::Wait; 8use embedded_hal_async::digital::Wait;
9use embedded_hal_async::spi::SpiDevice; 9use embedded_hal_async::spi::SpiDevice;
10use ioctl::IoctlState; 10use ioctl::IoctlState;
11use proto::CtrlMsg;
11 12
12use crate::ioctl::PendingIoctl; 13use crate::ioctl::PendingIoctl;
13 14
@@ -194,8 +195,6 @@ where
194 tx_buf[0..12].copy_from_slice(&header.to_bytes()); 195 tx_buf[0..12].copy_from_slice(&header.to_bytes());
195 header.checksum = checksum(&tx_buf[..26 + req_len]); 196 header.checksum = checksum(&tx_buf[..26 + req_len]);
196 tx_buf[0..12].copy_from_slice(&header.to_bytes()); 197 tx_buf[0..12].copy_from_slice(&header.to_bytes());
197
198 debug!("====== SENDING IOCTL");
199 } 198 }
200 Either3::Second(packet) => { 199 Either3::Second(packet) => {
201 tx_buf[12..][..packet.len()].copy_from_slice(packet); 200 tx_buf[12..][..packet.len()].copy_from_slice(packet);
@@ -270,25 +269,46 @@ where
270 }, 269 },
271 // serial 270 // serial
272 2 => { 271 2 => {
273 debug!("serial rx: {:02x}", payload); 272 trace!("serial rx: {:02x}", payload);
274 if payload.len() < 14 { 273 if payload.len() < 14 {
275 warn!("serial rx: too short"); 274 warn!("serial rx: too short");
276 return; 275 return;
277 } 276 }
278 if &payload[..12] != b"\x01\x08\x00ctrlResp\x02" { 277
279 warn!("serial rx: bad tlv"); 278 let isEvent = match &payload[..12] {
280 return; 279 b"\x01\x08\x00ctrlResp\x02" => false,
281 } 280 b"\x01\x08\x00ctrlEvnt\x02" => true,
281 _ => {
282 warn!("serial rx: bad tlv");
283 return;
284 }
285 };
286
282 let len = u16::from_le_bytes(payload[12..14].try_into().unwrap()) as usize; 287 let len = u16::from_le_bytes(payload[12..14].try_into().unwrap()) as usize;
283 if payload.len() < 14 + len { 288 if payload.len() < 14 + len {
284 warn!("serial rx: too short 2"); 289 warn!("serial rx: too short 2");
285 return; 290 return;
286 } 291 }
287 self.ioctl_state.ioctl_done(&payload[14..][..len]); 292 let data = &payload[14..][..len];
293
294 if isEvent {
295 self.handle_event(data);
296 } else {
297 self.ioctl_state.ioctl_done(data);
298 }
288 } 299 }
289 _ => warn!("unknown iftype {}", if_type_and_num), 300 _ => warn!("unknown iftype {}", if_type_and_num),
290 } 301 }
291 } 302 }
303
304 fn handle_event(&self, data: &[u8]) {
305 let Ok(event) = noproto::read::<CtrlMsg>(data) else {
306 warn!("failed to parse event");
307 return
308 };
309
310 debug!("event: {:?}", &event);
311 }
292} 312}
293 313
294fn checksum(buf: &[u8]) -> u16 { 314fn checksum(buf: &[u8]) -> u16 {
diff --git a/embassy-net-esp-hosted/src/proto.rs b/embassy-net-esp-hosted/src/proto.rs
index e105e393c..8ceb1579d 100644
--- a/embassy-net-esp-hosted/src/proto.rs
+++ b/embassy-net-esp-hosted/src/proto.rs
@@ -3,6 +3,7 @@ use heapless::{String, Vec};
3/// internal supporting structures for CtrlMsg 3/// internal supporting structures for CtrlMsg
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))]
6pub struct ScanResult { 7pub struct ScanResult {
7 #[noproto(tag = "1")] 8 #[noproto(tag = "1")]
8 pub ssid: String<32>, 9 pub ssid: String<32>,
@@ -17,6 +18,7 @@ pub struct ScanResult {
17} 18}
18 19
19#[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))]
20pub struct ConnectedStaList { 22pub struct ConnectedStaList {
21 #[noproto(tag = "1")] 23 #[noproto(tag = "1")]
22 pub mac: String<32>, 24 pub mac: String<32>,
@@ -26,12 +28,14 @@ pub struct ConnectedStaList {
26/// * Req/Resp structure * 28/// * Req/Resp structure *
27 29
28#[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))]
29pub struct CtrlMsgReqGetMacAddress { 32pub struct CtrlMsgReqGetMacAddress {
30 #[noproto(tag = "1")] 33 #[noproto(tag = "1")]
31 pub mode: u32, 34 pub mode: u32,
32} 35}
33 36
34#[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))]
35pub struct CtrlMsgRespGetMacAddress { 39pub struct CtrlMsgRespGetMacAddress {
36 #[noproto(tag = "1")] 40 #[noproto(tag = "1")]
37 pub mac: String<32>, 41 pub mac: String<32>,
@@ -40,9 +44,11 @@ pub struct CtrlMsgRespGetMacAddress {
40} 44}
41 45
42#[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))]
43pub struct CtrlMsgReqGetMode {} 48pub struct CtrlMsgReqGetMode {}
44 49
45#[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))]
46pub struct CtrlMsgRespGetMode { 52pub struct CtrlMsgRespGetMode {
47 #[noproto(tag = "1")] 53 #[noproto(tag = "1")]
48 pub mode: u32, 54 pub mode: u32,
@@ -51,27 +57,32 @@ pub struct CtrlMsgRespGetMode {
51} 57}
52 58
53#[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))]
54pub struct CtrlMsgReqSetMode { 61pub struct CtrlMsgReqSetMode {
55 #[noproto(tag = "1")] 62 #[noproto(tag = "1")]
56 pub mode: u32, 63 pub mode: u32,
57} 64}
58 65
59#[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))]
60pub struct CtrlMsgRespSetMode { 68pub struct CtrlMsgRespSetMode {
61 #[noproto(tag = "1")] 69 #[noproto(tag = "1")]
62 pub resp: u32, 70 pub resp: u32,
63} 71}
64 72
65#[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))]
66pub struct CtrlMsgReqGetStatus {} 75pub struct CtrlMsgReqGetStatus {}
67 76
68#[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))]
69pub struct CtrlMsgRespGetStatus { 79pub struct CtrlMsgRespGetStatus {
70 #[noproto(tag = "1")] 80 #[noproto(tag = "1")]
71 pub resp: u32, 81 pub resp: u32,
72} 82}
73 83
74#[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))]
75pub struct CtrlMsgReqSetMacAddress { 86pub struct CtrlMsgReqSetMacAddress {
76 #[noproto(tag = "1")] 87 #[noproto(tag = "1")]
77 pub mac: String<32>, 88 pub mac: String<32>,
@@ -80,15 +91,18 @@ pub struct CtrlMsgReqSetMacAddress {
80} 91}
81 92
82#[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))]
83pub struct CtrlMsgRespSetMacAddress { 95pub struct CtrlMsgRespSetMacAddress {
84 #[noproto(tag = "1")] 96 #[noproto(tag = "1")]
85 pub resp: u32, 97 pub resp: u32,
86} 98}
87 99
88#[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))]
89pub struct CtrlMsgReqGetApConfig {} 102pub struct CtrlMsgReqGetApConfig {}
90 103
91#[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))]
92pub struct CtrlMsgRespGetApConfig { 106pub struct CtrlMsgRespGetApConfig {
93 #[noproto(tag = "1")] 107 #[noproto(tag = "1")]
94 pub ssid: String<32>, 108 pub ssid: String<32>,
@@ -105,6 +119,7 @@ pub struct CtrlMsgRespGetApConfig {
105} 119}
106 120
107#[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))]
108pub struct CtrlMsgReqConnectAp { 123pub struct CtrlMsgReqConnectAp {
109 #[noproto(tag = "1")] 124 #[noproto(tag = "1")]
110 pub ssid: String<32>, 125 pub ssid: String<32>,
@@ -119,6 +134,7 @@ pub struct CtrlMsgReqConnectAp {
119} 134}
120 135
121#[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))]
122pub struct CtrlMsgRespConnectAp { 138pub struct CtrlMsgRespConnectAp {
123 #[noproto(tag = "1")] 139 #[noproto(tag = "1")]
124 pub resp: u32, 140 pub resp: u32,
@@ -127,9 +143,11 @@ pub struct CtrlMsgRespConnectAp {
127} 143}
128 144
129#[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))]
130pub struct CtrlMsgReqGetSoftApConfig {} 147pub struct CtrlMsgReqGetSoftApConfig {}
131 148
132#[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))]
133pub struct CtrlMsgRespGetSoftApConfig { 151pub struct CtrlMsgRespGetSoftApConfig {
134 #[noproto(tag = "1")] 152 #[noproto(tag = "1")]
135 pub ssid: String<32>, 153 pub ssid: String<32>,
@@ -150,6 +168,7 @@ pub struct CtrlMsgRespGetSoftApConfig {
150} 168}
151 169
152#[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))]
153pub struct CtrlMsgReqStartSoftAp { 172pub struct CtrlMsgReqStartSoftAp {
154 #[noproto(tag = "1")] 173 #[noproto(tag = "1")]
155 pub ssid: String<32>, 174 pub ssid: String<32>,
@@ -168,6 +187,7 @@ pub struct CtrlMsgReqStartSoftAp {
168} 187}
169 188
170#[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))]
171pub struct CtrlMsgRespStartSoftAp { 191pub struct CtrlMsgRespStartSoftAp {
172 #[noproto(tag = "1")] 192 #[noproto(tag = "1")]
173 pub resp: u32, 193 pub resp: u32,
@@ -176,9 +196,11 @@ pub struct CtrlMsgRespStartSoftAp {
176} 196}
177 197
178#[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))]
179pub struct CtrlMsgReqScanResult {} 200pub struct CtrlMsgReqScanResult {}
180 201
181#[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))]
182pub struct CtrlMsgRespScanResult { 204pub struct CtrlMsgRespScanResult {
183 #[noproto(tag = "1")] 205 #[noproto(tag = "1")]
184 pub count: u32, 206 pub count: u32,
@@ -189,9 +211,11 @@ pub struct CtrlMsgRespScanResult {
189} 211}
190 212
191#[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))]
192pub struct CtrlMsgReqSoftApConnectedSta {} 215pub struct CtrlMsgReqSoftApConnectedSta {}
193 216
194#[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))]
195pub struct CtrlMsgRespSoftApConnectedSta { 219pub struct CtrlMsgRespSoftApConnectedSta {
196 #[noproto(tag = "1")] 220 #[noproto(tag = "1")]
197 pub num: u32, 221 pub num: u32,
@@ -202,36 +226,43 @@ pub struct CtrlMsgRespSoftApConnectedSta {
202} 226}
203 227
204#[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))]
205pub struct CtrlMsgReqOtaBegin {} 230pub struct CtrlMsgReqOtaBegin {}
206 231
207#[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))]
208pub struct CtrlMsgRespOtaBegin { 234pub struct CtrlMsgRespOtaBegin {
209 #[noproto(tag = "1")] 235 #[noproto(tag = "1")]
210 pub resp: u32, 236 pub resp: u32,
211} 237}
212 238
213#[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))]
214pub struct CtrlMsgReqOtaWrite { 241pub struct CtrlMsgReqOtaWrite {
215 #[noproto(tag = "1")] 242 #[noproto(tag = "1")]
216 pub ota_data: Vec<u8, 1024>, 243 pub ota_data: Vec<u8, 1024>,
217} 244}
218 245
219#[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))]
220pub struct CtrlMsgRespOtaWrite { 248pub struct CtrlMsgRespOtaWrite {
221 #[noproto(tag = "1")] 249 #[noproto(tag = "1")]
222 pub resp: u32, 250 pub resp: u32,
223} 251}
224 252
225#[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))]
226pub struct CtrlMsgReqOtaEnd {} 255pub struct CtrlMsgReqOtaEnd {}
227 256
228#[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))]
229pub struct CtrlMsgRespOtaEnd { 259pub struct CtrlMsgRespOtaEnd {
230 #[noproto(tag = "1")] 260 #[noproto(tag = "1")]
231 pub resp: u32, 261 pub resp: u32,
232} 262}
233 263
234#[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))]
235pub struct CtrlMsgReqVendorIeData { 266pub struct CtrlMsgReqVendorIeData {
236 #[noproto(tag = "1")] 267 #[noproto(tag = "1")]
237 pub element_id: u32, 268 pub element_id: u32,
@@ -246,6 +277,7 @@ pub struct CtrlMsgReqVendorIeData {
246} 277}
247 278
248#[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))]
249pub struct CtrlMsgReqSetSoftApVendorSpecificIe { 281pub struct CtrlMsgReqSetSoftApVendorSpecificIe {
250 #[noproto(tag = "1")] 282 #[noproto(tag = "1")]
251 pub enable: bool, 283 pub enable: bool,
@@ -258,27 +290,32 @@ pub struct CtrlMsgReqSetSoftApVendorSpecificIe {
258} 290}
259 291
260#[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))]
261pub struct CtrlMsgRespSetSoftApVendorSpecificIe { 294pub struct CtrlMsgRespSetSoftApVendorSpecificIe {
262 #[noproto(tag = "1")] 295 #[noproto(tag = "1")]
263 pub resp: u32, 296 pub resp: u32,
264} 297}
265 298
266#[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))]
267pub struct CtrlMsgReqSetWifiMaxTxPower { 301pub struct CtrlMsgReqSetWifiMaxTxPower {
268 #[noproto(tag = "1")] 302 #[noproto(tag = "1")]
269 pub wifi_max_tx_power: u32, 303 pub wifi_max_tx_power: u32,
270} 304}
271 305
272#[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))]
273pub struct CtrlMsgRespSetWifiMaxTxPower { 308pub struct CtrlMsgRespSetWifiMaxTxPower {
274 #[noproto(tag = "1")] 309 #[noproto(tag = "1")]
275 pub resp: u32, 310 pub resp: u32,
276} 311}
277 312
278#[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))]
279pub struct CtrlMsgReqGetWifiCurrTxPower {} 315pub struct CtrlMsgReqGetWifiCurrTxPower {}
280 316
281#[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))]
282pub struct CtrlMsgRespGetWifiCurrTxPower { 319pub struct CtrlMsgRespGetWifiCurrTxPower {
283 #[noproto(tag = "1")] 320 #[noproto(tag = "1")]
284 pub wifi_curr_tx_power: u32, 321 pub wifi_curr_tx_power: u32,
@@ -287,6 +324,7 @@ pub struct CtrlMsgRespGetWifiCurrTxPower {
287} 324}
288 325
289#[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))]
290pub struct CtrlMsgReqConfigHeartbeat { 328pub struct CtrlMsgReqConfigHeartbeat {
291 #[noproto(tag = "1")] 329 #[noproto(tag = "1")]
292 pub enable: bool, 330 pub enable: bool,
@@ -295,6 +333,7 @@ pub struct CtrlMsgReqConfigHeartbeat {
295} 333}
296 334
297#[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))]
298pub struct CtrlMsgRespConfigHeartbeat { 337pub struct CtrlMsgRespConfigHeartbeat {
299 #[noproto(tag = "1")] 338 #[noproto(tag = "1")]
300 pub resp: u32, 339 pub resp: u32,
@@ -302,24 +341,28 @@ pub struct CtrlMsgRespConfigHeartbeat {
302/// * Event structure * 341/// * Event structure *
303 342
304#[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))]
305pub struct CtrlMsgEventEspInit { 345pub struct CtrlMsgEventEspInit {
306 #[noproto(tag = "1")] 346 #[noproto(tag = "1")]
307 pub init_data: Vec<u8, 64>, 347 pub init_data: Vec<u8, 64>,
308} 348}
309 349
310#[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))]
311pub struct CtrlMsgEventHeartbeat { 352pub struct CtrlMsgEventHeartbeat {
312 #[noproto(tag = "1")] 353 #[noproto(tag = "1")]
313 pub hb_num: u32, 354 pub hb_num: u32,
314} 355}
315 356
316#[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))]
317pub struct CtrlMsgEventStationDisconnectFromAp { 359pub struct CtrlMsgEventStationDisconnectFromAp {
318 #[noproto(tag = "1")] 360 #[noproto(tag = "1")]
319 pub resp: u32, 361 pub resp: u32,
320} 362}
321 363
322#[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))]
323pub struct CtrlMsgEventStationDisconnectFromEspSoftAp { 366pub struct CtrlMsgEventStationDisconnectFromEspSoftAp {
324 #[noproto(tag = "1")] 367 #[noproto(tag = "1")]
325 pub resp: u32, 368 pub resp: u32,
@@ -328,6 +371,7 @@ pub struct CtrlMsgEventStationDisconnectFromEspSoftAp {
328} 371}
329 372
330#[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))]
331pub struct CtrlMsg { 375pub struct CtrlMsg {
332 /// msg_type could be req, resp or Event 376 /// msg_type could be req, resp or Event
333 #[noproto(tag = "1")] 377 #[noproto(tag = "1")]
@@ -345,6 +389,7 @@ pub struct CtrlMsg {
345 389
346/// union of all msg ids 390/// union of all msg ids
347#[derive(Debug, Clone, Eq, PartialEq, noproto::Oneof)] 391#[derive(Debug, Clone, Eq, PartialEq, noproto::Oneof)]
392#[cfg_attr(feature = "defmt", derive(defmt::Format))]
348pub enum CtrlMsgPayload { 393pub enum CtrlMsgPayload {
349 /// * Requests * 394 /// * Requests *
350 #[noproto(tag = "101")] 395 #[noproto(tag = "101")]
@@ -446,6 +491,7 @@ pub enum CtrlMsgPayload {
446/// Enums similar to ESP IDF 491/// Enums similar to ESP IDF
447#[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)]
448#[repr(u32)] 493#[repr(u32)]
494#[cfg_attr(feature = "defmt", derive(defmt::Format))]
449pub enum CtrlVendorIeType { 495pub enum CtrlVendorIeType {
450 #[default] 496 #[default]
451 Beacon = 0, 497 Beacon = 0,
@@ -457,6 +503,7 @@ pub enum CtrlVendorIeType {
457 503
458#[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)]
459#[repr(u32)] 505#[repr(u32)]
506#[cfg_attr(feature = "defmt", derive(defmt::Format))]
460pub enum CtrlVendorIeid { 507pub enum CtrlVendorIeid {
461 #[default] 508 #[default]
462 Id0 = 0, 509 Id0 = 0,
@@ -465,6 +512,7 @@ pub enum CtrlVendorIeid {
465 512
466#[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)]
467#[repr(u32)] 514#[repr(u32)]
515#[cfg_attr(feature = "defmt", derive(defmt::Format))]
468pub enum CtrlWifiMode { 516pub enum CtrlWifiMode {
469 #[default] 517 #[default]
470 None = 0, 518 None = 0,
@@ -475,6 +523,7 @@ pub enum CtrlWifiMode {
475 523
476#[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)]
477#[repr(u32)] 525#[repr(u32)]
526#[cfg_attr(feature = "defmt", derive(defmt::Format))]
478pub enum CtrlWifiBw { 527pub enum CtrlWifiBw {
479 #[default] 528 #[default]
480 BwInvalid = 0, 529 BwInvalid = 0,
@@ -484,6 +533,7 @@ pub enum CtrlWifiBw {
484 533
485#[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)]
486#[repr(u32)] 535#[repr(u32)]
536#[cfg_attr(feature = "defmt", derive(defmt::Format))]
487pub enum CtrlWifiPowerSave { 537pub enum CtrlWifiPowerSave {
488 #[default] 538 #[default]
489 PsInvalid = 0, 539 PsInvalid = 0,
@@ -493,6 +543,7 @@ pub enum CtrlWifiPowerSave {
493 543
494#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)] 544#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
495#[repr(u32)] 545#[repr(u32)]
546#[cfg_attr(feature = "defmt", derive(defmt::Format))]
496pub enum CtrlWifiSecProt { 547pub enum CtrlWifiSecProt {
497 #[default] 548 #[default]
498 Open = 0, 549 Open = 0,
@@ -508,6 +559,7 @@ pub enum CtrlWifiSecProt {
508/// enums for Control path 559/// enums for Control path
509#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)] 560#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
510#[repr(u32)] 561#[repr(u32)]
562#[cfg_attr(feature = "defmt", derive(defmt::Format))]
511pub enum CtrlStatus { 563pub enum CtrlStatus {
512 #[default] 564 #[default]
513 Connected = 0, 565 Connected = 0,
@@ -520,6 +572,7 @@ pub enum CtrlStatus {
520 572
521#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)] 573#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
522#[repr(u32)] 574#[repr(u32)]
575#[cfg_attr(feature = "defmt", derive(defmt::Format))]
523pub enum CtrlMsgType { 576pub enum CtrlMsgType {
524 #[default] 577 #[default]
525 MsgTypeInvalid = 0, 578 MsgTypeInvalid = 0,
@@ -531,6 +584,7 @@ pub enum CtrlMsgType {
531 584
532#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)] 585#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
533#[repr(u32)] 586#[repr(u32)]
587#[cfg_attr(feature = "defmt", derive(defmt::Format))]
534pub enum CtrlMsgId { 588pub enum CtrlMsgId {
535 #[default] 589 #[default]
536 MsgIdInvalid = 0, 590 MsgIdInvalid = 0,