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

📄 jmmstemplatesui.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
            IMG_GLOBAL_WARNING,
            1,
            JMMS_POPUP_TIME,
            WARNING_TONE,
            mmi_jmms_entry_write_message_screen);
    }

  END:
    if (g_jmms_context->pParseContent != NULL)
    {
        if (g_jmms_context->pParseContent->pFileName != NULL)
        {
            jdd_MemFree(g_jmms_context->pParseContent->pFileName);
            g_jmms_context->pParseContent->pFileName = NULL;
        }
        jdd_MemFree(g_jmms_context->pParseContent);
        g_jmms_context->pParseContent = NULL;
    }

    if (eRet != JC_OK && g_jmms_context->msg_handle != NULL)
    {
        eRet = mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
        g_jmms_context->msg_handle = NULL;
    }
    g_jmms_context->is_add_media_warning = 0;
    DeleteScreenIfPresent(SCR_ID_JMMS_PARSING_PROGRESS);
}


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

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    mmi_jmms_show_mms_properties(E_MSG_NEW_MMS_TEMPLATES, MMI_JMMS_TEMPLATES);

}


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

    PU8 gui_buffer; /* Buffer holding history data */
    S8 temp[14];
    S32 size_kb = 0, size_bytes = 0;
    JC_UINT32 size = 0;
    JC_RETCODE eRet = JC_OK;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    EntryNewScreen(SCR_ID_JMMS_NOTIFICATION_PROPERTIES, NULL, mmi_jmms_show_template_properties, NULL);

    gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_NOTIFICATION_PROPERTIES);

    /* /Subject */
    pfnUnicodeStrcpy((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_SUBJECT));

    memset(temp, 0x00, 14);
    AnsiiToUnicodeString((PS8) temp, (PS8) "\n----\n");
    pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);

    if (((MESSAGE_SEND*) g_jmms_context->MsgHeader_type_p)->pSubject == NULL)
    {
        pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
    }
    else
    {
        pfnUnicodeStrcat((S8*) subMenuData, (S8*) ((MESSAGE_SEND*) g_jmms_context->MsgHeader_type_p)->pSubject);
    }

    /* /Size of MMS */

    /* /size is returned in Bytes */
    eRet = mmi_jmms_jdi_get_size(g_jmms_context->msg_handle, 0, &size);
    if (eRet != JC_OK)
    {
        if (g_jmms_context->msg_handle != NULL)
        {
            mmi_jmms_deinit_mms_context(g_jmms_context);
        }
    }

    memset(temp, 0x00, 14);
    AnsiiToUnicodeString((PS8) temp, (PS8) "\n\n");
    pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
    pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_SIZE));

    memset(temp, 0x00, 14);
    AnsiiToUnicodeString((PS8) temp, (PS8) "\n----\n");
    pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);

    size_kb = size / 1024;
    size_bytes = size % 1024;

    if (size_kb >= 1)
    {
        size_kb++;
        memset(temp, 0x00, 14);
        gui_itoa((S32) size_kb, (UI_string_type) temp, 10);
        pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
        memset(temp, 0x00, 4);
        AnsiiToUnicodeString((PS8) temp, (PS8) " ");
        pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
        pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_KB));

    }
    else
    {
        memset(temp, 0x00, 14);
        gui_itoa((S32) size_bytes, (UI_string_type) temp, 10);
        pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
        memset(temp, 0x00, 4);
        AnsiiToUnicodeString((PS8) temp, (PS8) " ");
        pfnUnicodeStrcat((S8*) subMenuData, (S8*) temp);
        pfnUnicodeStrcat((S8*) subMenuData, (S8*) GetString(STR_ID_JMMS_BYTES));
    }

    ShowCategory78Screen(
        STR_MMS_MENUENTRY,
        GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
        NULL,
        NULL,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        NULL,
        (U8*) subMenuData,
        pfnUnicodeStrlen((S8*) subMenuData),
        gui_buffer);

    SetRightSoftkeyFunction(mm_jmms_back_from_template_properties, KEY_EVENT_UP);
    SetKeyHandler(mm_jmms_back_from_template_properties, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
	if (isInCall() == FALSE)
		SetKeyHandler(mm_jmms_end_from_template_properties, KEY_END, KEY_EVENT_DOWN);

    return;

}


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

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_jmms_deinit_mms_context(g_jmms_context);
    GoBackHistory();
}


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

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_jmms_deinit_mms_context(g_jmms_context);
    DisplayIdleScreen();

}


