Skip to content

Commit 1e40ec5

Browse files
pennamfacchinm
authored andcommitted
AT_CellularContext: move enable_access_technology() at commands into GEMALTO_CINTERION_CellularContext
1 parent b2415db commit 1e40ec5

File tree

4 files changed

+32
-26
lines changed

4 files changed

+32
-26
lines changed

connectivity/cellular/include/cellular/framework/AT/AT_CellularContext.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ class AT_CellularContext : public CellularContext {
135135

136136
PinName _dcd_pin;
137137
bool _active_high;
138-
RadioAccessTechnologyType _rat;
139-
FrequencyBand _band;
140138

141139
protected:
142140
char _found_apn[MAX_APN_LENGTH];
143141
// flag indicating if CP was requested to be setup
144142
bool _cp_req;
145143
bool _is_connected;
146144
ATHandler &_at;
145+
RadioAccessTechnologyType _rat;
146+
FrequencyBand _band;
147147
};
148148

149149
} // namespace mbed

connectivity/cellular/source/framework/AT/AT_CellularContext.cpp

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -445,30 +445,7 @@ bool AT_CellularContext::set_new_context(int cid)
445445

446446
void AT_CellularContext::enable_access_technology()
447447
{
448-
char *buffer = new char [8];
449-
memset(buffer, 0, 8);
450-
sprintf(buffer,"%08X", _band);
451-
switch (_rat)
452-
{
453-
case CATM1:
454-
_at.at_cmd_discard("^SXRAT", "=","%d", _rat);
455-
_at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatM",buffer);
456-
_at.at_cmd_discard("^SCFG", "=","%s%d%d", "Radio/Band/CatNB",0,0);
457-
break;
458-
459-
case CATNB:
460-
_at.at_cmd_discard("^SXRAT", "=","%d", _rat);
461-
_at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatNB",buffer);
462-
_at.at_cmd_discard("^SCFG", "=","%s%d%d", "Radio/Band/CatM",0,0);
463-
break;
464-
465-
default:
466-
break;
467-
}
468-
469-
_at.at_cmd_discard("^SCFG", "=", "%s%s", "Tcp/withURCs", "on");
470-
free(buffer);
471-
448+
enable_access_technology();
472449
}
473450

474451
nsapi_error_t AT_CellularContext::do_activate_context()

connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,32 @@ NetworkStack *GEMALTO_CINTERION_CellularContext::get_stack()
148148
}
149149
#endif // NSAPI_PPP_AVAILABLE
150150

151+
void GEMALTO_CINTERION_CellularContext::enable_access_technology()
152+
{
153+
char *buffer = new char [8];
154+
memset(buffer, 0, 8);
155+
sprintf(buffer,"%08X", _band);
156+
switch (_rat)
157+
{
158+
case CATM1:
159+
_at.at_cmd_discard("^SXRAT", "=","%d", _rat);
160+
_at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatM",buffer);
161+
_at.at_cmd_discard("^SCFG", "=","%s%d%d", "Radio/Band/CatNB",0,0);
162+
break;
163+
164+
case CATNB:
165+
_at.at_cmd_discard("^SXRAT", "=","%d", _rat);
166+
_at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatNB",buffer);
167+
_at.at_cmd_discard("^SCFG", "=","%s%d%d", "Radio/Band/CatM",0,0);
168+
break;
169+
170+
default:
171+
break;
172+
}
173+
174+
_at.at_cmd_discard("^SCFG", "=", "%s%s", "Tcp/withURCs", "on");
175+
free(buffer);
176+
177+
}
178+
151179
} /* namespace mbed */

connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class GEMALTO_CINTERION_CellularContext: public AT_CellularContext {
3434
virtual NetworkStack *get_stack();
3535
#endif // NSAPI_PPP_AVAILABLE
3636
virtual nsapi_error_t do_user_authentication();
37+
virtual void enable_access_technology();
3738
};
3839

3940
} /* namespace mbed */

0 commit comments

Comments
 (0)