Browse Source

Moved all src files into the src directory

Also fixed the "isNetworkConnected" for ESP8266
v_master
SRGDamia1 7 years ago
parent
commit
89203c8e25
12 changed files with 821 additions and 763 deletions
  1. +1
    -1
      library.json
  2. +0
    -0
      src/TinyGsmClient.h
  3. +756
    -756
      src/TinyGsmClientA6.h
  4. +19
    -6
      src/TinyGsmClientESP8266.h
  5. +0
    -0
      src/TinyGsmClientM590.h
  6. +0
    -0
      src/TinyGsmClientSIM800.h
  7. +0
    -0
      src/TinyGsmClientSIM808.h
  8. +0
    -0
      src/TinyGsmClientU201.h
  9. +0
    -0
      src/TinyGsmClientXBee.h
  10. +0
    -0
      src/TinyGsmCommon.h
  11. +0
    -0
      src/TinyGsmFifo.h
  12. +45
    -0
      tools/AT_Spy/AT_Spy.ino

+ 1
- 1
library.json View File

@ -16,7 +16,7 @@
},
"homepage": "https://github.com/vshymanskyy/TinyGSM",
"export": {
"exclude": [ "extras", "tools" ]
"exclude": [ "extras/*", "tools/*" ]
},
"frameworks": [ "arduino", "energia", "wiringpi" ],
"platforms": "*",


TinyGsmClient.h → src/TinyGsmClient.h View File


src/TinyGsmClientA6.h
File diff suppressed because it is too large
View File


TinyGsmClientESP8266.h → src/TinyGsmClientESP8266.h View File

@ -268,22 +268,25 @@ public:
streamSkipUntil(','); // Skip BSSID/MAC address
streamSkipUntil(','); // Skip Chanel number
int res2 = stream.parseInt(); // Read RSSI
waitResponse();
waitResponse(); // Returns an OK after the value
return res2;
}
bool isNetworkConnected() {
sendAT(GF("+CIPSTATUS"));
int res1 = waitResponse(3000, GF("STATUS:"));
int res2;
if (res1 == 1) {
int res2 = waitResponse(GFP(GSM_ERROR), GF("2"), GF("3"), GF("4"), GF("5"));
if (res2 == 2 || res2 == 3 || res2 == 4) return true;
res2 = waitResponse(GFP(GSM_ERROR), GF("2"), GF("3"), GF("4"), GF("5"));
}
// <stat> status of ESP8266 station interface
// 2 : ESP8266 station connected to an AP and has obtained IP
// 3 : ESP8266 station created a TCP or UDP transmission
// 4 : the TCP or UDP transmission of ESP8266 station disconnected (but AP is connected)
// 5 : ESP8266 station did NOT connect to an AP
waitResponse(); // Returns an OK after the status
if (res2 == 2 || res2 == 3 || res2 == 4) return true;
else return false;
}
bool waitForNetwork(unsigned long timeout = 60000L) {
@ -373,9 +376,19 @@ protected:
bool modemGetConnected(uint8_t mux) {
sendAT(GF("+CIPSTATUS="), mux);
int res = waitResponse(GF(",\"CONNECTED\""), GF(",\"CLOSED\""), GF(",\"CLOSING\""), GF(",\"INITIAL\""));
waitResponse();
return 1 == res;
int res1 = waitResponse(3000, GF("STATUS:"));
int res2;
if (res1 == 1) {
res2 = waitResponse(GFP(GSM_ERROR), GF("2"), GF("3"), GF("4"), GF("5"));
}
// <stat> status of ESP8266 station interface
// 2 : ESP8266 station connected to an AP and has obtained IP
// 3 : ESP8266 station created a TCP or UDP transmission
// 4 : the TCP or UDP transmission of ESP8266 station disconnected (but AP is connected)
// 5 : ESP8266 station did NOT connect to an AP
waitResponse(); // Returns an OK after the status
if (res2 == 2 || res2 == 3 || res2 == 4) return true;
else return false;
}
public:

TinyGsmClientM590.h → src/TinyGsmClientM590.h View File


TinyGsmClientSIM800.h → src/TinyGsmClientSIM800.h View File


TinyGsmClientSIM808.h → src/TinyGsmClientSIM808.h View File


TinyGsmClientU201.h → src/TinyGsmClientU201.h View File


TinyGsmClientXBee.h → src/TinyGsmClientXBee.h View File


TinyGsmCommon.h → src/TinyGsmCommon.h View File


TinyGsmFifo.h → src/TinyGsmFifo.h View File


+ 45
- 0
tools/AT_Spy/AT_Spy.ino View File

@ -0,0 +1,45 @@
/**************************************************************
*
* This script just listens in on the communication between an Arduino and the
* modem.
*
* TinyGSM Getting Started guide:
* http://tiny.cc/tiny-gsm-readme
*
**************************************************************/
// Set the baud rate between the modem and the board
#define BAUD_RATE 9600
// Set serial printing out the communication
#define SPY Serial
// Set serial for input from modem
#define MODEM_TX Serial1
// Set serial for AT commands (to the module)
// Use Hardware Serial on Mega, Leonardo, Micro
// #define BOARD_TX Serial1
// or AltSoftware
#include <AltSoftSerial.h>
AltSoftSerial BOARD_TX;
void setup() {
// Set console baud rate
SPY.begin(57600);
MODEM_TX.begin(BAUD_RATE);
BOARD_TX.begin(BAUD_RATE);
delay(5000);
}
void loop()
{
while (MODEM_TX.available()) {
SPY.write(MODEM_TX.read());
}
while (BOARD_TX.available()) {
SPY.write(BOARD_TX.read());
}
}

Loading…
Cancel
Save