Skip to content
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

Rethink WiFi API #3027

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Rethink WiFi API #3027

wants to merge 1 commit into from

Conversation

bjoernQ
Copy link
Contributor

@bjoernQ bjoernQ commented Jan 24, 2025

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 📝

  • I have updated existing examples or added new ones (if applicable).
  • I have used cargo xtask fmt-packages command to ensure that all changed code is formatted correctly.
  • My changes were added to the CHANGELOG.md in the proper section.
  • I have added necessary changes to user code to the Migration Guide.
  • My changes are in accordance to the esp-rs API guidelines

Extra:

Pull Request Details 📖

Description

This is a POC to address #2224

The idea is

  • network devices / interfaces are independent of the controller - they exist before creating the controller and still exist when the controller is dropped
  • no type-state for the enabled wifi mode - a user can switch the wifi mode at any time

This might or might not end up being merged. For now, it's here to illustrate how the API can or should be changed

Testing

Run the examples

pub async fn start_async(&mut self) -> Result<(), WifiError> {
let mode = WifiMode::try_from(&self.config)?;
if !TAKEN
.compare_exchange(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also be swap or fetch_or, which only need a single Ordering and end up in general simpler. In general I don't know if I'm happy with the interface being a completely separate singleton (or singleton pair) - but at the very least, we need an unsafe way to grab them in case they need to be re-created for some reasn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants