-
Notifications
You must be signed in to change notification settings - Fork 352
[feat] Add method to get current access point info controller (#4401) #4405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
esp-radio/src/wifi/mod.rs
Outdated
| pub fn ap_info(&self) -> Result<AccessPointInfo, WifiError> { | ||
| if self.mode()?.is_sta() { | ||
| let mut record: MaybeUninit<include::wifi_ap_record_t> = MaybeUninit::uninit(); | ||
| let record = unsafe { MaybeUninit::assume_init_mut(&mut record) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is UB, you can't do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that now, assume_init_mut before is not the way to go.
TBH, I don’t know this FFI stuff to well so I just used the same idea as line 3047, should I fix that as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need, we'll do that, just don't introduce more code like it, please :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see #4408 - it's okay to pass a pointer like that to the C code, and assume C code has initialized the data if the call succeeds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
|
this somehow fell off my radar - probably #4460 should get in first |
Binary Size Report
|
Thank you for your contribution!
We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:
Submission Checklist 📝
cargo xtask fmt-packagescommand to ensure that all changed code is formatted correctly.CHANGELOG.mdin the proper section.Extra:
Pull Request Details 📖
Description
Resolves this issue #4401 by exposing the c api
esp_wifi_sta_get_ap_infofrom theesp-wifi-syscrateTesting
I tested this on an esp32 dev kit, modifying the example for
embassy_dhcp:I can include this change in the PR if required