Browse Source

Merge remote-tracking branch 'upstream/master'

v_master
Michael Krumpus 6 years ago
parent
commit
34147ed24e
19 changed files with 80 additions and 50 deletions
  1. +4
    -1
      examples/AllFunctions/AllFunctions.ino
  2. +2
    -0
      examples/BlynkClient/BlynkClient.ino
  3. +2
    -0
      examples/FileDownload/FileDownload.ino
  4. +2
    -0
      examples/HttpClient/HttpClient.ino
  5. +3
    -1
      examples/HttpsClient/HttpsClient.ino
  6. +15
    -4
      examples/MqttClient/MqttClient.ino
  7. +2
    -0
      examples/WebClient/WebClient.ino
  8. +1
    -1
      library.json
  9. +1
    -1
      library.properties
  10. +5
    -0
      src/TinyGsmClientA6.h
  11. +5
    -0
      src/TinyGsmClientBG96.h
  12. +5
    -0
      src/TinyGsmClientESP8266.h
  13. +5
    -0
      src/TinyGsmClientM590.h
  14. +11
    -41
      src/TinyGsmClientSIM800.h
  15. +5
    -0
      src/TinyGsmClientUBLOX.h
  16. +5
    -0
      src/TinyGsmClientXBee.h
  17. +2
    -0
      tools/AT_Debug/AT_Debug.ino
  18. +3
    -1
      tools/Diagnostics/Diagnostics.ino
  19. +2
    -0
      tools/FactoryReset/FactoryReset.ino

+ 4
- 1
examples/AllFunctions/AllFunctions.ino View File

@ -13,6 +13,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590
@ -97,7 +99,8 @@ void loop() {
return;
}
bool res;
bool res = modem.isGprsConnected();
DBG("GPRS status:", res ? "connected" : "not connected");
String ccid = modem.getSimCCID();
DBG("CCID:", ccid);


+ 2
- 0
examples/BlynkClient/BlynkClient.ino View File

@ -32,6 +32,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590


+ 2
- 0
examples/FileDownload/FileDownload.ino View File

@ -17,6 +17,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590


+ 2
- 0
examples/HttpClient/HttpClient.ino View File

@ -18,6 +18,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590


+ 3
- 1
examples/HttpsClient/HttpsClient.ino View File

@ -10,7 +10,8 @@
* TinyGSM Getting Started guide:
* http://tiny.cc/tiny-gsm-readme
*
* SSL/TLS is currently supported only with SIM8xx series
* SSL/TLS is currently supported only with: SIM8xx, uBlox
*
* For more HTTP API examples, see ArduinoHttpClient library
*
**************************************************************/
@ -18,6 +19,7 @@
// Select your modem:
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_UBLOX
// Increase RX buffer if needed
//#define TINY_GSM_RX_BUFFER 512


+ 15
- 4
examples/MqttClient/MqttClient.ino View File

