Skip to content

src/TinyGsmClientSequansMonarch.h: use PDP context #1 #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 8 additions & 8 deletions src/TinyGsmClientSequansMonarch.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ class TinyGsmSequansMonarch
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
}
String getLocalIPImpl() {
sendAT(GF("+CGPADDR=3"));
if (waitResponse(10000L, GF("+CGPADDR: 3,\"")) != 1) { return ""; }
sendAT(GF("+CGPADDR=1"));
if (waitResponse(10000L, GF("+CGPADDR: 1,\"")) != 1) { return ""; }
String res = stream.readStringUntil('\"');
waitResponse();
return res;
Expand All @@ -348,18 +348,18 @@ class TinyGsmSequansMonarch
const char* pwd = NULL) {
gprsDisconnect();

// Define the PDP context (This uses context #3!)
sendAT(GF("+CGDCONT=3,\"IPV4V6\",\""), apn, '"');
// Define the PDP context
sendAT(GF("+CGDCONT=1,\"IPV4V6\",\""), apn, '"');
waitResponse();

// Set authentication
if (user && strlen(user) > 0) {
sendAT(GF("+CGAUTH=3,1,\""), user, GF("\",\""), pwd, GF("\""));
sendAT(GF("+CGAUTH=1,1,\""), user, GF("\",\""), pwd, GF("\""));
waitResponse();
}

// Activate the PDP context
sendAT(GF("+CGACT=1,3"));
sendAT(GF("+CGACT=1,1"));
waitResponse(60000L);

// Attach to GPRS
Expand Down Expand Up @@ -448,15 +448,15 @@ class TinyGsmSequansMonarch
// Socket configuration
// AT+SQNSCFG:<connId1>, <cid1>, <pktSz1>, <maxTo1>, <connTo1>, <txTo1>
// <connId1> = Connection ID = mux
// <cid1> = PDP context ID = 3 - this is number set up above in the
// <cid1> = PDP context ID = 1 - this is number set up above in the
// GprsConnect function
// <pktSz1> = Packet Size, used for online data mode only = 300 (default)
// <maxTo1> = Max timeout in seconds = 90 (default)
// <connTo1> = Connection timeout in hundreds of milliseconds
// = 600 (default)
// <txTo1> = Data sending timeout in hundreds of milliseconds,
// used for online data mode only = 50 (default)
sendAT(GF("+SQNSCFG="), mux, GF(",3,300,90,600,50"));
sendAT(GF("+SQNSCFG="), mux, GF(",1,300,90,600,50"));
waitResponse(5000L);

// Socket configuration extended
Expand Down