addind SARA G350 support

This commit is contained in:
qcabrol
2017-10-13 12:46:59 +02:00
parent 6ca301d73e
commit 416f4b104d

View File

@@ -62,7 +62,6 @@ public:
sock_available = 0; sock_available = 0;
sock_connected = false; sock_connected = false;
got_data = false; got_data = false;
return true; return true;
} }
@@ -212,6 +211,7 @@ public:
return false; return false;
} }
sendAT(GF("E0")); // Echo Off sendAT(GF("E0")); // Echo Off
sendAT(GF("+CMEE=2"));
if (waitResponse() != 1) { if (waitResponse() != 1) {
return false; return false;
} }
@@ -219,7 +219,7 @@ public:
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) { if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
simUnlock(pin); simUnlock(pin);
} }
return (getSimStatus() == SIM_READY); return (getSimStatus() /*== SIM_READY*/);
} }
void setBaud(unsigned long baud) { void setBaud(unsigned long baud) {
@@ -230,9 +230,11 @@ public:
for (unsigned long start = millis(); millis() - start < timeout; ) { for (unsigned long start = millis(); millis() - start < timeout; ) {
sendAT(GF("")); sendAT(GF(""));
if (waitResponse(200) == 1) { if (waitResponse(200) == 1) {
//nilThdSleepMilliseconds(100); --> add ifdef balise
delay(100); delay(100);
return true; return true;
} }
//nilThdSleepMilliseconds(50); --> add ifdef balise
delay(100); delay(100);
} }
return false; return false;
@@ -270,6 +272,7 @@ public:
if (waitResponse(10000L) != 1) { if (waitResponse(10000L) != 1) {
return false; return false;
} }
//nilThdSleepMilliseconds(3000); --> add ifdef balise
delay(3000); delay(3000);
return init(); return init();
} }
@@ -311,6 +314,7 @@ public:
for (unsigned long start = millis(); millis() - start < timeout; ) { for (unsigned long start = millis(); millis() - start < timeout; ) {
sendAT(GF("+CPIN?")); sendAT(GF("+CPIN?"));
if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) { if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
//nilThdSleepMilliseconds(1000); --> add ifdef balise
delay(1000); delay(1000);
continue; continue;
} }
@@ -372,6 +376,7 @@ public:
if (isNetworkConnected()) { if (isNetworkConnected()) {
return true; return true;
} }
//nilThdSleepMilliseconds(500); --> add ifdef balise
delay(500); delay(500);
} }
return false; return false;
@@ -473,7 +478,20 @@ public:
String sendUSSD(const String& code) TINY_GSM_ATTR_NOT_IMPLEMENTED; String sendUSSD(const String& code) TINY_GSM_ATTR_NOT_IMPLEMENTED;
bool sendSMS(const String& number, const String& text) TINY_GSM_ATTR_NOT_IMPLEMENTED; bool sendSMS(const String& number, const String& text) {
sendAT(GF("+CSCS=\"GSM\""));
waitResponse();
sendAT(GF("+CMGF=1"));
waitResponse();
sendAT(GF("+CMGS=\""), number, GF("\""));
if (waitResponse(GF(">")) != 1) {
return false;
}
stream.print(text);
stream.write((char)0x1A);
stream.flush();
return waitResponse(60000L) == 1;
}
bool sendSMS_UTF16(const String& number, const void* text, size_t len) TINY_GSM_ATTR_NOT_IMPLEMENTED; bool sendSMS_UTF16(const String& number, const void* text, size_t len) TINY_GSM_ATTR_NOT_IMPLEMENTED;
@@ -536,6 +554,7 @@ protected:
return -1; return -1;
} }
// 50ms delay, see AT manual section 25.10.4 // 50ms delay, see AT manual section 25.10.4
//nilThdSleepMilliseconds(50); --> add ifdef balise
delay(50); delay(50);
stream.write((uint8_t*)buff, len); stream.write((uint8_t*)buff, len);
stream.flush(); stream.flush();
@@ -628,7 +647,8 @@ public:
GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR), GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL) GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
{ {
/*String r1s(r1); r1s.trim(); /*
String r1s(r1); r1s.trim();
String r2s(r2); r2s.trim(); String r2s(r2); r2s.trim();
String r3s(r3); r3s.trim(); String r3s(r3); r3s.trim();
String r4s(r4); r4s.trim(); String r4s(r4); r4s.trim();