@@ -44,13 +44,6 @@ AT_CellularDevice::AT_CellularDevice(FileHandle *fh) : CellularDevice(fh), _netw
4444 MBED_ASSERT (fh);
4545 _at = get_at_handler (fh);
4646 MBED_ASSERT (_at);
47-
48- if (AT_CellularBase::get_property (AT_CellularBase::PROPERTY_AT_CGEREP)) {
49- _at->set_urc_handler (" +CGEV: NW DEACT" , callback (this , &AT_CellularDevice::urc_nw_deact));
50- _at->set_urc_handler (" +CGEV: ME DEACT" , callback (this , &AT_CellularDevice::urc_nw_deact));
51- _at->set_urc_handler (" +CGEV: NW PDN D" , callback (this , &AT_CellularDevice::urc_pdn_deact));
52- _at->set_urc_handler (" +CGEV: ME PDN D" , callback (this , &AT_CellularDevice::urc_pdn_deact));
53- }
5447}
5548
5649AT_CellularDevice::~AT_CellularDevice ()
@@ -84,6 +77,29 @@ AT_CellularDevice::~AT_CellularDevice()
8477 release_at_handler (_at);
8578}
8679
80+ void AT_CellularDevice::set_at_urcs_impl ()
81+ {
82+ }
83+
84+ void AT_CellularDevice::set_at_urcs ()
85+ {
86+ if (AT_CellularBase::get_property (AT_CellularBase::PROPERTY_AT_CGEREP)) {
87+ _at->set_urc_handler (" +CGEV: NW DEACT" , callback (this , &AT_CellularDevice::urc_nw_deact));
88+ _at->set_urc_handler (" +CGEV: ME DEACT" , callback (this , &AT_CellularDevice::urc_nw_deact));
89+ _at->set_urc_handler (" +CGEV: NW PDN D" , callback (this , &AT_CellularDevice::urc_pdn_deact));
90+ _at->set_urc_handler (" +CGEV: ME PDN D" , callback (this , &AT_CellularDevice::urc_pdn_deact));
91+ }
92+
93+ set_at_urcs_impl ();
94+ }
95+
96+ void AT_CellularDevice::setup_at_handler ()
97+ {
98+ set_at_urcs ();
99+
100+ _at->set_send_delay (get_send_delay ());
101+ }
102+
87103void AT_CellularDevice::urc_nw_deact ()
88104{
89105 // The network has forced a context deactivation
@@ -424,6 +440,8 @@ void AT_CellularDevice::modem_debug_on(bool on)
424440
425441nsapi_error_t AT_CellularDevice::init ()
426442{
443+ setup_at_handler ();
444+
427445 _at->lock ();
428446 _at->flush ();
429447 _at->at_cmd_discard (" E0" , " " );
0 commit comments