@@ -119,9 +119,15 @@ class ArduinoCellular {
119119 * @param apn The Access Point Name.
120120 * @param username The APN username.
121121 * @param password The APN password.
122+ * @param waitForever The function does not return unless a connection has been established
122123 * @return True if the connection is successful, false otherwise.
123124 */
124- bool connect (String apn = " " , String username = " " , String password = " " );
125+ bool connect (String apn = " " , String username = " " , String password = " " , bool waitForever = true );
126+
127+ /* *
128+ * @brief same as previous, username and password are empty
129+ */
130+ bool connect (String apn, bool waitForever = true );
125131
126132 /* *
127133 * @brief Checks if the modem is registered on the network.
@@ -259,20 +265,22 @@ class ArduinoCellular {
259265 */
260266 void setDebugStream (Stream& stream);
261267
262- private:
263- bool connectToGPRS (const char * apn, const char * gprsUser, const char * gprsPass);
264-
265- /* *
268+ /* *
266269 * @brief Gets the SIM card status.
267270 * @return The SIM card status.
268271 */
269272 SimStatus getSimStatus ();
270273
274+ private:
275+ bool connectToGPRS (const char * apn, const char * gprsUser, const char * gprsPass);
276+
277+
271278 /* *
272279 * @brief Waits for network registration. (Blocking call)
280+ * @param waitForever if true the function does not return until a connection has been established
273281 * @return True if the network registration is successful, false otherwise.
274282 */
275- bool awaitNetworkRegistration ();
283+ bool awaitNetworkRegistration (bool waitForever );
276284
277285 /* *
278286 * @brief Gets the GPS location. (Blocking call)
0 commit comments