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
This commit is contained in:
@@ -201,7 +201,7 @@ static void *_nas_user_mngr(void *args)
|
||||
|
||||
/* User receiving 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 */
|
||||
|
||||
@@ -212,7 +212,7 @@ void nas_user_initialize(emm_indication_callback_t emm_cb,
|
||||
** 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;
|
||||
|
||||
@@ -221,14 +221,19 @@ int nas_user_receive_and_process(int * fd)
|
||||
int bytes;
|
||||
int i;
|
||||
|
||||
/* Read the user data message */
|
||||
bytes = user_api_read_data (*fd);
|
||||
if (bytes == RETURNerror) {
|
||||
/* 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 (message != NULL) {
|
||||
/* Set the message in receive buffer (Use to simulate reception of data from UserProcess) */
|
||||
bytes = user_api_set_data(message);
|
||||
} else {
|
||||
/* Read the user data message */
|
||||
bytes = user_api_read_data (*fd);
|
||||
if (bytes == RETURNerror) {
|
||||
/* 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) {
|
||||
@@ -261,22 +266,25 @@ int nas_user_receive_and_process(int * fd)
|
||||
"The user procedure call failed");
|
||||
}
|
||||
|
||||
/* Encode the user data message */
|
||||
bytes = user_api_encode_data (nas_user_get_data (), i == nb_command - 1);
|
||||
if (bytes == RETURNerror) {
|
||||
/* Failed to encode the user data message;
|
||||
* go ahead and process the next user data */
|
||||
continue;
|
||||
}
|
||||
/* Send response to UserProcess (If not in simulated reception) */
|
||||
if (message == NULL) {
|
||||
/* Encode the user data message */
|
||||
bytes = user_api_encode_data (nas_user_get_data (), i == nb_command - 1);
|
||||
if (bytes == RETURNerror) {
|
||||
/* Failed to encode the user data message;
|
||||
* go ahead and process the next user data */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Send the data message to the user */
|
||||
bytes = user_api_send_data (*fd, bytes);
|
||||
if (bytes == RETURNerror) {
|
||||
/* Failed to send data to the user application layer;
|
||||
* exit from the receiving loop */
|
||||
LOG_TRACE (ERROR, "UE-MAIN - "
|
||||
"Failed to send data to the user application layer");
|
||||
LOG_FUNC_RETURN(TRUE);
|
||||
/* Send the data message to the user */
|
||||
bytes = user_api_send_data (*fd, bytes);
|
||||
if (bytes == RETURNerror) {
|
||||
/* Failed to send data to the user application layer;
|
||||
* exit from the receiving loop */
|
||||
LOG_TRACE (ERROR, "UE-MAIN - "
|
||||
"Failed to send data to the user application layer");
|
||||
LOG_FUNC_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ Description NAS procedure functions triggered by the user
|
||||
void nas_user_initialize(emm_indication_callback_t emm_cb,
|
||||
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);
|
||||
|
||||
|
||||
@@ -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 (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 {
|
||||
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) {
|
||||
{
|
||||
MessageDef *message_p;
|
||||
|
||||
#if (NAS_UE_AUTOSTART == 0)
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -122,6 +118,12 @@ void *nas_ue_task(void *args_p) {
|
||||
case INITIALIZE_MESSAGE:
|
||||
LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, msg_name);
|
||||
#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
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user