Commit e90e30a5 authored by winckel's avatar winckel

Modified NAS_UE_AUTOSTART option, an "at+cfun=1" message reception from...

Modified NAS_UE_AUTOSTART option, an "at+cfun=1" message reception from UserProcess is simulated to start NAS Ue activities.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4809 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent b3fda596
...@@ -201,7 +201,7 @@ static void *_nas_user_mngr(void *args) ...@@ -201,7 +201,7 @@ static void *_nas_user_mngr(void *args)
/* User receiving loop */ /* User receiving loop */
while (!exit_loop) { while (!exit_loop) {
exit_loop = nas_user_receive_and_process(fd); exit_loop = nas_user_receive_and_process(fd, NULL);
} }
/* Close the connection to the user application layer */ /* Close the connection to the user application layer */
......
...@@ -212,7 +212,7 @@ void nas_user_initialize(emm_indication_callback_t emm_cb, ...@@ -212,7 +212,7 @@ void nas_user_initialize(emm_indication_callback_t emm_cb,
** Outputs: Return: FALSE, TRUE ** ** Outputs: Return: FALSE, TRUE **
** ** ** **
***************************************************************************/ ***************************************************************************/
int nas_user_receive_and_process(int * fd) int nas_user_receive_and_process(int *fd, char *message)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -221,14 +221,19 @@ int nas_user_receive_and_process(int * fd) ...@@ -221,14 +221,19 @@ int nas_user_receive_and_process(int * fd)
int bytes; int bytes;
int i; int i;
/* Read the user data message */ if (message != NULL) {
bytes = user_api_read_data (*fd); /* Set the message in receive buffer (Use to simulate reception of data from UserProcess) */
if (bytes == RETURNerror) { bytes = user_api_set_data(message);
/* Failed to read data from the user application layer; } else {
* exit from the receiving loop */ /* Read the user data message */
LOG_TRACE (ERROR, "UE-MAIN - " bytes = user_api_read_data (*fd);
"Failed to read data from the user application layer"); if (bytes == RETURNerror) {
LOG_FUNC_RETURN(TRUE); /* Failed to read data from the user application layer;
* exit from the receiving loop */
LOG_TRACE (ERROR, "UE-MAIN - "
"Failed to read data from the user application layer");
LOG_FUNC_RETURN(TRUE);
}
} }
if (bytes == 0) { if (bytes == 0) {
...@@ -261,22 +266,25 @@ int nas_user_receive_and_process(int * fd) ...@@ -261,22 +266,25 @@ int nas_user_receive_and_process(int * fd)
"The user procedure call failed"); "The user procedure call failed");
} }
/* Encode the user data message */ /* Send response to UserProcess (If not in simulated reception) */
bytes = user_api_encode_data (nas_user_get_data (), i == nb_command - 1); if (message == NULL) {
if (bytes == RETURNerror) { /* Encode the user data message */
/* Failed to encode the user data message; bytes = user_api_encode_data (nas_user_get_data (), i == nb_command - 1);
* go ahead and process the next user data */ if (bytes == RETURNerror) {
continue; /* Failed to encode the user data message;
} * go ahead and process the next user data */
continue;
}
/* Send the data message to the user */ /* Send the data message to the user */
bytes = user_api_send_data (*fd, bytes); bytes = user_api_send_data (*fd, bytes);
if (bytes == RETURNerror) { if (bytes == RETURNerror) {
/* Failed to send data to the user application layer; /* Failed to send data to the user application layer;
* exit from the receiving loop */ * exit from the receiving loop */
LOG_TRACE (ERROR, "UE-MAIN - " LOG_TRACE (ERROR, "UE-MAIN - "
"Failed to send data to the user application layer"); "Failed to send data to the user application layer");
LOG_FUNC_RETURN(TRUE); LOG_FUNC_RETURN(TRUE);
}
} }
} }
......
...@@ -40,7 +40,7 @@ Description NAS procedure functions triggered by the user ...@@ -40,7 +40,7 @@ Description NAS procedure functions triggered by the user
void nas_user_initialize(emm_indication_callback_t emm_cb, void nas_user_initialize(emm_indication_callback_t emm_cb,
esm_indication_callback_t esm_cb, const char *version); esm_indication_callback_t esm_cb, const char *version);
int nas_user_receive_and_process(int * fd); int nas_user_receive_and_process(int * fd, char *message);
int nas_user_process_data(const void *data); int nas_user_process_data(const void *data);
......
...@@ -58,7 +58,7 @@ static int nas_ue_process_events(struct epoll_event *events, int nb_events) ...@@ -58,7 +58,7 @@ static int nas_ue_process_events(struct epoll_event *events, int nb_events)
{ {
/* If the event has not been yet been processed (not an itti message) */ /* If the event has not been yet been processed (not an itti message) */
if (events[event].data.fd == user_fd) { if (events[event].data.fd == user_fd) {
exit_loop = nas_user_receive_and_process(&user_fd); exit_loop = nas_user_receive_and_process(&user_fd, NULL);
} else { } else {
LOG_E(NAS, "[UE] Received an event from an unknown fd %d!\n", events[event].data.fd); LOG_E(NAS, "[UE] Received an event from an unknown fd %d!\n", events[event].data.fd);
} }
...@@ -101,11 +101,7 @@ void *nas_ue_task(void *args_p) { ...@@ -101,11 +101,7 @@ void *nas_ue_task(void *args_p) {
{ {
MessageDef *message_p; MessageDef *message_p;
#if (NAS_UE_AUTOSTART == 0)
message_p = itti_alloc_new_message(TASK_NAS_UE, DEACTIVATE_MESSAGE); message_p = itti_alloc_new_message(TASK_NAS_UE, DEACTIVATE_MESSAGE);
#else
message_p = itti_alloc_new_message(TASK_NAS_UE, ACTIVATE_MESSAGE);
#endif
itti_send_msg_to_task(TASK_L2L1, instance, message_p); itti_send_msg_to_task(TASK_L2L1, instance, message_p);
} }
...@@ -122,6 +118,12 @@ void *nas_ue_task(void *args_p) { ...@@ -122,6 +118,12 @@ void *nas_ue_task(void *args_p) {
case INITIALIZE_MESSAGE: case INITIALIZE_MESSAGE:
LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, msg_name); LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, msg_name);
#if (NAS_UE_AUTOSTART != 0) #if (NAS_UE_AUTOSTART != 0)
{
/* Send an activate modem command to NAS like UserProcess should do it */
char *user_data = "at+cfun=1\r";
nas_user_receive_and_process (&user_fd, user_data);
}
#endif #endif
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment