@@ -58,21 +58,15 @@ unsigned long GSMConnectionHandler::getTime()
58
58
59
59
NetworkConnectionState GSMConnectionHandler::update_handleInit ()
60
60
{
61
- if (_gsm.begin (_pin) == GSM_READY)
62
- {
63
- Debug.print (DBG_INFO, " SIM card ok" );
64
- _gsm.setTimeout (GSM_TIMEOUT);
65
- return NetworkConnectionState::CONNECTING;
66
- }
67
- else
61
+ if (_gsm.begin (_pin) != GSM_READY)
68
62
{
69
63
Debug.print (DBG_ERROR, " SIM not present or wrong PIN" );
70
64
return NetworkConnectionState::ERROR;
71
65
}
72
- }
73
66
74
- NetworkConnectionState GSMConnectionHandler::update_handleConnecting ()
75
- {
67
+ Debug.print (DBG_INFO, " SIM card ok" );
68
+ _gsm.setTimeout (GSM_TIMEOUT);
69
+
76
70
GSM3_NetworkStatus_t const network_status = _gprs.attachGPRS (_apn, _login, _pass, true );
77
71
Debug.print (DBG_DEBUG, " GPRS.attachGPRS(): %d" , network_status);
78
72
if (network_status == GSM3_NetworkStatus_t::ERROR)
@@ -81,6 +75,12 @@ NetworkConnectionState GSMConnectionHandler::update_handleConnecting()
81
75
Debug.print (DBG_ERROR, " Make sure the antenna is connected and reset your board." );
82
76
return NetworkConnectionState::ERROR;
83
77
}
78
+
79
+ return NetworkConnectionState::CONNECTING;
80
+ }
81
+
82
+ NetworkConnectionState GSMConnectionHandler::update_handleConnecting ()
83
+ {
84
84
Debug.print (DBG_INFO, " Sending PING to outer space..." );
85
85
int const ping_result = _gprs.ping (" time.arduino.cc" );
86
86
Debug.print (DBG_INFO, " GPRS.ping(): %d" , ping_result);
0 commit comments