@@ -61,7 +61,7 @@ CellularStateMachine::CellularStateMachine(CellularDevice &device, events::Event
61
61
_start_time (rand() % (MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY)),
62
62
#endif // MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY
63
63
_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 )
65
65
{
66
66
67
67
// set initial retry values in seconds
@@ -289,8 +289,10 @@ void CellularStateMachine::retry_state_or_fail()
289
289
if (_retry_count < _retry_array_length) {
290
290
tr_debug (" %s: retry %d/%d" , get_state_string (_state), _retry_count, _retry_array_length);
291
291
// 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;
292
294
_cb_data.status_data = _current_event;
293
- _cb_data.data = &_retry_count ;
295
+ _cb_data.data = &_retry_cb_data ;
294
296
_cb_data.error = NSAPI_ERROR_OK;
295
297
send_event_cb (CellularStateRetryEvent);
296
298
@@ -680,8 +682,11 @@ void CellularStateMachine::send_event_cb(cellular_connection_status_t status)
680
682
681
683
void CellularStateMachine::change_timeout (const std::chrono::duration<int , std::milli> &timeout)
682
684
{
685
+ _timeout_cb_data.timeout = timeout.count ();
686
+ _timeout_cb_data.state = _state;
687
+
683
688
_cb_data.status_data = _current_event;
684
- _cb_data.data = &timeout ;
689
+ _cb_data.data = &_timeout_cb_data ;
685
690
_cb_data.error = NSAPI_ERROR_OK;
686
691
// event callback is a preferred method to communicate to CellularDevice,
687
692
// for example calling CellularDevice::set_timeout would call back to this class
0 commit comments