Skip to content
Snippets Groups Projects
Commit b40c06db authored by francois's avatar francois
Browse files

update

parent c9f8c23c
Branches
Tags
No related merge requests found
...@@ -536,22 +536,21 @@ bool senso::_parseCredentials( char *json ) { ...@@ -536,22 +536,21 @@ bool senso::_parseCredentials( char *json ) {
log_info(F("\n[senso] found 'password' = "));log_info(_mqtt_passwd); log_flush(); log_info(F("\n[senso] found 'password' = "));log_info(_mqtt_passwd); log_flush();
_updated = true; _updated = true;
} }
else {
// no password provided
si NVS ==> _updated = true to force saving file + save senso credentials to NVS
// no password provided --> does login match ? // no password provided --> does login match ?
else if( strncmp(_mqtt_login,(const char *)(root[F("login")]),sizeof(_mqtt_login))!=0 ) { else if( strncmp(_mqtt_login,(const char *)(root[F("login")]),sizeof(_mqtt_login))==0 ) {
// no password provided but login matches ours ==> we also have the right password :)
log_info(F("\n[senso] found SAME 'login' = "));log_info(_mqtt_login); log_flush();
}
// no password provided and login does not match ... but will it match login from NVS ?
else if( ) {
to be continued
_updated = true; // to save config
}
else {
// mqtt_login does not match and no password provided ... you're dead! // mqtt_login does not match and no password provided ... you're dead!
log_error(F("\n[senso] no password provided and logins do not match ... dead :(")); log_flush(); log_error(F("\n[senso] no password provided and logins do not match ... dead :(")); log_flush();
return false; return false;
} }
else {
// no password provided but login matches ours ==> we also have the right password :)
log_info(F("\n[senso] found SAME 'login' = "));log_info(_mqtt_login); log_flush();
}
// success :) // success :)
return true; return true;
......
...@@ -78,12 +78,14 @@ private: ...@@ -78,12 +78,14 @@ private:
bool _parseConfig( const char * ); // VERY IMPORTANT 'const' as it force ArduinoJson to create a copy bool _parseConfig( const char * ); // VERY IMPORTANT 'const' as it force ArduinoJson to create a copy
bool _loadConfig( JsonObject ); // interprets JSON buffer from config file bool _loadConfig( JsonObject ); // interprets JSON buffer from config file
bool _saveConfig( JsonObject ); // fill JSON buffer with things to save to config file bool _saveConfig( JsonObject ); // fill JSON buffer with things to save to config file
bool _NVSgetLogin( & ); // [NVS] retrieve sensOCampus mqtt_login from NonVolatileStorage
bool _NVSgetPasswd( & ); // [NVS] retrieve sensOCampus mqtt_passwd from NonVolatileStorage
/* /*
* private attributes * private attributes
*/ */
bool _initialized; // check if structure is valid bool _initialized; // check if structure is valid
bool _updated; // any change in current parameters ? bool _updated; // any change in current parameters ? yes ==> save it
bool _defaults; // default parameters, hence no need to save bool _defaults; // default parameters, hence no need to save
wifiParametersMgt *_wp; // global wifiParametersMgt wifiParametersMgt *_wp; // global wifiParametersMgt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment