mirror of https://github.com/ARMmbed/mbed-os.git
Setup connection profile with username and password
parent
943254c78c
commit
ee17c7c996
|
@ -38,7 +38,7 @@ NetworkStack *GEMALTO_CINTERION_CellularContext::get_stack()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_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;
|
return _stack;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,9 @@
|
||||||
|
|
||||||
using namespace mbed;
|
using namespace mbed;
|
||||||
|
|
||||||
GEMALTO_CINTERION_CellularStack::GEMALTO_CINTERION_CellularStack(ATHandler &atHandler, const char *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)
|
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();
|
_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
|
// set maximum inactivity timeout
|
||||||
_at.cmd_start("AT^SICS=");
|
_at.cmd_start("AT^SICS=");
|
||||||
_at.write_int(connection_profile_id);
|
_at.write_int(connection_profile_id);
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace mbed {
|
||||||
|
|
||||||
class GEMALTO_CINTERION_CellularStack : public AT_CellularStack {
|
class GEMALTO_CINTERION_CellularStack : public AT_CellularStack {
|
||||||
public:
|
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();
|
virtual ~GEMALTO_CINTERION_CellularStack();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -62,8 +62,10 @@ private:
|
||||||
// socket open need to be deferred until sendto due to BGS2 does not support UDP server endpoint
|
// 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);
|
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 *_apn;
|
||||||
|
const char *_user;
|
||||||
|
const char *_password;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
Loading…
Reference in New Issue