mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-30 22:01:11 +00:00
Fix wifi event names (#4065)
* Fix wifi event names * CHANGELOG.md --------- Co-authored-by: Juraj Sadel <juraj.sadel@espressif.com>
This commit is contained in:
parent
bea71a1884
commit
27c89c3adc
@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Fixed a BLE panic caused by unimplemented functions (#3762)
|
- Fixed a BLE panic caused by unimplemented functions (#3762)
|
||||||
- Fixed the BLE stack crashing in certain cases (#3854)
|
- Fixed the BLE stack crashing in certain cases (#3854)
|
||||||
- `ADC2` now cannot be used simultaneously with `radio` on ESP32 (#3876)
|
- `ADC2` now cannot be used simultaneously with `radio` on ESP32 (#3876)
|
||||||
|
- Fixed names of some Wi-Fi events: ApStaConnected, ApStaDisconnected, ApProbeReqReceived (#4065)
|
||||||
- BLE on ESP32-C2 with 26MHz xtal (#4062)
|
- BLE on ESP32-C2 with 26MHz xtal (#4062)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
@ -39,14 +39,14 @@ fn default_handler<Event: 'static>() -> Box<Handler<Event>> {
|
|||||||
///
|
///
|
||||||
/// ```rust, no_run
|
/// ```rust, no_run
|
||||||
/// # use esp_radio::wifi::event::{self, *};
|
/// # use esp_radio::wifi::event::{self, *};
|
||||||
/// # fn new_handler(_: &ApStaconnected) {}
|
/// # fn new_handler(_: &ApStaConnected) {}
|
||||||
/// event::ApStaconnected::update_handler(|_cs, event| {
|
/// event::ApStaConnected::update_handler(|_cs, event| {
|
||||||
/// new_handler(event);
|
/// new_handler(event);
|
||||||
/// })
|
/// })
|
||||||
/// ```
|
/// ```
|
||||||
// Implemented like this instead of free functions because the syntax would be
|
// Implemented like this instead of free functions because the syntax would be
|
||||||
// ```
|
// ```
|
||||||
// event::update_handler::<event::ApStaconnected, _>(...)
|
// event::update_handler::<event::ApStaConnected, _>(...)
|
||||||
// ```
|
// ```
|
||||||
#[instability::unstable]
|
#[instability::unstable]
|
||||||
pub trait EventExt: sealed::Event + Sized + 'static {
|
pub trait EventExt: sealed::Event + Sized + 'static {
|
||||||
@ -131,9 +131,9 @@ impl_wifi_event!(StaWpsErPin, wifi_event_sta_wps_er_pin_t);
|
|||||||
impl_wifi_event!(StaWpsErPbcOverlap);
|
impl_wifi_event!(StaWpsErPbcOverlap);
|
||||||
impl_wifi_event!(ApStart);
|
impl_wifi_event!(ApStart);
|
||||||
impl_wifi_event!(ApStop);
|
impl_wifi_event!(ApStop);
|
||||||
impl_wifi_event!(ApStaconnected, wifi_event_ap_staconnected_t);
|
impl_wifi_event!(ApStaConnected, wifi_event_ap_staconnected_t);
|
||||||
impl_wifi_event!(ApStadisconnected, wifi_event_ap_stadisconnected_t);
|
impl_wifi_event!(ApStaDisconnected, wifi_event_ap_stadisconnected_t);
|
||||||
impl_wifi_event!(ApProbereqrecved, wifi_event_ap_probe_req_rx_t);
|
impl_wifi_event!(ApProbeReqReceived, wifi_event_ap_probe_req_rx_t);
|
||||||
impl_wifi_event!(FtmReport, wifi_event_ftm_report_t);
|
impl_wifi_event!(FtmReport, wifi_event_ftm_report_t);
|
||||||
impl_wifi_event!(StaBssRssiLow, wifi_event_bss_rssi_low_t);
|
impl_wifi_event!(StaBssRssiLow, wifi_event_bss_rssi_low_t);
|
||||||
impl_wifi_event!(ActionTxStatus, wifi_event_action_tx_status_t);
|
impl_wifi_event!(ActionTxStatus, wifi_event_action_tx_status_t);
|
||||||
@ -175,7 +175,7 @@ impl_wifi_event!(NdpTerminated, wifi_event_ndp_terminated_t);
|
|||||||
impl_wifi_event!(HomeChannelChange, wifi_event_home_channel_change_t);
|
impl_wifi_event!(HomeChannelChange, wifi_event_home_channel_change_t);
|
||||||
impl_wifi_event!(StaNeighborRep, wifi_event_neighbor_report_t);
|
impl_wifi_event!(StaNeighborRep, wifi_event_neighbor_report_t);
|
||||||
|
|
||||||
impl ApStaconnected {
|
impl ApStaConnected {
|
||||||
/// Get the MAC address of the connected station.
|
/// Get the MAC address of the connected station.
|
||||||
pub fn mac(&self) -> &[u8] {
|
pub fn mac(&self) -> &[u8] {
|
||||||
&self.0.mac
|
&self.0.mac
|
||||||
@ -187,7 +187,7 @@ impl ApStaconnected {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ApStadisconnected {
|
impl ApStaDisconnected {
|
||||||
/// Get the MAC address of the disconnected station.
|
/// Get the MAC address of the disconnected station.
|
||||||
pub fn mac(&self) -> &[u8] {
|
pub fn mac(&self) -> &[u8] {
|
||||||
&self.0.mac
|
&self.0.mac
|
||||||
@ -343,7 +343,7 @@ impl FtmReport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ApProbereqrecved {
|
impl ApProbeReqReceived {
|
||||||
/// Get received probe request SSID.
|
/// Get received probe request SSID.
|
||||||
pub fn rssi(&self) -> i32 {
|
pub fn rssi(&self) -> i32 {
|
||||||
self.0.rssi
|
self.0.rssi
|
||||||
@ -806,14 +806,14 @@ pub(crate) unsafe fn dispatch_event_handler(
|
|||||||
WifiEvent::ApStop => {
|
WifiEvent::ApStop => {
|
||||||
handle_raw::<ApStop>(event_data, event_data_size)
|
handle_raw::<ApStop>(event_data, event_data_size)
|
||||||
}
|
}
|
||||||
WifiEvent::ApStaconnected => {
|
WifiEvent::ApStaConnected => {
|
||||||
handle_raw::<ApStaconnected>(event_data, event_data_size)
|
handle_raw::<ApStaConnected>(event_data, event_data_size)
|
||||||
}
|
}
|
||||||
WifiEvent::ApStadisconnected => {
|
WifiEvent::ApStaDisconnected => {
|
||||||
handle_raw::<ApStadisconnected>(event_data, event_data_size)
|
handle_raw::<ApStaDisconnected>(event_data, event_data_size)
|
||||||
}
|
}
|
||||||
WifiEvent::ApProbereqrecved => {
|
WifiEvent::ApProbeReqReceived => {
|
||||||
handle_raw::<ApProbereqrecved>(event_data, event_data_size)
|
handle_raw::<ApProbeReqReceived>(event_data, event_data_size)
|
||||||
}
|
}
|
||||||
WifiEvent::FtmReport => {
|
WifiEvent::FtmReport => {
|
||||||
handle_raw::<FtmReport>(event_data, event_data_size)
|
handle_raw::<FtmReport>(event_data, event_data_size)
|
||||||
|
@ -1174,11 +1174,11 @@ pub enum WifiEvent {
|
|||||||
/// Soft-AP stop.
|
/// Soft-AP stop.
|
||||||
ApStop,
|
ApStop,
|
||||||
/// A station connected to Soft-AP.
|
/// A station connected to Soft-AP.
|
||||||
ApStaconnected,
|
ApStaConnected,
|
||||||
/// A station disconnected from Soft-AP.
|
/// A station disconnected from Soft-AP.
|
||||||
ApStadisconnected,
|
ApStaDisconnected,
|
||||||
/// Received probe request packet in Soft-AP interface.
|
/// Received probe request packet in Soft-AP interface.
|
||||||
ApProbereqrecved,
|
ApProbeReqReceived,
|
||||||
|
|
||||||
/// Received report of FTM procedure.
|
/// Received report of FTM procedure.
|
||||||
FtmReport,
|
FtmReport,
|
||||||
|
@ -48,14 +48,14 @@ fn main() -> ! {
|
|||||||
// Set event handlers for wifi before init to avoid missing any.
|
// Set event handlers for wifi before init to avoid missing any.
|
||||||
let mut connections = 0u32;
|
let mut connections = 0u32;
|
||||||
_ = event::ApStart::replace_handler(|_| println!("ap start event"));
|
_ = event::ApStart::replace_handler(|_| println!("ap start event"));
|
||||||
event::ApStaconnected::update_handler(move |event| {
|
event::ApStaConnected::update_handler(move |event| {
|
||||||
connections += 1;
|
connections += 1;
|
||||||
esp_println::println!("connected {}, mac: {:?}", connections, event.mac());
|
esp_println::println!("connected {}, mac: {:?}", connections, event.mac());
|
||||||
});
|
});
|
||||||
event::ApStaconnected::update_handler(|event| {
|
event::ApStaConnected::update_handler(|event| {
|
||||||
esp_println::println!("connected aid: {}", event.aid());
|
esp_println::println!("connected aid: {}", event.aid());
|
||||||
});
|
});
|
||||||
event::ApStadisconnected::update_handler(|event| {
|
event::ApStaDisconnected::update_handler(|event| {
|
||||||
println!(
|
println!(
|
||||||
"disconnected mac: {:?}, reason: {:?}",
|
"disconnected mac: {:?}, reason: {:?}",
|
||||||
event.mac(),
|
event.mac(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user