Browse Source

Back to virtual super class

v_master
Sara Damiano 6 years ago
parent
commit
c5c3cd2af5
4 changed files with 28 additions and 97 deletions
  1. +1
    -2
      src/TinyGsmClientA6.h
  2. +1
    -2
      src/TinyGsmClientESP8266.h
  3. +1
    -2
      src/TinyGsmClientUBLOX.h
  4. +25
    -91
      src/TinyGsmCommon.h

+ 1
- 2
src/TinyGsmClientA6.h View File

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


+ 1
- 2
src/TinyGsmClientESP8266.h View File

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


+ 1
- 2
src/TinyGsmClientUBLOX.h View File

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


+ 25
- 91
src/TinyGsmCommon.h View File

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


Loading…
Cancel
Save