mirror of
https://github.com/KevinMidboe/TinyGSM.git
synced 2025-10-29 18:00:18 +00:00
Merge branch 'master' of https://github.com/vshymanskyy/TinyGSM
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
#define TINY_GSM_RX_BUFFER 64
|
||||
#endif
|
||||
|
||||
#define TINY_GSM_MUX_COUNT 5
|
||||
#define TINY_GSM_MUX_COUNT 12
|
||||
|
||||
#include <TinyGsmCommon.h>
|
||||
|
||||
@@ -39,10 +39,22 @@ enum RegStatus {
|
||||
REG_UNKNOWN = 4,
|
||||
};
|
||||
|
||||
//============================================================================//
|
||||
//============================================================================//
|
||||
// Declaration of the TinyGsmBG96 Class
|
||||
//============================================================================//
|
||||
//============================================================================//
|
||||
|
||||
class TinyGsmBG96
|
||||
{
|
||||
|
||||
//============================================================================//
|
||||
//============================================================================//
|
||||
// The Internal BG96 Client Class
|
||||
//============================================================================//
|
||||
//============================================================================//
|
||||
|
||||
|
||||
public:
|
||||
|
||||
class GsmClient : public Client
|
||||
@@ -178,6 +190,13 @@ private:
|
||||
RxFifo rx;
|
||||
};
|
||||
|
||||
//============================================================================//
|
||||
//============================================================================//
|
||||
// The BG96 Secure Client
|
||||
//============================================================================//
|
||||
//============================================================================//
|
||||
|
||||
|
||||
class GsmClientSecure : public GsmClient
|
||||
{
|
||||
public:
|
||||
@@ -197,9 +216,19 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
//============================================================================//
|
||||
//============================================================================//
|
||||
// The BG96 Modem Functions
|
||||
//============================================================================//
|
||||
//============================================================================//
|
||||
|
||||
public:
|
||||
|
||||
#ifdef GSM_DEFAULT_STREAM
|
||||
TinyGsmBG96(Stream& stream = GSM_DEFAULT_STREAM)
|
||||
#else
|
||||
TinyGsmBG96(Stream& stream)
|
||||
#endif
|
||||
: stream(stream)
|
||||
{
|
||||
memset(sockets, 0, sizeof(sockets));
|
||||
@@ -349,10 +378,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;
|
||||
@@ -409,6 +438,10 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* WiFi functions
|
||||
*/
|
||||
|
||||
/*
|
||||
* GPRS functions
|
||||
*/
|
||||
@@ -665,9 +698,13 @@ public:
|
||||
streamWrite(tail...);
|
||||
}
|
||||
|
||||
bool streamSkipUntil(char c) { //TODO: timeout
|
||||
while (true) {
|
||||
while (!stream.available()) { TINY_GSM_YIELD(); }
|
||||
bool streamSkipUntil(char c) {
|
||||
const unsigned long timeout = 1000L;
|
||||
unsigned long startMillis = millis();
|
||||
while (millis() - startMillis < timeout) {
|
||||
while (millis() - startMillis < timeout && !stream.available()) {
|
||||
TINY_GSM_YIELD();
|
||||
}
|
||||
if (stream.read() == c)
|
||||
return true;
|
||||
}
|
||||
@@ -748,6 +785,7 @@ finish:
|
||||
}
|
||||
data = "";
|
||||
}
|
||||
//DBG('<', index, '>');
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user