nas: add helper for entering new state in FSM

the helper will log the event
master
Andre Puschmann 5 years ago
parent ef80502047
commit dbb8b6a360

@ -220,6 +220,7 @@ private:
void send_activate_test_mode_complete(const uint8_t sec_hdr_type); void send_activate_test_mode_complete(const uint8_t sec_hdr_type);
// Other internal helpers // Other internal helpers
void enter_state(emm_state_t state_);
void handle_airplane_mode_sim(); void handle_airplane_mode_sim();
void enter_emm_deregistered(); void enter_emm_deregistered();

@ -253,7 +253,7 @@ void nas::init(usim_interface_nas* usim_, rrc_interface_nas* rrc_, gw_interface_
usim = usim_; usim = usim_;
rrc = rrc_; rrc = rrc_;
gw = gw_; gw = gw_;
state = EMM_STATE_DEREGISTERED; enter_state(EMM_STATE_DEREGISTERED);
if (!usim->get_home_plmn_id(&home_plmn)) { if (!usim->get_home_plmn_id(&home_plmn)) {
nas_log->error("Getting Home PLMN Id from USIM. Defaulting to 001-01\n"); nas_log->error("Getting Home PLMN Id from USIM. Defaulting to 001-01\n");
@ -493,7 +493,13 @@ void nas::enter_emm_deregistered()
eps_bearer.clear(); eps_bearer.clear();
plmn_is_selected = false; plmn_is_selected = false;
state = EMM_STATE_DEREGISTERED; enter_state(EMM_STATE_DEREGISTERED);
}
void nas::enter_state(emm_state_t state_)
{
state = state_;
nas_log->info("New state %s\n", emm_state_text[state]);
} }
void nas::left_rrc_connected() {} void nas::left_rrc_connected() {}
@ -1186,7 +1192,7 @@ void nas::parse_attach_accept(uint32_t lcid, unique_byte_buffer_t pdu)
bearer.eps_bearer_id = act_def_eps_bearer_context_req.eps_bearer_id; bearer.eps_bearer_id = act_def_eps_bearer_context_req.eps_bearer_id;
if (eps_bearer.insert(eps_bearer_map_pair_t(bearer.eps_bearer_id, bearer)).second) { if (eps_bearer.insert(eps_bearer_map_pair_t(bearer.eps_bearer_id, bearer)).second) {
// bearer added successfully // bearer added successfully
state = EMM_STATE_REGISTERED; enter_state(EMM_STATE_REGISTERED);
attach_attempt_counter = 0; // reset according to 5.5.1.1 attach_attempt_counter = 0; // reset according to 5.5.1.1
@ -1919,7 +1925,7 @@ void nas::send_detach_request(bool switch_off)
enter_emm_deregistered(); enter_emm_deregistered();
} else { } else {
// we are expecting a response from the core // we are expecting a response from the core
state = EMM_STATE_DEREGISTERED_INITIATED; enter_state(EMM_STATE_DEREGISTERED_INITIATED);
// start T3421 // start T3421
nas_log->info("Starting T3421\n"); nas_log->info("Starting T3421\n");
@ -2234,7 +2240,7 @@ void nas::send_esm_information_response(const uint8 proc_transaction_id)
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true); unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
if (!pdu) { if (!pdu) {
nas_log->error("Fatal Error: Couldn't allocate PDU in send_attach_request().\n"); nas_log->error("Fatal Error: Couldn't allocate PDU in %s.\n", __FUNCTION__);
return; return;
} }

Loading…
Cancel
Save