File tree Expand file tree Collapse file tree 4 files changed +14
-9
lines changed
Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 22
33SCRIPTPATH=" $( cd " $( dirname " $0 " ) " ; pwd -P ) "
44
5- TARGET=$SCRIPTPATH /../src/examples/http/http .ino
5+ TARGET=$SCRIPTPATH /../src/examples/http_get_time/http_get_time .ino
66EXTRA_ARGS=--clean
77
88if [ " $1 " = " clean" ]; then
Original file line number Diff line number Diff line change 11#include < Arduino.h>
22#include < http_client.h>
3+ #include < led_ctrl.h>
34#include < log.h>
45#include < lte.h>
56
@@ -10,6 +11,7 @@ void testHttp();
1011void setup () {
1112
1213 Log.begin (115200 );
14+ LedCtrl.begin ();
1315
1416 // Start LTE modem and wait until we are connected to the operator
1517 Lte.begin ();
Original file line number Diff line number Diff line change 11#include < Arduino.h>
22#include < http_client.h>
3+ #include < led_ctrl.h>
34#include < log.h>
45#include < lte.h>
56
@@ -16,28 +17,30 @@ long getTimeFromApiresp(String *resp) {
1617
1718void setup () {
1819
20+ LedCtrl.begin ();
21+
1922 Log.begin (115200 );
2023 Log.info (" Starting HTTP Get Time Example\r\n " );
2124
2225 // Start LTE modem and wait until we are connected to the operator
2326 Lte.begin ();
24-
27+ Log. infof ( " Connecting to operator " );
2528 while (!Lte.isConnected ()) {
26- Log.info ( " Not connected to operator yet... \r\n " );
27- delay (5000 );
29+ Log.raw ( " . " );
30+ delay (1000 );
2831 }
2932
30- Log.info (" Connected to operator!\r\n " );
33+ Log.raw (" \r\n " );
34+ Log.infof (" Connected to operator: %s\r\n " , Lte.getOperator ().c_str ());
3135
3236 if (!HttpClient.configure (TIMEZONE_URL, 80 , false )) {
3337 Log.errorf (" Failed to configure the http client for the domain %s\r\n " ,
3438 TIMEZONE_URL);
3539 return ;
3640 }
3741
38- Log.info (" Configured to HTTP\r\n " );
42+ Log.info (" --- Configured to HTTP --- " );
3943
40- // TODO: Fails, get status code 0
4144 HttpResponse response;
4245 response = HttpClient.get (TIMEZONE_URI);
4346 if (response.status_code != HttpClient.STATUS_OK ) {
Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ String LteClass::getOperator(void) {
185185 uint8_t index = 0 ;
186186 char buffer[48 ] = " " ;
187187
188- while (SequansController.waitForByte (URC_IDENTIFIER_START_CHARACTER, 500 ) !=
188+ while (SequansController.waitForByte (URC_IDENTIFIER_START_CHARACTER, 100 ) !=
189189 SEQUANS_CONTROLLER_READ_BYTE_TIMEOUT) {
190190
191191 while (SequansController.readByte () != URC_IDENTIFIER_END_CHARACTER) {}
@@ -234,7 +234,7 @@ String LteClass::getOperator(void) {
234234
235235 // Clear the rest of the result from querying the operators
236236 while (
237- SequansController.waitForByte (URC_IDENTIFIER_END_CHARACTER, 500 ) !=
237+ SequansController.waitForByte (URC_IDENTIFIER_END_CHARACTER, 100 ) !=
238238 SEQUANS_CONTROLLER_READ_BYTE_TIMEOUT) {}
239239
240240 SequansController.clearReceiveBuffer ();
You can’t perform that action at this time.
0 commit comments