Rename classes for A6, ESP, M590 and XBee
This commit is contained in:
		@@ -34,11 +34,13 @@
 | 
				
			|||||||
#elif defined(TINY_GSM_MODEM_A6) || defined(TINY_GSM_MODEM_A7)
 | 
					#elif defined(TINY_GSM_MODEM_A6) || defined(TINY_GSM_MODEM_A7)
 | 
				
			||||||
  #define TINY_GSM_MODEM_HAS_GPRS
 | 
					  #define TINY_GSM_MODEM_HAS_GPRS
 | 
				
			||||||
  #include <TinyGsmClientA6.h>
 | 
					  #include <TinyGsmClientA6.h>
 | 
				
			||||||
 | 
					  typedef TinyGsmA6 TinyGsm;
 | 
				
			||||||
  typedef TinyGsm::GsmClient TinyGsmClient;
 | 
					  typedef TinyGsm::GsmClient TinyGsmClient;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#elif defined(TINY_GSM_MODEM_M590)
 | 
					#elif defined(TINY_GSM_MODEM_M590)
 | 
				
			||||||
  #define TINY_GSM_MODEM_HAS_GPRS
 | 
					  #define TINY_GSM_MODEM_HAS_GPRS
 | 
				
			||||||
  #include <TinyGsmClientM590.h>
 | 
					  #include <TinyGsmClientM590.h>
 | 
				
			||||||
 | 
					  typedef TinyGsmM590 TinyGsm;
 | 
				
			||||||
  typedef TinyGsm::GsmClient TinyGsmClient;
 | 
					  typedef TinyGsm::GsmClient TinyGsmClient;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#elif defined(TINY_GSM_MODEM_U201)
 | 
					#elif defined(TINY_GSM_MODEM_U201)
 | 
				
			||||||
@@ -51,6 +53,7 @@
 | 
				
			|||||||
