setSecurity doesn't seem to be working (compiling)

#include "application.h"
WiFiCredentials credentials;
credentials.setSecurity(WPA2);


Compiling target is 0.7.0
[ I’ve also tried various combinations with #include “Particle.h” ]


This code throws the following error during compile time :

error: no matching function for call to 'spark::WiFiCredentials::setSecurity(spark::SecurityType)'
credentials.setSecurity(WPA2);
^
In file included from …/wiring/inc/spark_wiring_wifi.h:37:0,
from …/wiring/inc/spark_wiring.h:42,
from ./inc/application.h:40,
from WiFi.cpp:3:
…/wiring/inc/spark_wiring_wifi_credentials.h:72:30: note: candidate: virtual spark::WiFiCredentials& spark::WiFiCredentials::setSecurity(WLanSecurityType)
virtual WiFiCredentials& setSecurity(WLanSecurityType security) {
^
…/wiring/inc/spark_wiring_wifi_credentials.h:72:30: note: no known conversion for argument 1 from ‘spark::SecurityType’ to ‘WLanSecurityType’

Seems like its unable to find this function ? I literally copy pasted the code from
https://docs.particle.io/reference/firmware/photon/#wificredentials-class

Any help would be appreciated - thanks !

Obviously there are two incompatible enums at play
How about writing it as

 credentials.setSecurity(WLAN_SEC_WPA2);

While this isn’t more than a poor workaround, as this should not happen and a GitHub issue might be advisable, this should work.


I have filed a GitHub issue

1 Like

Thanks @ScruffR ! Will give this a shot.