Skip to content

Fix WiFi credentials clear event not being fired#1580

Open
garzdin wants to merge 1 commit into
particle-iot:developfrom
garzdin:fix/issue-1570
Open

Fix WiFi credentials clear event not being fired#1580
garzdin wants to merge 1 commit into
particle-iot:developfrom
garzdin:fix/issue-1570

Conversation

@garzdin

@garzdin garzdin commented Oct 9, 2018

Copy link
Copy Markdown

Problem

A WiFi credentials event should be fired when a user calls WiFi.clear_credentials(). It doesn't currently happen.

Solution

A system event is triggered, when a user clears WiFi credentials.

Example App

void credentialsChanged() {
    Serial.println("Credentials changed");
}

SYSTEM_MODE(AUTOMATIC);

void setup() {
    Serial.begin(9600);
    System.on(network_credentials, credentialsChanged);
}

void loop() {
    Serial.println("Clearing credentials");
    WiFi.clearCredentials();
    delay(1000);
}

References

#1570


Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • Added documentation
  • Added to CHANGELOG.md after merging (add links to docs and issues)


bool clear_credentials() override
{
system_notify_event(network_credentials, network_credentials_cleared);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I feel I would like to make this conditional on the result of wlan_clear_credentials. We should also check if other Radio interfaces need a similar change. It might be better to add it to the network_clear_credentials() function so that it is ubiquitous?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants