Skip to content

Commit 964f5ad

Browse files
authored
Merge pull request #10098 from ghseb/credentials-for-connection-profile
Cinterion Cellular: Setup connection profile with username and password
2 parents e665df9 + ee17c7c commit 964f5ad

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ NetworkStack *GEMALTO_CINTERION_CellularContext::get_stack()
3838
}
3939

4040
if (!_stack) {
41-
_stack = new GEMALTO_CINTERION_CellularStack(_at, _apn, _cid, (nsapi_ip_stack_t)_pdp_type);
41+
_stack = new GEMALTO_CINTERION_CellularStack(_at, _apn, _uname, _pwd, _cid, (nsapi_ip_stack_t)_pdp_type);
4242
}
4343
return _stack;
4444
}

features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232

3333
using namespace mbed;
3434

35-
GEMALTO_CINTERION_CellularStack::GEMALTO_CINTERION_CellularStack(ATHandler &atHandler, const char *apn,
36-
int cid, nsapi_ip_stack_t stack_type) : AT_CellularStack(atHandler, cid, stack_type), _apn(apn)
35+
GEMALTO_CINTERION_CellularStack::GEMALTO_CINTERION_CellularStack(ATHandler &atHandler, const char *apn, const char *user, const char* password,
36+
int cid, nsapi_ip_stack_t stack_type) : AT_CellularStack(atHandler, cid, stack_type), _apn(apn),
37+
_user(user), _password(password)
3738
{
3839
}
3940

@@ -551,6 +552,22 @@ nsapi_error_t GEMALTO_CINTERION_CellularStack::create_connection_profile(int con
551552
_at.cmd_stop_read_resp();
552553
}
553554

555+
if (_user && strlen(_user) > 0) {
556+
_at.cmd_start("AT^SICS=");
557+
_at.write_int(connection_profile_id);
558+
_at.write_string("user");
559+
_at.write_string(_user);
560+
_at.cmd_stop_read_resp();
561+
}
562+
563+
if (_password && strlen(_password) > 0) {
564+
_at.cmd_start("AT^SICS=");
565+
_at.write_int(connection_profile_id);
566+
_at.write_string("passwd");
567+
_at.write_string(_password);
568+
_at.cmd_stop_read_resp();
569+
}
570+
554571
// set maximum inactivity timeout
555572
_at.cmd_start("AT^SICS=");
556573
_at.write_int(connection_profile_id);

features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace mbed {
2424

2525
class GEMALTO_CINTERION_CellularStack : public AT_CellularStack {
2626
public:
27-
GEMALTO_CINTERION_CellularStack(ATHandler &atHandler, const char *apn, int cid, nsapi_ip_stack_t stack_type);
27+
GEMALTO_CINTERION_CellularStack(ATHandler &atHandler, const char *apn, const char *username, const char* password, int cid, nsapi_ip_stack_t stack_type);
2828
virtual ~GEMALTO_CINTERION_CellularStack();
2929

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

65-
// connection profile configuration needs Access Point Name
65+
// connection profile configuration needs Access Point Name, User Name and Password
6666
const char *_apn;
67+
const char *_user;
68+
const char *_password;
6769
};
6870

6971
} // namespace mbed

0 commit comments

Comments
 (0)