@@ -26,11 +26,12 @@ CellularConnectionHandler::CellularConnectionHandler()
2626
2727CellularConnectionHandler::CellularConnectionHandler (const char * pin, const char * apn, const char * login, const char * pass, bool const keep_alive)
2828: ConnectionHandler{keep_alive, NetworkAdapter::CELL}
29- , _pin(pin)
30- , _apn(apn)
31- , _login(login)
32- , _pass(pass)
3329{
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);
3435
3536}
3637
@@ -57,7 +58,7 @@ NetworkConnectionState CellularConnectionHandler::update_handleInit()
5758{
5859 _cellular.begin ();
5960 _cellular.setDebugStream (Serial);
60- if (String (_pin). length ( ) > 0 && !_cellular.unlockSIM (_pin )) {
61+ if (strlen (_settings. cell . pin ) > 0 && !_cellular.unlockSIM (_settings. cell . pin )) {
6162 Debug.print (DBG_ERROR, F (" SIM not present or wrong PIN" ));
6263 return NetworkConnectionState::ERROR;
6364 }
@@ -66,7 +67,7 @@ NetworkConnectionState CellularConnectionHandler::update_handleInit()
6667
6768NetworkConnectionState CellularConnectionHandler::update_handleConnecting ()
6869{
69- if (!_cellular.connect (_apn, _login, _pass )) {
70+ if (!_cellular.connect (String (_settings. cell . apn ), String (_settings. cell . login ), String (_settings. cell . pass ) )) {
7071 Debug.print (DBG_ERROR, F (" The board was not able to register to the network..." ));
7172 return NetworkConnectionState::ERROR;
7273 }
0 commit comments