/*****************************************************************************
 * FUNCTION
 *  mmi_jmms_create_template_messages
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_jmms_create_template_messages(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    /* U8 i = 0; */
    PU8 img_buff_p;
    S8 *title;

    /* JC_RETCODE eRet = JC_OK; */
    U32 audio_len = 0, image_len = 0;
    U8 *audio_buff = NULL;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /*
     * for (i = 0; i < __MMI_MMS_TEMPLATES_NUM__; i++)
     * {
     */
    title = (S8*) GetString(mms_templates[gtemplate_count].strId);
    img_buff_p = (PU8) GetImage((U16) (mms_templates[gtemplate_count].imageId));
    audio_len = resource_mms_sounds[mms_templates[gtemplate_count].audioId].len;
    audio_buff = (U8*) (resource_mms_sounds[mms_templates[gtemplate_count].audioId].data);

    mmi_jmms_create_template_mms(title, (U8*) (img_buff_p), image_len, audio_buff, audio_len);

    /* } */
}


/*****************************************************************************
 * FUNCTION
 *  mmi_jmms_create_template_mms
 * DESCRIPTION
 *  
 * PARAMETERS
 *  subject         [?]         [?]
 *  image_buff      [?]         [?]
 *  image_len       [IN]        
 *  audio_buff      [?]         [?]
 *  audio_len       [IN]        
 * RETURNS
 *  
 *****************************************************************************/
JC_RETCODE mmi_jmms_create_template_mms(S8 *subject, U8 *image_buff, U32 image_len, U8 *audio_buff, U32 audio_len)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    JC_RETCODE eRet = JC_OK;
    MESSAGE_SEND *pMessageSend = NULL;
    MESSAGE_HEADERS *pMsgHeaders = NULL;
    S32 len = 0;
    JMMS_COMP_ERRCODE err_code;
    U8 content_type_audio[] = "audio/midi";
    JC_IMAGE_INFO img_info = {0, };

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* free any allocated memory */
    PRINT_INFORMATION_2((MMI_TRACE_INFO, "Enters mmi_jmms_create_template_mms"));
    if (g_jmms_context->msg_handle != NULL)
    {
        mmi_jmms_deinit_mms_context(g_jmms_context);
    }

    if (g_jmms_context->compose_context == NULL)
    {
        g_jmms_context->compose_context =
            (jmms_compose_context_struct*) jdd_MemAlloc(sizeof(jmms_compose_context_struct), 1);
        if (g_jmms_context->compose_context == NULL)
        {
            eRet = JC_ERR_MEMORY_ALLOCATION;
            goto END;
        }
    }
    mmi_jmms_free_mms_pdu_memory(g_jmms_context);

    g_jmms_context->MsgHeaders_p = (MESSAGE_HEADERS*) jdd_MemAlloc(sizeof(MESSAGE_HEADERS), 1);

    if (NULL == g_jmms_context->MsgHeaders_p)
    {
        eRet = JC_ERR_MEMORY_ALLOCATION;
        mmi_jmms_free_mms_pdu_memory(g_jmms_context);
        goto END;
    }

    g_jmms_context->MsgHeader_type_p = (MESSAGE_SEND*) jdd_MemAlloc(sizeof(MESSAGE_SEND), 1);
    if (NULL == g_jmms_context->MsgHeader_type_p)
    {
        eRet = JC_ERR_MEMORY_ALLOCATION;
        mmi_jmms_free_mms_pdu_memory(g_jmms_context);
        goto END;
    }

    eRet = mmi_jmms_set_mmsc_version();
    if (eRet != JC_OK)
    {
        mmi_jmms_free_mms_pdu_memory(g_jmms_context);
        goto END;
    }

    pMsgHeaders = g_jmms_context->MsgHeaders_p;
    pMessageSend = g_jmms_context->MsgHeader_type_p;

    pMessageSend->pVersion = (JC_INT8*) g_jmms_context->version;

    pMessageSend->bDeliveryReport = DEFAULT_DELIVERY_REPORT_DURING_SENDING;
    pMessageSend->bReadReport = DEFAULT_READ_REPORT_DURING_SENDING;
    pMessageSend->bHideSender = E_OFF;

    pMessageSend->uiExpiryTime = MAX_VALIDITY_PERIOD_VALUE;

    pMessageSend->uiDeliveryTime = 0;

    pMessageSend->eMsgPriority = E_MSG_PRIORITY_NORMAL;
    pMessageSend->pReplyChargingInfo = NULL;

    pMessageSend->eMsgClass = E_MSG_PERSONAL_CLASS;
    pMessageSend->pTo = NULL;
    pMessageSend->pCc = NULL;
    pMessageSend->pBcc = NULL;

    len = 0;

⌨️ 快捷键说明

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