diff options
| -rw-r--r-- | embassy-net-esp-hosted/src/control.rs | 7 | ||||
| -rw-r--r-- | embassy-net-esp-hosted/src/ioctl.rs | 4 | ||||
| -rw-r--r-- | embassy-net-esp-hosted/src/lib.rs | 36 | ||||
| -rw-r--r-- | embassy-net-esp-hosted/src/proto.rs | 54 |
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}; | |||
| 8 | use embedded_hal_async::digital::Wait; | 8 | use embedded_hal_async::digital::Wait; |
| 9 | use embedded_hal_async::spi::SpiDevice; | 9 | use embedded_hal_async::spi::SpiDevice; |
| 10 | use ioctl::IoctlState; | 10 | use ioctl::IoctlState; |
| 11 | use proto::CtrlMsg; | ||
| 11 | 12 | ||
| 12 | use crate::ioctl::PendingIoctl; | 13 | use 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 | ||
| 294 | fn checksum(buf: &[u8]) -> u16 { | 314 | fn 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))] | ||
| 6 | pub struct ScanResult { | 7 | pub 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))] | ||
| 20 | pub struct ConnectedStaList { | 22 | pub 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))] | ||
| 29 | pub struct CtrlMsgReqGetMacAddress { | 32 | pub 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))] | ||
| 35 | pub struct CtrlMsgRespGetMacAddress { | 39 | pub 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))] | ||
| 43 | pub struct CtrlMsgReqGetMode {} | 48 | pub 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))] | ||
| 46 | pub struct CtrlMsgRespGetMode { | 52 | pub 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))] | ||
| 54 | pub struct CtrlMsgReqSetMode { | 61 | pub 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))] | ||
| 60 | pub struct CtrlMsgRespSetMode { | 68 | pub 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))] | ||
| 66 | pub struct CtrlMsgReqGetStatus {} | 75 | pub 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))] | ||
| 69 | pub struct CtrlMsgRespGetStatus { | 79 | pub 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))] | ||
| 75 | pub struct CtrlMsgReqSetMacAddress { | 86 | pub 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))] | ||
| 83 | pub struct CtrlMsgRespSetMacAddress { | 95 | pub 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))] | ||
| 89 | pub struct CtrlMsgReqGetApConfig {} | 102 | pub 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))] | ||
| 92 | pub struct CtrlMsgRespGetApConfig { | 106 | pub 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))] | ||
| 108 | pub struct CtrlMsgReqConnectAp { | 123 | pub 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))] | ||
| 122 | pub struct CtrlMsgRespConnectAp { | 138 | pub 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))] | ||
| 130 | pub struct CtrlMsgReqGetSoftApConfig {} | 147 | pub 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))] | ||
| 133 | pub struct CtrlMsgRespGetSoftApConfig { | 151 | pub 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))] | ||
| 153 | pub struct CtrlMsgReqStartSoftAp { | 172 | pub 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))] | ||
| 171 | pub struct CtrlMsgRespStartSoftAp { | 191 | pub 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))] | ||
| 179 | pub struct CtrlMsgReqScanResult {} | 200 | pub 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))] | ||
| 182 | pub struct CtrlMsgRespScanResult { | 204 | pub 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))] | ||
| 192 | pub struct CtrlMsgReqSoftApConnectedSta {} | 215 | pub 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))] | ||
| 195 | pub struct CtrlMsgRespSoftApConnectedSta { | 219 | pub 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))] | ||
| 205 | pub struct CtrlMsgReqOtaBegin {} | 230 | pub 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))] | ||
| 208 | pub struct CtrlMsgRespOtaBegin { | 234 | pub 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))] | ||
| 214 | pub struct CtrlMsgReqOtaWrite { | 241 | pub 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))] | ||
| 220 | pub struct CtrlMsgRespOtaWrite { | 248 | pub 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))] | ||
| 226 | pub struct CtrlMsgReqOtaEnd {} | 255 | pub 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))] | ||
| 229 | pub struct CtrlMsgRespOtaEnd { | 259 | pub 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))] | ||
| 235 | pub struct CtrlMsgReqVendorIeData { | 266 | pub 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))] | ||
| 249 | pub struct CtrlMsgReqSetSoftApVendorSpecificIe { | 281 | pub 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))] | ||
| 261 | pub struct CtrlMsgRespSetSoftApVendorSpecificIe { | 294 | pub 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))] | ||
| 267 | pub struct CtrlMsgReqSetWifiMaxTxPower { | 301 | pub 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))] | ||
| 273 | pub struct CtrlMsgRespSetWifiMaxTxPower { | 308 | pub 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))] | ||
| 279 | pub struct CtrlMsgReqGetWifiCurrTxPower {} | 315 | pub 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))] | ||
| 282 | pub struct CtrlMsgRespGetWifiCurrTxPower { | 319 | pub 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))] | ||
| 290 | pub struct CtrlMsgReqConfigHeartbeat { | 328 | pub 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))] | ||
| 298 | pub struct CtrlMsgRespConfigHeartbeat { | 337 | pub 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))] | ||
| 305 | pub struct CtrlMsgEventEspInit { | 345 | pub 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))] | ||
| 311 | pub struct CtrlMsgEventHeartbeat { | 352 | pub 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))] | ||
| 317 | pub struct CtrlMsgEventStationDisconnectFromAp { | 359 | pub 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))] | ||
| 323 | pub struct CtrlMsgEventStationDisconnectFromEspSoftAp { | 366 | pub 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))] | ||
| 331 | pub struct CtrlMsg { | 375 | pub 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))] | ||
| 348 | pub enum CtrlMsgPayload { | 393 | pub 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))] | ||
| 449 | pub enum CtrlVendorIeType { | 495 | pub 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))] | ||
| 460 | pub enum CtrlVendorIeid { | 507 | pub 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))] | ||
| 468 | pub enum CtrlWifiMode { | 516 | pub 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))] | ||
| 478 | pub enum CtrlWifiBw { | 527 | pub 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))] | ||
| 487 | pub enum CtrlWifiPowerSave { | 537 | pub 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))] | ||
| 496 | pub enum CtrlWifiSecProt { | 547 | pub 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))] | ||
| 511 | pub enum CtrlStatus { | 563 | pub 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))] | ||
| 523 | pub enum CtrlMsgType { | 576 | pub 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))] | ||
| 534 | pub enum CtrlMsgId { | 588 | pub enum CtrlMsgId { |
| 535 | #[default] | 589 | #[default] |
| 536 | MsgIdInvalid = 0, | 590 | MsgIdInvalid = 0, |