#elif defined(TINY_GSM_MODEM_ESP8266)
 | 
					#elif defined(TINY_GSM_MODEM_ESP8266)
 | 
				
			||||||
  #define TINY_GSM_MODEM_HAS_WIFI
 | 
					  #define TINY_GSM_MODEM_HAS_WIFI
 | 
				
			||||||
  #include <TinyGsmClientESP8266.h>
 | 
					  #include <TinyGsmClientESP8266.h>
 | 
				
			||||||
 | 
					  typedef TinyGsmESP8266 TinyGsm;
 | 
				
			||||||
  typedef TinyGsm::GsmClient TinyGsmClient;
 | 
					  typedef TinyGsm::GsmClient TinyGsmClient;
 | 
				
			||||||
  typedef TinyGsm::GsmClientSecure TinyGsmClientSecure;
 | 
					  typedef TinyGsm::GsmClientSecure TinyGsmClientSecure;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -58,7 +61,9 @@
 | 
				
			|||||||
  #define TINY_GSM_MODEM_HAS_GPRS
 | 
					  #define TINY_GSM_MODEM_HAS_GPRS
 | 
				
			||||||
  #define TINY_GSM_MODEM_HAS_WIFI
 | 
					  #define TINY_GSM_MODEM_HAS_WIFI
 | 
				
			||||||
  #include <TinyGsmClientXBee.h>
 | 
					  #include <TinyGsmClientXBee.h>
 | 
				
			||||||
  typedef TinyGsm::GsmClient TinyGsmClient;
 | 
					  typedef TinyGsmXBee TinyGsm;
 | 
				
			||||||
 | 
					  typedef TinyGsmXBee::GsmClient TinyGsmClient;
 | 
				
			||||||
 | 
					  typedef TinyGsmXBee::GsmClientSecure TinyGsmClientSecure;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
  #error "Please define GSM modem model"
 | 
					  #error "Please define GSM modem model"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,24 +39,24 @@ enum RegStatus {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TinyGsm
 | 
					class TinyGsmA6
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GsmClient : public Client
 | 
					class GsmClient : public Client
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  friend class TinyGsm;
 | 
					  friend class TinyGsmA6;
 | 
				
			||||||
  typedef TinyGsmFifo<uint8_t, TINY_GSM_RX_BUFFER> RxFifo;
 | 
					  typedef TinyGsmFifo<uint8_t, TINY_GSM_RX_BUFFER> RxFifo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  GsmClient() {}
 | 
					  GsmClient() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  GsmClient(TinyGsm& modem) {
 | 
					  GsmClient(TinyGsmA6& modem) {
 | 
				
			||||||
    init(&modem);
 | 
					    init(&modem);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool init(TinyGsm* modem) {
 | 
					  bool init(TinyGsmA6* modem) {
 | 
				
			||||||
    this->at = modem;
 | 
					    this->at = modem;
 | 
				
			||||||
    this->mux = -1;
 | 
					    this->mux = -1;
 | 
				
			||||||
    sock_connected = false;
 | 
					    sock_connected = false;
 | 
				
			||||||
@@ -161,7 +161,7 @@ public:
 | 
				
			|||||||
  String remoteIP() TINY_GSM_ATTR_NOT_IMPLEMENTED;
 | 
					  String remoteIP() TINY_GSM_ATTR_NOT_IMPLEMENTED;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  TinyGsm*      at;
 | 
					  TinyGsmA6*      at;
 | 
				
			||||||
  uint8_t       mux;
 | 
					  uint8_t       mux;
 | 
				
			||||||
  bool          sock_connected;
 | 
					  bool          sock_connected;
 | 
				
			||||||
  RxFifo        rx;
 | 
					  RxFifo        rx;
 | 
				
			||||||
@@ -169,7 +169,7 @@ private:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TinyGsm(Stream& stream)
 | 
					  TinyGsmA6(Stream& stream)
 | 
				
			||||||
    : stream(stream)
 | 
					    : stream(stream)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    memset(sockets, 0, sizeof(sockets));
 | 
					    memset(sockets, 0, sizeof(sockets));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,24 +24,24 @@ static const char GSM_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
 | 
				
			|||||||
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
 | 
					static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
 | 
				
			||||||
static unsigned TINY_GSM_TCP_KEEP_ALIVE = 120;
 | 
					static unsigned TINY_GSM_TCP_KEEP_ALIVE = 120;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TinyGsm
 | 
					class TinyGsmESP8266
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GsmClient : public Client
 | 
					class GsmClient : public Client
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  friend class TinyGsm;
 | 
					  friend class TinyGsmESP8266;
 | 
				
			||||||
  typedef TinyGsmFifo<uint8_t, TINY_GSM_RX_BUFFER> RxFifo;
 | 
					  typedef TinyGsmFifo<uint8_t, TINY_GSM_RX_BUFFER> RxFifo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  GsmClient() {}
 | 
					  GsmClient() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  GsmClient(TinyGsm& modem, uint8_t mux = 1) {
 | 
					  GsmClient(TinyGsmESP8266& modem, uint8_t mux = 1) {
 | 
				
			||||||
    init(&modem, mux);
 | 
					    init(&modem, mux);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool init(TinyGsm* modem, uint8_t mux = 1) {
 | 
					  bool init(TinyGsmESP8266* modem, uint8_t mux = 1) {
 | 
				
			||||||
    this->at = modem;
 | 
					    this->at = modem;
 | 
				
			||||||
    this->mux = mux;
 | 
					    this->mux = mux;
 | 
				
			||||||
    sock_connected = false;
 | 
					    sock_connected = false;
 | 
				
			||||||
@@ -143,7 +143,7 @@ public:
 | 
				
			|||||||
  String remoteIP() TINY_GSM_ATTR_NOT_IMPLEMENTED;
 | 
					  String remoteIP() TINY_GSM_ATTR_NOT_IMPLEMENTED;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  TinyGsm*      at;
 | 
					  TinyGsmESP8266*      at;
 | 
				
			||||||
  uint8_t       mux;
 | 
					  uint8_t       mux;
 | 
				
			||||||
  bool          sock_connected;
 | 
					  bool          sock_connected;
 | 
				
			||||||
  RxFifo        rx;
 | 
					  RxFifo        rx;
 | 
				
			||||||
@@ -154,7 +154,7 @@ class GsmClientSecure : public GsmClient
 | 
				
			|||||||
public:
 | 
					public:
 | 
				
			||||||
  GsmClientSecure() {}
 | 
					  GsmClientSecure() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  GsmClientSecure(TinyGsm& modem, uint8_t mux = 1)
 | 
					  GsmClientSecure(TinyGsmESP8266& modem, uint8_t mux = 1)
 | 
				
			||||||
    : GsmClient(modem, mux)
 | 
					    : GsmClient(modem, mux)
 | 
				
			||||||
  {}
 | 
					  {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -169,7 +169,7 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TinyGsm(Stream& stream)
 | 
					  TinyGsmESP8266(Stream& stream)
 | 
				
			||||||
    : stream(stream)
 | 
					    : stream(stream)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    memset(sockets, 0, sizeof(sockets));
 | 
					    memset(sockets, 0, sizeof(sockets));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,24 +39,24 @@ enum RegStatus {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TinyGsm
 | 
					class TinyGsmM590
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GsmClient : public Client
 | 
					class GsmClient : public Client
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  friend class TinyGsm;
 | 
					  friend class TinyGsmM590;
 | 
				
			||||||
  typedef TinyGsmFifo<uint8_t, TINY_GSM_RX_BUFFER> RxFifo;
 | 
					  typedef TinyGsmFifo<uint8_t, TINY_GSM_RX_BUFFER> RxFifo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  GsmClient() {}
 | 
					  GsmClient() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  GsmClient(TinyGsm& modem, uint8_t mux = 1) {
 | 
					  GsmClient(TinyGsmM590& modem, uint8_t mux = 1) {
 | 
				
			||||||
    init(&modem, mux);
 | 
					    init(&modem, mux);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool init(TinyGsm* modem, uint8_t mux = 1) {
 | 
					  bool init(TinyGsmM590* modem, uint8_t mux = 1) {
 | 
				
			||||||
    this->at = modem;
 | 
					    this->at = modem;
 | 
				
			||||||
    this->mux = mux;
 | 
					    this->mux = mux;
 | 
				
			||||||
    sock_connected = false;
 | 
					    sock_connected = false;
 | 
				
			||||||
@@ -158,7 +158,7 @@ public:
 | 
				
			|||||||
  String remoteIP() TINY_GSM_ATTR_NOT_IMPLEMENTED;
 | 
					  String remoteIP() TINY_GSM_ATTR_NOT_IMPLEMENTED;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  TinyGsm*      at;
 | 
					  TinyGsmM590*      at;
 | 
				
			||||||
  uint8_t       mux;
 | 
					  uint8_t       mux;
 | 
				
			||||||
  bool          sock_connected;
 | 
					  bool          sock_connected;
 | 
				
			||||||
  RxFifo        rx;
 | 
					  RxFifo        rx;
 | 
				
			||||||
@@ -166,7 +166,7 @@ private:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TinyGsm(Stream& stream)
 | 
					  TinyGsmM590(Stream& stream)
 | 
				
			||||||
    : stream(stream)
 | 
					    : stream(stream)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    memset(sockets, 0, sizeof(sockets));
 | 
					    memset(sockets, 0, sizeof(sockets));
 | 
				
			||||||
@@ -403,12 +403,12 @@ public:
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_dns:
 | 
					// set_dns:  // TODO
 | 
				
			||||||
    sendAT(GF("+DNSSERVER=1,8.8.8.8"));
 | 
					//     sendAT(GF("+DNSSERVER=1,8.8.8.8"));
 | 
				
			||||||
    waitResponse();
 | 
					//     waitResponse();
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
    sendAT(GF("+DNSSERVER=2,8.8.4.4"));
 | 
					//     sendAT(GF("+DNSSERVER=2,8.8.4.4"));
 | 
				
			||||||
    waitResponse();
 | 
					//     waitResponse();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,23 +44,23 @@ enum RegStatus {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TinyGsm
 | 
					class TinyGsmXBee
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GsmClient : public Client
 | 
					class GsmClient : public Client
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  friend class TinyGsm;
 | 
					  friend class TinyGsmXBee;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  GsmClient() {}
 | 
					  GsmClient() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  GsmClient(TinyGsm& modem, uint8_t mux = 0) {
 | 
					  GsmClient(TinyGsmXBee& modem, uint8_t mux = 0) {
 | 
				
			||||||
    init(&modem, mux);
 | 
					    init(&modem, mux);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool init(TinyGsm* modem, uint8_t mux = 0) {
 | 
					  bool init(TinyGsmXBee* modem, uint8_t mux = 0) {
 | 
				
			||||||
    this->at = modem;
 | 
					    this->at = modem;
 | 
				
			||||||
    this->mux = mux;
 | 
					    this->mux = mux;
 | 
				
			||||||
    sock_connected = false;
 | 
					    sock_connected = false;
 | 
				
			||||||
@@ -131,7 +131,7 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  virtual int read(uint8_t *buf, size_t size) {
 | 
					  virtual int read(uint8_t *buf, size_t size) {
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    return at->stream.readBytes((uint8_t*)buf, size);
 | 
					    return at->stream.readBytes((char*)buf, size);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  virtual int read() {
 | 
					  virtual int read() {
 | 
				
			||||||
@@ -157,7 +157,7 @@ public:
 | 
				
			|||||||
  String remoteIP() TINY_GSM_ATTR_NOT_IMPLEMENTED;
 | 
					  String remoteIP() TINY_GSM_ATTR_NOT_IMPLEMENTED;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  TinyGsm*      at;
 | 
					  TinyGsmXBee*  at;
 | 
				
			||||||
  uint8_t       mux;
 | 
					  uint8_t       mux;
 | 
				
			||||||
  bool          sock_connected;
 | 
					  bool          sock_connected;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -167,7 +167,7 @@ class GsmClientSecure : public GsmClient
 | 
				
			|||||||
public:
 | 
					public:
 | 
				
			||||||
  GsmClientSecure() {}
 | 
					  GsmClientSecure() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  GsmClientSecure(TinyGsm& modem, uint8_t mux = 1)
 | 
					  GsmClientSecure(TinyGsmXBee& modem, uint8_t mux = 1)
 | 
				
			||||||
    : GsmClient(modem, mux)
 | 
					    : GsmClient(modem, mux)
 | 
				
			||||||
  {}
 | 
					  {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -199,7 +199,11 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TinyGsm(Stream& stream)
 | 
					#ifdef GSM_DEFAULT_STREAM
 | 
				
			||||||
 | 
					  TinyGsmXBee(Stream& stream = GSM_DEFAULT_STREAM)
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					  TinyGsmXBee(Stream& stream)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
    : stream(stream)
 | 
					    : stream(stream)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    memset(sockets, 0, sizeof(sockets));
 | 
					    memset(sockets, 0, sizeof(sockets));
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user