@ -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 ;
}