mirror of
https://github.com/vshymanskyy/TinyGSM.git
synced 2026-05-15 04:06:10 +00:00
Fix SIM70xx inheritance
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
@@ -17,14 +17,29 @@
|
||||
|
||||
#include "TinyGsmClientSIM70xx.h"
|
||||
#include "TinyGsmTCP.tpp"
|
||||
#include "TinyGsmSMS.tpp"
|
||||
#include "TinyGsmGSMLocation.tpp"
|
||||
#include "TinyGsmTime.tpp"
|
||||
#include "TinyGsmNTP.tpp"
|
||||
#include "TinyGsmBattery.tpp"
|
||||
|
||||
class TinyGsmSim7000 : public TinyGsmSim70xx<TinyGsmSim7000>,
|
||||
public TinyGsmTCP<TinyGsmSim7000, TINY_GSM_MUX_COUNT>,
|
||||
public TinyGsmSMS<TinyGsmSim7000>,
|
||||
public TinyGsmTime<TinyGsmSim7000>,
|
||||
public TinyGsmNTP<TinyGsmSim7000>,
|
||||
public TinyGsmTCP<TinyGsmSim7000, TINY_GSM_MUX_COUNT> {
|
||||
public TinyGsmGSMLocation<TinyGsmSim7000>,
|
||||
public TinyGsmBattery<TinyGsmSim7000> {
|
||||
friend class TinyGsmSim70xx<TinyGsmSim7000>;
|
||||
friend class TinyGsmNTP<TinyGsmSim7000>;
|
||||
friend class TinyGsmModem<TinyGsmSim7000>;
|
||||
friend class TinyGsmGPRS<TinyGsmSim7000>;
|
||||
friend class TinyGsmTCP<TinyGsmSim7000, TINY_GSM_MUX_COUNT>;
|
||||
friend class TinyGsmSMS<TinyGsmSim7000>;
|
||||
friend class TinyGsmGSMLocation<TinyGsmSim7000>;
|
||||
friend class TinyGsmGPS<TinyGsmSim7000>;
|
||||
friend class TinyGsmTime<TinyGsmSim7000>;
|
||||
friend class TinyGsmNTP<TinyGsmSim7000>;
|
||||
friend class TinyGsmBattery<TinyGsmSim7000>;
|
||||
|
||||
/*
|
||||
* Inner Client
|
||||
@@ -87,7 +102,7 @@ class TinyGsmSim7000 : public TinyGsmSim70xx<TinyGsmSim7000>,
|
||||
/*
|
||||
* Inner Secure Client
|
||||
*/
|
||||
// NOTE: Use modem TINYGSMSIM7000SSL for a secure client!
|
||||
// NOTE: Use modem TinyGsmSim7000SSL for a secure client!
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
|
||||
@@ -18,31 +18,32 @@
|
||||
#include "TinyGsmClientSIM70xx.h"
|
||||
#include "TinyGsmTCP.tpp"
|
||||
#include "TinyGsmSSL.tpp"
|
||||
#include "TinyGsmNTP.tpp"
|
||||
#include "TinyGsmSMS.tpp"
|
||||
#include "TinyGsmTime.tpp"
|
||||
#include "TinyGsmGSMLocation.tpp"
|
||||
#include "TinyGsmTime.tpp"
|
||||
#include "TinyGsmNTP.tpp"
|
||||
#include "TinyGsmBattery.tpp"
|
||||
|
||||
class TinyGsmSim7000SSL
|
||||
: public TinyGsmSim70xx<TinyGsmSim7000SSL>,
|
||||
public TinyGsmTCP<TinyGsmSim7000SSL, TINY_GSM_MUX_COUNT>,
|
||||
public TinyGsmSSL<TinyGsmSim7000SSL, TINY_GSM_MUX_COUNT>,
|
||||
public TinyGsmSMS<TinyGsmSim7000SSL>,
|
||||
public TinyGsmGSMLocation<TinyGsmSim7000SSL>,
|
||||
public TinyGsmTime<TinyGsmSim7000SSL>,
|
||||
public TinyGsmNTP<TinyGsmSim7000SSL>,
|
||||
public TinyGsmBattery<TinyGsmSim7000SSL>,
|
||||
public TinyGsmGSMLocation<TinyGsmSim7000SSL> {
|
||||
public TinyGsmBattery<TinyGsmSim7000SSL> {
|
||||
friend class TinyGsmSim70xx<TinyGsmSim7000SSL>;
|
||||
friend class TinyGsmTCP<TinyGsmSim7000SSL, TINY_GSM_MUX_COUNT>;
|
||||
friend class TinyGsmSSL<TinyGsmSim7000SSL, TINY_GSM_MUX_COUNT>;
|
||||
friend class TinyGsmModem<TinyGsmSim7000SSL>;
|
||||
friend class TinyGsmGPRS<TinyGsmSim7000SSL>;
|
||||
friend class TinyGsmSMS<TinyGsmSim7000SSL>;
|
||||
friend class TinyGsmGSMLocation<TinyGsmSim7000SSL>;
|
||||
friend class TinyGsmGPS<TinyGsmSim7000SSL>;
|
||||
friend class TinyGsmNTP<TinyGsmSim7000SSL>;
|
||||
friend class TinyGsmTime<TinyGsmSim7000SSL>;
|
||||
friend class TinyGsmBattery<TinyGsmSim7000SSL>;
|
||||
friend class TinyGsmGSMLocation<TinyGsmSim7000SSL>;
|
||||
friend class TinyGsmGPS<TinyGsmSim7000SSL>;
|
||||
|
||||
/*
|
||||
* Inner Client
|
||||
@@ -135,8 +136,7 @@ class TinyGsmSim7000SSL
|
||||
*/
|
||||
public:
|
||||
explicit TinyGsmSim7000SSL(Stream& stream)
|
||||
: TinyGsmSim70xx<TinyGsmSim7000SSL>(stream),
|
||||
certificates() {
|
||||
: TinyGsmSim70xx<TinyGsmSim7000SSL>(stream) {
|
||||
memset(sockets, 0, sizeof(sockets));
|
||||
}
|
||||
|
||||
@@ -662,7 +662,6 @@ class TinyGsmSim7000SSL
|
||||
|
||||
protected:
|
||||
GsmClientSim7000SSL* sockets[TINY_GSM_MUX_COUNT];
|
||||
String certificates[TINY_GSM_MUX_COUNT];
|
||||
};
|
||||
|
||||
#endif // SRC_TINYGSMCLIENTSIM7000SSL_H_
|
||||
|
||||
@@ -18,16 +18,31 @@
|
||||
#include "TinyGsmClientSIM70xx.h"
|
||||
#include "TinyGsmTCP.tpp"
|
||||
#include "TinyGsmSSL.tpp"
|
||||
#include "TinyGsmSMS.tpp"
|
||||
#include "TinyGsmGSMLocation.tpp"
|
||||
#include "TinyGsmTime.tpp"
|
||||
#include "TinyGsmNTP.tpp"
|
||||
#include "TinyGsmBattery.tpp"
|
||||
|
||||
class TinyGsmSim7080 : public TinyGsmSim70xx<TinyGsmSim7080>,
|
||||
public TinyGsmNTP<TinyGsmSim7080>,
|
||||
public TinyGsmTCP<TinyGsmSim7080, TINY_GSM_MUX_COUNT>,
|
||||
public TinyGsmSSL<TinyGsmSim7080> {
|
||||
public TinyGsmSSL<TinyGsmSim7080, TINY_GSM_MUX_COUNT>,
|
||||
public TinyGsmSMS<TinyGsmSim7080>,
|
||||
public TinyGsmGSMLocation<TinyGsmSim7080>,
|
||||
public TinyGsmTime<TinyGsmSim7080>,
|
||||
public TinyGsmNTP<TinyGsmSim7080>,
|
||||
public TinyGsmBattery<TinyGsmSim7080> {
|
||||
friend class TinyGsmSim70xx<TinyGsmSim7080>;
|
||||
friend class TinyGsmNTP<TinyGsmSim7080>;
|
||||
friend class TinyGsmModem<TinyGsmSim7080>;
|
||||
friend class TinyGsmGPRS<TinyGsmSim7080>;
|
||||
friend class TinyGsmTCP<TinyGsmSim7080, TINY_GSM_MUX_COUNT>;
|
||||
friend class TinyGsmSSL<TinyGsmSim7080>;
|
||||
friend class TinyGsmSSL<TinyGsmSim7080, TINY_GSM_MUX_COUNT>;
|
||||
friend class TinyGsmSMS<TinyGsmSim7080>;
|
||||
friend class TinyGsmGSMLocation<TinyGsmSim7080>;
|
||||
friend class TinyGsmGPS<TinyGsmSim7080>;
|
||||
friend class TinyGsmTime<TinyGsmSim7080>;
|
||||
friend class TinyGsmNTP<TinyGsmSim7080>;
|
||||
friend class TinyGsmBattery<TinyGsmSim7080>;
|
||||
|
||||
/*
|
||||
* Inner Client
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
#include "TinyGsmGPRS.tpp"
|
||||
#include "TinyGsmGPS.tpp"
|
||||
#include "TinyGsmModem.tpp"
|
||||
#include "TinyGsmSMS.tpp"
|
||||
#include "TinyGsmTime.tpp"
|
||||
#include "TinyGsmGSMLocation.tpp"
|
||||
|
||||
enum SIM70xxRegStatus {
|
||||
REG_NO_RESULT = -1,
|
||||
@@ -34,31 +31,23 @@ enum SIM70xxRegStatus {
|
||||
REG_UNKNOWN = 4,
|
||||
};
|
||||
|
||||
template <class modemType>
|
||||
class TinyGsmSim70xx : public TinyGsmModem<TinyGsmSim70xx<modemType>>,
|
||||
public TinyGsmGPRS<TinyGsmSim70xx<modemType>>,
|
||||
public TinyGsmSMS<TinyGsmSim70xx<modemType>>,
|
||||
public TinyGsmGPS<TinyGsmSim70xx<modemType>>,
|
||||
public TinyGsmTime<TinyGsmSim70xx<modemType>>,
|
||||
public TinyGsmBattery<TinyGsmSim70xx<modemType>>,
|
||||
public TinyGsmGSMLocation<TinyGsmSim70xx<modemType>> {
|
||||
friend class TinyGsmModem<TinyGsmSim70xx<modemType>>;
|
||||
friend class TinyGsmGPRS<TinyGsmSim70xx<modemType>>;
|
||||
friend class TinyGsmSMS<TinyGsmSim70xx<modemType>>;
|
||||
friend class TinyGsmGPS<TinyGsmSim70xx<modemType>>;
|
||||
friend class TinyGsmTime<TinyGsmSim70xx<modemType>>;
|
||||
friend class TinyGsmBattery<TinyGsmSim70xx<modemType>>;
|
||||
friend class TinyGsmGSMLocation<TinyGsmSim70xx<modemType>>;
|
||||
template <class SIM70xxType>
|
||||
class TinyGsmSim70xx : public TinyGsmModem<SIM70xxType>,
|
||||
public TinyGsmGPRS<SIM70xxType>,
|
||||
public TinyGsmGPS<SIM70xxType> {
|
||||
friend class TinyGsmModem<SIM70xxType>;
|
||||
friend class TinyGsmGPRS<SIM70xxType>;
|
||||
friend class TinyGsmGPS<SIM70xxType>;
|
||||
|
||||
/*
|
||||
* CRTP Helper
|
||||
*/
|
||||
protected:
|
||||
inline const modemType& thisModem() const {
|
||||
return static_cast<const modemType&>(*this);
|
||||
inline const SIM70xxType& thisModem() const {
|
||||
return static_cast<const SIM70xxType&>(*this);
|
||||
}
|
||||
inline modemType& thisModem() {
|
||||
return static_cast<modemType&>(*this);
|
||||
inline SIM70xxType& thisModem() {
|
||||
return static_cast<SIM70xxType&>(*this);
|
||||
}
|
||||
~TinyGsmSim70xx() {}
|
||||
|
||||
@@ -72,10 +61,6 @@ class TinyGsmSim70xx : public TinyGsmModem<TinyGsmSim70xx<modemType>>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
return thisModem().initImpl(pin);
|
||||
}
|
||||
|
||||
String getModemNameImpl() {
|
||||
String name = "SIMCom SIM7000";
|
||||
|
||||
@@ -230,23 +215,11 @@ class TinyGsmSim70xx : public TinyGsmModem<TinyGsmSim70xx<modemType>>,
|
||||
return thisModem().waitResponse() == 1;
|
||||
}
|
||||
|
||||
String getLocalIPImpl() {
|
||||
return thisModem().getLocalIPImpl();
|
||||
}
|
||||
|
||||
/*
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
// should implement in sub-classes
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
return thisModem().gprsConnectImpl(apn, user, pwd);
|
||||
}
|
||||
|
||||
bool gprsDisconnectImpl() {
|
||||
return thisModem().gprsDisconnectImpl();
|
||||
}
|
||||
|
||||
/*
|
||||
* SIM card functions
|
||||
|
||||
Reference in New Issue
Block a user