electrotwelve 3 Posted June 3, 2016 Share Posted June 3, 2016 Hi, I've been following the ConnectWithWPA example to see the encryption type. However, it keeps showing me "Encryption Type: 0". What does this mean? Also what does the AUTO return value mean? (from this reference: http://energia.nu/reference/wifi/wifi_encryptiontype) Quote Link to post Share on other sites
Fmilburn 445 Posted June 3, 2016 Share Posted June 3, 2016 Hi @@electrotwelve I suggest looking in Wifi.cpp and WiFi.h of the CC3200 libraries folder in your version of Energia - the code is pretty clear as to what is happening. I don't use the CC3200 at the moment so can't comment a whole lot more... Note that it is an adaptation of the Arduino code and you might a search there as well. Quote Link to post Share on other sites
electrotwelve 3 Posted June 4, 2016 Author Share Posted June 4, 2016 Hi @@Fmilburn, I think I've got this working for now. There seem to be two variants for the encrytionType function and the default Energia example is calling the one which does not accept arguments: uint8_t WiFiClass::encryptionType() { return 0; } I changed the return value to verify this and it is indeed this one that is being called. The other variant accepts an integer value as an argument presumably the SSID number. I borrowed code sections from the ScanNetworks example. I compared the string returned by WiFi.encryptionType with the defined SSID and when they matched I printed out the encryption type. int numSsid = WiFi.scanNetworks(); if (numSsid == -1) { Serial.println("Couldn't get a wifi connection"); while (true); } for (int thisNet = 0; thisNet < numSsid; thisNet++) { if (strcmp(WiFi.SSID(thisNet),ssid) == 0) { Serial.print("Encryption: "); printEncryptionType(WiFi.encryptionType(thisNet)); } } The printEncryptionType function is the same one from ScanNetworks example. Fmilburn 1 Quote Link to post Share on other sites
SmokinGrunts 5 Posted June 10, 2016 Share Posted June 10, 2016 There seem to be two variants for the encrytionType function... Correct, uint8_t WiFiClass::encryptionType() and uint8_t WiFiClass::encryptionType(uint8_t networkItem) Two functions, with the same name, but different parameters. This is called Function Overloading. Your compiler determines the best fit for which function definition to process based on the types you give to said function. For more information, see here: http://www.tutorialspoint.com/cplusplus/cpp_overloading.htm electrotwelve 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.