@@ -39,7 +39,7 @@ namespace mbed {
39
39
40
40
CellularConnectionFSM::CellularConnectionFSM () :
41
41
_serial (0 ), _state(STATE_INIT), _next_state(_state), _status_callback(0 ), _network(0 ), _power(0 ), _sim(0 ),
42
- _queue (8 * EVENTS_EVENT_SIZE), _queue_thread(0 ), _retry_count(0 ), _state_retry_count(0 ), _at_queue(8 * EVENTS_EVENT_SIZE)
42
+ _queue (8 * EVENTS_EVENT_SIZE), _queue_thread(0 ), _retry_count(0 ), _state_retry_count(0 ), _at_queue(2 * EVENTS_EVENT_SIZE)
43
43
{
44
44
memset (_sim_pin, 0 , sizeof (_sim_pin));
45
45
#if MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY == 0
@@ -60,7 +60,7 @@ CellularConnectionFSM::CellularConnectionFSM() :
60
60
_retry_timeout_array[8 ] = 600 ;
61
61
_retry_timeout_array[9 ] = TIMEOUT_NETWORK_MAX;
62
62
_retry_array_length = MAX_RETRY_ARRAY_SIZE;
63
-
63
+
64
64
_cellularDevice = new CELLULAR_DEVICE (_at_queue);
65
65
}
66
66
@@ -155,22 +155,6 @@ bool CellularConnectionFSM::open_sim()
155
155
return state == CellularSIM::SimStateReady;
156
156
}
157
157
158
- void CellularConnectionFSM::device_ready ()
159
- {
160
- CellularInformation *info = _cellularDevice->open_information (_serial);
161
- char device_info_buf[2048 ]; // may be up to 2048 according to 3GPP
162
-
163
- if (info->get_manufacturer (device_info_buf, sizeof (device_info_buf)) == NSAPI_ERROR_OK) {
164
- tr_info (" Cellular device manufacturer: %s" , device_info_buf);
165
- }
166
- if (info->get_model (device_info_buf, sizeof (device_info_buf)) == NSAPI_ERROR_OK) {
167
- tr_info (" Cellular device model: %s" , device_info_buf);
168
- }
169
- if (info->get_revision (device_info_buf, sizeof (device_info_buf)) == NSAPI_ERROR_OK) {
170
- tr_info (" Cellular device revision: %s" , device_info_buf);
171
- }
172
- }
173
-
174
158
bool CellularConnectionFSM::set_network_registration (char *plmn)
175
159
{
176
160
if (_network->set_registration (plmn) != NSAPI_ERROR_OK) {
@@ -301,7 +285,9 @@ void CellularConnectionFSM::event()
301
285
tr_info (" Cellular device ready" );
302
286
_next_state = STATE_SIM_PIN;
303
287
_retry_count = 0 ;
304
- device_ready ();
288
+ _cellularDevice->close_power ();
289
+ _power = NULL ;
290
+
305
291
} else {
306
292
tr_info (" Waiting for cellular device (retry %d/%d, timeout %d ms)" , _retry_count, RETRY_COUNT_DEFAULT,
307
293
TIMEOUT_POWER_ON);
@@ -320,6 +306,8 @@ void CellularConnectionFSM::event()
320
306
_next_state = STATE_REGISTERING_NETWORK;
321
307
_retry_count = 0 ;
322
308
_state_retry_count = 0 ;
309
+ _cellularDevice->close_sim ();
310
+ _sim = NULL ;
323
311
tr_info (" Check for network registration" );
324
312
} else {
325
313
if (_retry_count++ <= RETRY_COUNT_DEFAULT) {
@@ -498,7 +486,7 @@ nsapi_error_t CellularConnectionFSM::start_dispatch()
498
486
499
487
MBED_ASSERT (!_queue_thread);
500
488
501
- _queue_thread = new rtos::Thread;
489
+ _queue_thread = new rtos::Thread (osPriorityNormal, 2048 ) ;
502
490
if (!_queue_thread) {
503
491
stop ();
504
492
return NSAPI_ERROR_NO_MEMORY;
@@ -517,6 +505,10 @@ void CellularConnectionFSM::stop()
517
505
tr_info (" CellularConnectionUtil::stop" );
518
506
_cellularDevice->close_power ();
519
507
_cellularDevice->close_network ();
508
+ _cellularDevice->close_sim ();
509
+ _power = NULL ;
510
+ _network = NULL ;
511
+ _sim = NULL ;
520
512
if (_queue_thread) {
521
513
_queue_thread->terminate ();
522
514
_queue_thread = NULL ;
0 commit comments