如果你只是发送文件,使用下面的函数,把文件插入到彩信内容中,
1. mms_content_insert_hdlr()
然后填入发送地址
1. g_jmms_context->to_address_p->address_p
彩信主题
1. g_jmms_context->subject_input_buffer
然后调用发送就行了,
1. mmi_jmms_entry_write_mms_done_send_only();
注意结构体其他的变量的初始化和设置,比如发送地址相关的
1. g_jmms_context->num_total_addresses = 1;
2. g_jmms_context->num_to_addresses = 1;
3. g_jmms_context->g_address_option_index = E_ADD_NUMBER;
1. mms_content_insert_hdlr()
然后填入发送地址
1. g_jmms_context->to_address_p->address_p
彩信主题
1. g_jmms_context->subject_input_buffer
然后调用发送就行了,
1. mmi_jmms_entry_write_mms_done_send_only();
注意结构体其他的变量的初始化和设置,比如发送地址相关的
1. g_jmms_context->num_total_addresses = 1;
2. g_jmms_context->num_to_addresses = 1;
3. g_jmms_context->g_address_option_index = E_ADD_NUMBER;
static void MyApp_send_mms()
{
JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
/* from : void mmi_jmms_entry_write_message(void) */
if (mmi_jmms_is_ready_without_store(1)){
return;
}
g_jmms_context->g_use_local_send_setings = 0;
g_jmms_context->store_context->current_folder_name = E_JMMS_WRITE_MMS;
mmi_jmms_init_msg_context_struct();
/* Filled mms sending settings structure either by using MMS PDU or NVRAM. */
mmi_jmms_fill_mms_sending_settings();
if (g_jmms_context->compose_context == NULL){
g_jmms_context->compose_context =
(mmi_jmms_compose_context_struct*)
jdd_MemAlloc(sizeof(mmi_jmms_compose_context_struct), 1);
if (g_jmms_context->compose_context == NULL){
DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
return;
}
}
/* 初始化一些成员 */
if (JMMS_COMP_OK != mmi_jmms_compose_new_mms()){
/* 出错处理 */
return;
}
/* from : void mmi_jmms_entry_write_message_screen(void) */
#ifdef __MMI_UNIFIED_MESSAGE__
mmi_jmms_jdi_deinitview(g_jmms_context->msg_handle);
#endif
if (g_jmms_context->compose_context == NULL){
g_jmms_context->compose_context =
(mmi_jmms_compose_context_struct*)
jdd_MemAlloc(sizeof(mmi_jmms_compose_context_struct), 1);
if (g_jmms_context->compose_context == NULL){
/* 出错处理 */
DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
return;
}
}
set_leading_zero(FALSE);
/* 有问题 */
g_jmms_context->is_add_media_as_drm = MMI_FALSE;
/* from: mmi_jmms_callback_filemgr_select_attachment() */
/* 添加附件的代码 */
if (g_jmms_context->compose_context->media_path_p != NULL){
jdd_MemFree(g_jmms_context->compose_context->media_path_p);
g_jmms_context->compose_context->media_path_p = NULL;
}
g_jmms_context->compose_context->media_path_p =
(S8*) jdd_MemAlloc((pfnUnicodeStrlen((S8 *)DEMO_TXT_FILE) + 1), sizeof(JC_CHAR));
if (g_jmms_context->compose_context->media_path_p == NULL){
/* 出错处理 */
DisplayPopup((PU8)GetString(STR_ID_JMMS_OUT_OF_MEMORY),
IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
return;
}
pfnUnicodeStrcpy((S8*) g_jmms_context->compose_context->media_path_p, (S8*)DEMO_TXT_FILE);
/* 添加附件,并且释放media_path_p的空间 */
//mms_content_insert_hdlr();
/* 将下面的函数里面具体在剔除一些东西 */
//mmi_jmms_fm_add_attachment(); //添加文件到附件中了
err_code = mmi_jmms_compose_add_media(g_jmms_context->compose_context->media_path_p,
E_MEDIA_OTHERS, E_TRUE, 0);
jdd_MemFree(g_jmms_context->compose_context->media_path_p);
g_jmms_context->compose_context->media_path_p = NULL;
/* 添加 to 收信人地址 */
g_jmms_context->address_list_flag = E_TO_ADDRESSES;
g_jmms_context->num_to_addresses = 0;
/* 添加to地址,并且处理相关变量 */
mmi_jmms_add_address_in_addresse_list((S8 *)L"159xxxxxxxx");
/* 添加 subject 主题 */
/* subject_input_buffer 是数组 */
pfnUnicodeStrcpy((S8*)g_jmms_context->subject_input_buffer, (S8*)MMS_SUBJECT);
//memcpy(g_jmms_context->subject_input_buffer, L"data", 4);
/* 准备调用发送函数前的处理 */
g_jmms_context->nvram_compose_settings.creation_mode = E_CREAT_MODE_FREE; //不知道是否前面做了处理
/* 发送 */
mmi_jmms_entry_write_mms_done_send_only();
}