Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/SimpleNBClientSIM7020.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class SimpleNBSim7020
// <cid>: Optional. Although the documenation say can passing-in a <cid>, but actual
// implementation dos not allowed (you get an ERROR).
sendAT(GF("+CSOC=1,1,1"));
if (waitResponse(60000L) != 1) { return false; }
if (waitResponse(10000L) != 1) { return false; }
int16_t cid = streamGetIntBefore('\n');
waitResponse();
if (cid < SIMPLE_NB_MUX_COUNT)
Expand All @@ -200,8 +200,8 @@ class SimpleNBSim7020
}

bool deactivateDataNetwork() {
sendAT(GF("+CSOC=0"));
if (waitResponse(60000L) != 1) { return false; }
sendAT(GF("+CSOCL=0"));
if (waitResponse(10000L) != 1) { return false; }
return true;
}

Expand Down Expand Up @@ -299,6 +299,7 @@ class SimpleNBSim7020
// when not using SSL, the TCP application toolkit is more stable
sendAT(GF("+CIPSTART="), GF("\"TCP"), GF("\",\""), host, GF("\","), port);
int8_t rsp = 0;
waitResponse(timeout_ms, GF("OK" ACK_NL));
rsp = waitResponse(timeout_ms, GF("CONNECT OK" ACK_NL),
GF("CONNECT FAIL" ACK_NL),
GF("ALREADY CONNECT" ACK_NL), GF("ERROR" ACK_NL),
Expand Down Expand Up @@ -365,7 +366,7 @@ class SimpleNBSim7020
size_t modemGetAvailable(uint8_t mux) {
if (!sockets[mux]) return 0;

sendAT(GF("+CIPRXGET=4"), mux);
sendAT(GF("+CIPRXGET=4"));
size_t result = 0;
if (waitResponse(GF("+CIPRXGET:")) == 1) {
streamSkipUntil(','); // Skip mode 4
Expand Down
9 changes: 5 additions & 4 deletions src/SimpleNBCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,18 @@ uint32_t SimpleNBAutoBaud(T& SerialAT, uint32_t minimum = 9600,
}

template <class T>
bool SimpleNBBegin(T& SerialAT, uint32_t rate) {
bool SimpleNBBegin(T& SerialAT, uint32_t rate, uint32_t RX_pin, uint32_t TX_pin) {
DBG("Communicate at baud rate", rate, "...");
SerialAT.begin(rate);
delay(10);
SerialAT.begin(rate,SERIAL_8N1,RX_pin,TX_pin);
delay(500);
for (int j = 0; j < 10; j++) {
SerialAT.print("AT\r\n");
String input = SerialAT.readString();
Serial.println(input);
if (input.indexOf("OK") >= 0) {
return true;
}
delay(10);
delay(100);
}
DBG("No response from modem, check your hardware connection");
return false;
Expand Down