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

Refactor/abstract Wifi classes #1802

Merged
merged 12 commits into from
Aug 6, 2019
Merged

Conversation

mikee47
Copy link
Contributor

@mikee47 mikee47 commented Aug 4, 2019

The StationClass, WifiEventsClass and AccessPointClass classes are now virtual base classes.
The actual arch-specific implementations are StationImpl, WifiEventsImpl and AccessPointImpl.

Breaking changes:

  • getConnectionStatusName() and getAuthorizationMethodName() return String instead of const char*
  • Event delegates changed to use new MACAddress class for bssids, etc. plus const references and enumerated types.

Esp8266 'StationImpl':

  • Use addElement(BssInfo*) instead of add(BssInfo&) to avoid additional copy operation
  • Simplify config() logic, should be a little easier to follow
  • Add getMacAddr method to retrieve raw MAC address

Added dependencies:

  • ENABLE_WPS=1 requires ENABLE_ESPCONN=1
  • ENABLE_SMART_CONFIG has been added as it too has dependencies

Host updates:

  • Provides fixed list of AP's
  • Neither WPS nor SmartConfig are supported and will generate a warning.

@slaff slaff added this to the 4.0.0 milestone Aug 4, 2019
@slaff
Copy link
Contributor

slaff commented Aug 4, 2019

@mikee47 Can you check the issues reported by Codacy?

@mikee47 mikee47 force-pushed the update/wifi-refactoring branch from d9f4f76 to 07302c8 Compare August 4, 2019 19:25
@mikee47
Copy link
Contributor Author

mikee47 commented Aug 4, 2019

@slaff If you're happy with this PR in general, there are some more breaking changes I'd like to implement, such as changing:

change typedef Delegate<void(String ssid, uint8_t ssidLen, uint8_t bssid[6], uint8_t channel)> StationConnectDelegate;
to typedef Delegate<void(const String& ssid, uint8_t bssid[6], uint8_t channel)> StationConnectDelegate;

change typedef Delegate<void(uint8_t oldMode, uint8_t newMode)> StationAuthModeChangeDelegate;
to something with enumerated types for the 'mode' parameter

and so on. The smartconfig stuff also needs rework.

This will break existing applications, but the alternative is to add additional delegates and deprecate the old ones.
Any thoughts?

@mikee47 mikee47 changed the title Refactor/abstract Wifi classes [WIP] Refactor/abstract Wifi classes Aug 4, 2019
@slaff
Copy link
Contributor

slaff commented Aug 5, 2019

This will break existing applications ...

Let's go with the breaking changes. Of course we should describe them in our migration document.

mikee47 added 12 commits August 6, 2019 11:01
* Use `addElement(BssInfo*)` instead of `add(BssInfo&)` to avoid additional copy operation
* Make methods const as appropriate
* coding style
* Tested with ENABLE_WPS=1, requires ENABLE_ESPCONN
* `getConnectionStatusName()` returns String instead of `char*`
* Add `getMacAddr` method
* Replace static methods with lambdas
* Add list of AP's for Host
* Add `ENABLE_SMART_CONFIG`
* Add check to host for WPS/SmartConfig (not supported)
* Rename `EStationConnectionStatus` -> `StationConnectionStatus`
* Add `WpsStatus` enumerated type
* Add list of AP's for Host
* Add check to host for WPS/SmartConfig (not supported)
@mikee47 mikee47 force-pushed the update/wifi-refactoring branch from 07302c8 to dfcf34b Compare August 6, 2019 10:40
@slaff
Copy link
Contributor

slaff commented Aug 6, 2019

@mikee47 Ping me when the PR is ready and tested on your device(s).

@mikee47 mikee47 changed the title [WIP] Refactor/abstract Wifi classes Refactor/abstract Wifi classes Aug 6, 2019
@mikee47
Copy link
Contributor Author

mikee47 commented Aug 6, 2019

@slaff Yes, tested with HttpServer_ConfigNetwork sample, Basic_SmartConfig.

@slaff slaff merged commit 5dda877 into SmingHub:develop Aug 6, 2019
@mikee47 mikee47 deleted the update/wifi-refactoring branch August 7, 2019 20:16
@slaff slaff removed the 3 - Review label Aug 8, 2019
@slaff slaff mentioned this pull request Sep 28, 2019
4 tasks
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