@@ -61,7 +61,7 @@ CellularStateMachine::CellularStateMachine(CellularDevice &device, events::Event
6161 _start_time (rand() % (MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY)),
6262#endif // MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY
6363 _event_timeout (-1s), _event_id(-1 ), _plmn(0 ), _command_success(false ),
64- _is_retry (false ), _cb_data(), _current_event(CellularDeviceReady), _status(0 )
64+ _is_retry (false ), _cb_data(), _timeout_cb_data(), _retry_cb_data(), _current_event(CellularDeviceReady), _status(0 )
6565{
6666
6767 // set initial retry values in seconds
@@ -289,8 +289,10 @@ void CellularStateMachine::retry_state_or_fail()
289289 if (_retry_count < _retry_array_length) {
290290 tr_debug (" %s: retry %d/%d" , get_state_string (_state), _retry_count, _retry_array_length);
291291 // send info to application/driver about error logic so it can implement proper error logic
292+ _retry_cb_data.retry_count = _retry_count;
293+ _retry_cb_data.state = _state;
292294 _cb_data.status_data = _current_event;
293- _cb_data.data = &_retry_count ;
295+ _cb_data.data = &_retry_cb_data ;
294296 _cb_data.error = NSAPI_ERROR_OK;
295297 send_event_cb (CellularStateRetryEvent);
296298
@@ -680,8 +682,11 @@ void CellularStateMachine::send_event_cb(cellular_connection_status_t status)
680682
681683void CellularStateMachine::change_timeout (const std::chrono::duration<int , std::milli> &timeout)
682684{
685+ _timeout_cb_data.timeout = timeout.count ();
686+ _timeout_cb_data.state = _state;
687+
683688 _cb_data.status_data = _current_event;
684- _cb_data.data = &timeout ;
689+ _cb_data.data = &_timeout_cb_data ;
685690 _cb_data.error = NSAPI_ERROR_OK;
686691 // event callback is a preferred method to communicate to CellularDevice,
687692 // for example calling CellularDevice::set_timeout would call back to this class
0 commit comments