From c4d2492902498eb52d6ae27b4a60d1f9494e21bd Mon Sep 17 00:00:00 2001 From: SRGDamia1 Date: Thu, 21 Sep 2017 10:39:07 -0400 Subject: [PATCH] Fixed XBee mux array compiler warning, updated readme --- README.md | 41 +++++++++++++++++++++-------------------- TinyGsmClientXBee.h | 18 +++++++++--------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 5722642..2fdc07d 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ A small Arduino library for GSM modules, that just works. [![GitHub stars](https://img.shields.io/github/stars/vshymanskyy/TinyGSM.svg)](https://github.com/vshymanskyy/TinyGSM/stargazers) [![License](https://img.shields.io/badge/license-LGPL3-blue.svg)](https://github.com/vshymanskyy/TinyGSM/blob/master/LICENSE) -If you like **TinyGSM** - give it a star, or fork it and contribute! -[![GitHub stars](https://img.shields.io/github/stars/vshymanskyy/TinyGSM.svg?style=social&label=Star)](https://github.com/vshymanskyy/TinyGSM/stargazers) +If you like **TinyGSM** - give it a star, or fork it and contribute! +[![GitHub stars](https://img.shields.io/github/stars/vshymanskyy/TinyGSM.svg?style=social&label=Star)](https://github.com/vshymanskyy/TinyGSM/stargazers) [![GitHub forks](https://img.shields.io/github/forks/vshymanskyy/TinyGSM.svg?style=social&label=Fork)](https://github.com/vshymanskyy/TinyGSM/network) You can also join our chat: @@ -35,29 +35,29 @@ TinyGSM also pulls data gently from the modem (whenever possible), so it can ope ## Features -Feature \ Modem | SIM800 | SIM8x8 | A6/A7/A20 | M590 | ESP8266 ---- | --- | --- | --- | --- | --- +Feature \ Modem | SIM800 | SIM8x8 | A6/A7/A20 | M590 | ESP8266 | XBee +--- | --- | --- | --- | --- | --- | **Data connections** -TCP (HTTP, MQTT, Blynk, ...) | ✔ | ✔ | ✔ | ✔ | ✔ -UDP | | | | | -SSL/TLS (HTTPS) | ✔¹ | ✔¹ | 🅧 | 🅧 | ◌ +TCP (HTTP, MQTT, Blynk, ...) | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ +UDP | | | | | | ◌ +SSL/TLS (HTTPS) | ✔¹ | ✔¹ | 🅧 | 🅧 | ◌ | **USSD** -Sending USSD requests | ✔ | ✔ | ✔ | ✔ | -Decoding 7,8,16-bit response | ✔ | ✔ | ✔ | ✔ | +Sending USSD requests | ✔ | ✔ | ✔ | ✔ | | +Decoding 7,8,16-bit response | ✔ | ✔ | ✔ | ✔ | | **SMS** -Sending | ✔ | ✔ | ✔ | ✔ | -Sending Unicode | ✔ | ✔ | ◌ | 🅧 | -Reading | | | | | -Incoming message event | | | | ? | +Sending | ✔ | ✔ | ✔ | ✔ | | ✔ +Sending Unicode | ✔ | ✔ | ◌ | 🅧 | | +Reading | | | | | | +Incoming message event | | | | ? | | **Calls** -Dial, hangup | ✔ | ✔ | ✔ | 🅧 | -Receiving calls | ✔ | ✔ | ✔ | 🅧 | -Incoming event (RING) | ◌ | ◌ | ◌ | 🅧 | -DTMF sending | ◌ | ◌ | ◌ | 🅧 | -DTMF decoding | ◌ | ◌ | 🅧 | 🅧 | +Dial, hangup | ✔ | ✔ | ✔ | 🅧 | | 🅧 +Receiving calls | ✔ | ✔ | ✔ | 🅧 | | 🅧 +Incoming event (RING) | ◌ | ◌ | ◌ | 🅧 | | 🅧 +DTMF sending | ◌ | ◌ | ◌ | 🅧 | | 🅧 +DTMF decoding | ◌ | ◌ | 🅧 | 🅧 | | 🅧 **Location** -GSM location service | ✔ | ✔ | 🅧 | 🅧 | -GPS/GNSS | 🅧 | ✔² | ◌¹ | 🅧 | +GSM location service | ✔ | ✔ | 🅧 | 🅧 | | 🅧 +GPS/GNSS | 🅧 | ✔² | ◌¹ | 🅧 | | 🅧 ✔ - implemented  ◌ - planned  🅧 - not available for this modem ¹ - only some device models or firmware revisions have this feature @@ -70,6 +70,7 @@ GPS/GNSS | 🅧 | ✔² | ◌¹ | 🅧 | - [x] AI-Thinker A6, A6C, A7 - [x] Neoway M590 - [x] ESP8266 (AT commands interface, similar to GSM modems) +- [x] Digi XBee WiFi and Cellular (using XBee command mode) ### Supported modules - [x] GPRSbee diff --git a/TinyGsmClientXBee.h b/TinyGsmClientXBee.h index d12a46e..475f34f 100644 --- a/TinyGsmClientXBee.h +++ b/TinyGsmClientXBee.h @@ -15,6 +15,8 @@ #define TINY_GSM_RX_BUFFER 256 #endif +#define TINY_GSM_MUX_COUNT 1 // Multi-plexing isn't supported using command mode + #include #define GSM_NL "\r" @@ -59,11 +61,11 @@ class GsmClient : public Client public: GsmClient() {} - GsmClient(TinyGsm& modem, uint8_t mux = 1) { + GsmClient(TinyGsm& modem, uint8_t mux = 0) { init(&modem, mux); } - bool init(TinyGsm* modem, uint8_t mux = 1) { + bool init(TinyGsm* modem, uint8_t mux = 0) { this->at = modem; this->mux = mux; sock_connected = false; @@ -438,7 +440,7 @@ public: private: - int modemConnect(const char* host, uint16_t port, uint8_t mux = 1) { + int modemConnect(const char* host, uint16_t port, uint8_t mux = 0) { sendAT(GF("LA"), host); String strIP; strIP.reserve(16); // wait for the response @@ -460,7 +462,7 @@ private: return modemConnect(res, port); } - int modemConnect(IPAddress ip, uint16_t port, uint8_t mux = 1) { + int modemConnect(IPAddress ip, uint16_t port, uint8_t mux = 0) { String host; host.reserve(16); host += ip[0]; host += "."; @@ -478,13 +480,13 @@ private: return rsp; } - int modemSend(const void* buff, size_t len, uint8_t mux = 1) { + int modemSend(const void* buff, size_t len, uint8_t mux = 0) { stream.write((uint8_t*)buff, len); stream.flush(); return len; } - bool modemGetConnected(uint8_t mux = 1) { + bool modemGetConnected(uint8_t mux = 0) { commandMode(); if (beeType == S6B) sendAT(GF("AI")); else sendAT(GF("CI")); @@ -625,9 +627,7 @@ private: int guardTime; XBeeType beeType; Stream& stream; - GsmClient* sockets[1]; + GsmClient* sockets[TINY_GSM_MUX_COUNT]; }; -typedef TinyGsm::GsmClient TinyGsmClient; - #endif