Skip to content

Commit f2a6948

Browse files
pennamfacchinm
authored andcommitted
CellularDevice: avoid callback data is changed before attached callback is changed
1 parent 2e1da01 commit f2a6948

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

connectivity/cellular/source/framework/device/CellularDevice.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ void CellularDevice::stm_callback(nsapi_event_t ev, intptr_t ptr)
180180

181181
void CellularDevice::cellular_callback(nsapi_event_t ev, intptr_t ptr, CellularContext *ctx)
182182
{
183+
// forward to callback function if set by attach(...).
184+
if (_status_cb) {
185+
_status_cb(ev, ptr);
186+
}
187+
183188
if (ev >= NSAPI_EVENT_CELLULAR_STATUS_BASE && ev <= NSAPI_EVENT_CELLULAR_STATUS_END) {
184189
cellular_connection_status_t cell_ev = (cellular_connection_status_t)ev;
185190
cell_callback_data_t *ptr_data = (cell_callback_data_t *)ptr;
@@ -220,11 +225,6 @@ void CellularDevice::cellular_callback(nsapi_event_t ev, intptr_t ptr, CellularC
220225
}
221226
curr = curr->_next;
222227
}
223-
224-
// forward to callback function if set by attach(...).
225-
if (_status_cb) {
226-
_status_cb(ev, ptr);
227-
}
228228
}
229229

230230
nsapi_error_t CellularDevice::shutdown()

0 commit comments

Comments
 (0)