Skip to content

Cinterion Cellular: Setup connection profile with username and password #10098

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

Merged
merged 1 commit into from
Mar 18, 2019
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ NetworkStack *GEMALTO_CINTERION_CellularContext::get_stack()
}

if (!_stack) {
_stack = new GEMALTO_CINTERION_CellularStack(_at, _apn, _cid, (nsapi_ip_stack_t)_pdp_type);
_stack = new GEMALTO_CINTERION_CellularStack(_at, _apn, _uname, _pwd, _cid, (nsapi_ip_stack_t)_pdp_type);
}
return _stack;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@

using namespace mbed;

GEMALTO_CINTERION_CellularStack::GEMALTO_CINTERION_CellularStack(ATHandler &atHandler, const char *apn,
int cid, nsapi_ip_stack_t stack_type) : AT_CellularStack(atHandler, cid, stack_type), _apn(apn)
GEMALTO_CINTERION_CellularStack::GEMALTO_CINTERION_CellularStack(ATHandler &atHandler, const char *apn, const char *user, const char* password,
int cid, nsapi_ip_stack_t stack_type) : AT_CellularStack(atHandler, cid, stack_type), _apn(apn),
_user(user), _password(password)
{
}

Expand Down Expand Up @@ -551,6 +552,22 @@ nsapi_error_t GEMALTO_CINTERION_CellularStack::create_connection_profile(int con
_at.cmd_stop_read_resp();
}

if (_user && strlen(_user) > 0) {
_at.cmd_start("AT^SICS=");
_at.write_int(connection_profile_id);
_at.write_string("user");
_at.write_string(_user);
_at.cmd_stop_read_resp();
}

if (_password && strlen(_password) > 0) {
_at.cmd_start("AT^SICS=");
_at.write_int(connection_profile_id);
_at.write_string("passwd");
_at.write_string(_password);
_at.cmd_stop_read_resp();
}

// set maximum inactivity timeout
_at.cmd_start("AT^SICS=");
_at.write_int(connection_profile_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace mbed {

class GEMALTO_CINTERION_CellularStack : public AT_CellularStack {
public:
GEMALTO_CINTERION_CellularStack(ATHandler &atHandler, const char *apn, int cid, nsapi_ip_stack_t stack_type);
GEMALTO_CINTERION_CellularStack(ATHandler &atHandler, const char *apn, const char *username, const char* password, int cid, nsapi_ip_stack_t stack_type);
virtual ~GEMALTO_CINTERION_CellularStack();

protected:
Expand Down Expand Up @@ -62,8 +62,10 @@ class GEMALTO_CINTERION_CellularStack : public AT_CellularStack {
// socket open need to be deferred until sendto due to BGS2 does not support UDP server endpoint
nsapi_error_t socket_open_defer(CellularSocket *socket, const SocketAddress *address = NULL);

// connection profile configuration needs Access Point Name
// connection profile configuration needs Access Point Name, User Name and Password
const char *_apn;
const char *_user;
const char *_password;
};

} // namespace mbed
Expand Down