Merge pull request #10098 from ghseb/credentials-for-connection-profile

Cinterion Cellular: Setup connection profile with username and password
pull/10005/head
Martin Kojtal 2019-03-18 08:13:32 +01:00 committed by GitHub
commit 964f5ad321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 5 deletions

View File

@ -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;
}

View File

@ -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)
{
}
@ -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);

View File

@ -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:
@ -62,8 +62,10 @@ private:
// 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