Many sub templates to inherit from!

This commit is contained in:
Sara Damiano
2020-02-11 16:03:44 -05:00
parent 9ec9111f32
commit be81985c83
33 changed files with 1976 additions and 2291 deletions

71
src/TinyGsmSSL.tpp Normal file
View File

@@ -0,0 +1,71 @@
/**
* @file TinyGsmSSL.tpp
* @author Volodymyr Shymanskyy
* @license LGPL-3.0
* @copyright Copyright (c) 2016 Volodymyr Shymanskyy
* @date Nov 2016
*/
#ifndef SRC_TINYGSMSSL_H_
#define SRC_TINYGSMSSL_H_
#include "TinyGsmCommon.h"
#define TINY_GSM_MODEM_HAS_SSL
template <class modemType>
class TinyGsmSSL {
public:
/*
* SSL functions
*/
bool addCertificate(const char* filename) {
return thisModem().addCertificateImpl(filename);
}
bool deleteCertificate() {
return thisModem().deleteCertificateImpl();
}
/*
* CRTP Helper
*/
protected:
inline const modemType& thisModem() const {
return static_cast<const modemType&>(*this);
}
inline modemType& thisModem() {
return static_cast<modemType&>(*this);
}
/*
* Inner Secure Client
*/
/*
public:
class GsmClientSecure : public GsmClient {
public:
GsmClientSecureSim800() {}
explicit GsmClientSecureSim800(TinyGsmSim800& modem, uint8_t mux = 1)
: GsmClientSim800(modem, mux) {}
public:
int connect(const char* host, uint16_t port, int timeout_s) {
stop();
TINY_GSM_YIELD();
rx.clear();
sock_connected = at->modemConnect(host, port, mux, true, timeout_s);
return sock_connected;
}
};*/
/*
* SSL functions
*/
protected:
bool addCertificateImpl(const char* filename) TINY_GSM_ATTR_NOT_IMPLEMENTED;
bool deleteCertificateImpl() TINY_GSM_ATTR_NOT_IMPLEMENTED;
};
#endif // SRC_TINYGSMSSL_H_