⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jmmsprotocol.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
                    AnsiiToUnicodeString((S8*) tmp_buff_ucs2, (S8*) "\n");
                    len = len + pfnUnicodeStrlen((S8*) tmp_buff_ucs2);
                    pfnUnicodeStrcat(g_jmms_context->g_jmms_progress_str, (S8*) tmp_buff_ucs2);
                }
            }
            else if (pProgressInd->eStackStatus == E_COMM_STACK_RECEIVING)
            {
                memset(g_jmms_context->g_jmms_progress_str, 0, MAX_PROGRESS_SCREEN_HINT_LEN * ENCODING_LENGTH);

                if ((pProgressInd->uiBytesRecvd) != 0)
                {
                    percentage_of_progress = (pProgressInd->uiBytesRecvd);

                }

                size_kb = pProgressInd->uiBytesRecvd / 1024;
                if (size_kb >= 1)
                {
                    size_kb++;
                    sprintf(tmp_str_ascii, "%d", size_kb);
                }
                else
                {
                    sprintf(tmp_str_ascii, "%d", percentage_of_progress);
                }

                PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "JMMS Downloading Bytes = ", percentage_of_progress));

                AnsiiToUnicodeString(tmp_str_ucs2, tmp_str_ascii);

                len = pfnUnicodeStrlen((S8*) GetString(STR_ID_JMMS_MMS_DOWNLOADING));
                if (len > (MAX_PROGRESS_SCREEN_HINT_LEN - 1))
                {
                    pfnUnicodeStrncpy(
                        g_jmms_context->g_jmms_progress_str,
                        GetString(STR_ID_JMMS_MMS_DOWNLOADING),
                        (MAX_PROGRESS_SCREEN_HINT_LEN - 1));
                    goto END;
                }

                pfnUnicodeStrcpy(g_jmms_context->g_jmms_progress_str, GetString(STR_ID_JMMS_MMS_DOWNLOADING));
                temp_len = len;
/*dilip 31st aug to add space after downloading on downloading progress screen*/
                AnsiiToUnicodeString((S8*) tmp_buff_ucs2, (S8*) " ");
                len = len + pfnUnicodeStrlen((S8*) tmp_buff_ucs2);
                if (len > (MAX_PROGRESS_SCREEN_HINT_LEN - 1))
                {
                    pfnUnicodeStrncat(
                        g_jmms_context->g_jmms_progress_str,
                        (S8*) tmp_buff_ucs2,
                        ((MAX_PROGRESS_SCREEN_HINT_LEN - 1) - temp_len));
                    goto END;
                }

                pfnUnicodeStrcat(g_jmms_context->g_jmms_progress_str, (S8*) tmp_buff_ucs2);
                temp_len = len;
                len = len + pfnUnicodeStrlen(tmp_str_ucs2);
                if (len > (MAX_PROGRESS_SCREEN_HINT_LEN - 1))
                {
                    pfnUnicodeStrncat(
                        g_jmms_context->g_jmms_progress_str,
                        tmp_str_ucs2,
                        ((MAX_PROGRESS_SCREEN_HINT_LEN - 1) - temp_len));
                    goto END;
                }

                pfnUnicodeStrcat(g_jmms_context->g_jmms_progress_str, tmp_str_ucs2);
                temp_len = len;
                AnsiiToUnicodeString((S8*) tmp_buff_ucs2, (S8*) " ");
                len = len + pfnUnicodeStrlen((S8*) tmp_buff_ucs2);
                if (len > (MAX_PROGRESS_SCREEN_HINT_LEN - 1))
                {
                    pfnUnicodeStrncat(
                        g_jmms_context->g_jmms_progress_str,
                        (S8*) tmp_buff_ucs2,
                        ((MAX_PROGRESS_SCREEN_HINT_LEN - 1) - temp_len));
                    goto END;
                }

                pfnUnicodeStrcat(g_jmms_context->g_jmms_progress_str, (S8*) tmp_buff_ucs2);
                temp_len = len;
                if(size_kb >=1)
                {
                    len = len + pfnUnicodeStrlen((S8*) GetString(STR_ID_JMMS_KB));
                    if (len > (MAX_PROGRESS_SCREEN_HINT_LEN - 1))
                    {
                        pfnUnicodeStrncat(
                            g_jmms_context->g_jmms_progress_str,
                            GetString(STR_ID_JMMS_KB),
                            ((MAX_PROGRESS_SCREEN_HINT_LEN - 1) - temp_len));
                        goto END;
                    }
                    pfnUnicodeStrcat(g_jmms_context->g_jmms_progress_str, GetString(STR_ID_JMMS_KB));
                }
                else
                {
                    len = len + pfnUnicodeStrlen((S8*) GetString(STR_ID_JMMS_BYTES));
                    if (len > (MAX_PROGRESS_SCREEN_HINT_LEN - 1))
                    {
                        pfnUnicodeStrncat(
                            g_jmms_context->g_jmms_progress_str,
                            GetString(STR_ID_JMMS_BYTES),
                            ((MAX_PROGRESS_SCREEN_HINT_LEN - 1) - temp_len));
                        goto END;
                    }
                    pfnUnicodeStrcat(g_jmms_context->g_jmms_progress_str, GetString(STR_ID_JMMS_BYTES));
                }
                temp_len = len;
                AnsiiToUnicodeString((S8*) tmp_buff_ucs2, (S8*) " ");
                len = len + pfnUnicodeStrlen((S8*) tmp_buff_ucs2);
                if (len > (MAX_PROGRESS_SCREEN_HINT_LEN - 1))
                {
                    pfnUnicodeStrncat(
                        g_jmms_context->g_jmms_progress_str,
                        (S8*) tmp_buff_ucs2,
                        ((MAX_PROGRESS_SCREEN_HINT_LEN - 1) - temp_len));
                    goto END;
                }
                pfnUnicodeStrcat(g_jmms_context->g_jmms_progress_str, (S8*) tmp_buff_ucs2);

                len = len + pfnUnicodeStrlen((S8*) GetString(STR_ID_JMMS_BYTES_KB_RECIEVED));
                if (len > (MAX_PROGRESS_SCREEN_HINT_LEN - 1))
                {
                    pfnUnicodeStrncat( g_jmms_context->g_jmms_progress_str,
                        GetString(STR_ID_JMMS_BYTES_KB_RECIEVED),
                        ((MAX_PROGRESS_SCREEN_HINT_LEN - 1) - temp_len));
                    goto END;
                }
                pfnUnicodeStrcat(g_jmms_context->g_jmms_progress_str, (S8*) GetString(STR_ID_JMMS_BYTES_KB_RECIEVED));
            }

        }
        else
        {
            return;
        }

      END:
        if (GetActiveScreenId() == SCR_ID_JMMS_PROGRESS)
        {
            cat66_update_progress_string();
        }

    }

}


