JSR205.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:105k
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * mmi_jsr.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- *
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #ifndef _MMI_JSR_C
- #define _MMI_JSR_C
- /* Include: MMI header file */
- #include "MMI_features.h"
- #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
- #include "stdC.h"
- #include "PixtelDataTypes.h"
- #include "Fat_fs.h"
- #include "QueueGProt.h"
- #include "EventsGprot.h"
- #include "ProtocolEvents.h"
- #include "DebugInitDef.h" /* Debug Info */
- #include "JsrTypes.h"
- #include "JsrProts.h"
- #include "JMMSJSRHandler.h"
- #include "JMMSGprot.h"
- #include "jdd_memapi.h" /* JDD memory allocation functions */
- #include "JProfileHandlerTypes.h"
- #include "JProfileHandlerProts.h"
- #ifdef __MMI_UNIFIED_MESSAGE__
- #include "JMMSUMHandling.h"
- #endif
- #include "Unicodexdcl.h" /* Unicode transform functions */
- #include "UCS2Prot.h"
- /*****************************************************************************
- * Define
- *****************************************************************************/
- /*****************************************************************************
- * Typedef
- *****************************************************************************/
- /*****************************************************************************
- * Local Variable
- *****************************************************************************/
- /*****************************************************************************
- * Local Function
- *****************************************************************************/
- static JsrResult mmi_jsr_write_folder_status_to_file(U32 no_of_message, JsrMessageInfo *list);
- static void mmi_jsr_read_object_list_from_file(void);
- static MMI_BOOL mmi_jsr_write_object_list_to_file(void);
- static MMI_BOOL mmi_jsr_insert_appid_info_to_list(
- jsr_appid_msgid_list **appid_object_list,
- S8 *string,
- jsr_msg_info *msg_list);
- static MMI_BOOL mmi_jsr_remove_appid_info_from_list(jsr_appid_msgid_list **list, S8 *appId);
- static MMI_BOOL mmi_jsr_remove_appid_info_from_list_recursive(jsr_appid_msgid_list **list);
- static MMI_BOOL mmi_jsr_insert_msg_info_to_list(jsr_msg_info **msg_list, U32 msgId, U8 ischecked);
- static MMI_BOOL mmi_jsr_remove_msg_info_from_list(jsr_msg_info **list, U32 msgId);
- static MMI_BOOL mmi_jsr_remove_msg_info_from_list_recursive(jsr_msg_info **list);
- static U32 mmi_jsr_get_digit_of_integer(U32 msgId);
- static U32 mmi_jsr_get_current_size_of_object_list(jsr_appid_msgid_list *appid_object_list, U32 *max_chrs_in_line);
- static void mmi_jsr_read_line_from_file(U32 filehandle, S8 *buffer, U32 buf_length, U32 *line_length, S32 *ret);
- static MMI_BOOL mmi_jsr_check_appId(S8 *appId);
- /*****************************************************************************
- * Global Variable
- *****************************************************************************/
- jsr_context_struct jsr_cntx;
- jsr_context_struct *jsr_cntx_p = &jsr_cntx;
- jsr_appid_msgid_list *g_jsr_appid_object_list = NULL;
- jsr_appid_info_struct *jsr_appid_db[JSR_MAX_APP_ID_NUM]; /* for registered apps */
- /*****************************************************************************
- * Global Function
- *****************************************************************************/
- extern int mmi_charset_ucs2_to_utf8_length_in_bytes(const kal_uint8 *raw);
- extern kal_int32 mmi_chset_ucs2_to_utf8_string(kal_uint8 *dest, kal_int32 dest_size, kal_uint8 *src);
- extern void mmi_jmms_reset_mms_downloading_busy(void);
- extern void mmi_jmms_update_status_icon_indicator(void);
- /*****************************************************************************
- * FUNCTION
- * JsrCleanContext
- * DESCRIPTION
- * Clear the JSR context information.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void JsrCleanContext(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (JSR_CNTX)
- {
- JSR_CNTX->op = 0;
- JSR_CNTX->state = 0;
- JSR_CNTX->msgId = 0;
- JSR_CNTX->curr_media_obj_no = 0;
- JSR_CNTX->total_media_obj_no = 0;
- JSR_CNTX->retrievalMode = 0;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_init_appid_msgid_list
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_init_appid_msgid_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_jsr_appid_object_list == NULL)
- {
- mmi_jsr_read_object_list_from_file();
- }
- }
- //Testing Stubs start
- //wap_mmc_read_folder_status_req_ind_struct folder_status;
- //extern void mmi_jmms_get_msgid_value_from_nvram(void);
- //void mmi_jmms_java_mms_set_content_type_params(wap_mmc_recv_appmms_rsp_struct* resp,JC_INT8 *content_type);
- //wap_mmc_recv_appmms_rsp_struct recv_struct;
- //wap_mmc_delete_msg_req_ind_struct delete_struct;
- /* wap_mmc_upload_msg_req_ind_struct upload_struct; */
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_testing
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_testing(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- // folder_status.folderId = JSR_DRAFTS;
- // folder_status.folderId = JSR_TEMPLATES;
- // folder_status.retrievalMode = JSR_FULL;
- // mmi_jsr_read_folder_status_req_hldr(&folder_status);
- // delete_struct.folderId = 0;
- // delete_struct.msgId = 6;
- // mmi_jsr_delete_msg_req_hldr(&delete_struct);
- // pfnUnicodeStrcpy(upload_struct.filePath,"C : \ t e m p . m ");
- // mmi_jsr_upload_msg_req_hldr((void*)&upload_struct);
- // mmi_jmms_get_msgid_value_from_nvram(); //tested
- // mmi_jmms_java_mms_set_content_type_params(&recv_struct, "application/vnd.wap.multipart.related; Type=application/smil; Start="<smil-part>"; Application-ID=com.siemens.Messenger; Reply-To-Application-ID=com.siemens.Messenger");//tested
- }
- /* Testing Stubs end. */
- /* AT COMMANDS API */
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_write_folder_status_to_file
- * DESCRIPTION
- * Write mms folder status to information file
- * PARAMETERS
- * no_of_msgs [IN] Number of messages
- * list [?] List of messages
- * RETURNS
- * JsrResult
- *****************************************************************************/
- JsrResult mmi_jsr_write_folder_status_to_file(U32 no_of_msgs, JsrMessageInfo *list)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 msg_no = 0;
- int info_file_size = 0;
- int result = JSR_RESULT_ERROR;
- U32 bytes_written = 0;
- JsrMessageInfo *msgInfo_p = NULL;
- /* for new phone suite */
- JDD_FSHANDLE file_handle = NULL;
- JC_CHAR *pInFilename = NULL;
- S8 buff[20];
- JDD_FILE fh = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* for new phone suite */
- if (file_handle == NULL)
- {
- jdd_FSInitialize(&file_handle);
- }
- memset(buff, 0, 20);
- pInFilename = jdd_MemAlloc(sizeof(S8), 100);
- if (NULL == pInFilename)
- {
- result = JSR_RESULT_INSUFFICIENT_MEMORY;
- goto END;
- }
- AnsiiToUnicodeString((S8*) pInFilename, (S8*) (JDD_FS_MMS_SYS_FOLDER));
- AnsiiToUnicodeString((S8*) buff, (S8*) "\");
- pfnUnicodeStrcat((S8*) pInFilename, (S8*) buff);
- AnsiiToUnicodeString((S8*) buff, (S8*) (JSR_INFO));
- pfnUnicodeStrcat((S8*) pInFilename, (S8*) buff);
- jdd_FSDelete(file_handle, (JC_CHAR*) pInFilename);
- if (no_of_msgs == 0)
- {
- result = JSR_RESULT_OK;
- goto END;
- }
- fh = jdd_FSOpen(file_handle, (JC_CHAR*) pInFilename, E_CREATE_WRITE_MODE);
- if (fh == NULL)
- {
- result = JSR_RESULT_FILE_OPERATION_ERROR;
- goto END;
- }
- info_file_size = no_of_msgs * sizeof(JsrMessageInfo);
- msgInfo_p = (JsrMessageInfo*) jdd_MemAlloc(no_of_msgs, sizeof(JsrMessageInfo));
- if (NULL == msgInfo_p)
- {
- result = JSR_RESULT_INSUFFICIENT_MEMORY;
- goto END;
- }
- memset(msgInfo_p, 0, (no_of_msgs * sizeof(JsrMessageInfo)));
- for (msg_no = 0; msg_no < no_of_msgs; msg_no++)
- {
- msgInfo_p[msg_no].msgId = list[msg_no].msgId;
- /* 180406 */
- msgInfo_p[msg_no].offset = list[msg_no].offset;
- msgInfo_p[msg_no].date = list[msg_no].date;
- msgInfo_p[msg_no].size = list[msg_no].size;
- /* msgInfo_p[msg_no].fileType = list[msg_no].fileType; */
- strcpy((S8*) msgInfo_p[msg_no].filename, (S8*) list[msg_no].filename);
- /* write address and subject only when retrieval mode is JSR_FULL */
- if (JSR_CNTX->retrievalMode == JSR_FULL)
- {
- strcpy((S8*) msgInfo_p[msg_no].address, (S8*) list[msg_no].address);
- strcpy((S8*) msgInfo_p[msg_no].subject, (S8*) list[msg_no].subject);
- }
- }
- bytes_written = jdd_FSWrite(msgInfo_p, 1, info_file_size, fh);
- if (bytes_written != info_file_size)
- {
- jdd_FSDelete(file_handle, (JC_CHAR*) pInFilename);
- result = JSR_RESULT_INSUFFICIENT_MEMORY;
- goto END;
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d): JSR module write folder status to info.db file. n", __FILE__,
- __LINE__));
- result = JSR_RESULT_OK;
- END:
- if (fh != NULL)
- {
- jdd_FSClose(fh);
- }
- if (file_handle != NULL)
- {
- jdd_FSDeinitialize(file_handle);
- file_handle = NULL;
- }
- if (msgInfo_p != NULL)
- {
- jdd_MemFree(msgInfo_p);
- msgInfo_p = NULL;
- }
- if (pInFilename != NULL)
- {
- jdd_MemFree(pInFilename);
- pInFilename = NULL;
- }
- return result;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_read_folder_status_req_hldr
- * DESCRIPTION
- * Create a WAP_MMC_READ_FOLDER_STATUS_REQ_IND primitive to L4
- * PARAMETERS
- * msg [?] Message received from L4
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_read_folder_status_req_hldr(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_read_folder_status_req_ind_struct *Message;
- JsrFolderInfo *folderInfo = NULL;
- JsrMessageInfo *message_list = NULL;
- JsrResult result = JSR_RESULT_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Message = (wap_mmc_read_folder_status_req_ind_struct*) msg;
- PRINT_INFORMATION_2((MMI_TRACE_INFO,
- "%s(%d): MMI recives a wap_mmc_read_folder_status_req_ind signal, folder:%d and retrieval mode: %d. n",
- __FILE__, __LINE__, Message->folderId, Message->retrievalMode));
- #if defined(MMS_SUPPORT)
- if (E_FALSE == jmms_is_ready())
- {
- mmi_jsr_read_folder_status_output_req_hldr(JSR_RESULT_MMS_NO_READY, NULL);
- return;
- }
- #endif
- if (JSR_CNTX->state == JSR_STATE_IDLE)
- {
- if ((Message->folderId == JSR_INBOX)
- || (Message->folderId == JSR_OUTBOX)
- || (Message->folderId == JSR_SENT)
- || (Message->folderId == JSR_DRAFTS) || (Message->folderId == JSR_TEMPLATES))
- {
- if ((Message->retrievalMode == JSR_BASIC) || (Message->retrievalMode == JSR_FULL))
- {
- JSR_CNTX->state = JSR_STATE_READ_FOLDER;
- JSR_CNTX->retrievalMode = Message->retrievalMode;
- folderInfo = (JsrFolderInfo*) jdd_MemAlloc(sizeof(JsrFolderInfo), 1);
- if (folderInfo == NULL)
- {
- ASSERT(0);
- }
- memset(folderInfo, 0, sizeof(JsrFolderInfo));
- /* JMMS function */
- mmi_jmms_at_get_folder_info(Message->folderId, folderInfo);
- if (folderInfo->numOfMsg > 0)
- {
- message_list = (JsrMessageInfo*) jdd_MemAlloc((folderInfo->numOfMsg), sizeof(JsrMessageInfo));
- if (message_list == NULL)
- {
- ASSERT(0);
- }
- memset(message_list, 0, (folderInfo->numOfMsg) * sizeof(JsrMessageInfo));
- }
- /* JMMS function */
- mmi_jmms_at_get_message_list(Message->folderId, message_list);
- result = mmi_jsr_write_folder_status_to_file((folderInfo->numOfMsg), message_list);
- if (message_list != NULL)
- {
- jdd_MemFree(message_list);
- message_list = NULL;
- }
- /* This block will add the MMS root folder path
- and JSR info file path into folderInfo. */
- {
- int len = 100;
- JDD_FSHANDLE filehandle = NULL;
- S8 *pInFilename = NULL;
- S8 *pOutFilename = NULL;
- S8 *info_file_path = NULL;
- /* for new phone suite */
- if (filehandle == NULL)
- {
- jdd_FSInitialize(&filehandle);
- }
- pInFilename = (S8*) jdd_MemAlloc(sizeof(S8), 40);
- AnsiiToUnicodeString((S8*) pInFilename, (S8*) "@mms");
- ASSERT(E_TRUE == jdd_FSGetAbsoluteFilePath(filehandle, (JC_CHAR*) pInFilename, (JC_CHAR **) & pOutFilename));
- if (filehandle != NULL)
- {
- jdd_FSDeinitialize(filehandle);
- filehandle = NULL;
- }
- len = UCS2Strlen((S8*) pOutFilename) * ENCODING_LENGTH;
- if (len <= 100)
- {
- memcpy(folderInfo->mmsHomeDirectory, pOutFilename, len);
- }
- else
- {
- memcpy(folderInfo->mmsHomeDirectory, pOutFilename, 100);
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d): The path of mms home directory is too long.n",
- __FILE__, __LINE__));
- }
- len = 0;
- /* for new phone suite */
- if (filehandle == NULL)
- {
- jdd_FSInitialize(&filehandle);
- }
- if(pOutFilename != NULL)
- {
- jdd_MemFree(pOutFilename);
- pOutFilename = NULL;
- }
- memset(pInFilename, 0, 40);
- AnsiiToUnicodeString((S8*) pInFilename, (S8*) JDD_FS_MMS_SYS_FOLDER);
- ASSERT(E_TRUE == jdd_FSGetAbsoluteFilePath(filehandle, (JC_CHAR*) pInFilename, (JC_CHAR **) & pOutFilename));
- info_file_path = jdd_MemAlloc(sizeof(S8), (pfnUnicodeStrlen((S8*) pOutFilename) + 9));
- UnicodeToAnsii((S8*) info_file_path, (S8*) pOutFilename);
- strcat(info_file_path, "\");
- strcat(info_file_path, JSR_INFO);
- if(pOutFilename != NULL)
- {
- jdd_MemFree(pOutFilename);
- pOutFilename = NULL;
- }
-
- pOutFilename = jdd_MemAlloc(((strlen(info_file_path) + 1) * ENCODING_LENGTH), sizeof(S8));
- AnsiiToUnicodeString((S8*) pOutFilename, (S8*) (info_file_path));
- if (filehandle != NULL)
- {
- jdd_FSDeinitialize(filehandle);
- filehandle = NULL;
- }
- len = UCS2Strlen((S8*) pOutFilename) * ENCODING_LENGTH;
- if (len <= 100)
- {
- memcpy(folderInfo->infoFilePath, pOutFilename, len);
- }
- else
- {
- memcpy(folderInfo->infoFilePath, pOutFilename, 100);
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d): The path of info.db file is too long.n",
- __FILE__, __LINE__));
- }
- if (pInFilename != NULL)
- {
- jdd_MemFree(pInFilename);
- pInFilename = NULL;
- }
- if (info_file_path != NULL)
- {
- jdd_MemFree(info_file_path);
- info_file_path = NULL;
- }
- if (pOutFilename != NULL)
- {
- jdd_MemFree(pOutFilename);
- pOutFilename = NULL;
- }
- }
- mmi_jsr_read_folder_status_output_req_hldr(result, folderInfo);
- }
- else
- {
- mmi_jsr_read_folder_status_output_req_hldr(JSR_RESULT_INVALID_PARAMETER, NULL);
- }
- }
- else
- {
- mmi_jsr_read_folder_status_output_req_hldr(JSR_RESULT_INVALID_PARAMETER, NULL);
- }
- }
- else
- {
- mmi_jsr_read_folder_status_output_req_hldr(JSR_RESULT_BUSY, NULL);
- }
- if (folderInfo != NULL)
- {
- jdd_MemFree(folderInfo);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_read_folder_status_output_req_hldr
- * DESCRIPTION
- * Create a WAP_MMC_READ_FOLDER_STATUS_OUTPUT_REQ primitive to L4
- * PARAMETERS
- * result [IN]
- * folderInfo [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_read_folder_status_output_req_hldr(JsrResult result, JsrFolderInfo *folderInfo)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_read_folder_status_output_req_struct *myMsgPtr;
- ilm_struct *ilm_ptr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr = (wap_mmc_read_folder_status_output_req_struct*)
- OslConstructDataPtr(sizeof(wap_mmc_read_folder_status_output_req_struct));
- if (myMsgPtr)
- {
- memset((char*)(myMsgPtr) + 4, 0x00, (sizeof(wap_mmc_read_folder_status_output_req_struct) - 4));
- myMsgPtr->result = (U8) result;
- if (folderInfo)
- {
- myMsgPtr->numOfMsg = folderInfo->numOfMsg;
- myMsgPtr->numOfUnreadMsg = folderInfo->numOfUnreadMsg;
- memset(myMsgPtr->mmsHomeDirectory, 0x00, 100);
- memset(myMsgPtr->infoFilePath, 0x00, 100);
- memcpy(
- myMsgPtr->mmsHomeDirectory,
- folderInfo->mmsHomeDirectory,
- (UCS2Strlen((char*)folderInfo->mmsHomeDirectory) * 2));
- memcpy(
- myMsgPtr->infoFilePath,
- folderInfo->infoFilePath,
- (UCS2Strlen((char*)folderInfo->infoFilePath) * 2));
- }
- ilm_ptr = allocate_ilm(MOD_WAP);
- ilm_ptr->src_mod_id = MOD_WAP;
- ilm_ptr->sap_id = MMI_L4C_SAP;
- ilm_ptr->dest_mod_id = MOD_L4C;
- ilm_ptr->local_para_ptr = (local_para_struct*) myMsgPtr;
- ilm_ptr->msg_id = MSG_ID_WAP_MMC_READ_FOLDER_STATUS_OUTPUT_REQ;
- ilm_ptr->peer_buff_ptr = NULL;
- msg_send_ext_queue(ilm_ptr);
- if (result != JSR_RESULT_BUSY)
- {
- JsrCleanContext();
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO,
- "%s(%d): JSR module returns wap_mmc_read_folder_status_output_req with result: %d, nMsg: %d, and nUnreadMsg: %d n",
- __FILE__, __LINE__, result, myMsgPtr->numOfMsg, myMsgPtr->numOfUnreadMsg));
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO,
- "%s(%d): JSR module can't get memory for wap_mmc_upload_msg_output_req_struct n",
- __FILE__, __LINE__));
- ASSERT(0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_upload_msg_req_hldr
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_UPLOAD_MSG_REQ_IND primitive to L4
- * PARAMETERS
- * msg [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_upload_msg_req_hldr(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_upload_msg_req_ind_struct *Message;
- int len = 0;
- char *fname = NULL;
- JsrResult result = JSR_RESULT_OK;
- U32 msgId = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Message = (wap_mmc_upload_msg_req_ind_struct*) msg;
- #if defined(MMS_SUPPORT)//DIlip
- if (E_FALSE == jmms_is_ready())
- {
- mmi_jsr_upload_msg_output_req_hldr(JSR_RESULT_MMS_NO_READY, 0);
- return;
- }
- #endif
- /* Check the MMS folder for Max messages. */
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d): MMI recives a wap_mmc_upload_msg_req_ind signal. n", __FILE__,
- __LINE__));
- if (JSR_CNTX->state == JSR_STATE_IDLE)
- {
- JSR_CNTX->op = JSR_OP_UPLOAD_MSG;
- JSR_CNTX->state = JSR_STATE_UPLOAD_MSG;
- if (Message->filePath)
- {
- len = mmi_charset_ucs2_to_utf8_length_in_bytes(Message->filePath);
- if (len < 100)
- {
- fname = (S8*) jdd_MemAlloc(sizeof(S8), 100);
- if (NULL == fname)
- {
- mmi_jsr_upload_msg_output_req_hldr(JSR_RESULT_INSUFFICIENT_MEMORY, 0);
- return;
- }
- memset(fname, 0, 100);
- mmi_chset_ucs2_to_utf8_string((U8*) fname, (len + 1), (U8*) Message->filePath);
- //JMMS function call
- result = mmi_jmms_at_save_mms(fname, &msgId);
- mmi_jsr_upload_msg_output_req_hldr(result, msgId);
- if (fname != NULL)
- {
- jdd_MemFree(fname);
- fname = NULL;
- }
- }
- else
- {
- ASSERT(0); /* File path too long. */
- }
- }
- else
- {
- mmi_jsr_upload_msg_output_req_hldr(JSR_RESULT_INVALID_PARAMETER, 0);
- }
- }
- else
- {
- mmi_jsr_upload_msg_output_req_hldr(JSR_RESULT_BUSY, 0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_upload_msg_output_req_hldr
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_UPLOAD_MSG_OUTPUT_REQ primitive to L4
- * PARAMETERS
- * result [IN]
- * msgId [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_upload_msg_output_req_hldr(JsrResult result, U32 msgId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_upload_msg_output_req_struct *myMsgPtr;
- ilm_struct *ilm_ptr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr = (wap_mmc_upload_msg_output_req_struct*)
- OslConstructDataPtr(sizeof(wap_mmc_upload_msg_output_req_struct));
- if (myMsgPtr)
- {
- memset((char*)(myMsgPtr) + 4, 0x00, (sizeof(wap_mmc_upload_msg_output_req_struct) - 4));
- myMsgPtr->result = (U8) result;
- myMsgPtr->msgId = msgId;
- ilm_ptr = allocate_ilm(MOD_WAP);
- ilm_ptr->src_mod_id = MOD_WAP;
- ilm_ptr->sap_id = MMI_L4C_SAP;
- ilm_ptr->dest_mod_id = MOD_L4C;
- ilm_ptr->local_para_ptr = (local_para_struct*) myMsgPtr;
- ilm_ptr->msg_id = MSG_ID_WAP_MMC_UPLOAD_MSG_OUTPUT_REQ;
- ilm_ptr->peer_buff_ptr = NULL;
- msg_send_ext_queue(ilm_ptr);
- if (result != JSR_RESULT_BUSY)
- {
- JsrCleanContext();
- if (result == JSR_RESULT_OK)
- {
- /* Refresh the MMS folder menu screen. */
- #ifdef __MMI_UNIFIED_MESSAGE__
- mmi_um_jmms_highlight_mms_message_ind();
- #endif
- mmi_jmms_update_folder();
- }
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO,
- "%s(%d): JSR module returns wap_mmc_upload_msg_output_req with result %d and msgid %d n",
- __FILE__, __LINE__, result, msgId));
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO,
- "%s(%d): JSR module can't get memory for wap_mmc_upload_msg_output_req_struct n",
- __FILE__, __LINE__));
- ASSERT(0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_delete_msg_req_hldr
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_DELETE_MSG_REQ_IND primitive to L4
- * PARAMETERS
- * msg [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_delete_msg_req_hldr(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_delete_msg_req_ind_struct *Message;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Message = (wap_mmc_delete_msg_req_ind_struct*) msg;
- PRINT_INFORMATION_2((MMI_TRACE_INFO,
- "%s(%d): MMI recives a wap_mmc_deldete_msg_req_ind signal from l4c, msgid: %d and folderId: %d n",
- __FILE__, __LINE__, Message->msgId, Message->folderId));
- #if defined(MMS_SUPPORT)/*Dilip*/
- if (E_FALSE == jmms_is_ready())
- {
- mmi_jsr_delete_msg_output_req_hldr(JSR_RESULT_MMS_NO_READY);
- return;
- }
- #endif
- if (JSR_CNTX->state == JSR_STATE_IDLE)
- {
- JSR_CNTX->op = JSR_OP_DELETE_MSG;
- JSR_CNTX->state = JSR_STATE_DELETE_MSG;
- if (Message->folderId != 0)
- {
- if ((Message->folderId == JSR_INBOX)
- || (Message->folderId == JSR_OUTBOX)
- || (Message->folderId == JSR_SENT) || (Message->folderId == JSR_DRAFTS))
- {
- /* JMMS function call */
- mmi_jmms_at_delete_mms(Message->folderId, Message->msgId, mmi_jsr_delete_msg_output_req_hldr);
- }
- else
- {
- mmi_jsr_delete_msg_output_req_hldr(JSR_RESULT_INVALID_FOLDER);
- }
- }
- else
- {
- //JMMS function call
- // to do check if message is opened or folder is template.
- if (JSR_RESULT_OK == mmi_jmms_java_mms_error(mmi_jmms_is_message_found(JSR_TEMPLATES, Message->msgId)))
- {
- mmi_jsr_delete_msg_output_req_hldr(JSR_RESULT_ACCESS_DENY);
- }
- else
- {
- mmi_jmms_at_delete_mms(Message->folderId, Message->msgId, mmi_jsr_delete_msg_output_req_hldr);
- }
- }
- }
- else
- {
- mmi_jsr_delete_msg_output_req_hldr(JSR_RESULT_BUSY);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_delete_msg_output_req_hldr
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_DELETE_MSG_OUTPUT_REQ primitive to L4
- * PARAMETERS
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_delete_msg_output_req_hldr(JsrResult result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_delete_msg_output_req_struct *myMsgPtr;
- ilm_struct *ilm_ptr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr = (wap_mmc_delete_msg_output_req_struct*)
- OslConstructDataPtr(sizeof(wap_mmc_delete_msg_output_req_struct));
- if (myMsgPtr)
- {
- memset((char*)(myMsgPtr) + 4, 0x00, (sizeof(wap_mmc_delete_msg_output_req_struct) - 4));
- myMsgPtr->result = (U8) result;
- ilm_ptr = allocate_ilm(MOD_WAP);
- ilm_ptr->src_mod_id = MOD_WAP;
- ilm_ptr->sap_id = MMI_L4C_SAP;
- ilm_ptr->dest_mod_id = MOD_L4C;
- ilm_ptr->local_para_ptr = (local_para_struct*) myMsgPtr;
- ilm_ptr->msg_id = MSG_ID_WAP_MMC_DELETE_MSG_OUTPUT_REQ;
- ilm_ptr->peer_buff_ptr = NULL;
- msg_send_ext_queue(ilm_ptr);
- if (result != JSR_RESULT_BUSY)
- {
- JsrCleanContext();
- if (result == JSR_RESULT_OK)
- {
- /* Refresh the MMS folder menu screen. */
- mmi_jmms_update_folder();
- }
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO,
- "%s(%d): JSR module returns wap_mmc_delete_msg_output_req_struct with result %d n",
- __FILE__, __LINE__, result));
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO,
- "%s(%d): JSR module can't get memory for wap_mmc_delete_msg_output_req_struct n",
- __FILE__, __LINE__));
- ASSERT(0);
- }
- }
- /* JSR MESSAGE HANDLER API */
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_send_appmms_req_hldr
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_SEND_APPMMS_REQ primitive to Java
- * PARAMETERS
- * msg [?]
- * mod_src [IN]
- * peerBuf [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_send_appmms_req_hldr(void *msg, int mod_src, void *peerBuf)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_send_appmms_req_struct *Message;
- U16 buffer_length = 0;
- U8 *pdu = NULL;
- peer_buff_struct *peer_ptr = peerBuf;
- JsrResult result;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Message = (wap_mmc_send_appmms_req_struct*) msg;
- if (JSR_CNTX->state != JSR_STATE_IDLE)
- {
- mmi_jsr_send_appmms_rsp(JSR_RESULT_BUSY);
- }
- else
- {
- JsrCleanContext();
- JSR_CNTX->op = JSR_OP_SEND_MSG;
- JSR_CNTX->state = JSR_STATE_PROCESS_SEND_MSG_HDR;
- JSR_CNTX->total_media_obj_no = Message->bdy_part_no;
- JSR_CNTX->curr_media_obj_no = 0;
- pdu = (U8*) get_pdu_ptr(peer_ptr, &buffer_length);
- //JMMS function call
- result = mmi_jmms_jsr_create_mms(Message, pdu);
- if (result != JSR_RESULT_OK)
- {
- result = JSR_RESULT_ERROR_FAIL_TO_GEN_MMS_HDR;
- mmi_jsr_send_appmms_rsp(result);
- }
- else
- {
- if ((JSR_CNTX->curr_media_obj_no) < (JSR_CNTX->total_media_obj_no))
- {
- JSR_CNTX->state = JSR_STATE_PROCESS_SEND_MSG_BDY;
- mmi_jsr_send_post_appmms_msg_part_ind(JSR_RESULT_OK);
- }
- else
- {
- //JMMS function call
- mmi_jmms_jsr_send_mms(mmi_jsr_send_appmms_rsp);
- }
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_send_appmms_rsp
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_SEND_APPMMS_RSP primitive to Java
- * PARAMETERS
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_send_appmms_rsp(JsrResult result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_send_appmms_rsp_struct *myMsgPtr;
- ilm_struct *ilm_ptr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr = (wap_mmc_send_appmms_rsp_struct*) OslConstructDataPtr(sizeof(wap_mmc_send_appmms_rsp_struct));
- myMsgPtr->result = (U8) result;
- ilm_ptr = allocate_ilm(MOD_WAP);
- ilm_ptr->src_mod_id = MOD_WAP;
- ilm_ptr->sap_id = J2ME_WAP_SAP;
- ilm_ptr->dest_mod_id = MOD_JASYN;
- ilm_ptr->local_para_ptr = (local_para_struct*) myMsgPtr;
- ilm_ptr->msg_id = MSG_ID_WAP_MMC_SEND_APPMMS_RSP;
- ilm_ptr->peer_buff_ptr = NULL;
- msg_send_ext_queue(ilm_ptr);
- /* Clean the Jsr Context */
- JsrCleanContext();
- /* PMT HIMANSHU START 20060425 */
- mmi_jmms_reset_mms_downloading_busy();
- mmi_jmms_update_status_icon_indicator();
- /* PMT HIMANSHU END 20060425 */
- mmi_jmms_jsr_delete_temp_media_files();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_send_post_appmms_msg_part_ind
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_POST_APPMMS_MSG_PART_IND primitive to Java
- * PARAMETERS
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_send_post_appmms_msg_part_ind(JsrResult result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_post_appmms_msg_part_ind_struct *myMsgPtr;
- ilm_struct *ilm_ptr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr = (wap_mmc_post_appmms_msg_part_ind_struct*)
- OslConstructDataPtr(sizeof(wap_mmc_post_appmms_msg_part_ind_struct));
- myMsgPtr->result = (U8) result;
- ilm_ptr = allocate_ilm(MOD_WAP);
- ilm_ptr->src_mod_id = MOD_WAP;
- ilm_ptr->sap_id = J2ME_WAP_SAP;
- ilm_ptr->dest_mod_id = MOD_JASYN;
- ilm_ptr->local_para_ptr = (local_para_struct*) myMsgPtr;
- ilm_ptr->msg_id = MSG_ID_WAP_MMC_POST_APPMMS_MSG_PART_IND;
- ilm_ptr->peer_buff_ptr = NULL;
- msg_send_ext_queue(ilm_ptr);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_send_post_appmms_msg_part_rsp
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_POST_APPMMS_MSG_PART_RES primitive to Java
- * PARAMETERS
- * msg [?]
- * U8 result(?)
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_send_post_appmms_msg_part_rsp(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JsrResult result = JSR_RESULT_OK;
- wap_mmc_post_appmms_msg_part_res_struct *Message;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (JSR_CNTX->state != JSR_STATE_PROCESS_SEND_MSG_BDY)
- {
- mmi_jsr_send_appmms_rsp(JSR_RESULT_ACCESS_DENY);
- return;
- }
- Message = (wap_mmc_post_appmms_msg_part_res_struct*) msg;
- /* add media object to MMS message */
- result = mmi_jmms_jsr_add_media_object(JSR_CNTX->msgId, Message);
- if (result != JSR_RESULT_OK)
- {
- mmi_jsr_send_appmms_rsp(result);
- JsrCleanContext();
- return;
- }
- /* increment current media object by 1 */
- JSR_CNTX->curr_media_obj_no = JSR_CNTX->curr_media_obj_no + 1;
- if ((JSR_CNTX->curr_media_obj_no) < (JSR_CNTX->total_media_obj_no))
- {
- JSR_CNTX->state = JSR_STATE_PROCESS_SEND_MSG_BDY;
- mmi_jsr_send_post_appmms_msg_part_ind(JSR_RESULT_OK);
- }
- else
- {
- //JMMS function call
- mmi_jmms_jsr_send_mms(mmi_jsr_send_appmms_rsp);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_check_recv_mms_for_java
- * DESCRIPTION
- * Check if the message is a java message and send indication to java task.
- * PARAMETERS
- * contentType [?] [?]
- * msgId(?) [IN]
- * char* appId(?)(?)
- * RETURNS
- * void
- *****************************************************************************/
- MMI_BOOL mmi_jsr_check_recv_mms_for_java(S8 *contentType)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 *str_pos = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "(%d) Content Type ( %s )", __LINE__, contentType));
- // if ((contentType == NULL) || ((str_pos = strstr(contentType, "application-id")) == NULL))
- if ((contentType == NULL) || ((str_pos = mmi_jmms_jsr_get_application_string_from_content_type(contentType, JSR_APPLICATION_ID)) == NULL))
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d) Normal MMS", __FILE__, __LINE__));
- return FALSE;
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d) JAVA MMS", __FILE__, __LINE__));
- return TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_add_recv_java_mms_content
- * DESCRIPTION
- *
- * PARAMETERS
- * msgId [IN]
- * contentType [?]
- * RETURNS
- *
- *****************************************************************************/
- MMI_BOOL mmi_jsr_add_recv_java_mms_content(U32 msgId, S8 *contentType)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 *str_pos = NULL;
- S8 *reply_str_pos = NULL;
- S8 *temp_str = NULL;
- S8 *appId = NULL;
- U32 len = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- // if ((contentType == NULL) || ((str_pos = strstr(contentType, "application-id")) == NULL))
- if ((contentType == NULL) || ((str_pos = mmi_jmms_jsr_get_application_string_from_content_type(contentType, JSR_APPLICATION_ID)) == NULL))
- {
- return FALSE;
- }
- else
- {
- // reply_str_pos = strstr(contentType, "reply-to-application-id");
- reply_str_pos = mmi_jmms_jsr_get_application_string_from_content_type(contentType, JSR_REPLY_TO_APPLICATION_ID);
- /* if (reply_str_pos == NULL)
- {
- return FALSE;
- }*/
- /* if (reply_str_pos < str_pos)*/
- if((reply_str_pos != NULL) && (reply_str_pos < str_pos))
- {
- // str_pos = strstr(str_pos + 1, "application-id");
- str_pos = mmi_jmms_jsr_get_application_string_from_content_type(str_pos + 1, JSR_APPLICATION_ID);
- if (str_pos == NULL)
- {
- return FALSE;
- }
- }
- temp_str = str_pos;
- str_pos = strstr(temp_str, "=");
- temp_str = str_pos + 1;
- str_pos = strstr(temp_str, ";");
- if (str_pos != NULL)
- {
- len = strlen(temp_str) - strlen(str_pos);
- }
- else
- {
- len = strlen(temp_str);
- }
- appId = jdd_MemAlloc(sizeof(S8), (len + 1));
- memcpy(appId, temp_str, len);
- mmi_jsr_insert_msgId_to_appId_list(msgId, appId, FALSE);
- if (TRUE == mmi_jsr_check_appId(appId))
- {
- mmi_jsr_send_appmms_new_mms_ind(appId, (U32) strlen((S8*) appId));
- }
- jdd_MemFree(appId);
- return TRUE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_send_appmms_new_mms_ind
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_APPMMS_NEW_MMS_IND primitive to Java
- * PARAMETERS
- * appId [?]
- * length [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_send_appmms_new_mms_ind(char *appId, U32 length)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_appmms_new_mms_ind_struct *myMsgPtr;
- ilm_struct *ilm_ptr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr = (wap_mmc_appmms_new_mms_ind_struct*) OslConstructDataPtr(sizeof(wap_mmc_appmms_new_mms_ind_struct));
- memcpy(myMsgPtr->app_id, appId, length);
- myMsgPtr->app_id_len = length;
- ilm_ptr = allocate_ilm(MOD_WAP);
- ilm_ptr->src_mod_id = MOD_WAP;
- ilm_ptr->sap_id = J2ME_WAP_SAP;
- ilm_ptr->dest_mod_id = MOD_JASYN;
- ilm_ptr->local_para_ptr = (local_para_struct*) myMsgPtr;
- ilm_ptr->msg_id = MSG_ID_WAP_MMC_APPMMS_NEW_MMS_IND;
- ilm_ptr->peer_buff_ptr = NULL;
- msg_send_ext_queue(ilm_ptr);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_insert_msgId_to_appId_list
- * DESCRIPTION
- * Insert the message information in application object list.
- * PARAMETERS
- * msgId [IN]
- * appId [?]
- * is_checked [IN]
- * RETURNS
- * MMI_BOOL result
- *****************************************************************************/
- MMI_BOOL mmi_jsr_insert_msgId_to_appId_list(U32 msgId, char *appId, BOOL is_checked)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- jsr_appid_msgid_list *appid_list = NULL;
- jsr_msg_info *msg_list = NULL;
- MMI_BOOL result = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_jsr_appid_object_list == NULL)
- {
- mmi_jsr_read_object_list_from_file();
- }
- appid_list = g_jsr_appid_object_list;
- while (appid_list)
- {
- if ((appid_list->appId) && (strcmp((S8*) appid_list->appId, (S8*) appId) == 0))
- {
- result = mmi_jsr_insert_msg_info_to_list(&(appid_list->msgs), msgId, is_checked);
- break;
- }
- appid_list = appid_list->next;
- }
- if (appid_list == NULL)
- {
- if (mmi_jsr_insert_msg_info_to_list(&msg_list, msgId, is_checked))
- {
- result = mmi_jsr_insert_appid_info_to_list(&appid_list, appId, msg_list);
- g_jsr_appid_object_list = appid_list;
- }
- }
- if (result == TRUE)
- {
- mmi_jsr_write_object_list_to_file();
- }
- return result;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_remove_msgId_from_appId_list
- * DESCRIPTION
- * Delete the message information from application object list.
- * PARAMETERS
- * msgId [IN]
- * RETURNS
- * MMI_BOOL result
- *****************************************************************************/
- MMI_BOOL mmi_jsr_remove_msgId_from_appId_list(U32 msgId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- jsr_appid_msgid_list *appid_list = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_jsr_appid_object_list == NULL)
- {
- mmi_jsr_read_object_list_from_file();
- }
- appid_list = g_jsr_appid_object_list;
- while (appid_list)
- {
- if (appid_list->msgs)
- {
- jsr_msg_info *msg_list = appid_list->msgs;
- while (msg_list)
- {
- if (msg_list->msgId == msgId)
- {
- mmi_jsr_remove_msg_info_from_list(&(appid_list->msgs), msgId);
- if (appid_list->msgs == NULL)
- {
- mmi_jsr_remove_appid_info_from_list(&g_jsr_appid_object_list, appid_list->appId);
- }
- mmi_jsr_write_object_list_to_file();
- return TRUE;
- }
- msg_list = msg_list->next;
- }
- }
- appid_list = appid_list->next;
- }
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_receive_appmms_req_hldr
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_RECV_APPMMS_REQ primitive to Java
- * PARAMETERS
- * msg [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_receive_appmms_req_hldr(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_recv_appmms_req_struct *Message = NULL;
- wap_mmc_recv_appmms_rsp_struct response;
- jsr_appid_msgid_list *appid_list = NULL;
- S8 *appId = NULL;
- U32 msgId = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (JSR_CNTX->state != JSR_STATE_IDLE)
- {
- memset(&response, 0, sizeof(wap_mmc_recv_appmms_rsp_struct));
- response.result = JSR_RESULT_BUSY;
- mmi_jsr_receive_appmms_rsp(&response, NULL, 0);
- return;
- }
- Message = (wap_mmc_recv_appmms_req_struct*) msg;
- *(Message->app_id + Message->app_id_len) = ' ';
- appId = (S8*) Message->app_id;
- JSR_CNTX->op = JSR_OP_RECV_MSG;
- JSR_CNTX->state = JSR_STATE_RECV_MSG_HDR;
- if (appId == NULL)
- {
- response.result = JSR_RESULT_INVALID_PARAMETER;
- mmi_jsr_receive_appmms_rsp(&response, NULL, 0);
- JsrCleanContext();
- return;
- }
- else if (g_jsr_appid_object_list == NULL)
- {
- mmi_jsr_read_object_list_from_file();
- }
- appid_list = g_jsr_appid_object_list;
- while (appid_list)
- {
- if ((appid_list->appId) && (strcmp((S8*) appid_list->appId, (S8*) appId) == 0))
- {
- ASSERT(appid_list->msgs);
- msgId = appid_list->msgs->msgId;
- if (JSR_RESULT_OK != mmi_jmms_java_mms_error(mmi_jmms_is_message_found(JSR_INBOX, msgId)))
- {
- mmi_jsr_remove_msgId_from_appId_list(msgId);
- response.result = JSR_RESULT_ERROR_MSG_CORRUPTED;
- mmi_jsr_receive_appmms_rsp(&response, NULL, 0);
- JsrCleanContext();
- return;
- }
- JSR_CNTX->msgId = msgId;
- mmi_jmms_jsr_get_message_details(msgId, mmi_jsr_receive_appmms_post_req_hldr);
- return;
- }
- appid_list = appid_list->next;
- }
- response.result = JSR_RESULT_NO_MSG_FOR_JAVA;
- mmi_jsr_receive_appmms_rsp(&response, NULL, 0);
- JsrCleanContext();
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_receive_appmms_post_req_hldr
- * DESCRIPTION
- *
- * PARAMETERS
- * resp [?]
- * buffer [?]
- * buffer_size [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_receive_appmms_post_req_hldr(void *resp, S8 *buffer, U16 buffer_size)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_recv_appmms_rsp_struct *response = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- response = (wap_mmc_recv_appmms_rsp_struct*) resp;
- response->result = JSR_RESULT_OK;
- mmi_jsr_receive_appmms_rsp(response, buffer, buffer_size);
- if (response->bdy_part_no != 0)
- {
- JSR_CNTX->total_media_obj_no = response->bdy_part_no;
- JSR_CNTX->curr_media_obj_no = 1;
- JSR_CNTX->state = JSR_STATE_RECV_MSG_BDY;
- }
- else
- {
- mmi_jsr_remove_msgId_from_appId_list(JSR_CNTX->msgId);
- mmi_jmms_jsr_delete_msg(JSR_CNTX->msgId);
- JsrCleanContext();
- mmi_jmms_update_folder();
- }
- if (response != NULL)
- {
- jdd_MemFree(response);
- response = NULL;
- }
- if (buffer != NULL)
- {
- jdd_MemFree(buffer);
- buffer = NULL;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_receive_appmms_rsp
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_RECV_APPMMS_RSP primitive to Java
- * PARAMETERS
- * response_struct [?]
- * buffer [?]
- * buffer_size [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_receive_appmms_rsp(wap_mmc_recv_appmms_rsp_struct *response_struct, S8 *buffer, U16 buffer_size)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_recv_appmms_rsp_struct *myMsgPtr = NULL;
- ilm_struct *ilm_ptr = NULL;
- peer_buff_struct *peer_buff_ptr = NULL;
- U16 peer_pdu_len = 0;
- U8 *peer_pdu = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr = (wap_mmc_recv_appmms_rsp_struct*) OslConstructDataPtr(sizeof(wap_mmc_recv_appmms_rsp_struct));
- memset((S8*)(myMsgPtr) + 4, 0, (sizeof(wap_mmc_recv_appmms_rsp_struct) - 4));
- myMsgPtr->result = response_struct->result;
- myMsgPtr->priority = response_struct->priority;
- myMsgPtr->date = response_struct->date;
- myMsgPtr->from_addr_no = response_struct->from_addr_no;
- myMsgPtr->to_addr_no = response_struct->to_addr_no;
- myMsgPtr->cc_addr_no = response_struct->cc_addr_no;
- myMsgPtr->bdy_part_no = response_struct->bdy_part_no;
- myMsgPtr->start_cnt_id_len = response_struct->start_cnt_id_len;
- memset(myMsgPtr->start_cnt_id, 0, 100);
- memcpy(myMsgPtr->start_cnt_id, response_struct->start_cnt_id, 100);
- myMsgPtr->reply_app_id_len = response_struct->reply_app_id_len;
- memset(myMsgPtr->reply_app_id, 0, 100);
- memcpy(myMsgPtr->reply_app_id, response_struct->reply_app_id, 100);
- if (buffer)
- {
- peer_buff_ptr = (peer_buff_struct*) construct_peer_buff(buffer_size, 0, 0, TD_CTRL);
- peer_pdu = (U8*) get_pdu_ptr(peer_buff_ptr, &peer_pdu_len);
- if (peer_pdu)
- {
- memcpy(peer_pdu, buffer, buffer_size);
- }
- }
- ilm_ptr = allocate_ilm(MOD_WAP);
- ilm_ptr->src_mod_id = MOD_WAP;
- ilm_ptr->sap_id = J2ME_WAP_SAP;
- ilm_ptr->dest_mod_id = MOD_JASYN;
- ilm_ptr->local_para_ptr = (local_para_struct*) myMsgPtr;
- ilm_ptr->msg_id = MSG_ID_WAP_MMC_RECV_APPMMS_RSP;
- ilm_ptr->peer_buff_ptr = (peer_buff_struct*) peer_buff_ptr;
- msg_send_ext_queue(ilm_ptr);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_read_appmms_msg_part_req
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_READ_APPMMS_MSG_PART_REQ primitive to Java
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_read_appmms_msg_part_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_read_appmms_msg_part_rsp_struct response;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (JSR_CNTX->state != JSR_STATE_RECV_MSG_BDY)
- {
- memset(&response, 0, sizeof(wap_mmc_read_appmms_msg_part_rsp_struct));
- response.result = JSR_RESULT_ACCESS_DENY;
- mmi_jsr_read_appmms_msg_part_rsp(&response);
- }
- else
- {
- if (mmi_jmms_jsr_generate_recv_msg_body_part(
- JSR_CNTX->msgId,
- &(JSR_CNTX->curr_media_obj_no),
- (JSR_CNTX->total_media_obj_no),
- &response))
- {
- mmi_jsr_read_appmms_msg_part_rsp(&response);
- JSR_CNTX->curr_media_obj_no = JSR_CNTX->curr_media_obj_no + 1;
- if (JSR_CNTX->curr_media_obj_no > JSR_CNTX->total_media_obj_no)
- {
- mmi_jsr_remove_msgId_from_appId_list(JSR_CNTX->msgId);
- mmi_jmms_jsr_delete_msg(JSR_CNTX->msgId);
- JsrCleanContext();
- mmi_jmms_update_folder();
- }
- }
- else
- {
- memset(&response, 0, sizeof(wap_mmc_read_appmms_msg_part_rsp_struct));
- response.result = JSR_RESULT_INSUFFICIENT_PERSISTENT_STORAGE;
- mmi_jsr_read_appmms_msg_part_rsp(&response);
- JsrCleanContext();
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_read_appmms_msg_part_rsp
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_READ_APPMMS_MSG_PART_RSP primitive to Java
- * PARAMETERS
- * response [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_read_appmms_msg_part_rsp(wap_mmc_read_appmms_msg_part_rsp_struct *response)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_read_appmms_msg_part_rsp_struct *myMsgPtr;
- ilm_struct *ilm_ptr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr = (wap_mmc_read_appmms_msg_part_rsp_struct*)
- OslConstructDataPtr(sizeof(wap_mmc_read_appmms_msg_part_rsp_struct));
- myMsgPtr->result = response->result;
- myMsgPtr->encoding_scheme = response->encoding_scheme;
- /* Content-Type */
- myMsgPtr->content_type_value = response->content_type_value;
- myMsgPtr->content_type_len = response->content_type_len;
- memcpy(myMsgPtr->content_type, response->content_type, 100);
- /* Content-Id */
- myMsgPtr->content_id_len = response->content_id_len;
- memcpy(myMsgPtr->content_id, response->content_id, 100);
- /* Content-Location */
- myMsgPtr->content_location_len = response->content_location_len;
- memcpy(myMsgPtr->content_location, response->content_location, 100);
- /* Media object filepath */
- myMsgPtr->filepath_len = response->filepath_len;
- memcpy(myMsgPtr->filepath, response->filepath, 200);
- ilm_ptr = allocate_ilm(MOD_WAP);
- ilm_ptr->src_mod_id = MOD_WAP;
- ilm_ptr->sap_id = J2ME_WAP_SAP;
- ilm_ptr->dest_mod_id = MOD_JASYN;
- ilm_ptr->local_para_ptr = (local_para_struct*) myMsgPtr;
- ilm_ptr->msg_id = MSG_ID_WAP_MMC_READ_APPMMS_MSG_PART_RSP;
- ilm_ptr->peer_buff_ptr = NULL;
- msg_send_ext_queue(ilm_ptr);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_cfg_appmms_appid_req
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_CFG_APPMMS_APPID_REQ primitive to Java
- * PARAMETERS
- * msg [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_cfg_appmms_appid_req(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_cfg_appmms_appid_req_struct *Message;
- JsrResult result;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Message = (wap_mmc_cfg_appmms_appid_req_struct*) msg;
- result = mmi_jsr_cfg_app_id(Message->app_id, Message->app_id_len, Message->op);
- mmi_jsr_cfg_appmms_appid_rsp(result);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_cfg_appmms_appid_rsp
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_CFG_APPMMS_APPID_RSP primitive to Java
- * PARAMETERS
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_cfg_appmms_appid_rsp(JsrResult result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_cfg_appmms_appid_rsp_struct *myMsgPtr;
- ilm_struct *ilm_ptr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr = (wap_mmc_cfg_appmms_appid_rsp_struct*) OslConstructDataPtr(sizeof(wap_mmc_cfg_appmms_appid_rsp_struct));
- myMsgPtr->result = (U8) result;
- ilm_ptr = allocate_ilm(MOD_WAP);
- ilm_ptr->src_mod_id = MOD_WAP;
- ilm_ptr->sap_id = J2ME_WAP_SAP;
- ilm_ptr->dest_mod_id = MOD_JASYN;
- ilm_ptr->local_para_ptr = (local_para_struct*) myMsgPtr;
- ilm_ptr->msg_id = MSG_ID_WAP_MMC_CFG_APPMMS_APPID_RSP;
- ilm_ptr->peer_buff_ptr = NULL;
- msg_send_ext_queue(ilm_ptr);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_cfg_app_id
- * DESCRIPTION
- * Register/Deregister the Java application
- * PARAMETERS
- * app_id [?]
- * app_id_length [IN]
- * is_remove [IN]
- * RETURNS
- * void
- *****************************************************************************/
- JsrResult mmi_jsr_cfg_app_id(U8 *app_id, U8 app_id_length, U8 is_remove)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((app_id == NULL) || (app_id_length == 0))
- {
- return JSR_RESULT_INVALID_PARAMETER;
- }
- if (is_remove == TRUE)
- {
- for (i = 0; i < JSR_MAX_APP_ID_NUM; i++)
- {
- if ((jsr_appid_db[i])
- && (jsr_appid_db[i]->appId) && (strcmp((S8*) jsr_appid_db[i]->appId, (S8*) app_id) == 0))
- {
- jdd_MemFree(jsr_appid_db[i]->appId);
- jdd_MemFree(jsr_appid_db[i]);
- jsr_appid_db[i] = NULL;
- return JSR_RESULT_OK;
- }
- }
- return JSR_RESULT_ERROR_APPID_NOT_FOUND;
- }
- else
- {
- S32 empty_slot = -1;
- for (i = 0; i < JSR_MAX_APP_ID_NUM; i++)
- {
- if (jsr_appid_db[i] == NULL)
- {
- empty_slot = i;
- break;
- }
- else
- {
- if ((jsr_appid_db[i]->appId) && (strcmp((S8*) jsr_appid_db[i]->appId, (S8*) app_id) == 0))
- {
- return JSR_RESULT_ERROR_APPID_EXIST;
- }
- }
- }
- if (empty_slot < 0)
- {
- return JSR_RESULT_ERROR_APPID_FULL;
- }
- else
- {
- jsr_appid_db[i] = (jsr_appid_info_struct*) jdd_MemAlloc(1, sizeof(jsr_appid_info_struct));
- jsr_appid_db[i]->appId = (S8*) jdd_MemAlloc(1, app_id_length + 1);
- memcpy(jsr_appid_db[i]->appId, app_id, app_id_length);
- return JSR_RESULT_OK;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_check_appmms_coming_req
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_CHECK_APPMMS_COMING_REQ primitive to Java
- * PARAMETERS
- * msg [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_check_appmms_coming_req(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_check_appmms_coming_req_struct *Message;
- MMI_BOOL result = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Message = (wap_mmc_check_appmms_coming_req_struct*) msg;
- result = mmi_jsr_check_appid_msgs(Message->app_id, Message->app_id_len, (U8) Message->only_new);
- mmi_jsr_check_appmms_coming_rsp(result);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_check_appmms_coming_rsp
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_CHECK_APPMMS_COMING_RSP primitive to Java
- * PARAMETERS
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_check_appmms_coming_rsp(MMI_BOOL result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_check_appmms_coming_rsp_struct *myMsgPtr;
- ilm_struct *ilm_ptr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr = (wap_mmc_check_appmms_coming_rsp_struct*)
- OslConstructDataPtr(sizeof(wap_mmc_check_appmms_coming_rsp_struct));
- myMsgPtr->result = (result) ? (1) : (0);
- ilm_ptr = allocate_ilm(MOD_WAP);
- ilm_ptr->src_mod_id = MOD_WAP;
- ilm_ptr->sap_id = J2ME_WAP_SAP;
- ilm_ptr->dest_mod_id = MOD_JASYN;
- ilm_ptr->local_para_ptr = (local_para_struct*) myMsgPtr;
- ilm_ptr->msg_id = MSG_ID_WAP_MMC_CHECK_APPMMS_COMING_RSP;
- ilm_ptr->peer_buff_ptr = NULL;
- msg_send_ext_queue(ilm_ptr);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_check_appid_msgs
- * DESCRIPTION
- * Checks the application object list for specific application
- * PARAMETERS
- * app_id [?]
- * app_id_length [IN]
- * is_new [IN]
- * RETURNS
- * void
- *****************************************************************************/
- MMI_BOOL mmi_jsr_check_appid_msgs(U8 *app_id, U8 app_id_length, U8 is_new)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_jsr_appid_object_list == NULL)
- {
- mmi_jsr_read_object_list_from_file();
- }
- if (g_jsr_appid_object_list)
- {
- jsr_appid_msgid_list *appid_list = g_jsr_appid_object_list;
- while (appid_list)
- {
- if ((appid_list->appId) && (strcmp((S8*) appid_list->appId, (S8*) app_id) == 0))
- {
- jsr_msg_info *msg_list = appid_list->msgs;
- while (msg_list)
- {
- if (msg_list->is_checked == FALSE)
- {
- msg_list->is_checked = TRUE;
- mmi_jsr_write_object_list_to_file();
- return TRUE;
- }
- else
- {
- if (is_new == FALSE)
- {
- return TRUE;
- }
- }
- msg_list = msg_list->next;
- }
- return FALSE;
- }
- appid_list = appid_list->next;
- }
- }
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_abort_appmms_req
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_ABORT_APPMMS_REQ primitive to Java
- * PARAMETERS
- * msg [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_abort_appmms_req(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 *file_name_p = NULL;
- U32 file_path_len = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((JSR_CNTX->op != JSR_OP_SEND_MSG) && (JSR_CNTX->op != JSR_OP_RECV_MSG))
- {
- mmi_jsr_abort_appmms_rsp(JSR_RESULT_ACCESS_DENY);
- }
- else
- {
- if (JSR_CNTX->op == JSR_OP_SEND_MSG)
- {
- if ((JSR_CNTX->state == JSR_STATE_PROCESS_SEND_MSG_HDR)
- || (JSR_CNTX->state == JSR_STATE_PROCESS_SEND_MSG_BDY))
- {
- file_path_len = (strlen((S8*) (JSR_MEDIA_OBJECT_FILE)) + 1) * ENCODING_LENGTH;
- file_name_p = jdd_MemAlloc(sizeof(S8), file_path_len);
- AnsiiToUnicodeString((S8*) file_name_p, (S8*) (JSR_MEDIA_OBJECT_FILE));
- mmi_jsr_abort_appmms_rsp(JSR_RESULT_OK);
- /* JMMS function call */
- FS_Delete((U16*) file_name_p);
- JsrCleanContext();
- }
- else
- {
- /* JMMS function call */
- mmi_jmms_jsr_cancel_send_mms(JSR_CNTX->msgId, mmi_jsr_abort_appmms_rsp);
- }
- }
- else
- {
- file_path_len = (strlen((S8*) (JSR_MEDIA_OBJECT_FILE)) + 1) * ENCODING_LENGTH;
- file_name_p = jdd_MemAlloc(sizeof(S8), file_path_len);
- AnsiiToUnicodeString((S8*) file_name_p, (S8*) (JSR_MEDIA_OBJECT_FILE));
- /* Aborting receiving of Java MMS by Java app. */
- mmi_jsr_abort_appmms_rsp(JSR_RESULT_OK);
- FS_Delete((U16*) file_name_p);
- JsrCleanContext();
- }
- if (file_name_p != NULL)
- {
- jdd_MemFree(file_name_p);
- file_name_p = NULL;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_abort_appmms_rsp
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_ABORT_APPMMS_RSP primitive to Java
- * PARAMETERS
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_abort_appmms_rsp(JsrResult result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_abort_appmms_rsp_struct *myMsgPtr;
- ilm_struct *ilm_ptr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr = (wap_mmc_abort_appmms_rsp_struct*) OslConstructDataPtr(sizeof(wap_mmc_abort_appmms_rsp_struct));
- myMsgPtr->result = (U8) result;
- ilm_ptr = allocate_ilm(MOD_WAP);
- ilm_ptr->src_mod_id = MOD_WAP;
- ilm_ptr->sap_id = J2ME_WAP_SAP;
- ilm_ptr->dest_mod_id = MOD_JASYN;
- ilm_ptr->local_para_ptr = (local_para_struct*) myMsgPtr;
- ilm_ptr->msg_id = MSG_ID_WAP_MMC_ABORT_APPMMS_RSP;
- ilm_ptr->peer_buff_ptr = NULL;
- msg_send_ext_queue(ilm_ptr);
- }
- /* JAVA PROFILE SETTINGS API */
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_get_mms_profile_req
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_GET_MMS_PROF_REQ primitive to Java
- * PARAMETERS
- * msg [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_get_mms_profile_req(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_get_mms_prof_req_struct *Message;
- U8 result = 2; /* invalid prof id. */
- U8 value_length = 0;
- U8 *value = NULL;
- U8 *temp = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Message = (wap_mmc_get_mms_prof_req_struct*) msg;
- switch (Message->access_id)
- {
- case JSR_WAP_MMS_PROF_MMSC_ADDRESS:
- {
- /* U8 mms_profile_id; */
- value = (U8*) jdd_MemAlloc(1, 256);
- #if defined(MMS_SUPPORT)/*dilip*/
- temp = mmi_ph_mms_get_activated_profile_mmsc_url();
- if (NULL == temp)
- {
- result = 1; /* MMS not ready yet. */
- break;
- }
- #endif
- value_length = strlen((S8*) temp) + 1;
- if (value_length > 256)
- {
- ASSERT(0); /* memory corruption */
- }
- memcpy(value, temp, value_length);
- result = 0;
- break;
- }
- }
- mmi_jsr_get_mms_profile_rsp(result, value, value_length);
- if (NULL != value)
- {
- jdd_MemFree(value);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_get_mms_profile_rsp
- * DESCRIPTION
- * Create a MSG_ID_WAP_MMC_GET_MMS_PROF_RSP primitive to Java
- * PARAMETERS
- * result [IN]
- * value [?]
- * value_length [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_get_mms_profile_rsp(U8 result, U8 *value, U8 value_length)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmc_get_mms_prof_rsp_struct *myMsgPtr = NULL;
- ilm_struct *ilm_ptr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr = (wap_mmc_get_mms_prof_rsp_struct*) OslConstructDataPtr(sizeof(wap_mmc_get_mms_prof_rsp_struct));
- myMsgPtr->result = result;
- myMsgPtr->value_len = value_length;
- if (value_length > 0 && value != NULL)
- {
- memcpy(myMsgPtr->value, value, value_length);
- }
- ilm_ptr = allocate_ilm(MOD_WAP);
- ilm_ptr->src_mod_id = MOD_WAP;
- ilm_ptr->sap_id = J2ME_MMI_SAP;
- ilm_ptr->dest_mod_id = MOD_J2ME;
- ilm_ptr->local_para_ptr = (local_para_struct*) myMsgPtr;
- ilm_ptr->msg_id = MSG_ID_WAP_MMC_GET_MMS_PROF_RSP;
- ilm_ptr->peer_buff_ptr = NULL;
- msg_send_ext_queue(ilm_ptr);
- }
- /* JSR INTERNAL APIs */
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_read_object_list_from_file
- * DESCRIPTION
- * Read the application object list information from a file.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_read_object_list_from_file(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 filename[100];
- int filehandle = -1;
- S8 *buff;
- U32 buf_size = 512;
- U32 line_length;
- S32 ret;
- MMI_BOOL update_file = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- AnsiiToUnicodeString((S8*) filename, (S8*) (JSR_APPID_LIST_FILE));
- filehandle = FS_Open((U16*) (filename), FS_READ_ONLY);
- if (filehandle < 0)
- {
- return;
- }
- buff = (S8*) jdd_MemAlloc(1, buf_size);
- while (1)
- {
- S8 *appid_string = NULL;
- jsr_msg_info *msg_list = NULL;
- U32 step = 1;
- for (step = 1; step < 4; step++)
- {
- /* applib_file_read_line(filehandle, buff, buf_size, &line_length, &ret); */
- mmi_jsr_read_line_from_file(filehandle, buff, buf_size, &line_length, &ret);
- if ((ret == 0) && (line_length == 0))
- {
- FS_Close(filehandle);
- jdd_MemFree(buff);
- if (update_file == TRUE)
- {
- mmi_jsr_write_object_list_to_file();
- }
- return;
- }
- else if (ret < 0)
- {
- FS_Close(filehandle);
- jdd_MemFree(buff);
- /* File format corrupted, so remove all the appid info. */
- mmi_jsr_remove_appid_info_from_list_recursive(&g_jsr_appid_object_list);
- return;
- }
- ASSERT(line_length > 2);
- /* replace 'r''n' with ' '' ' */
- *(buff + line_length - 1) = ' ';
- *(buff + line_length - 2) = ' ';
- /* Read appid from file */
- if (step == 1)
- {
- appid_string = (S8*) jdd_MemAlloc(1, (strlen((char*)buff) + 1));
- ASSERT(appid_string);
- strcpy((S8*) appid_string, (S8*) buff);
- }
- /* Read msgid and isChecked string */
- else if (step == 2)
- {
- S8 *text = buff;
- S8 *colon = NULL;
- S8 *next_token = NULL;
- U32 msgId;
- U8 isChecked;
- while (text)
- {
- next_token = (S8*) strchr((char*)text, ',');
- if (next_token != NULL)
- {
- *(next_token++) = ' ';
- }
- colon = (S8*) strchr((char*)text, ':');
- ASSERT(colon);
- *(colon++) = ' ';
- msgId = atoi((char*)text);
- isChecked = atoi((char*)colon);
- if (mmi_jmms_check_msg_id(msgId) == TRUE)
- {
- mmi_jsr_insert_msg_info_to_list(&msg_list, msgId, isChecked);
- }
- else
- {
- update_file = TRUE;
- }
- text = next_token;
- }
- }
- /* 'r' and 'n' */
- else if (step == 3)
- {
- if (msg_list != NULL)
- {
- mmi_jsr_insert_appid_info_to_list(&g_jsr_appid_object_list, appid_string, msg_list);
- }
- else
- {
- if (appid_string)
- {
- jdd_MemFree(appid_string);
- }
- }
- }
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_write_object_list_to_file
- * DESCRIPTION
- * Write the application object list information to file.
- * PARAMETERS
- * void
- * RETURNS
- * MMI_BOOL result
- *****************************************************************************/
- MMI_BOOL mmi_jsr_write_object_list_to_file(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 filename[100];
- S8 orig_file[100];
- S8 *buff = NULL;
- U32 buf_size = 0;
- U32 filesize = 0;
- U32 datalen = 0;
- int filehandle = -1;
- U32 written = 0;
- S32 result = -1;
- jsr_appid_msgid_list *appid_list;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_jsr_appid_object_list == NULL)
- {
- return FALSE;
- }
- filesize = mmi_jsr_get_current_size_of_object_list(g_jsr_appid_object_list, &buf_size);
- ASSERT(filesize);
- AnsiiToUnicodeString((S8*) orig_file, (S8*) (JSR_APPID_LIST_FILE));
- AnsiiToUnicodeString((S8*) filename, (S8*) (JSR_APPID_LIST_FILE_TMP));
- FS_Delete((U16*) filename);
- filehandle = FS_Open((U16*) filename, FS_CREATE_ALWAYS | FS_READ_WRITE);
- if (filehandle < 0)
- {
- return FALSE;
- }
- buff = (S8*) jdd_MemAlloc(sizeof(S8), buf_size + 1);
- ASSERT(buff);
- appid_list = g_jsr_appid_object_list;
- while (appid_list)
- {
- ASSERT(appid_list->appId);
- {
- datalen = 0;
- sprintf((char*)buff, "%srn", appid_list->appId);
- datalen = strlen((char*)appid_list->appId) + 2;
- result = FS_Write(filehandle, buff, datalen, &written);
- if (result < 0)
- {
- FS_Close(filehandle);
- jdd_MemFree(buff);
- return FALSE;
- }
- }
- ASSERT(appid_list->msgs);
- {
- jsr_msg_info *msg_list = appid_list->msgs;
- datalen = 0;
- while (msg_list)
- {
- sprintf((char*)(buff + datalen), "%d:%1d", msg_list->msgId, msg_list->is_checked);
- datalen += mmi_jsr_get_digit_of_integer(msg_list->msgId) + 2;
- if (msg_list->next)
- {
- sprintf((char*)(buff + datalen), ",");
- datalen += 1;
- }
- msg_list = msg_list->next;
- }
- sprintf((char*)(buff + datalen), "rn*rn");
- datalen += 5;
- ASSERT(buf_size >= datalen);
- result = FS_Write(filehandle, buff, datalen, &written);
- if (result < 0)
- {
- FS_Close(filehandle);
- jdd_MemFree(buff);
- return FALSE;
- }
- }
- appid_list = appid_list->next;
- }
- FS_Close(filehandle);
- jdd_MemFree(buff);
- FS_Delete((U16*) orig_file);
- FS_Rename((U16*) filename, (U16*) orig_file);
- return TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_insert_appid_info_to_list
- * DESCRIPTION
- * Insert the application info to application object list.
- * PARAMETERS
- * appid_object_list [IN]
- * string [?]
- * msg_list [?]
- * RETURNS
- * MMI_BOOL result
- *****************************************************************************/
- MMI_BOOL mmi_jsr_insert_appid_info_to_list(
- jsr_appid_msgid_list **appid_object_list,
- S8 *string,
- jsr_msg_info *msg_list)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- jsr_appid_msgid_list *node = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (appid_object_list == NULL)
- {
- return FALSE;
- }
- node = (jsr_appid_msgid_list*) jdd_MemAlloc(1, sizeof(jsr_appid_msgid_list));
- ASSERT(node);
- node->appId = (S8*) jdd_MemAlloc(1, (strlen((S8*) string) + 1));
- ASSERT(node->appId);
- strcpy((S8*) node->appId, (S8*) string);
- node->msgs = msg_list;
- if (*appid_object_list == NULL)
- {
- node->prev = node;
- *appid_object_list = node;
- return TRUE;
- }
- else
- {
- jsr_appid_msgid_list *tempnode = *appid_object_list;
- while (tempnode->next)
- {
- tempnode = tempnode->next;
- }
- tempnode->next = node;
- node->prev = tempnode;
- return TRUE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_remove_appid_info_from_list
- * DESCRIPTION
- * Remove the application info from application object list.
- * PARAMETERS
- * list [IN]
- * appId [?]
- * RETURNS
- * MMI_BOOL result
- *****************************************************************************/
- MMI_BOOL mmi_jsr_remove_appid_info_from_list(jsr_appid_msgid_list **list, S8 *appId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- jsr_appid_msgid_list *appid_list;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((list == NULL) || (*(list) == NULL))
- {
- return FALSE;
- }
- appid_list = *list;
- while (appid_list)
- {
- if ((appid_list->appId) && (appId) && (strcmp((S8*) appid_list->appId, (S8*) appId) == 0))
- {
- if (appid_list == *list)
- {
- *list = appid_list->next;
- if (appid_list->next)
- {
- appid_list->next->prev = appid_list->next;
- }
- }
- else
- {
- appid_list->prev->next = appid_list->next;
- if (appid_list->next)
- {
- appid_list->next->prev = appid_list->prev;
- }
- }
- jdd_MemFree(appid_list->appId);
- mmi_jsr_remove_msg_info_from_list_recursive(&(appid_list->msgs));
- jdd_MemFree(appid_list);
- return TRUE;
- }
- appid_list = appid_list->next;
- }
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_remove_appid_info_from_list_recursive
- * DESCRIPTION
- * Remove the appid info of all the messages in the application object list.
- * PARAMETERS
- * list [IN]
- * RETURNS
- * MMI_BOOL result
- *****************************************************************************/
- MMI_BOOL mmi_jsr_remove_appid_info_from_list_recursive(jsr_appid_msgid_list **list)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- jsr_appid_msgid_list *appid_list;
- jsr_appid_msgid_list *appid_list_temp = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((list == NULL) || (*list == NULL))
- {
- return FALSE;
- }
- appid_list = *list;
- while (appid_list)
- {
- appid_list_temp = appid_list->next;
- jdd_MemFree(appid_list->appId);
- mmi_jsr_remove_msg_info_from_list_recursive(&(appid_list->msgs));
- jdd_MemFree(appid_list);
- appid_list = appid_list_temp;
- }
- *list = NULL;
- return TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_insert_msg_info_to_list
- * DESCRIPTION
- * Insert the message info to application object list.
- * PARAMETERS
- * msg_list [IN]
- * msgId [IN]
- * ischecked [IN]
- * RETURNS
- * MMI_BOOL result
- *****************************************************************************/
- MMI_BOOL mmi_jsr_insert_msg_info_to_list(jsr_msg_info **msg_list, U32 msgId, U8 ischecked)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- jsr_msg_info *node = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (msg_list == NULL)
- {
- return FALSE;
- }
- node = (jsr_msg_info*) jdd_MemAlloc(1, sizeof(jsr_msg_info));
- ASSERT(node);
- node->msgId = msgId;
- node->is_checked = ischecked;
- if (*msg_list == NULL)
- {
- node->prev = node;
- *msg_list = node;
- return TRUE;
- }
- else
- {
- jsr_msg_info *tempnode = *msg_list;
- while (tempnode->next)
- {
- tempnode = tempnode->next;
- }
- tempnode->next = node;
- node->prev = tempnode;
- return TRUE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_remove_msg_info_from_list
- * DESCRIPTION
- * Remove the message info from application object list.
- * PARAMETERS
- * list [IN]
- * msgId [IN]
- * RETURNS
- * MMI_BOOL result
- *****************************************************************************/
- MMI_BOOL mmi_jsr_remove_msg_info_from_list(jsr_msg_info **list, U32 msgId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- jsr_msg_info *msg_list;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((list == NULL) || (*(list) == NULL))
- {
- return FALSE;
- }
- msg_list = *list;
- while (msg_list)
- {
- if (msg_list->msgId == msgId)
- {
- if (msg_list == *list)
- {
- *list = msg_list->next;
- if (msg_list->next)
- {
- msg_list->next->prev = msg_list->next;
- }
- }
- else
- {
- msg_list->prev->next = msg_list->next;
- if (msg_list->next)
- {
- msg_list->next->prev = msg_list->prev;
- }
- }
- jdd_MemFree(msg_list);
- return TRUE;
- }
- msg_list = msg_list->next;
- }
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_remove_msg_info_from_list_recursive
- * DESCRIPTION
- * Remove the message info of all the messages in the message list.
- * PARAMETERS
- * list [IN]
- * RETURNS
- * MMI_BOOL result
- *****************************************************************************/
- MMI_BOOL mmi_jsr_remove_msg_info_from_list_recursive(jsr_msg_info **list)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- jsr_msg_info *msg_list;
- jsr_msg_info *msg_list_temp = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((list == NULL) || (*(list) == NULL))
- {
- return FALSE;
- }
- msg_list = *list;
- while (msg_list)
- {
- msg_list_temp = msg_list->next;
- jdd_MemFree(msg_list);
- msg_list = msg_list_temp;
- }
- *list = NULL;
- return TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_get_digit_of_integer
- * DESCRIPTION
- * Calculates the number of digits in an integer.
- * PARAMETERS
- * msgId [IN]
- * RETURNS
- * U32 length
- *****************************************************************************/
- U32 mmi_jsr_get_digit_of_integer(U32 msgId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 buff[11];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- sprintf((S8*) buff, "%d", msgId);
- return strlen((S8*) buff);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_get_current_size_of_object_list
- * DESCRIPTION
- * Calculates the current size of application object list.
- * PARAMETERS
- * appid_object_list [?]
- * max_chrs_in_line [?]
- * RETURNS
- * U32 size
- *****************************************************************************/
- U32 mmi_jsr_get_current_size_of_object_list(jsr_appid_msgid_list *appid_object_list, U32 *max_chrs_in_line)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 sum = 0;
- U32 chrs = 0;
- U32 max_chrs = 0;
- jsr_appid_msgid_list *appid_list;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *(max_chrs_in_line) = 0;
- if (appid_object_list == NULL)
- {
- return 0;
- }
- appid_list = appid_object_list;
- while (appid_list)
- {
- if (appid_list->appId)
- {
- chrs = strlen((S8*) appid_list->appId) + 2; /* appid string+rn */
- sum += chrs;
- if (chrs > max_chrs)
- {
- max_chrs = chrs;
- }
- }
- chrs = 0;
- if (appid_list->msgs)
- {
- jsr_msg_info *msg_list = appid_list->msgs;
- while (msg_list)
- {
- /* msgid:isChecked */
- chrs += (mmi_jsr_get_digit_of_integer(msg_list->msgId) + 2);
- if (msg_list->next)
- {
- chrs += 1;
- }
- msg_list = msg_list->next;
- }
- chrs += 5; /* rn*rn */
- sum += chrs;
- if (chrs > max_chrs)
- {
- max_chrs = chrs;
- }
- }
- appid_list = appid_list->next;
- }
- *max_chrs_in_line = max_chrs;
- return sum;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_read_line_from_file
- * DESCRIPTION
- * Reads a line from a file and store it in buffer.
- * PARAMETERS
- * filehandle [IN]
- * buffer [?]
- * buf_length [IN]
- * line_length [?]
- * ret [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jsr_read_line_from_file(U32 filehandle, S8 *buffer, U32 buf_length, U32 *line_length, S32 *ret)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 *pos = buffer;
- U32 rd_no = 0;
- U32 count = 0;
- MMI_BOOL CR = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(buffer, 0, buf_length);
- *line_length = 0;
- while (buf_length)
- {
- *ret = FS_Read(filehandle, pos, 1, &rd_no);
- if (*ret < 0)
- {
- *line_length = count;
- return;
- }
- else if (rd_no != 1)
- {
- *line_length = count;
- return;
- }
- else
- {
- count++;
- if (*pos == 'r')
- {
- CR = TRUE;
- }
- else if (*pos == 'n')
- {
- if (CR == TRUE)
- {
- *line_length = count;
- return;
- }
- else
- {
- CR = FALSE;
- }
- }
- else
- {
- CR = FALSE;
- }
- }
- buf_length--;
- pos++;
- }
- *ret = -1;
- *line_length = rd_no;
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_check_appId
- * DESCRIPTION
- * Checks whether the application is registered or not.
- * PARAMETERS
- * appId [?]
- * RETURNS
- * MMI_BOOL result
- *****************************************************************************/
- MMI_BOOL mmi_jsr_check_appId(S8 *appId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < JSR_MAX_APP_ID_NUM; i++)
- {
- if (jsr_appid_db[i] && jsr_appid_db[i]->appId && (strcmp((S8*) jsr_appid_db[i]->appId, (S8*) appId) == 0))
- {
- return TRUE;
- }
- }
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jsr_is_java_msg
- * DESCRIPTION
- * Checks whether the message is a Java message or not.
- * PARAMETERS
- * msgId [IN]
- * RETURNS
- * MMI_BOOL result
- *****************************************************************************/
- MMI_BOOL mmi_jsr_is_java_msg(U32 msgId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_jsr_appid_object_list == NULL)
- {
- mmi_jsr_read_object_list_from_file();
- }
- if (g_jsr_appid_object_list)
- {
- jsr_appid_msgid_list *appid_list = g_jsr_appid_object_list;
- while (appid_list)
- {
- if (appid_list->msgs)
- {
- jsr_msg_info *msg_list = appid_list->msgs;
- while (msg_list)
- {
- if (msg_list->msgId == msgId)
- {
- return TRUE;
- }
- msg_list = msg_list->next;
- }
- }
- appid_list = appid_list->next;
- }
- }
- return FALSE;
- }
- #endif /* (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT)) */ // #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
- #endif /* _MMI_JSR_C */