Removed parent class

This commit is contained in:
Sara Damiano
2019-05-14 16:20:48 -04:00
parent da84f955e9
commit f2aca3b6b6
14 changed files with 445 additions and 176 deletions

View File

@@ -45,7 +45,7 @@ enum TinyGSMDateTimeFormat {
DATE_DATE = 2
};
class TinyGsmSim7000 : public TinyGsmModem
class TinyGsmSim7000
{
public:
@@ -245,7 +245,7 @@ public:
public:
TinyGsmSim7000(Stream& stream)
: TinyGsmModem(stream), stream(stream)
: stream(stream)
{
memset(sockets, 0, sizeof(sockets));
}
@@ -268,6 +268,10 @@ public:
return true;
}
bool begin(const char* pin = NULL) {
return init(pin);
}
String getModemName() {
return "SIMCom SIM7000";
}
@@ -480,6 +484,16 @@ public:
return res;
}
bool waitForNetwork(unsigned long timeout = 60000L) {
for (unsigned long start = millis(); millis() - start < timeout; ) {
if (isNetworkConnected()) {
return true;
}
delay(250);
}
return false;
}
String setNetworkMode(uint8_t mode) {
sendAT(GF("+CNMP="), mode);
if (waitResponse(GF(GSM_NL "+CNMP:")) != 1) {
@@ -641,6 +655,10 @@ public:
return res;
}
IPAddress localIP() {
return TinyGsmIpFromString(getLocalIP());
}
/*
* Phone Call functions
@@ -1019,6 +1037,17 @@ public:
Utilities
*/
template<typename T>
void streamWrite(T last) {
stream.print(last);
}
template<typename T, typename... Args>
void streamWrite(T head, Args... tail) {
stream.print(head);
streamWrite(tail...);
}
template<typename... Args>
void sendAT(Args... cmd) {
streamWrite("AT", cmd..., GSM_NL);
@@ -1027,6 +1056,19 @@ public:
//DBG("### AT:", cmd...);
}
bool streamSkipUntil(const char c, const unsigned long timeout = 1000L) {
unsigned long startMillis = millis();
while (millis() - startMillis < timeout) {
while (millis() - startMillis < timeout && !stream.available()) {
TINY_GSM_YIELD();
}
if (stream.read() == c) {
return true;
}
}
return false;
}
// TODO: Optimize this!
uint8_t waitResponse(uint32_t timeout, String& data,
GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),