static void srv_sms_handle_new_msg(srv_sms_sim_enum sim_id, mmi_sms_new_msg_pdu_ind_struct *data)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
smslib_general_struct *app_lib_data = OslMalloc(sizeof(smslib_general_struct));
char log[256]={0};
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
smslib_decode_pdu(data->pdu, (kal_uint8)data->pdu_length, app_lib_data);
smslib_get_msg_content(KAL_FALSE, app_lib_data, NULL);
stkj_trace("srv_sms_handle_new_msg");
stkj_covertctring_to16jz((char *)app_lib_data->forMMI_UserData,app_lib_data->forMMI_UserData_length);
sprintf(log,"app_lib_data->forMMI_UserData_length=%d",app_lib_data->forMMI_UserData_length);
stkj_trace(log);
memset(log,0,256);
srv_sms_get_content_from_tpud(
(U8*)log,
256,
app_lib_data->tpdu.fo,
(U8)srv_sms_smslib_alphabet_to_dcs(app_lib_data->tpdu.alphabet_type),
app_lib_data->forMMI_UserData,
(U8)app_lib_data->forMMI_UserData_length);
stkj_covertctring_to16jz((char *)log,app_lib_data->forMMI_UserData_length);
if (app_lib_data->tpdu.msg_wait.is_msg_wait)
{
if (app_lib_data->tpdu.msg_wait.need_store == MMI_FALSE)
{
srv_sms_send_sms_ack(sim_id, 0xffff, SRV_SMS_STORAGE_UNSPECIFIC, MMI_TRUE, 0);
smslib_dealloc_sms_struct(app_lib_data);
OslMfree(app_lib_data);
return;
}
}
if (srv_sms_check_sms_port(app_lib_data->tpdu.port.dest_port, sim_id) != SRV_SMS_INVALID_NUM
||(!(srv_sms_is_replace_sms(app_lib_data->tpdu.data.deliver_tpdu.pid)) && app_lib_data->tpdu.msg_class == SMSLIB_CLASS0))
{
srv_sms_add_sms_to_await(sim_id, app_lib_data);
}
/* the following is handle sms normal case */
else
{
if (app_lib_data->tpdu.mti == SMSLIB_MTI_DELIVER || app_lib_data->tpdu.mti == SMSLIB_MTI_UNSPECIFIED)
{
srv_sms_find_msg_struct find_data = {0};
U16 msg_id;
srv_sms_msg_add_pdu_struct add_pdu;
srv_sms_general_struct * sms_general_data = OslMalloc(sizeof(srv_sms_general_struct));
sms_general_data->data = (void *)app_lib_data;
sms_general_data->sim_id = sim_id;
sms_general_data->new_pdu = NULL;
/* handle replace message */
if (srv_sms_is_replace_sms(app_lib_data->tpdu.data.deliver_tpdu.pid) == MMI_TRUE)
{
find_data.is_check_concat = MMI_FALSE;
find_data.sim_id = sim_id;
find_data.pid = app_lib_data->tpdu.data.deliver_tpdu.pid;
find_data.mti = app_lib_data->tpdu.mti;
find_data.ref_num = app_lib_data->tpdu.concat_info.ref;
find_data.total_seg = app_lib_data->tpdu.concat_info.total_seg;
if (app_lib_data->tpdu.msg_class == SMSLIB_CLASS2)
{
find_data.storage_type = SRV_SMS_STORAGE_SIM;
}
else
{
find_data.storage_type = SRV_SMS_STORAGE_UNSPECIFIC;
}
srv_sms_convert_l4_num_to_ascii_num((U8*)find_data.address, &(app_lib_data->forMMI_TPAddr), SRV_SMS_MAX_ADDR_LEN);
if ((msg_id = srv_sms_find_msg(&find_data)) != SRV_SMS_INVALID_MSG_ID)
{
sms_general_data->new_pdu = OslMalloc(sizeof(mmi_sms_new_msg_pdu_ind_struct));
memcpy(sms_general_data->new_pdu, data, sizeof(mmi_sms_new_msg_pdu_ind_struct));
srv_sms_delete_msg_bg(msg_id, srv_sms_delete_sms_callback, (void *)sms_general_data);
return;
}
else if (app_lib_data->tpdu.msg_class == SMSLIB_CLASS0)
{
srv_sms_add_sms_to_await(sim_id, app_lib_data);
return;
}
}
add_pdu.is_hidden = MMI_FALSE;
if (app_lib_data->tpdu.concat_info.total_seg > 1)
{
find_data.is_check_concat = MMI_TRUE;
find_data.sim_id = sim_id;
find_data.pid = app_lib_data->tpdu.data.deliver_tpdu.pid;
find_data.mti = app_lib_data->tpdu.mti;
find_data.ref_num = app_lib_data->tpdu.concat_info.ref;
find_data.not_exist_seg = app_lib_data->tpdu.concat_info.seg;
find_data.total_seg = app_lib_data->tpdu.concat_info.total_seg;
find_data.storage_type = SRV_SMS_STORAGE_UNSPECIFIC;
srv_sms_convert_l4_num_to_ascii_num((U8*)find_data.address, &(app_lib_data->forMMI_TPAddr), SRV_SMS_MAX_ADDR_LEN);
if ((msg_id = srv_sms_find_msg(&find_data)) != SRV_SMS_INVALID_MSG_ID)
{
srv_sms_msg_append_pdu_struct append_msg_data;
append_msg_data.status = SRV_SMS_STATUS_UNREAD;
append_msg_data.msg_id = msg_id;
append_msg_data.decode_data = app_lib_data;
append_msg_data.pdu_raw_data = data->pdu;
append_msg_data.raw_data_size = (U8)data->pdu_length;
append_msg_data.sim_id = sim_id;
if (app_lib_data->tpdu.msg_class == SMSLIB_CLASS2)
{
append_msg_data.storage_type = SRV_SMS_STORAGE_SIM;
}
else
{
append_msg_data.storage_type = SRV_SMS_STORAGE_UNSPECIFIC;
}
sms_general_data->storage = append_msg_data.storage_type;
sms_general_data->msg_id = msg_id;
srv_sms_msg_append_pdu(&append_msg_data, srv_sms_save_sms_callback, (void *)sms_general_data);
return;
}
else
{
add_pdu.is_hidden = MMI_TRUE;
}
}
add_pdu.status = SRV_SMS_STATUS_UNREAD;
add_pdu.pdu_raw_data = data->pdu;
add_pdu.sim_id = sim_id;
add_pdu.raw_data_size = (U8)data->pdu_length;
add_pdu.decode_data = app_lib_data;
add_pdu.is_search_concat = MMI_FALSE;
if (app_lib_data->tpdu.msg_class == SMSLIB_CLASS2)
{
add_pdu.storage_type = SRV_SMS_STORAGE_SIM;
}
else