@@ -26,11 +26,12 @@ CellularConnectionHandler::CellularConnectionHandler()
26
26
27
27
CellularConnectionHandler::CellularConnectionHandler (const char * pin, const char * apn, const char * login, const char * pass, bool const keep_alive)
28
28
: ConnectionHandler{keep_alive, NetworkAdapter::CELL}
29
- , _pin(pin)
30
- , _apn(apn)
31
- , _login(login)
32
- , _pass(pass)
33
29
{
30
+ _settings.type = NetworkAdapter::CELL;
31
+ strcpy (_settings.cell .pin , pin);
32
+ strcpy (_settings.cell .apn , apn);
33
+ strcpy (_settings.cell .login , login);
34
+ strcpy (_settings.cell .pass , pass);
34
35
35
36
}
36
37
@@ -57,7 +58,7 @@ NetworkConnectionState CellularConnectionHandler::update_handleInit()
57
58
{
58
59
_cellular.begin ();
59
60
_cellular.setDebugStream (Serial);
60
- if (String (_pin). length ( ) > 0 && !_cellular.unlockSIM (_pin )) {
61
+ if (strlen (_settings. cell . pin ) > 0 && !_cellular.unlockSIM (_settings. cell . pin )) {
61
62
Debug.print (DBG_ERROR, F (" SIM not present or wrong PIN" ));
62
63
return NetworkConnectionState::ERROR;
63
64
}
@@ -66,7 +67,7 @@ NetworkConnectionState CellularConnectionHandler::update_handleInit()
66
67
67
68
NetworkConnectionState CellularConnectionHandler::update_handleConnecting ()
68
69
{
69
- if (!_cellular.connect (_apn, _login, _pass )) {
70
+ if (!_cellular.connect (String (_settings. cell . apn ), String (_settings. cell . login ), String (_settings. cell . pass ) )) {
70
71
Debug.print (DBG_ERROR, F (" The board was not able to register to the network..." ));
71
72
return NetworkConnectionState::ERROR;
72
73
}
0 commit comments