Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
neOCampus-arduino
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GIS-neOCampus
neOSensor
neOCampus-arduino
Commits
b40c06db
Commit
b40c06db
authored
2 years ago
by
francois
Browse files
Options
Downloads
Patches
Plain Diff
update
parent
c9f8c23c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
neosensor/libraries/neocampus/sensocampus.cpp
+10
-11
10 additions, 11 deletions
neosensor/libraries/neocampus/sensocampus.cpp
neosensor/libraries/neocampus/sensocampus.h
+3
-1
3 additions, 1 deletion
neosensor/libraries/neocampus/sensocampus.h
with
13 additions
and
12 deletions
neosensor/libraries/neocampus/sensocampus.cpp
+
10
−
11
View file @
b40c06db
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
neosensor/libraries/neocampus/sensocampus.h
+
3
−
1
View file @
b40c06db
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment