Accounting for API differences in XBee between WiFi and Cellular
This commit is contained in:
@@ -160,7 +160,14 @@ public:
|
|||||||
sendAT(GF("GT64")); // shorten the guard time to 100ms
|
sendAT(GF("GT64")); // shorten the guard time to 100ms
|
||||||
waitResponse();
|
waitResponse();
|
||||||
writeChanges();
|
writeChanges();
|
||||||
|
sendAT(GF("IM")); // Get the Hardware series; 0x601 for S6B (Wifi)
|
||||||
|
// wait for the response
|
||||||
|
unsigned long startMillis = millis();
|
||||||
|
while (!stream.available() && millis() - startMillis < 1000) {};
|
||||||
|
String res = streamReadUntil('\r'); // Does not send an OK, just the result
|
||||||
exitCommand();
|
exitCommand();
|
||||||
|
if (res == "0x601") series = "WIFI";
|
||||||
|
else series = "CELL";
|
||||||
guardTime = 125;
|
guardTime = 125;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -243,7 +250,8 @@ public:
|
|||||||
|
|
||||||
int getSignalQuality() {
|
int getSignalQuality() {
|
||||||
commandMode();
|
commandMode();
|
||||||
sendAT(GF("DB"));
|
if (series == "WIFI") sendAT(GF("DB"));
|
||||||
|
else sendAT(GF("LM"));
|
||||||
// wait for the response
|
// wait for the response
|
||||||
unsigned long startMillis = millis();
|
unsigned long startMillis = millis();
|
||||||
while (!stream.available() && millis() - startMillis < 1000) {};
|
while (!stream.available() && millis() - startMillis < 1000) {};
|
||||||
@@ -263,7 +271,8 @@ public:
|
|||||||
|
|
||||||
RegStatus getRegistrationStatus() {
|
RegStatus getRegistrationStatus() {
|
||||||
commandMode();
|
commandMode();
|
||||||
sendAT(GF("AI"));
|
if (series == "WIFI") sendAT(GF("AI"));
|
||||||
|
else sendAT(GF("CI"));
|
||||||
// wait for the response
|
// wait for the response
|
||||||
unsigned long startMillis = millis();
|
unsigned long startMillis = millis();
|
||||||
while (!stream.available() && millis() - startMillis < 1000) {};
|
while (!stream.available() && millis() - startMillis < 1000) {};
|
||||||
@@ -571,6 +580,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int guardTime;
|
int guardTime;
|
||||||
|
String series;
|
||||||
Stream& stream;
|
Stream& stream;
|
||||||
GsmClient* sockets[1];
|
GsmClient* sockets[1];
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user