@ -31,6 +31,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590
@ -119,7 +121,14 @@ void setup() {
boolean mqttConnect() {
SerialMon.print("Connecting to ");
SerialMon.print(broker);
if (!mqtt.connect("GsmClientTest")) {
// Connect to MQTT Broker
boolean status = mqtt.connect("GsmClientTest");
// Or, if you want to authenticate MQTT:
//boolean status = mqtt.connect("GsmClientName", "mqtt_user", "mqtt_pass");
if (status == false) {
SerialMon.println(" fail");
return false;
}
@ -131,9 +140,8 @@ boolean mqttConnect() {
void loop() {
if (mqtt.connected()) {
mqtt.loop();
} else {
if (!mqtt.connected()) {
SerialMon.println("=== MQTT NOT CONNECTED ===");
// Reconnect every 10 seconds
unsigned long t = millis();
if (t - lastReconnectAttempt > 10000L) {
@ -142,8 +150,11 @@ void loop() {
lastReconnectAttempt = 0;
}
}
delay(100);
return;
}
mqtt.loop();
}
void mqttCallback(char* topic, byte* payload, unsigned int len) {


+ 2
- 0
examples/WebClient/WebClient.ino View File

@ -12,6 +12,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590


+ 1
- 1
library.json View File

@ -1,6 +1,6 @@
{
"name": "TinyGSM",
"version": "0.3.3",
"version": "0.3.5",
"description": "A small Arduino library for GPRS modules, that just works. Includes examples for Blynk, MQTT, File Download, and Web Client. Supports GSM modules with AT command interface: SIM800, SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868, SIM900, SIM900A, SIM900D, SIM908, SIM968",
"keywords": "GSM, AT commands, AT, SIM800, SIM900, A6, A7, M590, ESP8266, SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868, SIM900A, SIM900D, SIM908, SIM968",
"authors":


+ 1
- 1
library.properties View File

@ -1,5 +1,5 @@
name=TinyGSM
version=0.3.3
version=0.3.5
author=Volodymyr Shymanskyy
maintainer=Volodymyr Shymanskyy
sentence=A small Arduino library for GPRS modules, that just works.


+ 5
- 0
src/TinyGsmClientA6.h View File

@ -120,6 +120,11 @@ public:
return write(&c, 1);
}
virtual size_t write(const char *str) {
if (str == NULL) return 0;
return write((const uint8_t *)str, strlen(str));
}
virtual int available() {
TINY_GSM_YIELD();
if (!rx.size() && sock_connected) {


+ 5
- 0
src/TinyGsmClientBG96.h View File

@ -120,6 +120,11 @@ public:
return write(&c, 1);
}
virtual size_t write(const char *str) {
if (str == NULL) return 0;
return write((const uint8_t *)str, strlen(str));
}
virtual int available() {
TINY_GSM_YIELD();
if (!rx.size()) {


+ 5
- 0
src/TinyGsmClientESP8266.h View File

@ -117,6 +117,11 @@ public:
return write(&c, 1);
}
virtual size_t write(const char *str) {
if (str == NULL) return 0;
return write((const uint8_t *)str, strlen(str));
}
virtual int available() {
TINY_GSM_YIELD();
if (!rx.size() && sock_connected) {


+ 5
- 0
src/TinyGsmClientM590.h View File

@ -118,6 +118,11 @@ public:
return write(&c, 1);
}
virtual size_t write(const char *str) {
if (str == NULL) return 0;
return write((const uint8_t *)str, strlen(str));
}
virtual int available() {
TINY_GSM_YIELD();
if (!rx.size() && sock_connected) {


+ 11
- 41
src/TinyGsmClientSIM800.h View File

@ -45,22 +45,9 @@ enum TinyGSMDateTimeFormat {
DATE_DATE = 2
};
//============================================================================//
//============================================================================//
// Declaration of the TinyGsmSim800 Class
//============================================================================//
//============================================================================//
class TinyGsmSim800
{
//============================================================================//
//============================================================================//
// The Sim800 Internal Client Class
//============================================================================//
//============================================================================//
public:
class GsmClient : public Client
@ -127,6 +114,11 @@ public:
return write(&c, 1);
}
virtual size_t write(const char *str) {
if (str == NULL) return 0;
return write((const uint8_t *)str, strlen(str));
}
virtual int available() {
TINY_GSM_YIELD();
if (!rx.size() && sock_connected) {
@ -200,13 +192,6 @@ private:
RxFifo rx;
};
//============================================================================//
//============================================================================//
// The SIM800 Secure Client
//============================================================================//
//============================================================================//
class GsmClientSecure : public GsmClient
{
public:
@ -226,19 +211,9 @@ public:
}
};
//============================================================================//
//============================================================================//
// The SIM800 Modem Functions
//============================================================================//
//============================================================================//
public:
#ifdef GSM_DEFAULT_STREAM
TinyGsmSim800(Stream& stream = GSM_DEFAULT_STREAM)
#else
TinyGsmSim800(Stream& stream)
#endif
: stream(stream)
{
memset(sockets, 0, sizeof(sockets));
@ -343,6 +318,7 @@ public:
return false;
}
//Enable Local Time Stamp for getting network time
// TODO: Find a better place for this
sendAT(GF("+CLTS=1"));
if (waitResponse(10000L) != 1) {
return false;
@ -426,10 +402,10 @@ public:
int status = waitResponse(GF("READY"), GF("SIM PIN"), GF("SIM PUK"), GF("NOT INSERTED"));
waitResponse();
switch (status) {
case 2:
case 3: return SIM_LOCKED;
case 1: return SIM_READY;
default: return SIM_ERROR;
case 2:
case 3: return SIM_LOCKED;
case 1: return SIM_READY;
default: return SIM_ERROR;
}
}
return SIM_ERROR;
@ -486,10 +462,6 @@ public:
return false;
}
/*
* WiFi functions
*/
/*
* GPRS functions
*/
@ -926,8 +898,7 @@ public:
streamWrite(tail...);
}
bool streamSkipUntil(char c) {
const unsigned long timeout = 1000L;
bool streamSkipUntil(const char c, const unsigned long timeout = 3000L) {
unsigned long startMillis = millis();
while (millis() - startMillis < timeout) {
while (millis() - startMillis < timeout && !stream.available()) {
@ -1013,7 +984,6 @@ finish:
}
data = "";
}
//DBG('<', index, '>');
return index;
}


+ 5
- 0
src/TinyGsmClientUBLOX.h View File

@ -118,6 +118,11 @@ public:
return write(&c, 1);
}
virtual size_t write(const char *str) {
if (str == NULL) return 0;
return write((const uint8_t *)str, strlen(str));
}
virtual int available() {
TINY_GSM_YIELD();
if (!rx.size() && sock_connected) {


+ 5
- 0
src/TinyGsmClientXBee.h View File

@ -136,6 +136,11 @@ public:
return write(&c, 1);
}
virtual size_t write(const char *str) {
if (str == NULL) return 0;
return write((const uint8_t *)str, strlen(str));
}
virtual int available() {
TINY_GSM_YIELD();
return at->stream.available();


+ 2
- 0
tools/AT_Debug/AT_Debug.ino View File

@ -12,6 +12,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590


+ 3
- 1
tools/Diagnostics/Diagnostics.ino View File

@ -14,6 +14,7 @@
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590
@ -56,6 +57,7 @@ const char resource[] = "/TinyGSM/logo.txt";
const int port = 80;
TinyGsmClient client(modem);
// For SSL:
//const int port = 443;
//TinyGsmClientSecure client(modem);
@ -155,7 +157,7 @@ void loop() {
while (client.connected() && millis() - timeout < 10000L) {
while (client.available()) {
char c = client.read();
SerialMon.print(c);
//SerialMon.print(c);
bytesReceived += 1;
timeout = millis();
}


+ 2
- 0
tools/FactoryReset/FactoryReset.ino View File

@ -13,6 +13,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590


Loading…
Cancel
Save