Skip to content

Commit bb81766

Browse files
committed
Rename Location to CellularLocation
1 parent 6531063 commit bb81766

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

src/ArduinoCellular.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ void ArduinoCellular::begin() {
3535
modem.sendAT("+CNMI=2,1,0,0,0");
3636
modem.waitResponse();
3737

38-
38+
#if defined(ARDUINO_CELLULAR_BEARSSL)
3939
ArduinoBearSSL.onGetTime(ArduinoCellular::getTime);
40+
#endif
4041

4142
}
4243

@@ -87,7 +88,7 @@ bool ArduinoCellular::connect(String apn, String username, String password){
8788
}
8889

8990

90-
Location ArduinoCellular::getGPSLocation(unsigned long timeout){
91+
CellularLocation ArduinoCellular::getGPSLocation(unsigned long timeout){
9192
if (model == ModemModel::EG25){
9293
float latitude = 0.00000;
9394
float longitude = 0.00000;
@@ -98,7 +99,7 @@ Location ArduinoCellular::getGPSLocation(unsigned long timeout){
9899
delay(1000);
99100
}
100101

101-
Location loc;
102+
CellularLocation loc;
102103
loc.latitude = latitude;
103104
loc.longitude = longitude;
104105

@@ -107,7 +108,7 @@ Location ArduinoCellular::getGPSLocation(unsigned long timeout){
107108
if(this->debugStream != nullptr){
108109
this->debugStream->println("Unsupported modem model");
109110
}
110-
return Location();
111+
return CellularLocation();
111112
}
112113
}
113114

@@ -155,13 +156,15 @@ HttpClient ArduinoCellular::getHTTPClient(const char * server, const int port){
155156
return HttpClient(* new TinyGsmClient(modem), server, port);
156157
}
157158

159+
#if defined(ARDUINO_CELLULAR_BEARSSL)
158160
HttpClient ArduinoCellular::getHTTPSClient(const char * server, const int port){
159161
return HttpClient(* new BearSSLClient(* new TinyGsmClient(modem)), server, port);
160162
}
161163

162164
BearSSLClient ArduinoCellular::getSecureNetworkClient(){
163165
return BearSSLClient(* new TinyGsmClient(modem));
164166
}
167+
#endif
165168

166169
bool ArduinoCellular::isConnectedToOperator(){
167170
return modem.isNetworkConnected();
@@ -214,11 +217,13 @@ bool ArduinoCellular::awaitNetworkRegistration(){
214217
if(this->debugStream != nullptr){
215218
this->debugStream->println("Waiting for network registration...");
216219
}
220+
/* reduce max wait time */
217221
while (!modem.waitForNetwork()) {
218222
if(this->debugStream != nullptr){
219223
this->debugStream->print(".");
220224
}
221225
delay(2000);
226+
/* Add watchdog kik*/
222227
}
223228
return true;
224229
}

src/ArduinoCellular.h

+16-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,18 @@
1616

1717
#include <Arduino.h>
1818
#include <vector>
19-
#include "ArduinoBearSSLConfig.h"
20-
#include <ArduinoBearSSL.h>
19+
20+
#if defined __has_include
21+
#if !__has_include (<ArduinoIoTCloud.h>)
22+
#define ARDUINO_CELLULAR_BEARSSL
23+
#endif
24+
#endif
25+
26+
#if defined(ARDUINO_CELLULAR_BEARSSL)
27+
#include "ArduinoBearSSLConfig.h"
28+
#include <ArduinoBearSSL.h>
29+
#endif
30+
2131
#include <ModemInterface.h>
2232
#include <TimeUtils.h>
2333

@@ -71,7 +81,7 @@ class SMS {
7181
* @struct Location
7282
* @brief Represents a geographic location with latitude and longitude coordinates.
7383
*/
74-
struct Location {
84+
struct CellularLocation {
7585
float latitude; /**< The latitude coordinate of the location. */
7686
float longitude; /**< The longitude coordinate of the location. */
7787
};
@@ -136,7 +146,7 @@ class ArduinoCellular {
136146
* @param timeout The timeout (In milliseconds) to wait for the GPS location.
137147
* @return The GPS location. If the location is not retrieved, the latitude and longitude will be 0.0.
138148
*/
139-
Location getGPSLocation(unsigned long timeout = 60000);
149+
CellularLocation getGPSLocation(unsigned long timeout = 60000);
140150

141151
/**
142152
* @brief Gets the current time from the network.
@@ -206,7 +216,9 @@ class ArduinoCellular {
206216
* @brief Gets the Transport Layer Security (TLS) client. (OSI Layer 4)
207217
* @return The GSM client.
208218
*/
219+
#if defined(ARDUINO_CELLULAR_BEARSSL)
209220
BearSSLClient getSecureNetworkClient();
221+
#endif
210222

211223
/**
212224
* @brief Gets the HTTP client for the specified server and port.

0 commit comments

Comments
 (0)