Skip to content

Commit f4f40b9

Browse files
authored
Merge pull request #49 from jaka87/master
Increased timeout
2 parents a194c01 + 4680a7b commit f4f40b9

5 files changed

Lines changed: 17 additions & 16 deletions

File tree

src/Ftp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "Sim800.h"
3232
#include "Result.h"
3333

34+
3435
class FTP : public SIM800
3536
{
3637

src/GPRS.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ Result openGPRSContext(SIM800 *sim800, const char *apn)
5252

5353
sim800->sendATTest();
5454

55-
while ((sim800->sendCmdAndWaitForResp_P(REGISTRATION_STATUS, CONNECTED, 2000) != TRUE &&
56-
sim800->sendCmdAndWaitForResp_P(REGISTRATION_STATUS, ROAMING, 2000) != TRUE) &&
55+
while ((sim800->sendCmdAndWaitForResp_P(REGISTRATION_STATUS, CONNECTED, 12000) != TRUE &&
56+
sim800->sendCmdAndWaitForResp_P(REGISTRATION_STATUS, ROAMING, 12000) != TRUE) &&
5757
attempts < MAX_ATTEMPTS)
5858
{
59-
sim800->sendCmdAndWaitForResp_P(READ_VOLTAGE, AT_OK, 1000);
60-
sim800->sendCmdAndWaitForResp_P(SIGNAL_QUALITY, AT_OK, 1000);
59+
sim800->sendCmdAndWaitForResp_P(READ_VOLTAGE, AT_OK, 2000);
60+
sim800->sendCmdAndWaitForResp_P(SIGNAL_QUALITY, AT_OK, 2000);
6161
attempts++;
6262
delay(1000 * attempts);
6363
if (attempts == MAX_ATTEMPTS)
@@ -67,20 +67,20 @@ Result openGPRSContext(SIM800 *sim800, const char *apn)
6767
}
6868
}
6969

70-
if (sim800->sendCmdAndWaitForResp_P(BEARER_PROFILE_GPRS, AT_OK, 2000) == FALSE)
70+
if (sim800->sendCmdAndWaitForResp_P(BEARER_PROFILE_GPRS, AT_OK, 14000) == FALSE)
7171
result = ERROR_BEARER_PROFILE_GPRS;
7272

7373
char httpApn[64];
7474
char tmp[24];
7575
strcpy_P(tmp, apn);
7676
sprintf_P(httpApn, BEARER_PROFILE_APN, tmp);
77-
if (sim800->sendCmdAndWaitForResp(httpApn, AT_OK_, 2000) == FALSE)
77+
if (sim800->sendCmdAndWaitForResp(httpApn, AT_OK_, 10000) == FALSE)
7878
result = ERROR_BEARER_PROFILE_APN;
7979

80-
while (sim800->sendCmdAndWaitForResp_P(QUERY_BEARER, BEARER_OPEN, 2000) == FALSE && attempts < MAX_ATTEMPTS)
80+
while (sim800->sendCmdAndWaitForResp_P(QUERY_BEARER, BEARER_OPEN, 10000) == FALSE && attempts < MAX_ATTEMPTS)
8181
{
8282
attempts++;
83-
if (sim800->sendCmdAndWaitForResp_P(OPEN_GPRS_CONTEXT, AT_OK, 2000) == FALSE)
83+
if (sim800->sendCmdAndWaitForResp_P(OPEN_GPRS_CONTEXT, AT_OK, 10000) == FALSE)
8484
{
8585
result = ERROR_OPEN_GPRS_CONTEXT;
8686
}
@@ -97,7 +97,7 @@ Result closeGPRSContext(SIM800 *sim800)
9797
{
9898
Result result = SUCCESS;
9999

100-
if (sim800->sendCmdAndWaitForResp_P(CLOSE_GPRS_CONTEXT, AT_OK, 2000) == FALSE)
100+
if (sim800->sendCmdAndWaitForResp_P(CLOSE_GPRS_CONTEXT, AT_OK, 4000) == FALSE)
101101
result = ERROR_CLOSE_GPRS_CONTEXT;
102102

103103
return result;

src/Http.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Result HTTP::connect(const char *apn)
5555
{
5656
Result result = openGPRSContext(this, apn);
5757

58-
if (sendCmdAndWaitForResp_P(HTTP_INIT, AT_OK, 2000) == FALSE)
58+
if (sendCmdAndWaitForResp_P(HTTP_INIT, AT_OK, 8000) == FALSE)
5959
result = ERROR_HTTP_INIT;
6060

6161
return result;
@@ -65,7 +65,7 @@ Result HTTP::disconnect()
6565
{
6666
Result result = closeGPRSContext(this);
6767

68-
if (sendCmdAndWaitForResp_P(HTTP_CLOSE, AT_OK, 2000) == FALSE)
68+
if (sendCmdAndWaitForResp_P(HTTP_CLOSE, AT_OK, 5000) == FALSE)
6969
result = ERROR_HTTP_CLOSE;
7070

7171
return result;
@@ -83,7 +83,7 @@ Result HTTP::post(const char *uri, const char *body, char *response)
8383
sprintf_P(buffer, HTTP_DATA, strlen(body), delayToDownload);
8484
strcpy_P(resp, DOWNLOAD);
8585

86-
sendCmdAndWaitForResp(buffer, resp, 2000);
86+
sendCmdAndWaitForResp(buffer, resp, 7000);
8787

8888
purgeSerial();
8989
sendCmd(body);
@@ -108,7 +108,7 @@ Result HTTP::get(const char *uri, char *response)
108108
Result result;
109109
setHTTPSession(uri);
110110

111-
if (sendCmdAndWaitForResp_P(HTTP_GET, HTTP_2XX, 2000) == TRUE)
111+
if (sendCmdAndWaitForResp_P(HTTP_GET, HTTP_2XX, 7000) == TRUE)
112112
{
113113
char buffer[16];
114114
strcpy_P(buffer, HTTP_READ);

src/Sim800.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,11 @@ void SIM800::sleep(bool force)
203203
{
204204
if (force)
205205
{
206-
sendCmdAndWaitForResp_P(SLEEP_MODE_1, AT_OK, 2000);
206+
sendCmdAndWaitForResp_P(SLEEP_MODE_1, AT_OK, 4000);
207207
}
208208
else
209209
{
210-
sendCmdAndWaitForResp_P(SLEEP_MODE_2, AT_OK, 2000);
210+
sendCmdAndWaitForResp_P(SLEEP_MODE_2, AT_OK, 4000);
211211
}
212212
}
213213

src/Sim800.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,4 @@ class SIM800
143143
unsigned int resetPin;
144144
};
145145

146-
#endif
146+
#endif

0 commit comments

Comments
 (0)