SMSUtil.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:225k
- return TRUE;
- }
- while (dataindex != MMI_FRM_SMS_INVALID_NUM)
- {
- /* if mmi_frm_sms_content is full */
- if (dataindex == MMI_FRM_SMS_MSG_CONTENT_NUM)
- {
- return TRUE;
- }
- if (mmi_frm_sms_content[dataindex].segment != (i + 1))
- {
- return FALSE;
- }
- dataindex = mmi_frm_sms_content[dataindex].nextindex;
- i++;
- }
- if (i == total_seg)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_awaited_complete_msg
- * DESCRIPTION
- * Check awaited message completeness , excluding mmi_frm_sms_content full
- * PARAMETERS
- * index [IN] Index
- * RETURNS
- * void
- *****************************************************************************/
- U8 mmi_frm_sms_check_awaited_complete_msg(U8 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- mmi_frm_sms_concat_struct *concat_info = (mmi_frm_sms_concat_struct*) & (mmi_frm_sms_awaited[index].concat_info);
- U8 total_seg = ((concat_info->total_seg - concat_info->seg + 1) > g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) ?
- g_frm_sms_cntx.mmi_frm_sms_msg_seg_size : (concat_info->total_seg - concat_info->seg + 1);
- U8 dataindex = mmi_frm_sms_awaited[index].msg_data[0];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (dataindex != MMI_FRM_SMS_INVALID_NUM)
- {
- if (mmi_frm_sms_content[dataindex].segment != (i + 1))
- {
- return FALSE;
- }
- dataindex = mmi_frm_sms_content[dataindex].nextindex;
- i++;
- }
- if (i == total_seg)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_awaited
- * DESCRIPTION
- * Check awaited entry, see if any match
- * PARAMETERS
- * void
- * RETURNS
- * index
- *****************************************************************************/
- U8 mmi_frm_sms_check_awaited(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* find the entry in the awaited list that matches the last entry in the mmi_frm_sms_awaited */
- U8 i = 0;
- mmi_frm_sms_deliver_msg_struct *datainfo = &mmi_frm_sms_awaited[MMI_FRM_SMS_ACTION_SIZE];
- mmi_frm_sms_concat_struct *concatinfo =
- ((mmi_frm_sms_concat_struct*) & (mmi_frm_sms_awaited[MMI_FRM_SMS_ACTION_SIZE].concat_info));
- U8 thisseg = mmi_frm_sms_content[MMI_FRM_SMS_MSG_CONTENT_NUM].segment;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (((concatinfo->total_seg % g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) == 1) &&
- (concatinfo->total_seg == concatinfo->seg))
- {
- return MMI_FRM_SMS_ACTION_SIZE;
- }
- while (i < MMI_FRM_SMS_ACTION_SIZE)
- {
- mmi_frm_sms_deliver_msg_struct *data = &mmi_frm_sms_awaited[i];
- mmi_frm_sms_concat_struct *concat = ((mmi_frm_sms_concat_struct*) & (mmi_frm_sms_awaited[i].concat_info));
- if ((data->display_type == datainfo->display_type) && (concat->total_seg == concatinfo->total_seg) &&
- (concat->seg == concatinfo->seg) && (concat->ref == concatinfo->ref) &&
- ((ComparePhoneNum((PU8) data->addr_number.number, (PU8) datainfo->addr_number.number)) == TRUE))
- {
- U8 j = mmi_frm_sms_awaited[i].msg_data[0];
- while (j != MMI_FRM_SMS_INVALID_NUM)
- {
- /* find exactly the same entry in the awaited list as the last entry */
- if (mmi_frm_sms_content[j].segment == thisseg)
- {
- break;
- }
- /* thisseg is smaller than the current smallest segment number of this message */
- else if (mmi_frm_sms_content[j].segment > thisseg)
- {
- #ifdef __MMI_MESSAGES_COPY__
- if (mmi_frm_sms_awaited[i].storageType != MMI_FRM_SMS_PREFER_STORAGE)
- {
- mmi_frm_sms_awaited[i].storageType = datainfo->storageType;
- }
- #endif /* __MMI_MESSAGES_COPY__ */
- /* if add awaited segment fail, it will popup arbitrarily, so leave the mmi_frm_sms_indicate_sms to free memory */
- if (mmi_frm_sms_add_awaited_segment(i, datainfo->index, thisseg, datainfo) == TRUE)
- {
- mmi_frm_sms_free_new_sms();
- }
- return i;
- }
- /* thisseg is greater than the current largest segment number of this message */
- else if (mmi_frm_sms_content[j].segment < thisseg &&
- mmi_frm_sms_content[j].nextindex == MMI_FRM_SMS_INVALID_NUM)
- {
- #ifdef __MMI_MESSAGES_COPY__
- if (mmi_frm_sms_awaited[i].storageType != MMI_FRM_SMS_PREFER_STORAGE)
- {
- mmi_frm_sms_awaited[i].storageType = datainfo->storageType;
- }
- #endif /* __MMI_MESSAGES_COPY__ */
- /* if add awaited segment fail, it will popup arbitrarily, so leave the mmi_frm_sms_indicate_sms to free memory */
- if (mmi_frm_sms_add_awaited_segment(i, datainfo->index, thisseg, datainfo) == TRUE)
- {
- mmi_frm_sms_free_new_sms();
- }
- return i;
- }
- j = mmi_frm_sms_content[j].nextindex;
- }
- }
- i++;
- }
- return MMI_FRM_SMS_INVALID_NUM;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_inbox
- * DESCRIPTION
- * Check inbox, see if any match
- * PARAMETERS
- * entry [?] Message entry info
- * thissegment [IN] Segment
- * RETURNS
- * index
- *****************************************************************************/
- U16 mmi_frm_sms_check_inbox(mmi_frm_sms_msgbox_struct *entry, U8 thissegment)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (i < g_frm_sms_cntx.mmi_frm_sms_msg_box_size)
- {
- if (mmi_frm_sms_compare_entry(i, entry, thissegment) == TRUE)
- {
- return i;
- }
- i++;
- }
- return MMI_FRM_SMS_INVALID_INDEX;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_timeout_concatenate_sms
- * DESCRIPTION
- * timeout check concatenate SMS
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_timeout_concatenate_sms(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- U8 awaited_remain = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (i < MMI_FRM_SMS_ACTION_SIZE)
- {
- if (mmi_frm_sms_awaited_counter[i] != MMI_FRM_SMS_INVALID_NUM)
- {
- mmi_frm_sms_awaited_counter[i]++;
- if (mmi_frm_sms_awaited_counter[i] == MMI_FRM_SMS_ACTION_SIZE)
- {
- mmi_frm_sms_awaited_counter[i] = MMI_FRM_SMS_INVALID_NUM;
- mmi_frm_sms_indicate_sms(i);
- }
- else
- {
- awaited_remain = TRUE;
- }
- }
- i++;
- }
- /* timer expires but still some segments are missing in the mmi_frm_sms_awaited */
- if (awaited_remain == TRUE)
- {
- StartTimer(MESSAGES_LMS_RECV_TIMER_ID, MMI_FRM_SMS_LMS_TIME_OUT, mmi_frm_sms_timeout_concatenate_sms);
- }
- else
- {
- mmi_frm_sms_awaited_counting = FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_concatenate_sms
- * DESCRIPTION
- * Check concatenate SMS in awaited and inbox list
- * PARAMETERS
- * index [?] Index
- * RETURNS
- * type
- *****************************************************************************/
- U8 mmi_frm_sms_check_concatenate_sms(U16 *index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_concat_struct *concatinfo =
- (mmi_frm_sms_concat_struct*) & (mmi_frm_sms_awaited[MMI_FRM_SMS_ACTION_SIZE].concat_info);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (((concatinfo->total_seg % g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) == 1) &&
- (concatinfo->total_seg == concatinfo->seg))
- {
- *index = MMI_FRM_SMS_ACTION_SIZE;
- return MMI_FRM_SMS_AWAITS;
- }
- else
- {
- U8 awaited_index = mmi_frm_sms_check_awaited();
- /* the last entry in the mmi_frm_sms_awaited belongs to one of the segments of the entry with index awaited_index in the awaited list */
- if (awaited_index != MMI_FRM_SMS_INVALID_NUM)
- {
- if (mmi_frm_sms_check_awaited_complete(awaited_index) == TRUE)
- {
- mmi_frm_sms_awaited_counter[awaited_index] = MMI_FRM_SMS_INVALID_NUM;
- *index = awaited_index;
- return MMI_FRM_SMS_AWAITS;
- }
- /* not all segments of this message are arrived, restart the counter to keep waiting for other segment's arriving */
- else
- {
- mmi_frm_sms_awaited_counter[awaited_index] = 0;
- *index = awaited_index;
- return MMI_FRM_SMS_NOBOX;
- }
- }
- /* the last entry in the mmi_frm_sms_awaited matches nothing with other entries in the awaited list */
- else if (mmi_frm_sms_list_done)
- {
- U16 inbox_index;
- mmi_frm_sms_msgbox_struct *entry = OslMalloc(sizeof(mmi_frm_sms_msgbox_struct));
- U8 thissegment = mmi_frm_sms_content[MMI_FRM_SMS_MSG_CONTENT_NUM].segment;
- mmi_frm_sms_convert_mt_to_entry(&(mmi_frm_sms_awaited[MMI_FRM_SMS_ACTION_SIZE]), entry);
- inbox_index = mmi_frm_sms_check_inbox(entry, thissegment);
- OslMfree(entry);
- /* the last entry in the mmi_frm_sms_awaited belongs to one of the segments of the entry with index inbox_index in the inbox list */
- if (inbox_index != MMI_FRM_SMS_INVALID_INDEX)
- {
- #ifdef __MMI_UNIFIED_MESSAGE__
- {
- mmi_frm_sms_deliver_msg_struct *data = OslMalloc(sizeof(mmi_frm_sms_deliver_msg_struct));
- /* MMI could only allocate 2K control buffer, so limit the max allocate buffer to 1600 here */
- U16 content_len =
- ((MMI_FRM_SMS_MSG_LEN * g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) < (MMI_FRM_SMS_MSG_LEN * 10)) ?
- (MMI_FRM_SMS_MSG_LEN * g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) : (MMI_FRM_SMS_MSG_LEN * 10);
-
- U8 *content = OslMalloc(content_len);
- U8 withobject;
- U8 new_segment_index = MMI_FRM_SMS_ACTION_SIZE;
- U8 *ucs2_content = NULL;
- U16 ucs2_content_len = 0;
- memset(content, 0x00, content_len);
- withobject = mmi_frm_sms_get_awaited_sms((U8) new_segment_index, data, content);
- ucs2_content_len = ((mmi_msg_get_max_content_size() + 1) * ENCODING_LENGTH);
- ucs2_content = OslMalloc(ucs2_content_len);
- memset(ucs2_content, 0, ucs2_content_len);
-
- if (data->dcs == SMSAL_UCS2_DCS)
- {
- if (pfnUnicodeStrlen((S8*) content))
- {
- pfnUnicodeStrncpy(
- (S8*) ucs2_content,
- (S8*) content,
- mmi_msg_get_max_content_size());
- }
- }
- else
- {
- if (strlen((S8*) content))
- {
- AnsiiNToUnicodeString((S8*) ucs2_content, (S8*) content, (U32) mmi_msg_get_max_content_size());
- }
- }
- if (pfnUnicodeStrlen((S8*) ucs2_content) > 0)
- {
- if (mmi_frm_sms_index_list[mmi_frm_sms_msg_box[inbox_index].startindex].segment == thissegment - 1)
- {
- if (pfnUnicodeStrlen((S8*) mmi_frm_sms_msg_box[inbox_index].content) <
- (mmi_msg_get_max_content_size() - 1))
- {
- /* append content to mmi_frm_sms_msg_box[addindex].content */
- U16 *temp_content;
- U16 temp_content_size = (U16) (mmi_msg_get_max_content_size() + 1) * ENCODING_LENGTH;
-
- temp_content = OslMalloc(temp_content_size);
- memset((S8*) temp_content, 0, temp_content_size);
- pfnUnicodeStrncpy(
- (S8*) temp_content,
- (S8*) mmi_frm_sms_msg_box[inbox_index].content,
- mmi_msg_get_max_content_size());
-
- pfnUnicodeStrncat(
- (S8*) temp_content,
- (S8*) ucs2_content,
- (mmi_msg_get_max_content_size() - pfnUnicodeStrlen((S8*) temp_content)));
-
- mmi_frm_sms_add_content_to_entry(
- (mmi_frm_sms_msgbox_struct*) & mmi_frm_sms_msg_box[inbox_index],
- (U8*) temp_content);
-
- OslMfree(temp_content);
- }
- }
- else if (mmi_frm_sms_index_list[mmi_frm_sms_msg_box[inbox_index].startindex].segment == thissegment + 1)
- {
- /* copy data->content to the beginning of mmi_frm_sms_msg_box[addindex].content */
- U16 *temp_content;
- U16 temp_content_size = (U16) (mmi_msg_get_max_content_size() + 1) * ENCODING_LENGTH;
-
- temp_content = OslMalloc(temp_content_size);
- memset((S8*) temp_content, 0, temp_content_size);
- pfnUnicodeStrncpy((S8*) temp_content, (S8*) ucs2_content, mmi_msg_get_max_content_size());
-
- if (mmi_msg_get_max_content_size() > pfnUnicodeStrlen((S8*) temp_content))
- {
- pfnUnicodeStrncat(
- (S8*) temp_content,
- (S8*) mmi_frm_sms_msg_box[inbox_index].content,
- (mmi_msg_get_max_content_size() - pfnUnicodeStrlen((S8*) temp_content)));
- }
-
- mmi_frm_sms_add_content_to_entry(
- (mmi_frm_sms_msgbox_struct*) & mmi_frm_sms_msg_box[inbox_index],
- (U8*) temp_content);
-
- OslMfree(temp_content);
- }
- else if (mmi_frm_sms_index_list[mmi_frm_sms_msg_box[inbox_index].startindex].segment > thissegment)
- {
- mmi_frm_sms_add_content_to_entry(
- (mmi_frm_sms_msgbox_struct*) & mmi_frm_sms_msg_box[inbox_index],
- (U8*) ucs2_content);
- }
- else
- {
- /* thissegment > start_segment + 1 */
- /* If thissegment is the last segment of received segments, append the content */
- if (pfnUnicodeStrlen((S8*) mmi_frm_sms_msg_box[inbox_index].content) <
- (mmi_msg_get_max_content_size() - 1))
- {
- U16 l4_index = mmi_frm_sms_index_list[mmi_frm_sms_msg_box[inbox_index].startindex].nextindex;
- if (l4_index == MMI_FRM_SMS_INVALID_INDEX)
- {
- /* Do nothing */
- ;
- }
- else
- {
- for (;;)
- {
- /* Received segments are continuous */
- if (mmi_frm_sms_index_list[l4_index].nextindex == MMI_FRM_SMS_INVALID_INDEX)
- {
- if ((mmi_frm_sms_index_list[l4_index].segment - 1 ) !=
- mmi_frm_sms_index_list[mmi_frm_sms_index_list[l4_index].previndex].segment)
- {
- /* Do nothing if received segments are not continuous */
- break;
- }
- /* thissegment is the last segment of received segments */
- if (thissegment == (mmi_frm_sms_index_list[l4_index].segment + 1 ))
- {
- /* append content to mmi_frm_sms_msg_box[addindex].content */
- U16 *temp_content;
- U16 temp_content_size = (U16) (mmi_msg_get_max_content_size() + 1) * ENCODING_LENGTH;
-
- temp_content = OslMalloc(temp_content_size);
- memset((S8*) temp_content, 0, temp_content_size);
- pfnUnicodeStrncpy(
- (S8*) temp_content,
- (S8*) mmi_frm_sms_msg_box[inbox_index].content,
- mmi_msg_get_max_content_size());
-
- pfnUnicodeStrncat(
- (S8*) temp_content,
- (S8*) ucs2_content,
- (mmi_msg_get_max_content_size() - pfnUnicodeStrlen((S8*) temp_content)));
-
- mmi_frm_sms_add_content_to_entry(
- (mmi_frm_sms_msgbox_struct*) & mmi_frm_sms_msg_box[inbox_index],
- (U8*) temp_content);
-
- OslMfree(temp_content);
- }
- break;
- }
- if ((mmi_frm_sms_index_list[l4_index].segment - 1 ) !=
- mmi_frm_sms_index_list[mmi_frm_sms_index_list[l4_index].previndex].segment)
- {
- /* Do nothing if received segments are not continuous */
- break;
- }
- l4_index = mmi_frm_sms_index_list[l4_index].nextindex;
- }
- }
- }
- }
- }
-
- OslMfree(data);
- OslMfree(content);
- OslMfree(ucs2_content);
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- mmi_frm_sms_add_sms_segment(
- inbox_index,
- mmi_frm_sms_awaited[MMI_FRM_SMS_ACTION_SIZE].index,
- thissegment);
- #ifdef __MMI_MESSAGES_COPY__
- if (mmi_frm_sms_msg_box[inbox_index].storageType != MMI_FRM_SMS_PREFER_STORAGE)
- {
- mmi_frm_sms_msg_box[inbox_index].storageType =
- mmi_frm_sms_awaited[MMI_FRM_SMS_ACTION_SIZE].storageType;
- }
- #endif /* __MMI_MESSAGES_COPY__ */
- mmi_frm_sms_free_new_sms();
- *index = inbox_index;
- return MMI_FRM_SMS_INBOX;
- }
- }
- /* cannot find any match in awaited list and inbox list, add one entry with index awaited_index in the mmi_frm_sms_awaited */
- awaited_index = mmi_frm_sms_add_awaited_entry();
- /* find an empty entry in the awaited list and add successfully */
- if (awaited_index != MMI_FRM_SMS_INVALID_NUM)
- {
- mmi_frm_sms_free_new_sms();
- /* the timer is not started yet */
- if (mmi_frm_sms_awaited_counting == FALSE)
- {
- StartTimer(MESSAGES_LMS_RECV_TIMER_ID, MMI_FRM_SMS_LMS_TIME_OUT, mmi_frm_sms_timeout_concatenate_sms);
- mmi_frm_sms_awaited_counting = TRUE;
- }
- mmi_frm_sms_awaited_counter[awaited_index] = 0;
- *index = MMI_FRM_SMS_INVALID_INDEX;
- return MMI_FRM_SMS_NOBOX;
- }
- /* awaited list is full and the segment should be popup arbitrarily */
- else
- {
- *index = MMI_FRM_SMS_ACTION_SIZE;
- return MMI_FRM_SMS_AWAITS;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_sms_complete
- * DESCRIPTION
- * Check SMS completeness
- * PARAMETERS
- * type [IN] Type
- * index [IN] Index
- * RETURNS
- * TRUE: complete, FALSE: not
- *****************************************************************************/
- U8 mmi_frm_sms_check_sms_complete(U8 type, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- U8 total_seg;
- U16 dataindex;
- U16 msgindex;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (type)
- {
- case MMI_FRM_SMS_INBOX:
- case MMI_FRM_SMS_UNREAD:
- msgindex = mmi_frm_sms_inbox_list[index];
- break;
- case MMI_FRM_SMS_OUTBOX:
- #ifndef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #endif
- msgindex = mmi_frm_sms_outbox_list[index];
- break;
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #ifdef __MMI_UNIFIED_MESSAGE__
- case MMI_FRM_SMS_UNSENT:
- #endif
- msgindex = mmi_frm_sms_drafts_list[index];
- break;
- #endif /* __MMI_MESSAGES_DRAFT_BOX__ */
- default:
- msgindex = 0;
- break;
- }
- total_seg =
- ((mmi_frm_sms_msg_box[msgindex].totalseg - mmi_frm_sms_msg_box[msgindex].startseg + 1) >
- g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) ? g_frm_sms_cntx.
- mmi_frm_sms_msg_seg_size : (mmi_frm_sms_msg_box[msgindex].totalseg - mmi_frm_sms_msg_box[msgindex].startseg +
- 1);
- dataindex = mmi_frm_sms_msg_box[msgindex].startindex;
- while (dataindex != MMI_FRM_SMS_INVALID_INDEX)
- {
- if (mmi_frm_sms_index_list[dataindex].segment != (i + 1))
- {
- return FALSE;
- }
- dataindex = mmi_frm_sms_index_list[dataindex].nextindex;
- i++;
- }
- if (i == total_seg)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_data_index
- * DESCRIPTION
- * get data index of specific source port and module
- * PARAMETERS
- * mod [IN] Port
- * port [IN]
- * startindex [IN]
- * RETURNS
- * index
- *****************************************************************************/
- U8 mmi_frm_sms_get_data_index(module_type mod, U16 port, U8 startindex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = startindex; i < MMI_FRM_SMS_ACTION_SIZE; i++)
- {
- if ((mmi_frm_sms_data[i].dest_mod_id == mod) && (mmi_frm_sms_data[i].dest_port == port))
- {
- return i;
- }
- }
- return MMI_FRM_SMS_INVALID_NUM;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_remove_data
- * DESCRIPTION
- * Remove SMS with port, by module and port
- * PARAMETERS
- * mod [IN] Module
- * port [IN] Port number
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_remove_data(module_type mod, U16 port)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < MMI_FRM_SMS_ACTION_SIZE; i++)
- {
- if ((mmi_frm_sms_data[i].dest_mod_id == mod) && (mmi_frm_sms_data[i].dest_port == port))
- {
- mmi_frm_sms_free_data(i);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_add_data_segment
- * DESCRIPTION
- * add one segment to awaited entry
- * PARAMETERS
- * index [IN] Index
- * segment [IN] Segment
- * entry [?]
- * b addindex addindex(?)
- * RETURNS
- * void
- *****************************************************************************/
- U8 mmi_frm_sms_add_data_segment(U8 index, U8 segment, mmi_frm_sms_deliver_data_struct *entry)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 islast = TRUE;
- U8 dataindex = 0;
- U8 thisdataindex = mmi_frm_sms_data[index].data[0];
- U8 prevdataindex = MMI_FRM_SMS_INVALID_NUM;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* find an empty entry in mmi_frm_sms_content in order to move the last entry to that entry */
- while (dataindex < MMI_FRM_SMS_MSG_CONTENT_NUM)
- {
- if (mmi_frm_sms_content[dataindex].msglen == 0)
- {
- break; /* found empty entry */
- }
- dataindex++;
- }
- /* if mmi_frm_sms_content is full and cannot find any empty entry, don't have to move */
- if (dataindex != MMI_FRM_SMS_MSG_CONTENT_NUM)
- {
- /* move the actual data of the last entry to the entry with the index dataindex in mmi_frm_sms_content */
- if (entry->message_len)
- {
- mmi_frm_sms_content[dataindex].data = OslMalloc(entry->message_len);
- memcpy(
- (S8*) mmi_frm_sms_content[dataindex].data,
- (S8*) mmi_frm_sms_content[MMI_FRM_SMS_MSG_CONTENT_NUM].data,
- entry->message_len);
- }
- mmi_frm_sms_content[dataindex].msglen = entry->message_len;
- mmi_frm_sms_content[dataindex].segment = segment;
- }
- mmi_frm_sms_data[index].message_len += entry->message_len;
- MMI_ASSERT(mmi_frm_sms_data[index].message_len <= MMI_SMS_MAX_MSG_SEG * MMI_FRM_SMS_MSG_LEN);
- /* thisdataindex is the current smallest segment index of this message */
- if (mmi_frm_sms_content[thisdataindex].segment > segment)
- {
- islast = FALSE;
- /* dataindex is inserted in the head, now dataindex is the current smallest segment index of this message */
- mmi_frm_sms_content[dataindex].nextindex = thisdataindex;
- mmi_frm_sms_data[index].data[0] = dataindex;
- }
- else
- {
- while (mmi_frm_sms_content[thisdataindex].nextindex != MMI_FRM_SMS_INVALID_NUM)
- {
- prevdataindex = thisdataindex;
- thisdataindex = mmi_frm_sms_content[thisdataindex].nextindex;
- if (mmi_frm_sms_content[thisdataindex].segment > segment)
- {
- islast = FALSE;
- break;
- }
- }
- }
- if (islast == TRUE)
- {
- /* dataindex is inserted in the tail, now dataindex is the current largest segment index of this message */
- mmi_frm_sms_content[thisdataindex].nextindex = dataindex;
- mmi_frm_sms_content[dataindex].nextindex = MMI_FRM_SMS_INVALID_NUM;
- }
- else
- {
- /* dataindex is inserted in the middle */
- if (prevdataindex != MMI_FRM_SMS_INVALID_NUM)
- {
- mmi_frm_sms_content[prevdataindex].nextindex = dataindex;
- }
- mmi_frm_sms_content[dataindex].nextindex = thisdataindex;
- }
- /* mmi_frm_sms_content is full and cannot handle other new segment coming anymore */
- if (dataindex == MMI_FRM_SMS_MSG_CONTENT_NUM)
- {
- return FALSE;
- }
- else
- {
- return TRUE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_add_data_entry
- * DESCRIPTION
- * add sms to awaited list
- * PARAMETERS
- * void
- * a type type(?)
- * b index index(?)
- * c l4_index l4_index(?)
- * RETURNS
- * TRUE: inserted, FALSE: not inserted
- *****************************************************************************/
- U8 mmi_frm_sms_add_data_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- U8 dataindex = 0;
- U16 length = mmi_frm_sms_content[MMI_FRM_SMS_MSG_CONTENT_NUM].msglen;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (dataindex < MMI_FRM_SMS_MSG_CONTENT_NUM)
- {
- if (mmi_frm_sms_content[dataindex].segment == MMI_FRM_SMS_INVALID_NUM)
- {
- break; /* found empty entry */
- }
- dataindex++;
- }
- /* cannot find any empty entry in mmi_frm_sms_content */
- if (dataindex == MMI_FRM_SMS_MSG_CONTENT_NUM)
- {
- return MMI_FRM_SMS_INVALID_NUM;
- }
- mmi_frm_sms_content[dataindex].msglen = mmi_frm_sms_content[MMI_FRM_SMS_MSG_CONTENT_NUM].msglen;
- mmi_frm_sms_content[dataindex].nextindex = mmi_frm_sms_content[MMI_FRM_SMS_MSG_CONTENT_NUM].nextindex;
- mmi_frm_sms_content[dataindex].segment = mmi_frm_sms_content[MMI_FRM_SMS_MSG_CONTENT_NUM].segment;
- // mmi_frm_sms_content[dataindex].data=mmi_frm_sms_content[MMI_FRM_SMS_MSG_CONTENT_NUM].data;
- // mmi_frm_sms_content[MMI_FRM_SMS_MSG_CONTENT_NUM].data=NULL;
- if (length)
- {
- mmi_frm_sms_content[dataindex].data = OslMalloc(length);
- memcpy(mmi_frm_sms_content[dataindex].data, mmi_frm_sms_content[MMI_FRM_SMS_MSG_CONTENT_NUM].data, length);
- }
- while (i < MMI_FRM_SMS_ACTION_SIZE)
- {
- if (mmi_frm_sms_data[i].data[0] == MMI_FRM_SMS_INVALID_NUM)
- {
- memcpy(
- &(mmi_frm_sms_data[i]),
- &(mmi_frm_sms_data[MMI_FRM_SMS_ACTION_SIZE]),
- sizeof(mmi_frm_sms_deliver_data_struct));
- mmi_frm_sms_data[i].data[0] = dataindex;
- return i;
- }
- i++;
- }
- /* cannot find any empty entry in mmi_frm_sms_data */
- return MMI_FRM_SMS_INVALID_NUM;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_data
- * DESCRIPTION
- * Get SMS with port: get content
- * PARAMETERS
- * index [IN] Index
- * data [?] Entry info
- * content [?] Content
- * RETURNS
- * TRUE: OK, FALSE: content empty
- *****************************************************************************/
- U8 mmi_frm_sms_get_data(U8 index, mmi_frm_sms_deliver_data_struct *data, U8 *content)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (mmi_frm_sms_data[index].message_len == 0)
- {
- return FALSE;
- }
- memcpy((S8*) data, (S8*) & mmi_frm_sms_data[index], sizeof(mmi_frm_sms_deliver_data_struct));
- memset((S8*) content, 0, mmi_frm_sms_data[index].message_len);
- if (mmi_frm_sms_data[index].dcs == SMSAL_UCS2_DCS || mmi_frm_sms_data[index].dcs == SMSAL_DEFAULT_DCS)
- {
- U8 i = mmi_frm_sms_data[index].data[0];
- EMSData *pEMSdata = NULL;
- U8 *textBuff = NULL;
- U8 *textBuffShifted = NULL;
- U8 *TPUD[1];
- U8 TPUDLEN[1];
- U8 is_obj_present = 0;
- U16 buffLen = mmi_frm_sms_data[index].message_len;
- U16 textLen = 0;
- U8 udhi = KAL_FALSE;
- if (mmi_frm_sms_data[index].dcs == SMSAL_DEFAULT_DCS)
- {
- buffLen *= 2;
- }
- if (buffLen)
- {
- pEMSdata = OslMalloc(sizeof(EMSData));
- /* MMI could only allocate 2K control buffer, so limit the max allocate buffer to 1600 here */
- buffLen = (buffLen < (MMI_FRM_SMS_MSG_LEN * 10)) ? buffLen : (MMI_FRM_SMS_MSG_LEN * 10);
- textBuff = OslMalloc(buffLen);
- textBuffShifted = textBuff;
- pEMSdata->textBuffer = textBuff;
- pEMSdata->textBufferSize = buffLen;
- pEMSdata->textLength = 0;
- pEMSdata->dcs = mmi_frm_sms_data[index].dcs;
- while (i != MMI_FRM_SMS_INVALID_NUM)
- {
- TPUDLEN[0] = (U8) mmi_frm_sms_content[i].msglen;
- TPUD[0] = (U8*) mmi_frm_sms_content[i].data;
- EMSMsgPreview(
- 1,
- mmi_frm_sms_data[index].dcs,
- udhi,
- TPUD,
- TPUDLEN,
- buffLen,
- textBuffShifted,
- &is_obj_present,
- &textLen);
- pEMSdata->textLength += textLen;
- textBuffShifted += textLen;
- buffLen -= textLen;
- textLen = 0;
- i = mmi_frm_sms_content[i].nextindex;
- }
- EMS_ConvertGSM7BitDefaultEncodingToAsciiWithoutEMSlib(pEMSdata);
- /* UnicodeNToAnsii((S8*)content, (S8*)pEMSdata->textBuffer, pEMSdata->textBufferSize); */
- memcpy((S8*) content, (S8*) pEMSdata->textBuffer, pEMSdata->textLength);
- data->message_len = pEMSdata->textLength;
- OslMfree(textBuff);
- OslMfree(pEMSdata);
- }
- else
- {
- memset((S8*) content, 0, ENCODING_LENGTH);
- }
- return TRUE;
- }
- else
- {
- U8 i = mmi_frm_sms_data[index].data[0];
- U16 len = 0;
- while (i != MMI_FRM_SMS_INVALID_NUM)
- {
- memcpy(((S8*) content) + len, (S8*) mmi_frm_sms_content[i].data, mmi_frm_sms_content[i].msglen);
- len += mmi_frm_sms_content[i].msglen;
- i = mmi_frm_sms_content[i].nextindex;
- }
- return TRUE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_data
- * DESCRIPTION
- * Check SMS with port in data list
- * PARAMETERS
- * void
- * RETURNS
- * index
- *****************************************************************************/
- U8 mmi_frm_sms_check_data(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* find the entry in the data list that matches the last entry in the mmi_frm_sms_data */
- U8 i = 0;
- mmi_frm_sms_deliver_data_struct *datainfo = &mmi_frm_sms_data[MMI_FRM_SMS_ACTION_SIZE];
- mmi_frm_sms_concat_struct *concatinfo =
- ((mmi_frm_sms_concat_struct*) & (mmi_frm_sms_data[MMI_FRM_SMS_ACTION_SIZE].concat_info));
- U8 thisseg = mmi_frm_sms_content[MMI_FRM_SMS_MSG_CONTENT_NUM].segment;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (((concatinfo->total_seg % g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) == 1) &&
- (concatinfo->total_seg == concatinfo->seg))
- {
- return MMI_FRM_SMS_ACTION_SIZE;
- }
- while (i < MMI_FRM_SMS_ACTION_SIZE)
- {
- mmi_frm_sms_deliver_data_struct *data = &mmi_frm_sms_data[i];
- mmi_frm_sms_concat_struct *concat = ((mmi_frm_sms_concat_struct*) & (mmi_frm_sms_data[i].concat_info));
- if ((concat->total_seg == concatinfo->total_seg) && (concat->seg == concatinfo->seg) &&
- (concat->ref == concatinfo->ref) &&
- ((ComparePhoneNum((PU8) data->oa.number, (PU8) datainfo->oa.number)) == TRUE))
- {
- U8 j = mmi_frm_sms_data[i].data[0];
- while (j != MMI_FRM_SMS_INVALID_NUM)
- {
- /* find exactly the same entry in the data list as the last entry */
- if (mmi_frm_sms_content[j].segment == thisseg)
- {
- break;
- }
- /* thisseg is smaller than the current smallest segment number of this message */
- else if (mmi_frm_sms_content[j].segment > thisseg)
- {
- /* if add data segment fail, the last entry is not duplicated, so it cannot free here */
- if (mmi_frm_sms_add_data_segment(i, thisseg, datainfo) == TRUE)
- {
- mmi_frm_sms_free_new_data();
- }
- return i;
- }
- /* thisseg is greater than the current largest segment number of this message */
- else if (mmi_frm_sms_content[j].segment < thisseg &&
- mmi_frm_sms_content[j].nextindex == MMI_FRM_SMS_INVALID_NUM)
- {
- /* if add data segment fail, the last entry is not duplicated, so it cannot free here */
- if (mmi_frm_sms_add_data_segment(i, thisseg, datainfo) == TRUE)
- {
- mmi_frm_sms_free_new_data();
- }
- return i;
- }
- j = mmi_frm_sms_content[j].nextindex;
- }
- }
- i++;
- }
- return MMI_FRM_SMS_INVALID_NUM;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_timeout_concatenate_data
- * DESCRIPTION
- * timeout check concatenate SMS
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_timeout_concatenate_data(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- U8 awaited_remain = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (i < MMI_FRM_SMS_ACTION_SIZE)
- {
- if (mmi_frm_sms_data_counter[i] != MMI_FRM_SMS_INVALID_NUM)
- {
- mmi_frm_sms_data_counter[i]++;
- /* Give twice time for data to be re-assembled. */
- if (mmi_frm_sms_data_counter[i] == MMI_FRM_SMS_ACTION_SIZE * 2)
- {
- mmi_frm_sms_data_counter[i] = MMI_FRM_SMS_INVALID_NUM;
- mmi_frm_sms_free_data(i);
- }
- else
- {
- awaited_remain = TRUE;
- }
- }
- i++;
- }
- /* timer expires but still some segments are missing in the mmi_frm_sms_awaited */
- if (awaited_remain == TRUE)
- {
- StartTimer(MESSAGES_LMS_RECV_TIMER_ID, MMI_FRM_SMS_LMS_TIME_OUT, mmi_frm_sms_timeout_concatenate_data);
- }
- else
- {
- mmi_frm_sms_data_counting = FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_concatenate_data
- * DESCRIPTION
- * Check concatenate data
- * PARAMETERS
- * index [?] Index
- * RETURNS
- * index
- *****************************************************************************/
- U8 mmi_frm_sms_check_concatenate_data(U8 *index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_concat_struct *concatinfo =
- (mmi_frm_sms_concat_struct*) & (mmi_frm_sms_data[MMI_FRM_SMS_ACTION_SIZE].concat_info);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (((concatinfo->total_seg % g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) == 1) &&
- (concatinfo->total_seg == concatinfo->seg))
- {
- *index = MMI_FRM_SMS_ACTION_SIZE;
- return MMI_FRM_SMS_DATA;
- }
- else
- {
- U8 awaited_index = mmi_frm_sms_check_data();
- /* the last entry in the mmi_frm_sms_data belongs to one of the segments of the entry with index awaited_index in the data list */
- if (awaited_index != MMI_FRM_SMS_INVALID_NUM)
- {
- if (mmi_frm_sms_check_data_complete(awaited_index) == TRUE)
- {
- mmi_frm_sms_data_counter[awaited_index] = MMI_FRM_SMS_INVALID_NUM;
- *index = awaited_index;
- return MMI_FRM_SMS_DATA;
- }
- /* not all segments of this message are arrived */
- else
- {
- U8 dataindex = 0;
- /* check if mmi_frm_sms_content is full */
- while (dataindex < MMI_FRM_SMS_MSG_CONTENT_NUM)
- {
- if (mmi_frm_sms_content[dataindex].segment == MMI_FRM_SMS_INVALID_NUM)
- {
- /* mmi_frm_sms_content is not full, restart the counter to keep waiting for other segment's arriving */
- mmi_frm_sms_data_counter[awaited_index] = 0;
- *index = awaited_index;
- return MMI_FRM_SMS_NOBOX;
- }
- dataindex++;
- }
- /* mmi_frm_sms_content is full, reset the counter and free this message */
- mmi_frm_sms_data_counter[awaited_index] = MMI_FRM_SMS_INVALID_NUM;
- mmi_frm_sms_free_data(awaited_index);
- *index = awaited_index;
- return MMI_FRM_SMS_NOBOX;
- }
- }
- else
- {
- /* cannot find any match in data list, add one entry with index awaited_index in the mmi_frm_sms_data */
- awaited_index = mmi_frm_sms_add_data_entry();
- /* find an empty entry in the data list and add successfully */
- if (awaited_index != MMI_FRM_SMS_INVALID_NUM)
- {
- mmi_frm_sms_free_new_data();
- /* the timer is not started yet */
- if (mmi_frm_sms_data_counting == FALSE)
- {
- StartTimer(
- MESSAGES_LMS_RECV_TIMER_ID,
- MMI_FRM_SMS_LMS_TIME_OUT,
- mmi_frm_sms_timeout_concatenate_data);
- mmi_frm_sms_data_counting = TRUE;
- }
- mmi_frm_sms_data_counter[awaited_index] = 0;
- *index = MMI_FRM_SMS_INVALID_NUM;
- return MMI_FRM_SMS_NOBOX;
- }
- /* data list or content list is full and the segment should be discarded */
- else
- {
- mmi_frm_sms_free_new_data();
- *index = MMI_FRM_SMS_ACTION_SIZE;
- return MMI_FRM_SMS_NOBOX;
- }
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_data_complete
- * DESCRIPTION
- * Check SMS with port completeness
- * PARAMETERS
- * index [IN] Index
- * RETURNS
- * TRUE: complete, FALSE: not
- *****************************************************************************/
- U8 mmi_frm_sms_check_data_complete(U8 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- mmi_frm_sms_concat_struct *concat_info = (mmi_frm_sms_concat_struct*) & (mmi_frm_sms_data[index].concat_info);
- U8 total_seg = ((concat_info->total_seg - concat_info->seg + 1) > g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) ?
- g_frm_sms_cntx.mmi_frm_sms_msg_seg_size : (concat_info->total_seg - concat_info->seg + 1);
- U8 dataindex = mmi_frm_sms_data[index].data[0];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* if the message has only one segment */
- if (index == MMI_FRM_SMS_ACTION_SIZE)
- {
- return TRUE;
- }
- while (dataindex != MMI_FRM_SMS_INVALID_NUM)
- {
- if (mmi_frm_sms_content[dataindex].segment != (i + 1))
- {
- return FALSE;
- }
- dataindex = mmi_frm_sms_content[dataindex].nextindex;
- i++;
- }
- if (i == total_seg)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- /* given msg box index, change to type */
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_set_sms_status
- * DESCRIPTION
- * Set SMS status
- * PARAMETERS
- * type [IN] Origin type
- * index [IN] Index
- * newtype [IN] Type to be set
- * RETURNS
- * TRUE
- *****************************************************************************/
- U8 mmi_frm_sms_set_sms_status(U8 type, U16 index, U8 newtype)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 mti;
- U16 msgindex;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (type)
- {
- case MMI_FRM_SMS_NOBOX:
- msgindex = index;
- mti = (mmi_frm_sms_msg_box[msgindex].msgtype & 0xf0);
- mmi_frm_sms_msg_box[msgindex].msgtype = mti | newtype;
- break;
- case MMI_FRM_SMS_INBOX:
- case MMI_FRM_SMS_UNREAD:
- msgindex = mmi_frm_sms_inbox_list[index];
- mti = (mmi_frm_sms_msg_box[msgindex].msgtype & 0xf0);
- mmi_frm_sms_msg_box[msgindex].msgtype = mti | newtype;
- break;
- default:
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*-------[SmsUtil.c] mmi_frm_sms_set_sms_status DO NOTHING -------*n"));
- break;
- }
- return TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_sms_status
- * DESCRIPTION
- * Get SMS status
- * PARAMETERS
- * type [IN] Type
- * index [IN] Index
- * RETURNS
- * status
- *****************************************************************************/
- U8 mmi_frm_sms_get_sms_status(U8 type, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 entryindex = index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (type)
- {
- case MMI_FRM_SMS_INBOX:
- case MMI_FRM_SMS_UNREAD:
- entryindex = mmi_frm_sms_inbox_list[index];
- break;
- case MMI_FRM_SMS_OUTBOX:
- #ifndef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #endif
- entryindex = mmi_frm_sms_outbox_list[index];
- break;
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #ifdef __MMI_UNIFIED_MESSAGE__
- case MMI_FRM_SMS_UNSENT:
- #endif
- entryindex = mmi_frm_sms_drafts_list[index];
- break;
- #endif /* __MMI_MESSAGES_DRAFT_BOX__ */
- }
- return mmi_frm_sms_msg_box[entryindex].msgtype;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_sms_dcs
- * DESCRIPTION
- * Get SMS DCS
- * PARAMETERS
- * type [IN] Type
- * index [IN] Index
- * RETURNS
- * dcs
- *****************************************************************************/
- U8 mmi_frm_sms_get_sms_dcs(U8 type, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (type == MMI_FRM_SMS_DATA)
- {
- return mmi_frm_sms_data[index].dcs;
- }
- else
- {
- return SMSAL_8BIT_DCS;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_sms_address
- * DESCRIPTION
- * Get SMS address
- * PARAMETERS
- * type [IN] Type
- * index [IN] Index
- * RETURNS
- * address
- *****************************************************************************/
- U8 *mmi_frm_sms_get_sms_address(U8 type, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 entryindex = index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (type)
- {
- case MMI_FRM_SMS_INBOX:
- case MMI_FRM_SMS_UNREAD:
- entryindex = mmi_frm_sms_inbox_list[index];
- break;
- case MMI_FRM_SMS_OUTBOX:
- #ifndef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #endif
- entryindex = mmi_frm_sms_outbox_list[index];
- break;
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #ifdef __MMI_UNIFIED_MESSAGE__
- case MMI_FRM_SMS_UNSENT:
- #endif
- entryindex = mmi_frm_sms_drafts_list[index];
- break;
- #endif /* __MMI_MESSAGES_DRAFT_BOX__ */
- default:
- entryindex = index;
- break;
- }
- if (type == MMI_FRM_SMS_DATA)
- {
- return (U8*) & mmi_frm_sms_data[entryindex].oa;
- }
- else
- {
- return mmi_frm_sms_msg_box[entryindex].number;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_sms_timestamp
- * DESCRIPTION
- * Get SMS timestamp
- * PARAMETERS
- * type [IN] Type
- * index [IN] Index
- * RETURNS
- * timestamp
- *****************************************************************************/
- U8 *mmi_frm_sms_get_sms_timestamp(U8 type, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 entryindex = index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (type)
- {
- case MMI_FRM_SMS_INBOX:
- case MMI_FRM_SMS_UNREAD:
- entryindex = mmi_frm_sms_inbox_list[index];
- break;
- case MMI_FRM_SMS_OUTBOX:
- #ifndef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #endif
- entryindex = mmi_frm_sms_outbox_list[index];
- break;
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #ifdef __MMI_UNIFIED_MESSAGE__
- case MMI_FRM_SMS_UNSENT:
- #endif
- entryindex = mmi_frm_sms_drafts_list[index];
- break;
- #endif /* __MMI_MESSAGES_DRAFT_BOX__ */
- }
- if (type == MMI_FRM_SMS_DATA)
- {
- return mmi_frm_sms_data[entryindex].scts;
- }
- else
- {
- return mmi_frm_sms_msg_box[entryindex].timestamp;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_sms_size
- * DESCRIPTION
- * Get SMS size
- * PARAMETERS
- * type [IN] Type
- * index [IN] Index
- * RETURNS
- * size
- *****************************************************************************/
- U8 mmi_frm_sms_get_sms_size(U8 type, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 msgindex = 0;
- U8 totalseg = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (type)
- {
- case MMI_FRM_SMS_NOBOX:
- msgindex = index;
- break;
- case MMI_FRM_SMS_INBOX:
- case MMI_FRM_SMS_UNREAD:
- msgindex = mmi_frm_sms_inbox_list[index];
- break;
- case MMI_FRM_SMS_OUTBOX:
- #ifndef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #endif
- msgindex = mmi_frm_sms_outbox_list[index];
- break;
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- msgindex = mmi_frm_sms_drafts_list[index];
- break;
- #endif /* __MMI_MESSAGES_DRAFT_BOX__ */
- }
- totalseg = mmi_frm_sms_msg_box[msgindex].totalseg - mmi_frm_sms_msg_box[msgindex].startseg + 1;
- return ((totalseg > g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) ? g_frm_sms_cntx.mmi_frm_sms_msg_seg_size : totalseg);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_sms_received_size
- * DESCRIPTION
- * Get SMS received segment number
- * PARAMETERS
- * type [IN] Type
- * index [IN] Index
- * RETURNS
- * size
- *****************************************************************************/
- U8 mmi_frm_sms_get_sms_received_size(U8 type, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 msgindex = 0;
- U8 receivedseg = 0;
- unsigned short l4index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (type)
- {
- case MMI_FRM_SMS_NOBOX:
- msgindex = index;
- break;
- case MMI_FRM_SMS_INBOX:
- case MMI_FRM_SMS_UNREAD:
- msgindex = mmi_frm_sms_inbox_list[index];
- break;
- case MMI_FRM_SMS_OUTBOX:
- #ifndef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #endif
- msgindex = mmi_frm_sms_outbox_list[index];
- break;
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- msgindex = mmi_frm_sms_drafts_list[index];
- break;
- #endif /* __MMI_MESSAGES_DRAFT_BOX__ */
- }
- l4index = mmi_frm_sms_msg_box[msgindex].startindex;
- while (l4index != MMI_FRM_SMS_INVALID_INDEX)
- {
- receivedseg++;
- l4index = mmi_frm_sms_index_list[l4index].nextindex;
- }
- return receivedseg;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_sms_list_size
- * DESCRIPTION
- * Get SMS list size
- * PARAMETERS
- * type [IN] Type
- * RETURNS
- * size
- *****************************************************************************/
- U16 mmi_frm_sms_get_sms_list_size(U8 type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (mmi_frm_sms_list_done == FALSE || g_frm_sms_cntx.mmi_frm_sms_ready == FALSE)
- {
- return MMI_FRM_SMS_INVALID_INDEX;
- }
- switch (type)
- {
- case MMI_FRM_SMS_INBOX:
- case MMI_FRM_SMS_UNREAD:
- return mmi_frm_sms_inbox_size;
- case MMI_FRM_SMS_OUTBOX:
- #ifndef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #endif
- return mmi_frm_sms_outbox_size;
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #ifdef __MMI_UNIFIED_MESSAGE__
- {
- kal_uint16 msg_num = 0;
- mmi_frm_sms_get_draft_msg_num(&msg_num);
- return msg_num;
- }
- #else /* __MMI_UNIFIED_MESSAGE__ */
- return mmi_frm_sms_drafts_size;
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- #endif /* __MMI_MESSAGES_DRAFT_BOX__ */
- #ifdef __MMI_UNIFIED_MESSAGE__
- case MMI_FRM_SMS_UNSENT:
- {
- kal_uint16 msg_num = 0;
- mmi_frm_sms_get_unsent_msg_num(&msg_num);
- return msg_num;
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- }
- return 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_data_check
- * DESCRIPTION
- * See if data is checked
- * PARAMETERS
- * index [IN] Index
- * RETURNS
- * Check or not
- *****************************************************************************/
- U8 mmi_frm_sms_get_data_check(U8 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return (mmi_frm_sms_data_checked >> index) & 0x01;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_set_data_check
- * DESCRIPTION
- * Set SMS check
- * PARAMETERS
- * index [IN] Index
- * set [IN] 1/0
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_set_data_check(U8 index, U8 set)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 resetVector = (U16) (0xffff - (1 << index));
- U16 setVector = (U16) set;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- setVector = setVector << index;
- /* Reset the check bit to zero */
- mmi_frm_sms_data_checked &= resetVector;
- mmi_frm_sms_data_checked |= setVector;
- }
- #ifdef __MMI_MESSAGES_COPY__
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_sms_storage
- * DESCRIPTION
- * get SMS storage type
- * PARAMETERS
- * type [IN] mmi_frm_sms_app_msgbox_enum
- * index [IN] message list index
- * RETURNS
- * smsal_storage_enum (SMSAL_SM or SMSAL_ME)
- *****************************************************************************/
- U8 mmi_frm_sms_get_sms_storage(U8 type, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 msgindex = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (type)
- {
- case MMI_FRM_SMS_NOBOX:
- msgindex = index;
- break;
- case MMI_FRM_SMS_INBOX:
- case MMI_FRM_SMS_UNREAD:
- msgindex = mmi_frm_sms_inbox_list[index];
- break;
- case MMI_FRM_SMS_OUTBOX:
- #ifndef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #endif
- msgindex = mmi_frm_sms_outbox_list[index];
- break;
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #ifdef __MMI_UNIFIED_MESSAGE__
- case MMI_FRM_SMS_UNSENT:
- #endif
- msgindex = mmi_frm_sms_drafts_list[index];
- break;
- #endif /* __MMI_MESSAGES_DRAFT_BOX__ */
- }
- return mmi_frm_sms_msg_box[msgindex].storageType;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_copy_sms_abort
- * DESCRIPTION
- * abort SMS copy action
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_copy_sms_abort()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_frm_sms_copy_info.is_aborted = TRUE;
- return;
- }
- #endif /* __MMI_MESSAGES_COPY__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_swap_list_index
- * DESCRIPTION
- * swap list index
- * PARAMETERS
- * type [IN] mmi_frm_sms_app_msgbox_enum, only inbox, outbox or draft
- * index1 [IN]
- * index2 [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_swap_list_index(U8 type, U16 index1, U16 index2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 msgindex;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (type)
- {
- case MMI_FRM_SMS_INBOX:
- case MMI_FRM_SMS_UNREAD:
- msgindex = mmi_frm_sms_inbox_list[index1];
- mmi_frm_sms_inbox_list[index1] = mmi_frm_sms_inbox_list[index2];
- mmi_frm_sms_inbox_list[index2] = msgindex;
- break;
- case MMI_FRM_SMS_OUTBOX:
- #ifndef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- #endif
- msgindex = mmi_frm_sms_outbox_list[index1];
- mmi_frm_sms_outbox_list[index1] = mmi_frm_sms_outbox_list[index2];
- mmi_frm_sms_outbox_list[index2] = msgindex;
- break;
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- case MMI_FRM_SMS_DRAFTS:
- msgindex = mmi_frm_sms_drafts_list[index1];
- mmi_frm_sms_drafts_list[index1] = mmi_frm_sms_drafts_list[index2];
- mmi_frm_sms_drafts_list[index2] = msgindex;
- break;
- #endif /* __MMI_MESSAGES_DRAFT_BOX__ */
- default:
- return;
- }
- return;
- }
- #ifdef __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_set_delivery_report_awaited_check
- * DESCRIPTION
- * set check bit of msg box in delivery report list
- * PARAMETERS
- * delivery_report_awaited_index [IN]
- * msg_ref [IN]
- * status_type [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_set_delivery_report_awaited_check(U16 delivery_report_awaited_index, U8 msg_ref, U8 status_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 list_index = delivery_report_awaited_index;
- U8 mr = msg_ref;
- U8 st = status_type;
- int i = 0;
- mmi_frm_sms_delivery_report_box_struct *box = mmi_frm_sms_delivery_report_awaited[list_index].ptr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (st != ST_COMP_MSG_RECV_BY_SME)
- {
- mmi_frm_sms_delivery_report_awaited[list_index].result = st;
- }
- for (i = 0; i < mmi_frm_sms_delivery_report_awaited[list_index].box_number; i++)
- {
- if (box[i].mr == mr)
- {
- box[i].check_bit = 1;
- return;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_set_delivery_report_awaited_mr
- * DESCRIPTION
- * set message reference of msg box in delivery report list
- * PARAMETERS
- * delivery_report_awaited_index [IN]
- * msg_ref [IN]
- * seq_number [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_set_delivery_report_awaited_mr(U16 delivery_report_awaited_index, U8 msg_ref, U8 seq_number)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 mr = msg_ref;
- U8 seq_no = seq_number;
- U16 list_index = delivery_report_awaited_index;
- mmi_frm_sms_delivery_report_box_struct *box;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (seq_no < mmi_frm_sms_delivery_report_awaited[list_index].box_number)
- {
- box = mmi_frm_sms_delivery_report_awaited[list_index].ptr;
- box[seq_no].mr = mr;
- }
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_delivery_report_awaited_complete
- * DESCRIPTION
- * check if entry of delivery report awaited list is complete
- * PARAMETERS
- * delivery_report_awaited_index [IN]
- * RETURNS
- *
- *****************************************************************************/
- BOOL mmi_frm_sms_check_delivery_report_awaited_complete(U16 delivery_report_awaited_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 list_index = delivery_report_awaited_index;
- int i = 0;
- mmi_frm_sms_delivery_report_box_struct *box = mmi_frm_sms_delivery_report_awaited[list_index].ptr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < mmi_frm_sms_delivery_report_awaited[list_index].box_number; i++)
- {
- if (box[i].check_bit == 0)
- {
- return FALSE;
- }
- }
- return TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_remove_delivery_report_awaited
- * DESCRIPTION
- * remove delivery report list entry with the specified list index
- * PARAMETERS
- * delivery_report_awaited_list_index [IN]
- * RETURNS
- * index of delivery_report_awaited list(?)
- * MMI_FRM_SMS_ACTION_SIZE means not found(?)
- *****************************************************************************/
- void mmi_frm_sms_remove_delivery_report_awaited(U16 delivery_report_awaited_list_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 list_index = delivery_report_awaited_list_index;;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_delivery_report_awaited[list_index].result = 0;
- mmi_frm_sms_delivery_report_awaited[list_index].ref = 0;
- mmi_frm_sms_delivery_report_awaited[list_index].box_number = 0;
- if (mmi_frm_sms_delivery_report_awaited[list_index].ptr != NULL)
- {
- OslMfree(mmi_frm_sms_delivery_report_awaited[list_index].ptr);
- mmi_frm_sms_delivery_report_awaited[list_index].ptr = NULL;
- }
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_delivery_report_index_by_mr
- * DESCRIPTION
- * check if delivery report box with the specified message reference already in list
- * PARAMETERS
- * mr [IN]
- * RETURNS
- * index of delivery_report_awaited list
- * MMI_FRM_SMS_ACTION_SIZE means not found
- *****************************************************************************/
- U16 mmi_frm_sms_get_delivery_report_index_by_mr(U8 mr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 msg_reference = mr;
- int list_index = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (list_index = 0; list_index < MMI_FRM_SMS_ACTION_SIZE; list_index++)
- {
- if (mmi_frm_sms_delivery_report_awaited[list_index].box_number != 0)
- {
- int box_no = mmi_frm_sms_delivery_report_awaited[list_index].box_number;
- int box_index = 0;
- mmi_frm_sms_delivery_report_box_struct *box = mmi_frm_sms_delivery_report_awaited[list_index].ptr;
- for (box_index = 0; box_index < box_no; box_index++)
- {
- if (box[box_index].mr == msg_reference)
- {
- return list_index;
- }
- }
- }
- }
- return list_index;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_delivery_report_index_by_ref
- * DESCRIPTION
- * check if delivery report entry with the specified reference number already in list
- * PARAMETERS
- * ref [IN]
- * RETURNS
- * index of delivery_report_awaited list
- * MMI_FRM_SMS_ACTION_SIZE means not found
- *****************************************************************************/
- U16 mmi_frm_sms_get_delivery_report_index_by_ref(U16 ref)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 reference_no = ref;
- int list_index = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (list_index = 0; list_index < MMI_FRM_SMS_ACTION_SIZE; list_index++)
- {
- if (mmi_frm_sms_delivery_report_awaited[list_index].box_number != 0)
- {
- if (mmi_frm_sms_delivery_report_awaited[list_index].ref == reference_no)
- {
- return list_index;
- }
- }
- }
- return list_index;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_add_delivery_report_awaited
- * DESCRIPTION
- * add entry to delivery report awaited list
- * PARAMETERS
- * reference_number [IN]
- * total_segment [IN]
- * index [IN]
- * mr [IN]
- * RETURNS
- * ref : reference number(?)
- * total_segment : number of total segments(?)
- * index : segment number -1(?)
- * mr : message reference(?)
- *****************************************************************************/
- void mmi_frm_sms_add_delivery_report_awaited(U16 reference_number, U8 total_segment, U8 index, U8 mr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 ref_no = reference_number;
- U8 total_seg = total_segment;
- U8 box_index = index;
- U8 msg_reference = mr;
- mmi_frm_sms_delivery_report_box_struct *box;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (mmi_frm_sms_delivery_report_awaited[mmi_frm_sms_delivery_report_awaited_next_available].box_number != 0)
- {
- mmi_frm_sms_remove_delivery_report_awaited(mmi_frm_sms_delivery_report_awaited_next_available);
- }
- mmi_frm_sms_delivery_report_awaited[mmi_frm_sms_delivery_report_awaited_next_available].ref = ref_no;
- mmi_frm_sms_delivery_report_awaited[mmi_frm_sms_delivery_report_awaited_next_available].box_number = total_seg;
- mmi_frm_sms_delivery_report_awaited[mmi_frm_sms_delivery_report_awaited_next_available].result =
- ST_COMP_MSG_RECV_BY_SME;
- mmi_frm_sms_delivery_report_awaited[mmi_frm_sms_delivery_report_awaited_next_available].ptr = OslMalloc(total_seg * sizeof(mmi_frm_sms_delivery_report_box_struct));
- memset(
- (S8*) mmi_frm_sms_delivery_report_awaited[mmi_frm_sms_delivery_report_awaited_next_available].ptr,
- 0,
- total_seg * sizeof(mmi_frm_sms_delivery_report_box_struct));
- box = mmi_frm_sms_delivery_report_awaited[mmi_frm_sms_delivery_report_awaited_next_available].ptr;
- box[box_index].mr = msg_reference;
- mmi_frm_sms_delivery_report_awaited_next_available++;
- if (mmi_frm_sms_delivery_report_awaited_next_available == MMI_FRM_SMS_ACTION_SIZE)
- {
- mmi_frm_sms_delivery_report_awaited_next_available = 0;
- }
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_delivery_report_awaited_result
- * DESCRIPTION
- * get result of delivery report awaited list entry
- * PARAMETERS
- * delivery_report_awaited_index [IN]
- * RETURNS
- * delivery_report_awaited_index : index of delivery report list
- *****************************************************************************/
- U8 mmi_frm_sms_get_delivery_report_awaited_result(U16 delivery_report_awaited_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return mmi_frm_sms_delivery_report_awaited[delivery_report_awaited_index].result;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_delivery_report_awaited
- * DESCRIPTION
- * entry of check delivery report awaited list
- * PARAMETERS
- * inMsg [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_check_delivery_report_awaited(MMI_FRM_SMS_SEND_MSG_RSP_STRUCT *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_SEND_MSG_RSP_STRUCT *msgRsp = inMsg;
- U16 delivery_report_awaited_index;
- U16 ref = msgRsp->concat_info.ref;
- U8 msg_reference = msgRsp->mr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (msgRsp->result == TRUE) /* success */
- {
- /* check if mr is in delivery report awaited list */
- delivery_report_awaited_index = mmi_frm_sms_get_delivery_report_index_by_mr(msg_reference);
- /* mr is in delivery report awaited list */
- while (delivery_report_awaited_index != MMI_FRM_SMS_ACTION_SIZE)
- {
- mmi_frm_sms_remove_delivery_report_awaited(delivery_report_awaited_index);
- /* check if mr is in delivery report awaited list */
- delivery_report_awaited_index = mmi_frm_sms_get_delivery_report_index_by_mr(msg_reference);
- }
- /* Single-segment msg is always added into awaited list. Ref of single-segment msg is always zero. */
- if (msgRsp->concat_info.total_seg == 1)
- {
- delivery_report_awaited_index = MMI_FRM_SMS_ACTION_SIZE;
- }
- else
- {
- delivery_report_awaited_index = mmi_frm_sms_get_delivery_report_index_by_ref(ref);
- }
- /* reference number not in awaited list, add an entry to delivery report awaited list */
- if (delivery_report_awaited_index == MMI_FRM_SMS_ACTION_SIZE)
- {
- U8 total_seg = msgRsp->concat_info.total_seg;
- U8 box_index = msgRsp->concat_info.seg - 1; /* start from 0 */
- /* add entry to delivery report awaited list */
- mmi_frm_sms_add_delivery_report_awaited(ref, total_seg, box_index, msg_reference);
- }
- /* reference number is in awaited list */
- else
- {
- U8 box_index = msgRsp->concat_info.seg - 1; /* start from 0 */
- /* add mr to delivery report awaited list */
- mmi_frm_sms_set_delivery_report_awaited_mr(delivery_report_awaited_index, msg_reference, box_index);
- }
- }
- /* Send_RSP fail */
- else
- {
- /* Single-segment msg should not be taken care. */
- if (msgRsp->concat_info.total_seg == 1)
- {
- delivery_report_awaited_index = MMI_FRM_SMS_ACTION_SIZE;
- }
- else
- {
- delivery_report_awaited_index = mmi_frm_sms_get_delivery_report_index_by_ref(ref);
- }
- /* reference number in awaited list */
- while (delivery_report_awaited_index != MMI_FRM_SMS_ACTION_SIZE)
- {
- mmi_frm_sms_remove_delivery_report_awaited(delivery_report_awaited_index);
- delivery_report_awaited_index = mmi_frm_sms_get_delivery_report_index_by_ref(ref);
- }
- }
- }
- #endif /* __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_handle_extension_char
- * DESCRIPTION
- * added '1b' before extionsion char
- * caller must make sure the dstBuf size is at least twice more than srcBuf size
- * PARAMETERS
- * dstBuf [?]
- * srcBuf [?]
- * charNum [IN] number of char in srcBuffer
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_handle_extension_char(U16 *dstBuf, U16 *srcBuf, U16 charNum)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 *dstBuffer = dstBuf;
- U16 *srcBuffer = srcBuf;
- U16 charNumber = charNum;
- U16 c;
- U16 srcCount = 0;
- U16 dstCount = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (srcCount < charNumber)
- {
- c = srcBuffer[srcCount];
- if (UI_TEST_GSM_EXTENDED(c))
- {
- dstBuffer[dstCount] = EMS_ESCAPE_CHARACTER;
- dstCount++;
- }
- dstBuffer[dstCount] = c;
- srcCount++;
- dstCount++;
- }
- dstBuffer[dstCount] = ' ';
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_count_extension_char
- * DESCRIPTION
- * count the number of extension characters in buff
- * PARAMETERS
- * buff [?]
- * char_num [IN]
- * RETURNS
- * number of extension characters in buff
- *****************************************************************************/
- U32 mmi_frm_sms_count_extension_char(U16 *buff, U32 char_num)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 extension_char_num = 0;
- U32 count = 0;
- U16 c;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (count < char_num)
- {
- c = buff[count];
- if (UI_TEST_GSM_EXTENDED(c))
- {
- extension_char_num++;
- }
- count++;
- }
- return extension_char_num;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_UCS2
- * DESCRIPTION
- * check if UCS2 char exists
- * PARAMETERS
- * buf [?]
- * charNum [IN] number of char in buffer
- * RETURNS
- * return true if UCS2 char exists, else return false
- *****************************************************************************/
- BOOL mmi_frm_sms_check_UCS2(U16 *buf, U16 charNum)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 *buffer = buf;
- U16 charNumber = charNum;
- U16 c;
- U16 count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (count < charNumber)
- {
- c = buffer[count];
- if (UI_TEST_UCS2_CHARACTER(c))
- {
- return KAL_TRUE;
- }
- count++;
- }
- return KAL_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_dst_number
- * DESCRIPTION
- * check if the number is valid
- * PARAMETERS
- * num [?] dst number
- * numLen [IN] number length
- * RETURNS
- * return true if number is valid, else return false
- *****************************************************************************/
- BOOL mmi_frm_sms_check_dst_number(U8 *num, U8 numLen)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *number = num;
- U8 numberlen = numLen;
- U8 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (; i < numberlen; i++)
- {
- U8 digit = number[i];
- if (digit == 'p' || digit == 'P' || digit == 'w' || digit == 'W')
- {
- return KAL_FALSE;
- }
- }
- return KAL_TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_is_in_sim_refresh
- * DESCRIPTION
- * return if in sim refresh
- * PARAMETERS
- * void
- * RETURNS
- * return true if in sim refresh, else return false
- *****************************************************************************/
- BOOL mmi_frm_sms_is_in_sim_refresh(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((mmi_frm_sms_list_done) && (!g_frm_sms_cntx.mmi_frm_sms_ready))
- {
- return KAL_TRUE;
- }
- return KAL_FALSE;
- }
- #ifdef __MMI_UNIFIED_MESSAGE__
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_read_sms_content
- * DESCRIPTION
- * Get start up sms content
- * PARAMETERS
- * entry [?] Message entry info
- * content [?] Message content
- * RETURNS
- * object present
- *****************************************************************************/
- U8 mmi_frm_sms_get_read_sms_content(MMI_FRM_SMS_GET_MSG_RSP_STRUCT *entry, U8 *content)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *date_p = entry->msg_data;
- EMSData *pEMSdata = NULL;
- U8 *textBuff;
- U8 *TPUD[1];
- U8 TPUDLEN[1];
- U8 is_obj_present = 0;
- U16 buffLen = entry->no_msg_data;
- U16 textLen = 0;
- U8 totalseg = 1; /* always extract one segment at one time */
- EMSTATUS result;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- TPUDLEN[0] = (U8) buffLen;
- TPUD[0] = (U8*) date_p;
- if (entry->dcs != SMSAL_UCS2_DCS)
- {
- buffLen *= 2;
- }
- if (buffLen)
- {
- pEMSdata = OslMalloc(sizeof(EMSData));
- textBuff = OslMalloc(buffLen);
- result = EMSMsgPreview(
- totalseg,
- entry->dcs,
- (U8) GetUDHIBit(entry->fo),
- TPUD,
- TPUDLEN,
- buffLen,
- textBuff,
- &is_obj_present,
- &textLen);
- if (result == EMS_OK)
- {
- kal_uint16 content_len = 0;
- pEMSdata->textBuffer = textBuff;
- pEMSdata->textBufferSize = entry->no_msg_data;
- pEMSdata->textLength = textLen;
- pEMSdata->dcs = entry->dcs;
- EMS_ConvertGSM7BitDefaultEncodingToAsciiWithoutEMSlib(pEMSdata);
- content_len = (pEMSdata->textLength < MMI_FRM_SMS_MSG_LEN) ? pEMSdata->textLength : MMI_FRM_SMS_MSG_LEN;
- memcpy((S8*) content, (S8*) pEMSdata->textBuffer, content_len);
- }
- else
- {
- memset((S8*) content, 0, ENCODING_LENGTH);
- }
- OslMfree(textBuff);
- OslMfree(pEMSdata);
- }
- else
- {
- memset((S8*) content, 0, ENCODING_LENGTH);
- }
- return is_obj_present;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_startup_sms_content
- * DESCRIPTION
- * Get start up sms content
- * PARAMETERS
- * entry [?] Message entry info
- * content [?] Message content
- * RETURNS
- * object present
- *****************************************************************************/
- U8 mmi_frm_sms_get_startup_sms_content(MMI_FRM_SMS_STARTUP_READ_MSG_IND_STRUCT *entry, U8 *content)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *date_p = entry->msg_data;
- EMSData *pEMSdata = NULL;
- U8 *textBuff;
- U8 *TPUD[1];
- U8 TPUDLEN[1];
- U8 is_obj_present = 0;
- U16 buffLen = entry->no_msg_data;
- U16 textLen = 0;
- U8 totalseg = 1; /* always extract one segment at one time */
- EMSTATUS result;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- TPUDLEN[0] = (U8) buffLen;
- TPUD[0] = (U8*) date_p;
- if (entry->dcs != SMSAL_UCS2_DCS)
- {
- buffLen *= 2;
- }
- if (buffLen)
- {
- pEMSdata = OslMalloc(sizeof(EMSData));
- textBuff = OslMalloc(buffLen);
- result = EMSMsgPreview(
- totalseg,
- entry->dcs,
- (U8) GetUDHIBit(entry->fo),
- TPUD,
- TPUDLEN,
- buffLen,
- textBuff,
- &is_obj_present,
- &textLen);
- if (result == EMS_OK)
- {
- kal_uint16 content_len = 0;
- pEMSdata->textBuffer = textBuff;
- pEMSdata->textBufferSize = entry->no_msg_data;
- pEMSdata->textLength = textLen;
- pEMSdata->dcs = entry->dcs;
- EMS_ConvertGSM7BitDefaultEncodingToAsciiWithoutEMSlib(pEMSdata);
- content_len = (pEMSdata->textLength < MMI_FRM_SMS_MSG_LEN) ? pEMSdata->textLength : MMI_FRM_SMS_MSG_LEN;
- memcpy((S8*) content, (S8*) pEMSdata->textBuffer, content_len);
- }
- else
- {
- memset((S8*) content, 0, ENCODING_LENGTH);
- }
- OslMfree(textBuff);
- OslMfree(pEMSdata);
- }
- else
- {
- memset((S8*) content, 0, ENCODING_LENGTH);
- }
- return is_obj_present;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_add_content_to_entry
- * DESCRIPTION
- * Add message content to message box structure
- * PARAMETERS
- * entry [?]
- * content [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_add_content_to_entry(mmi_frm_sms_msgbox_struct *entry, U8 *content)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) entry->content, 0, mmi_msg_get_max_content_size() * ENCODING_LENGTH);
- /* Decrease one due to the null terminator */
- pfnUnicodeStrncpy((S8*) entry->content, (S8*) content, mmi_msg_get_max_content_size() - 1);
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_content
- * DESCRIPTION
- * get msg content
- * PARAMETERS
- * msg_box_type [IN]
- * msg_list_index [IN]
- * content [?]
- * max_subject_len [IN]
- * RETURNS
- * void
- *****************************************************************************/
- kal_bool mmi_frm_sms_get_content(
- kal_uint8 msg_box_type,
- kal_uint16 msg_list_index,
- kal_wchar *content,
- kal_uint8 max_subject_len)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 entryindex = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (msg_box_type)
- {
- case MMI_FRM_SMS_INBOX:
- case MMI_FRM_SMS_UNREAD:
- entryindex = mmi_frm_sms_inbox_list[msg_list_index];
- break;
- case MMI_FRM_SMS_OUTBOX:
- entryindex = mmi_frm_sms_outbox_list[msg_list_index];
- break;
- case MMI_FRM_SMS_DRAFTS:
- case MMI_FRM_SMS_UNSENT:
- entryindex = mmi_frm_sms_drafts_list[msg_list_index];
- break;
- default:
- entryindex = msg_list_index;
- }
- pfnUnicodeStrncpy((S8*) content, (S8*) mmi_frm_sms_msg_box[entryindex].content, max_subject_len);
- return KAL_TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_next_unsent_msg
- * DESCRIPTION
- * get next unsent sms msg index
- * PARAMETERS
- * current_msg_index [?]
- * RETURNS
- * void
- *****************************************************************************/
- kal_bool mmi_frm_sms_get_next_unsent_msg(kal_uint16 *current_msg_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- kal_uint16 index = *current_msg_index;
- U8 *address = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (index < mmi_frm_sms_drafts_size)
- {
- address = mmi_frm_sms_get_sms_address(MMI_FRM_SMS_APP_DRAFTS, index);
- if (strlen((char*)address))
- {
- *current_msg_index = index;
- return KAL_TRUE;
- }
- index++;
- }
- return KAL_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_next_draft_msg
- * DESCRIPTION
- * get next draft sms msg index
- * PARAMETERS
- * current_msg_index [?]
- * RETURNS
- * void
- *****************************************************************************/
- kal_bool mmi_frm_sms_get_next_draft_msg(kal_uint16 *current_msg_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- kal_uint16 index = *current_msg_index;
- U8 *address = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (index < mmi_frm_sms_drafts_size)
- {
- address = mmi_frm_sms_get_sms_address(MMI_FRM_SMS_APP_DRAFTS, index);
- if (strlen((char*)address) == 0)
- {
- *current_msg_index = index;
- return KAL_TRUE;
- }
- index++;
- }
- return KAL_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_unsent_msg_num
- * DESCRIPTION
- * get sms msg number of each msg box
- * PARAMETERS
- * unsent_msg_number [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_get_unsent_msg_num(kal_uint16 *unsent_msg_number)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- kal_uint16 current_msg_index = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- (*unsent_msg_number) = 0;
- while (mmi_frm_sms_get_next_unsent_msg(¤t_msg_index))
- {
- (*unsent_msg_number)++;
- current_msg_index++;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_draft_msg_num
- * DESCRIPTION
- * get sms msg number of each msg box
- * PARAMETERS
- * draft_msg_number [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_get_draft_msg_num(kal_uint16 *draft_msg_number)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- kal_uint16 current_msg_index = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- (*draft_msg_number) = 0;
- while (mmi_frm_sms_get_next_draft_msg(¤t_msg_index))
- {
- (*draft_msg_number)++;
- current_msg_index++;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_highlight_ind
- * DESCRIPTION
- * indicate UM to change highlighted msg
- * PARAMETERS
- * msg_box_type [IN]
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_highlight_ind(U8 msg_box_type, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 type;
- U16 msg_list_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (msg_box_type == MMI_FRM_SMS_NOBOX)
- {
- mmi_frm_sms_get_list_index(&type, &msg_list_index, index);
- if (type == MMI_FRM_SMS_INBOX)
- {
- type = UM_MSG_BOX_TYPE_INBOX;
- }
- else if (type == MMI_FRM_SMS_OUTBOX)
- {
- type = UM_MSG_BOX_TYPE_SENT;
- }
- else
- {
- U8 *address = NULL;
- address = mmi_frm_sms_get_sms_address(MMI_FRM_SMS_APP_DRAFTS, msg_list_index);
- if (strlen((char*)address))
- {
- type = UM_MSG_BOX_TYPE_UNSENT;
- }
- else
- {
- type = UM_MSG_BOX_TYPE_DRAFT;
- }
- }
- }
- else
- {
- switch (msg_box_type)
- {
- case MMI_FRM_SMS_INBOX:
- {
- type = UM_MSG_BOX_TYPE_INBOX;
- msg_list_index = index;
- }
- break;
- case MMI_FRM_SMS_OUTBOX:
- {
- type = UM_MSG_BOX_TYPE_SENT;
- msg_list_index = index;
- }
- break;
- case MMI_FRM_SMS_UNSENT:
- {
- type = UM_MSG_BOX_TYPE_UNSENT;
- msg_list_index = index;
- }
- break;
- case MMI_FRM_SMS_DRAFTS:
- {
- type = UM_MSG_BOX_TYPE_DRAFT;
- msg_list_index = index;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- }
- mmi_um_highlight_msg_ind(UM_MSG_TYPE_SMS, type, msg_list_index);
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_add_escape_symbol_for_extension_char
- * DESCRIPTION
- * added '1b' before extionsion char
- * caller must make sure the dstBuf size is large enough
- * The Euro sign is handled in this API.
- * PARAMETERS
- * dstBuf [?]
- * srcBuf [?]
- * charNum [IN] number of char in srcBuffer
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_add_escape_symbol_for_extension_char(U16 *dstBuf, U16 *srcBuf, U16 charNum)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 *dstBuffer = dstBuf;
- U16 *srcBuffer = srcBuf;
- U16 charNumber = charNum;
- U16 c;
- U16 srcCount = 0;
- U16 dstCount = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (srcCount < charNumber)
- {
- c = srcBuffer[srcCount];
- if (MMI_SMS_TEST_GSM7BIT_EXTENDED(c))
- {
- dstBuffer[dstCount] = EMS_ESCAPE_CHARACTER;
- dstCount++;
- }
- if (c == MMI_SMS_EURO_SIGN)
- {
- dstBuffer[dstCount] = EMS_EURO_CHARACTER;
- }
- else
- {
- dstBuffer[dstCount] = c;
- }
-
- srcCount++;
- dstCount++;
- }
- dstBuffer[dstCount] = ' ';
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_remove_escape_symbol_for_extension_char
- * DESCRIPTION
- * remove '1b' before extionsion char
- * caller must make sure the dstBuf size is large enough
- * The Euro sign is handled in this API.
- * PARAMETERS
- * dstBuf [?]
- * srcBuf [?]
- * charNum [IN] number of char in srcBuffer
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_remove_escape_symbol_for_extension_char(U16 *dstBuf, U16 *srcBuf, U16 charNum)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 *dstBuffer = dstBuf;
- U16 *srcBuffer = srcBuf;
- U16 charNumber = charNum;
- U16 c;
- U16 srcCount = 0;
- U16 dstCount = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (srcCount < charNumber)
- {
- c = srcBuffer[srcCount];
- if (c == EMS_ESCAPE_CHARACTER)
- {
- srcCount++;
- c = srcBuffer[srcCount];
- if (c == EMS_EURO_CHARACTER)
- {
- dstBuffer[dstCount] = MMI_SMS_EURO_SIGN;
-
- srcCount++;
- dstCount++;
- }
- continue;
- }
- dstBuffer[dstCount] = c;
-
- srcCount++;
- dstCount++;
- }
- dstBuffer[dstCount] = ' ';
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_init_msgbox
- * DESCRIPTION
- * Init message box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_init_msgbox(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(
- (S8*) mmi_frm_sms_inbox_list,
- MMI_FRM_SMS_INVALID_NUM,
- sizeof(U16) * g_frm_sms_cntx.mmi_frm_sms_msg_box_size);
- memset(
- (S8*) mmi_frm_sms_outbox_list,
- MMI_FRM_SMS_INVALID_NUM,
- sizeof(U16) * g_frm_sms_cntx.mmi_frm_sms_msg_box_size);
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- memset(
- (S8*) mmi_frm_sms_drafts_list,
- MMI_FRM_SMS_INVALID_NUM,
- sizeof(U16) * g_frm_sms_cntx.mmi_frm_sms_msg_box_size);
- #endif /* __MMI_MESSAGES_DRAFT_BOX__ */
- memset(
- (S8*) mmi_frm_sms_msg_box,
- MMI_FRM_SMS_INVALID_NUM,
- sizeof(mmi_frm_sms_msgbox_struct) * g_frm_sms_cntx.mmi_frm_sms_msg_box_size);
- memset(
- (S8*) mmi_frm_sms_index_list,
- MMI_FRM_SMS_INVALID_NUM,
- sizeof(mmi_frm_sms_index_struct) * g_frm_sms_cntx.mmi_frm_sms_msg_box_size);
- memset(
- (S8*) mmi_frm_sms_awaited,
- MMI_FRM_SMS_INVALID_NUM,
- sizeof(mmi_frm_sms_deliver_msg_struct) * (MMI_FRM_SMS_ACTION_SIZE + 1));
- memset((S8*) mmi_frm_sms_awaited_counter, MMI_FRM_SMS_INVALID_NUM, sizeof(U8) * (MMI_FRM_SMS_ACTION_SIZE));
- memset(
- (S8*) mmi_frm_sms_data,
- MMI_FRM_SMS_INVALID_NUM,
- sizeof(mmi_frm_sms_deliver_data_struct) * (MMI_FRM_SMS_ACTION_SIZE + 1));
- memset((S8*) mmi_frm_sms_data_counter, MMI_FRM_SMS_INVALID_NUM, sizeof(U8) * (MMI_FRM_SMS_ACTION_SIZE));
- memset((S8*) mmi_frm_sms_content, 0, sizeof(mmi_frm_sms_content_struct) * (MMI_FRM_SMS_MSG_CONTENT_NUM + 1));
- #ifdef __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__
- memset(
- (S8*) mmi_frm_sms_delivery_report_awaited,
- 0,
- sizeof(mmi_frm_sms_delivery_report_list_struct) * (MMI_FRM_SMS_ACTION_SIZE));
- #endif /* __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__ */
- for (i = 0; i < (MMI_FRM_SMS_MSG_CONTENT_NUM + 1); i++)
- {
- mmi_frm_sms_content[i].segment = MMI_FRM_SMS_INVALID_NUM;
- mmi_frm_sms_content[i].nextindex = MMI_FRM_SMS_INVALID_NUM;
- }
- mmi_frm_sms_inbox_size = 0;
- mmi_frm_sms_outbox_size = 0;
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- mmi_frm_sms_drafts_size = 0;
- #endif
- /* reset message icon in the status bar in case of sim refresh */
- g_msg_cntx.msg_full_ind = FALSE;
- g_msg_cntx.msg_ind_in_idle = FALSE;
- mmi_msg_set_msg_icon(FALSE, FALSE);
- }
- #endif /* __MOD_SMSAL__ */