/*****************************************************************************
 * FUNCTION
 *  mmi_jmms_set_profile
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  
 *****************************************************************************/
JC_RETCODE mmi_jmms_set_profile(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    COMM_PROFILE profile = {0, };
    JC_RETCODE eRet = JC_OK;
    U8 connect_type;
    GENERIC_DATA_CONN pDataConn;
    U8 ip_address[16] = {0x00};

    nvram_mms_profile_content_struct *activated_mms_profile;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_set_profile"));

    activated_mms_profile = mmi_ph_get_activated_mms_profile();

    connect_type = activated_mms_profile->conn_type;

    jc_memset(&profile, 0, sizeof(COMM_PROFILE));

    mmi_jmms_get_ip_address(ip_address, activated_mms_profile->proxy_ip);

    if (connect_type == PH_CONN_TYPE_HTTP)
    {

        if (activated_mms_profile->proxy_port == 0)
        {
            profile.eConnMode = E_COMM_WPHTTP_DIRECT;
            jc_strcpy(profile.szHostName, (JC_INT8*) ip_address);
            profile.uiPortNumber = activated_mms_profile->proxy_port;
        }
        else
        {
            profile.eConnMode = E_COMM_WPHTTP_PROXY;
            jc_strcpy(profile.szHostName, (JC_INT8*) ip_address);
            profile.uiPortNumber = activated_mms_profile->proxy_port;
        }

    }
    else if (connect_type == PH_CONN_TYPE_CONNECTION_OREINTED)
    {
        profile.eConnMode = E_COMM_WSP_CONNECTION_ORIENTED;
        jc_strcpy(profile.szHostName, (JC_INT8*) ip_address);
        profile.uiPortNumber = 0;
    }
    else
    {
        return JC_ERR_MEMORY_ALLOCATION;
    }

    eRet = jdi_CommunicationProfile(g_jmms_context->hCommHandle, &profile);
    if (eRet != JC_OK)
    {
        goto ERROR_HANDLE;
    }

    pDataConn.account_id = activated_mms_profile->data_account;
    eRet = jdi_CommunicationDataConnection(g_jmms_context->hCommHandle, (const GENERIC_DATA_CONN*)&pDataConn);

  ERROR_HANDLE:

    PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d", "mmi_jmms_set_profile return:", eRet));

    return eRet;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_jmms_get_ip_address
 * DESCRIPTION
 *  
 * PARAMETERS
 *  ip_address      [?]     [?]     [?]
 *  proxy_ip        [?]     [?]     [?]
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_jmms_get_ip_address(U8 *ip_address, U8 *proxy_ip)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8 temp[4] = {0x00};

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    sprintf((S8*) ip_address, "%d", proxy_ip[0]);
    strcat((S8*) ip_address, ".");
    sprintf((S8*) temp, "%d", proxy_ip[1]);
    strcat((S8*) ip_address, (S8*) temp);
    strcat((S8*) ip_address, ".");
    memset(temp, 0x00, 4);
    sprintf((S8*) temp, "%d", proxy_ip[2]);
    strcat((S8*) ip_address, (S8*) temp);
    strcat((S8*) ip_address, ".");
    memset(temp, 0x00, 4);
    sprintf((S8*) temp, "%d", proxy_ip[3]);
    strcat((S8*) ip_address, (S8*) temp);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_jmms_get_activated_mmsc_url
 * DESCRIPTION
 *  
 * PARAMETERS
 *  jmms_context        [?]     [?]     [?]
 * RETURNS
 *  
 *****************************************************************************/
U8 *mmi_jmms_get_activated_mmsc_url(jmms_context_struct *jmms_context)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    U8 *mmsc_url = NULL;
    U32 len = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_get_activated_mmsc_url"));
    mmsc_url = mmi_ph_mms_get_activated_profile_mmsc_url(); /* //for getting the mmsc url */
    if (mmsc_url == NULL)
    {
        return NULL;
    }
    len = (strlen((S8*) mmsc_url) + 1) * ENCODING_LENGTH;

    if (jmms_context->activated_mmsc_url != NULL)
    {
        jdd_MemFree(jmms_context->activated_mmsc_url);
    }
    jmms_context->activated_mmsc_url = (U8*) jdd_MemAlloc(sizeof(U8), len);
    if (jmms_context->activated_mmsc_url == NULL)
    {
        return NULL;
    }

    AnsiiToUnicodeString((PS8) (jmms_context->activated_mmsc_url), (PS8) mmsc_url);

    return (jmms_context->activated_mmsc_url);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_jmms_push_ind_callback
 * DESCRIPTION
 *  
 * PARAMETERS
 *  pCommArg            [?]     [?]     [?]
 *  pPushContentInd     [?]     [?]     [?]
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_jmms_push_ind_callback(void *pCommArg, COMM_PUSH_IND *pPushContentInd)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    JC_RETCODE eRet = JC_OK;
    CONTENT_DATA ViewContent = {0, };

    MSG_HANDLE hMsgHandle = NULL;
    MESSAGE_HEADERS *pMsgHdrs = NULL;
    MESSAGE_NOTIFICATION *pNotifyIndHdrs;

    JC_UINT32 msg_index = 0;

    /* JC_UINT32 msgid = 0; */
    U8 number_mms = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_push_ind_callback"));
    if (!wap_is_ready())
    {
        PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS: WAP is not ready"));
        return;
    }
	if(g_jmms_context->init_done == JMMS_READY_WITHOUT_STORE)
	{
        interupt_screen_title=STR_ID_JMMS_MEMORY_ERROR_NEW_MMS_NOTIF_SAVING;
		mmi_jmms_entry_general_pop_screen_in_case_interupt();
		PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS: Store is not ready"));
        return;
	}
    eRet = mmi_jmms_get_total_number_of_messages(&number_mms);
    if (eRet != JC_OK)
    {
        PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s%d", "JMMS Bad Store Module, Return Code: ", eRet));
        ASSERT(0) return;
    }

    if (number_mms >= MAX_POSSIBLE_MESSAGES_THRESHOLD)
    {
        mmi_jmms_update_status_icon_indicator();
    }

    if (number_mms >= MAX_POSSIBLE_MESSAGES)
    {
        mmi_jmms_add_memory_full_node_if_not_already();
        return;
    }

    if (NULL != pPushContentInd->pszContentType)
    {
        if (0 == jc_strcmp(pPushContentInd->pszContentType, "application/vnd.wap.mms-message"))
        {

            ViewContent.uiCurSize = ViewContent.uiTotalSize = pPushContentInd->uiLength;
            /* ViewContent.VIEW_MODE.contentInline.pBuffer = (JC_INT8 *)pPushContentInd->pBuffer  ; */
            ViewContent.pBuffer = (JC_UINT8*) pPushContentInd->pBuffer;

            PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS: Message parsing for Message header starts"));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -