Back to virtual super class

This commit is contained in:
Sara Damiano
2018-09-12 15:44:59 -04:00
parent 2876deb028
commit c5c3cd2af5
4 changed files with 28 additions and 97 deletions

View File

@@ -285,8 +285,7 @@ public:
bool radioOff() TINY_GSM_ATTR_NOT_IMPLEMENTED; bool radioOff() TINY_GSM_ATTR_NOT_IMPLEMENTED;
bool sleepEnable(bool enable = true) { return false; } bool sleepEnable(bool enable = true) TINY_GSM_ATTR_NOT_IMPLEMENTED;
// TINY_GSM_ATTR_NOT_IMPLEMENTED;
/* /*
* SIM card functions * SIM card functions

View File

@@ -298,8 +298,7 @@ public:
bool radioOff() TINY_GSM_ATTR_NOT_IMPLEMENTED; bool radioOff() TINY_GSM_ATTR_NOT_IMPLEMENTED;
bool sleepEnable(bool enable = true) { return false; } bool sleepEnable(bool enable = true) TINY_GSM_ATTR_NOT_IMPLEMENTED;
// TINY_GSM_ATTR_NOT_IMPLEMENTED;
/* /*
* SIM card functions * SIM card functions

View File

@@ -316,8 +316,7 @@ public:
return true; return true;
} }
bool sleepEnable(bool enable = true) { return false; } bool sleepEnable(bool enable = true) TINY_GSM_ATTR_NOT_IMPLEMENTED;
// TINY_GSM_ATTR_NOT_IMPLEMENTED;
/* /*
* SIM card functions * SIM card functions

View File

@@ -212,104 +212,51 @@ public:
*/ */
// Prepare the modem for further functionality // Prepare the modem for further functionality
virtual bool init(const char* pin = NULL) { virtual bool init(const char* pin = NULL) = 0;
DBG_PLAIN("init function not implemented");
return false;
}
// Begin is redundant with init // Begin is redundant with init
virtual bool begin(const char* pin = NULL) { virtual bool begin(const char* pin = NULL) {
return init(pin); return init(pin);
} }
// Returns a string with the chip name // Returns a string with the chip name
virtual String getModemName() { virtual String getModemName() = 0;
DBG_PLAIN("getModemName function not implemented");
return "";
}
// Sets the serial communication baud rate // Sets the serial communication baud rate
virtual void setBaud(unsigned long baud) { virtual void setBaud(unsigned long baud) = 0;
DBG_PLAIN("setBaud function not implemented");
}
// Checks that the modem is responding to standard AT commands // Checks that the modem is responding to standard AT commands
virtual bool testAT(unsigned long timeout = 10000L) { virtual bool testAT(unsigned long timeout = 10000L) = 0;
DBG_PLAIN("testAT function not implemented");
return false;
}
// Holds open communication with the modem waiting for data to come in // Holds open communication with the modem waiting for data to come in
virtual void maintain() { virtual void maintain() = 0;
DBG_PLAIN("maintain function not implemented");
}
// Resets all modem chip settings to factor defaults // Resets all modem chip settings to factor defaults
virtual bool factoryDefault() { virtual bool factoryDefault() = 0;
DBG_PLAIN("factoryDefault function not implemented");
return false;
}
// Returns the response to a get info request. The format varies by modem. // Returns the response to a get info request. The format varies by modem.
virtual String getModemInfo() { virtual String getModemInfo() = 0;
DBG_PLAIN("getModemInfo function not implemented"); // Answers whether types of communication are available on this modem
return ""; virtual bool hasSSL() = 0;
} virtual bool hasWifi() = 0;
// Answers whether secure communication is available on this modem virtual bool hasGPRS() = 0;
virtual bool hasSSL() {
DBG_PLAIN("hasSSL function not implemented");
return false;
}
virtual bool hasWifi() {
DBG_PLAIN("hasWifi function not implemented");
return false;
}
virtual bool hasGPRS() {
DBG_PLAIN("hasGPRS function not implemented");
return false;
}
/* /*
* Power functions * Power functions
*/ */
virtual bool restart() { virtual bool restart() = 0;
DBG_PLAIN("restart function not implemented");
return false;
}
virtual bool sleepEnable(bool enable = true) {
DBG_PLAIN("sleepEnable function not implemented");
return false;
}
/* /*
* SIM card functions * SIM card functions - only apply to cellular modems
*/ */
virtual bool simUnlock(const char *pin) { virtual bool simUnlock(const char *pin) { return false; }
DBG_PLAIN("simUnlock function not implemented"); virtual String getSimCCID() { return ""; }
return false; virtual String getIMEI() { return ""; }
} virtual String getOperator() { return ""; }
virtual String getSimCCID() {
DBG_PLAIN("getSimCCID function not implemented");
return "";
}
virtual String getIMEI() {
DBG_PLAIN("getIMEI function not implemented");
return "";
}
virtual String getOperator() {
DBG_PLAIN("getOperator function not implemented");
return "";
}
/* /*
* Generic network functions * Generic network functions
*/ */
virtual int getSignalQuality() { virtual int getSignalQuality() = 0;
DBG_PLAIN("getSignalQuality function not implemented");
return 0;
}
// NOTE: this returns whether the modem is registered on the cellular or WiFi // NOTE: this returns whether the modem is registered on the cellular or WiFi
// network NOT whether GPRS or other internet connections are available // network NOT whether GPRS or other internet connections are available
virtual bool isNetworkConnected() { virtual bool isNetworkConnected() = 0;
DBG_PLAIN("isNetworkConnected function not implemented");
return false;
}
virtual bool waitForNetwork(unsigned long timeout = 60000L) { virtual bool waitForNetwork(unsigned long timeout = 60000L) {
for (unsigned long start = millis(); millis() - start < timeout; ) { for (unsigned long start = millis(); millis() - start < timeout; ) {
if (isNetworkConnected()) { if (isNetworkConnected()) {
@@ -321,39 +268,26 @@ public:
} }
/* /*
* WiFi functions * WiFi functions - only apply to WiFi modems
*/ */
virtual bool networkConnect(const char* ssid, const char* pwd) { virtual bool networkConnect(const char* ssid, const char* pwd) { return false; }
DBG_PLAIN("networkConnect function not implemented"); virtual bool networkDisconnect() { return false; }
return false;
}
virtual bool networkDisconnect() {
DBG_PLAIN("networkDisconnect function not implemented");
return false;
}
/* /*
* GPRS functions * GPRS functions - only apply to cellular modems
*/ */
virtual bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) { virtual bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) {
DBG_PLAIN("gprsConnect function not implemented");
return false;
}
virtual bool gprsDisconnect() {
DBG_PLAIN("gprsDisconnect function not implemented");
return false; return false;
} }
virtual bool gprsDisconnect() { return false; }
/* /*
* IP Address functions * IP Address functions
*/ */
virtual String getLocalIP() { virtual String getLocalIP() = 0;
DBG_PLAIN("getLocalIP function not implemented");
return "";
}
virtual IPAddress localIP() { virtual IPAddress localIP() {
return TinyGsmIpFromString(getLocalIP()); return TinyGsmIpFromString(getLocalIP());
} }