@@ -102,6 +102,10 @@ NetworkConnectionState NBConnectionHandler::update_handleInit()
102
102
Debug.print (DBG_ERROR, F (" SIM not present or wrong PIN" ));
103
103
return NetworkConnectionState::ERROR;
104
104
}
105
+ }
106
+
107
+ NetworkConnectionState NBConnectionHandler::update_handleConnecting ()
108
+ {
105
109
NB_NetworkStatus_t const network_status = _nb_gprs.attachGPRS (true );
106
110
Debug.print (DBG_DEBUG, F (" GPRS.attachGPRS(): %d" ), network_status);
107
111
if (network_status == NB_NetworkStatus_t::NB_ERROR)
@@ -112,32 +116,6 @@ NetworkConnectionState NBConnectionHandler::update_handleInit()
112
116
else
113
117
{
114
118
Debug.print (DBG_INFO, F (" Connected to GPRS Network" ));
115
- return NetworkConnectionState::CONNECTING;
116
- }
117
-
118
- }
119
-
120
- NetworkConnectionState NBConnectionHandler::update_handleConnecting ()
121
- {
122
- if (_nb.isAccessAlive () != 1 ){
123
- return NetworkConnectionState::INIT;
124
- }
125
-
126
- if (!_check_internet_availability){
127
- return NetworkConnectionState::CONNECTED;
128
- }
129
-
130
- int ping_result = _nb_gprs.ping (" time.arduino.cc" );
131
- Debug.print (DBG_INFO, F (" GPRS.ping(): %d" ), ping_result);
132
- if (ping_result < 0 )
133
- {
134
- Debug.print (DBG_ERROR, F (" Internet check failed" ));
135
- Debug.print (DBG_INFO, F (" Retrying in \" %d\" milliseconds" ), CHECK_INTERVAL_TABLE[static_cast <unsigned int >(NetworkConnectionState::CONNECTING)]);
136
- return NetworkConnectionState::CONNECTING;
137
- }
138
- else
139
- {
140
- Debug.print (DBG_INFO, F (" Connected to Internet" ));
141
119
return NetworkConnectionState::CONNECTED;
142
120
}
143
121
}
0 commit comments