esp-hosted: print events.
This commit is contained in:
parent
6c123596b7
commit
ec2c095a76
4 changed files with 90 additions and 11 deletions
|
@ -112,6 +112,8 @@ impl<'a> Control<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn ioctl(&mut self, req: CtrlMsg) -> CtrlMsg {
|
async fn ioctl(&mut self, req: CtrlMsg) -> CtrlMsg {
|
||||||
|
debug!("ioctl req: {:?}", &req);
|
||||||
|
|
||||||
let mut buf = [0u8; 128];
|
let mut buf = [0u8; 128];
|
||||||
|
|
||||||
let req_len = noproto::write(&req, &mut buf).unwrap();
|
let req_len = noproto::write(&req, &mut buf).unwrap();
|
||||||
|
@ -136,6 +138,9 @@ impl<'a> Control<'a> {
|
||||||
|
|
||||||
ioctl.defuse();
|
ioctl.defuse();
|
||||||
|
|
||||||
noproto::read(&buf[..resp_len]).unwrap()
|
let res = noproto::read(&buf[..resp_len]).unwrap();
|
||||||
|
debug!("ioctl resp: {:?}", &res);
|
||||||
|
|
||||||
|
res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ impl IoctlState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn do_ioctl(&self, buf: &mut [u8], req_len: usize) -> usize {
|
pub async fn do_ioctl(&self, buf: &mut [u8], req_len: usize) -> usize {
|
||||||
debug!("IOCTL Request: {:02x}", Bytes(&buf[..req_len]));
|
trace!("ioctl req bytes: {:02x}", Bytes(&buf[..req_len]));
|
||||||
|
|
||||||
self.state.set(IoctlStateInner::Pending(PendingIoctl { buf, req_len }));
|
self.state.set(IoctlStateInner::Pending(PendingIoctl { buf, req_len }));
|
||||||
self.wake_runner();
|
self.wake_runner();
|
||||||
|
@ -103,7 +103,7 @@ impl IoctlState {
|
||||||
|
|
||||||
pub fn ioctl_done(&self, response: &[u8]) {
|
pub fn ioctl_done(&self, response: &[u8]) {
|
||||||
if let IoctlStateInner::Sent { buf } = self.state.get() {
|
if let IoctlStateInner::Sent { buf } = self.state.get() {
|
||||||
debug!("IOCTL Response: {:02x}", Bytes(response));
|
trace!("ioctl resp bytes: {:02x}", Bytes(response));
|
||||||
|
|
||||||
// TODO fix this
|
// TODO fix this
|
||||||
(unsafe { &mut *buf }[..response.len()]).copy_from_slice(response);
|
(unsafe { &mut *buf }[..response.len()]).copy_from_slice(response);
|
||||||
|
|
|
@ -8,6 +8,7 @@ use embedded_hal::digital::{InputPin, OutputPin};
|
||||||
use embedded_hal_async::digital::Wait;
|
use embedded_hal_async::digital::Wait;
|
||||||
use embedded_hal_async::spi::SpiDevice;
|
use embedded_hal_async::spi::SpiDevice;
|
||||||
use ioctl::IoctlState;
|
use ioctl::IoctlState;
|
||||||
|
use proto::CtrlMsg;
|
||||||
|
|
||||||
use crate::ioctl::PendingIoctl;
|
use crate::ioctl::PendingIoctl;
|
||||||
|
|
||||||
|
@ -194,8 +195,6 @@ where
|
||||||
tx_buf[0..12].copy_from_slice(&header.to_bytes());
|
tx_buf[0..12].copy_from_slice(&header.to_bytes());
|
||||||
header.checksum = checksum(&tx_buf[..26 + req_len]);
|
header.checksum = checksum(&tx_buf[..26 + req_len]);
|
||||||
tx_buf[0..12].copy_from_slice(&header.to_bytes());
|
tx_buf[0..12].copy_from_slice(&header.to_bytes());
|
||||||
|
|
||||||
debug!("====== SENDING IOCTL");
|
|
||||||
}
|
}
|
||||||
Either3::Second(packet) => {
|
Either3::Second(packet) => {
|
||||||
tx_buf[12..][..packet.len()].copy_from_slice(packet);
|
tx_buf[12..][..packet.len()].copy_from_slice(packet);
|
||||||
|
@ -270,25 +269,46 @@ where
|
||||||
},
|
},
|
||||||
// serial
|
// serial
|
||||||
2 => {
|
2 => {
|
||||||
debug!("serial rx: {:02x}", payload);
|
trace!("serial rx: {:02x}", payload);
|
||||||
if payload.len() < 14 {
|
if payload.len() < 14 {
|
||||||
warn!("serial rx: too short");
|
warn!("serial rx: too short");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if &payload[..12] != b"\x01\x08\x00ctrlResp\x02" {
|
|
||||||
|
let isEvent = match &payload[..12] {
|
||||||
|
b"\x01\x08\x00ctrlResp\x02" => false,
|
||||||
|
b"\x01\x08\x00ctrlEvnt\x02" => true,
|
||||||
|
_ => {
|
||||||
warn!("serial rx: bad tlv");
|
warn!("serial rx: bad tlv");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let len = u16::from_le_bytes(payload[12..14].try_into().unwrap()) as usize;
|
let len = u16::from_le_bytes(payload[12..14].try_into().unwrap()) as usize;
|
||||||
if payload.len() < 14 + len {
|
if payload.len() < 14 + len {
|
||||||
warn!("serial rx: too short 2");
|
warn!("serial rx: too short 2");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.ioctl_state.ioctl_done(&payload[14..][..len]);
|
let data = &payload[14..][..len];
|
||||||
|
|
||||||
|
if isEvent {
|
||||||
|
self.handle_event(data);
|
||||||
|
} else {
|
||||||
|
self.ioctl_state.ioctl_done(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => warn!("unknown iftype {}", if_type_and_num),
|
_ => warn!("unknown iftype {}", if_type_and_num),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle_event(&self, data: &[u8]) {
|
||||||
|
let Ok(event) = noproto::read::<CtrlMsg>(data) else {
|
||||||
|
warn!("failed to parse event");
|
||||||
|
return
|
||||||
|
};
|
||||||
|
|
||||||
|
debug!("event: {:?}", &event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn checksum(buf: &[u8]) -> u16 {
|
fn checksum(buf: &[u8]) -> u16 {
|
||||||
|
|
|
@ -3,6 +3,7 @@ use heapless::{String, Vec};
|
||||||
/// internal supporting structures for CtrlMsg
|
/// internal supporting structures for CtrlMsg
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct ScanResult {
|
pub struct ScanResult {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub ssid: String<32>,
|
pub ssid: String<32>,
|
||||||
|
@ -17,6 +18,7 @@ pub struct ScanResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct ConnectedStaList {
|
pub struct ConnectedStaList {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub mac: String<32>,
|
pub mac: String<32>,
|
||||||
|
@ -26,12 +28,14 @@ pub struct ConnectedStaList {
|
||||||
/// * Req/Resp structure *
|
/// * Req/Resp structure *
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqGetMacAddress {
|
pub struct CtrlMsgReqGetMacAddress {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub mode: u32,
|
pub mode: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespGetMacAddress {
|
pub struct CtrlMsgRespGetMacAddress {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub mac: String<32>,
|
pub mac: String<32>,
|
||||||
|
@ -40,9 +44,11 @@ pub struct CtrlMsgRespGetMacAddress {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqGetMode {}
|
pub struct CtrlMsgReqGetMode {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespGetMode {
|
pub struct CtrlMsgRespGetMode {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub mode: u32,
|
pub mode: u32,
|
||||||
|
@ -51,27 +57,32 @@ pub struct CtrlMsgRespGetMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqSetMode {
|
pub struct CtrlMsgReqSetMode {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub mode: u32,
|
pub mode: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespSetMode {
|
pub struct CtrlMsgRespSetMode {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub resp: u32,
|
pub resp: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqGetStatus {}
|
pub struct CtrlMsgReqGetStatus {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespGetStatus {
|
pub struct CtrlMsgRespGetStatus {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub resp: u32,
|
pub resp: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqSetMacAddress {
|
pub struct CtrlMsgReqSetMacAddress {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub mac: String<32>,
|
pub mac: String<32>,
|
||||||
|
@ -80,15 +91,18 @@ pub struct CtrlMsgReqSetMacAddress {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespSetMacAddress {
|
pub struct CtrlMsgRespSetMacAddress {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub resp: u32,
|
pub resp: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqGetApConfig {}
|
pub struct CtrlMsgReqGetApConfig {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespGetApConfig {
|
pub struct CtrlMsgRespGetApConfig {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub ssid: String<32>,
|
pub ssid: String<32>,
|
||||||
|
@ -105,6 +119,7 @@ pub struct CtrlMsgRespGetApConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqConnectAp {
|
pub struct CtrlMsgReqConnectAp {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub ssid: String<32>,
|
pub ssid: String<32>,
|
||||||
|
@ -119,6 +134,7 @@ pub struct CtrlMsgReqConnectAp {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespConnectAp {
|
pub struct CtrlMsgRespConnectAp {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub resp: u32,
|
pub resp: u32,
|
||||||
|
@ -127,9 +143,11 @@ pub struct CtrlMsgRespConnectAp {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqGetSoftApConfig {}
|
pub struct CtrlMsgReqGetSoftApConfig {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespGetSoftApConfig {
|
pub struct CtrlMsgRespGetSoftApConfig {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub ssid: String<32>,
|
pub ssid: String<32>,
|
||||||
|
@ -150,6 +168,7 @@ pub struct CtrlMsgRespGetSoftApConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqStartSoftAp {
|
pub struct CtrlMsgReqStartSoftAp {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub ssid: String<32>,
|
pub ssid: String<32>,
|
||||||
|
@ -168,6 +187,7 @@ pub struct CtrlMsgReqStartSoftAp {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespStartSoftAp {
|
pub struct CtrlMsgRespStartSoftAp {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub resp: u32,
|
pub resp: u32,
|
||||||
|
@ -176,9 +196,11 @@ pub struct CtrlMsgRespStartSoftAp {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqScanResult {}
|
pub struct CtrlMsgReqScanResult {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespScanResult {
|
pub struct CtrlMsgRespScanResult {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub count: u32,
|
pub count: u32,
|
||||||
|
@ -189,9 +211,11 @@ pub struct CtrlMsgRespScanResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqSoftApConnectedSta {}
|
pub struct CtrlMsgReqSoftApConnectedSta {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespSoftApConnectedSta {
|
pub struct CtrlMsgRespSoftApConnectedSta {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub num: u32,
|
pub num: u32,
|
||||||
|
@ -202,36 +226,43 @@ pub struct CtrlMsgRespSoftApConnectedSta {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqOtaBegin {}
|
pub struct CtrlMsgReqOtaBegin {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespOtaBegin {
|
pub struct CtrlMsgRespOtaBegin {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub resp: u32,
|
pub resp: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqOtaWrite {
|
pub struct CtrlMsgReqOtaWrite {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub ota_data: Vec<u8, 1024>,
|
pub ota_data: Vec<u8, 1024>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespOtaWrite {
|
pub struct CtrlMsgRespOtaWrite {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub resp: u32,
|
pub resp: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqOtaEnd {}
|
pub struct CtrlMsgReqOtaEnd {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespOtaEnd {
|
pub struct CtrlMsgRespOtaEnd {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub resp: u32,
|
pub resp: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqVendorIeData {
|
pub struct CtrlMsgReqVendorIeData {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub element_id: u32,
|
pub element_id: u32,
|
||||||
|
@ -246,6 +277,7 @@ pub struct CtrlMsgReqVendorIeData {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqSetSoftApVendorSpecificIe {
|
pub struct CtrlMsgReqSetSoftApVendorSpecificIe {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub enable: bool,
|
pub enable: bool,
|
||||||
|
@ -258,27 +290,32 @@ pub struct CtrlMsgReqSetSoftApVendorSpecificIe {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespSetSoftApVendorSpecificIe {
|
pub struct CtrlMsgRespSetSoftApVendorSpecificIe {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub resp: u32,
|
pub resp: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqSetWifiMaxTxPower {
|
pub struct CtrlMsgReqSetWifiMaxTxPower {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub wifi_max_tx_power: u32,
|
pub wifi_max_tx_power: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespSetWifiMaxTxPower {
|
pub struct CtrlMsgRespSetWifiMaxTxPower {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub resp: u32,
|
pub resp: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqGetWifiCurrTxPower {}
|
pub struct CtrlMsgReqGetWifiCurrTxPower {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespGetWifiCurrTxPower {
|
pub struct CtrlMsgRespGetWifiCurrTxPower {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub wifi_curr_tx_power: u32,
|
pub wifi_curr_tx_power: u32,
|
||||||
|
@ -287,6 +324,7 @@ pub struct CtrlMsgRespGetWifiCurrTxPower {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgReqConfigHeartbeat {
|
pub struct CtrlMsgReqConfigHeartbeat {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub enable: bool,
|
pub enable: bool,
|
||||||
|
@ -295,6 +333,7 @@ pub struct CtrlMsgReqConfigHeartbeat {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgRespConfigHeartbeat {
|
pub struct CtrlMsgRespConfigHeartbeat {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub resp: u32,
|
pub resp: u32,
|
||||||
|
@ -302,24 +341,28 @@ pub struct CtrlMsgRespConfigHeartbeat {
|
||||||
/// * Event structure *
|
/// * Event structure *
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgEventEspInit {
|
pub struct CtrlMsgEventEspInit {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub init_data: Vec<u8, 64>,
|
pub init_data: Vec<u8, 64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgEventHeartbeat {
|
pub struct CtrlMsgEventHeartbeat {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub hb_num: u32,
|
pub hb_num: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgEventStationDisconnectFromAp {
|
pub struct CtrlMsgEventStationDisconnectFromAp {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub resp: u32,
|
pub resp: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsgEventStationDisconnectFromEspSoftAp {
|
pub struct CtrlMsgEventStationDisconnectFromEspSoftAp {
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
pub resp: u32,
|
pub resp: u32,
|
||||||
|
@ -328,6 +371,7 @@ pub struct CtrlMsgEventStationDisconnectFromEspSoftAp {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, noproto::Message)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct CtrlMsg {
|
pub struct CtrlMsg {
|
||||||
/// msg_type could be req, resp or Event
|
/// msg_type could be req, resp or Event
|
||||||
#[noproto(tag = "1")]
|
#[noproto(tag = "1")]
|
||||||
|
@ -345,6 +389,7 @@ pub struct CtrlMsg {
|
||||||
|
|
||||||
/// union of all msg ids
|
/// union of all msg ids
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, noproto::Oneof)]
|
#[derive(Debug, Clone, Eq, PartialEq, noproto::Oneof)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum CtrlMsgPayload {
|
pub enum CtrlMsgPayload {
|
||||||
/// * Requests *
|
/// * Requests *
|
||||||
#[noproto(tag = "101")]
|
#[noproto(tag = "101")]
|
||||||
|
@ -446,6 +491,7 @@ pub enum CtrlMsgPayload {
|
||||||
/// Enums similar to ESP IDF
|
/// Enums similar to ESP IDF
|
||||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum CtrlVendorIeType {
|
pub enum CtrlVendorIeType {
|
||||||
#[default]
|
#[default]
|
||||||
Beacon = 0,
|
Beacon = 0,
|
||||||
|
@ -457,6 +503,7 @@ pub enum CtrlVendorIeType {
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum CtrlVendorIeid {
|
pub enum CtrlVendorIeid {
|
||||||
#[default]
|
#[default]
|
||||||
Id0 = 0,
|
Id0 = 0,
|
||||||
|
@ -465,6 +512,7 @@ pub enum CtrlVendorIeid {
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum CtrlWifiMode {
|
pub enum CtrlWifiMode {
|
||||||
#[default]
|
#[default]
|
||||||
None = 0,
|
None = 0,
|
||||||
|
@ -475,6 +523,7 @@ pub enum CtrlWifiMode {
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum CtrlWifiBw {
|
pub enum CtrlWifiBw {
|
||||||
#[default]
|
#[default]
|
||||||
BwInvalid = 0,
|
BwInvalid = 0,
|
||||||
|
@ -484,6 +533,7 @@ pub enum CtrlWifiBw {
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum CtrlWifiPowerSave {
|
pub enum CtrlWifiPowerSave {
|
||||||
#[default]
|
#[default]
|
||||||
PsInvalid = 0,
|
PsInvalid = 0,
|
||||||
|
@ -493,6 +543,7 @@ pub enum CtrlWifiPowerSave {
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum CtrlWifiSecProt {
|
pub enum CtrlWifiSecProt {
|
||||||
#[default]
|
#[default]
|
||||||
Open = 0,
|
Open = 0,
|
||||||
|
@ -508,6 +559,7 @@ pub enum CtrlWifiSecProt {
|
||||||
/// enums for Control path
|
/// enums for Control path
|
||||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum CtrlStatus {
|
pub enum CtrlStatus {
|
||||||
#[default]
|
#[default]
|
||||||
Connected = 0,
|
Connected = 0,
|
||||||
|
@ -520,6 +572,7 @@ pub enum CtrlStatus {
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum CtrlMsgType {
|
pub enum CtrlMsgType {
|
||||||
#[default]
|
#[default]
|
||||||
MsgTypeInvalid = 0,
|
MsgTypeInvalid = 0,
|
||||||
|
@ -531,6 +584,7 @@ pub enum CtrlMsgType {
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, noproto::Enumeration)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum CtrlMsgId {
|
pub enum CtrlMsgId {
|
||||||
#[default]
|
#[default]
|
||||||
MsgIdInvalid = 0,
|
MsgIdInvalid = 0,
|
||||||
|
|
Loading…
Reference in a new issue