📄 jam_msg_handler.c
字号:
/* | mmi_java_mids_getlist_cnf_struct ( mids_list_struct[1]) | mds_list_struct[mids_count-1] */
/* ^-- *pmids_list */
pmids_list = (mids_list_struct*) ((kal_uint8*) getlist_cnf_ptr +
sizeof(mmi_java_mids_getlist_cnf_struct) - sizeof(mids_list_struct));
mids_info_ptr = saved_mids_listfile_ptr->mids_info_list;
for (i = 0; i < saved_mids_listfile_ptr->mids_avail_count && mids_info_ptr; i++)
{
kal_uint8 attribute;
pmids_list[i].mids_id = i + 1 + mids_start_indx;
pmids_list[i].mids_name = mids_info_ptr->mids_name;
if (mids_info_ptr->mids_icon.icon_size)
{
pmids_list[i].mids_icon = (kal_char*) mids_info_ptr->mids_icon.icon_data;
} else
{
pmids_list[i].mids_icon = NULL;
}
if (mids_start_indx + i < j2me_default_game_count)
{
attribute = IS_DEFAULT_GAME; /* default game can not be updated and removed */
} else
{
attribute = CAN_BE_UPDATE | CAN_BE_REMOVE; /* not a default game */
}
if (mids_info_ptr->jad_url != NULL)
{
/* check if the url starts with "file://" */
if (strncmp((kal_char*) mids_info_ptr->jad_url, "f\0i\0l\0e\0:\0/\0/\0", 14) == 0)
{
attribute &= ~CAN_BE_UPDATE; /* local install game, can not be updated */
}
} else if (mids_info_ptr->jar_url != NULL)
{
/* check if the url starts with "file://" */
if (strncmp((kal_char*) mids_info_ptr->jar_url, "f\0i\0l\0e\0:\0/\0/\0", 14) == 0)
{
attribute &= ~CAN_BE_UPDATE; /* local install game, can not be updated */
}
}
pmids_list[i].mids_attributes = attribute;
pmids_list[i].mid_count = mids_info_ptr->mid_info.mid_count;
mids_info_ptr = mids_info_ptr->mids_list_info_next;
}
ASSERT(i == saved_mids_listfile_ptr->mids_avail_count);
} else
{
getlist_cnf_ptr = (mmi_java_mids_getlist_cnf_struct*)
construct_local_para(sizeof(mmi_java_mids_getlist_cnf_struct), TD_CTRL);
}
getlist_cnf_ptr->session_id = getlist_req_ptr->session_id;
getlist_cnf_ptr->mids_count = mids_count;
/* Reply actual got list start index, and count */
getlist_cnf_ptr->start_indx = mids_start_indx;
getlist_cnf_ptr->mids_list_count = mids_list_count;
getlist_cnf_ptr->error_code = error_code;
if ((getlist_req_ptr->extend_mode == KAL_TRUE) && (getlist_req_ptr->confirm_data_ptr))
{
*getlist_req_ptr->confirm_data_ptr = getlist_cnf_ptr;
kal_set_eg_events(J2ME_getlist_event_group, 1, KAL_OR);
} else
{
send_ilm = allocate_ilm(MOD_J2ME);
send_ilm->src_mod_id = MOD_J2ME;
send_ilm->dest_mod_id = MOD_MMI;
send_ilm->local_para_ptr = (local_para_struct*) getlist_cnf_ptr;
send_ilm->peer_buff_ptr = NULL;
send_ilm->msg_id = MSG_ID_MMI_JAVA_MIDS_GETLIST_CNF;
send_ilm->sap_id = J2ME_MMI_SAP;
msg_send_ext_queue(send_ilm);
}
}
/*****************************************************************************
* FUNCTION
* mid_getlist_req_handler
* DESCRIPTION
*
* PARAMETERS
* ilm_ptr [?]
* RETURNS
* void
*****************************************************************************/
void mid_getlist_req_handler(ilm_struct *ilm_ptr)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
ilm_struct *send_ilm;
kal_int32 error_code = J2ME_NO_ERROR;
mmi_java_mid_getlist_req_struct *getlist_req_ptr;
mmi_java_mid_getlist_cnf_struct *getlist_cnf_ptr = NULL;
kal_int32 mids_id;
mids_list_info_struct *mids_info_ptr = NULL;
mid_list_struct *pmid_list = NULL;
mid_struct *mid_ptr;
kal_int32 i, mid_count;
kal_int32 mids_start_indx;
game_type_enum type = GAMETYPE_INVALID_TYPE;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
kal_trace(TRACE_FUNC, FUNC_J2ME_MID_GETLIST_REQ_HANDLER);
getlist_req_ptr = (mmi_java_mid_getlist_req_struct*) ilm_ptr->local_para_ptr;
mids_id = getlist_req_ptr->mids_id;
type = getlist_req_ptr->game_type;
/* Update working internal system directory path */
work_sys_dir_path = _jvm_get_dir_path(type);
work_info_ptr = _jvm_get_builtin_file_info(type);
/* Add extend list information */
/* if (saved_mids_listfile_ptr == NULL ||
(mids_id <= saved_mids_listfile_ptr->mids_avail_indx) ||
(mids_id > (saved_mids_listfile_ptr->mids_avail_indx + saved_mids_listfile_ptr->mids_avail_count)))
{*/
error_code = jam_parse_midslistfile(type, (mids_id - 1), 1, &saved_mids_listfile_ptr);
// }
if (saved_mids_listfile_ptr)
{
mids_info_ptr = saved_mids_listfile_ptr->mids_info_list;
} else
{
error_code = J2ME_MIDS_NOT_EXIST;
}
if (mids_id && (error_code == J2ME_NO_ERROR))
{
mids_start_indx = saved_mids_listfile_ptr->mids_avail_indx;
/* Find specific mids info */
for (i = 1; i < mids_id - mids_start_indx && mids_info_ptr; i++)
{
mids_info_ptr = mids_info_ptr->mids_list_info_next;
}
ASSERT(mids_info_ptr);
mid_count = mids_info_ptr->mid_info.mid_count;
if (mid_count)
{
getlist_cnf_ptr = (mmi_java_mid_getlist_cnf_struct*) construct_local_para(
(kal_uint16) (sizeof (mmi_java_mid_getlist_cnf_struct) + (mid_count - 1) * sizeof(mid_list_struct)),
TD_CTRL);
pmid_list = (mid_list_struct*) ((kal_uint8*) getlist_cnf_ptr +
sizeof(mmi_java_mid_getlist_cnf_struct) - sizeof(mid_list_struct));
mid_ptr = mids_info_ptr->mid_info.mid_list;
for (i = 0; i < mid_count && mid_ptr; i++)
{
pmid_list[i].mid_id = i + 1;
pmid_list[i].mid_name = mid_ptr->mid_name;
if (mid_ptr->mid_icon.icon_size)
{
pmid_list[i].mid_icon = (kal_char*) mid_ptr->mid_icon.icon_data;
} else
{
pmid_list[i].mid_icon = NULL;
}
mid_ptr = mid_ptr->mid_next;
}
} else
{
getlist_cnf_ptr =
(mmi_java_mid_getlist_cnf_struct*) construct_local_para(
sizeof(mmi_java_mid_getlist_cnf_struct),
TD_CTRL);
}
} else
{
error_code = J2ME_MIDS_NOT_EXIST;
mid_count = 0;
}
getlist_cnf_ptr->session_id = getlist_req_ptr->session_id;
getlist_cnf_ptr->error_code = error_code;
getlist_cnf_ptr->mid_count = mid_count;
send_ilm = allocate_ilm(MOD_J2ME);
send_ilm->src_mod_id = MOD_J2ME;
send_ilm->dest_mod_id = MOD_MMI;
send_ilm->local_para_ptr = (local_para_struct*) getlist_cnf_ptr;
send_ilm->peer_buff_ptr = NULL;
send_ilm->msg_id = MSG_ID_MMI_JAVA_MID_GETLIST_CNF;
send_ilm->sap_id = J2ME_MMI_SAP;
msg_send_ext_queue(send_ilm);
}
/*****************************************************************************
* FUNCTION
* set_engineer_mode_memory
* DESCRIPTION
*
* PARAMETERS
* kal_int32 size
* RETURNS
* kal_bool
*****************************************************************************/
kal_bool set_engineer_mode_memory(int size)
{
#if DATACACHE_FBBR_ON
if(size != 8 * 1024 * 1024 && size != 6 * 1024 * 1024 && size != 4 * 1024 * 1024 && size != 3 * 1024 * 1024 &&
size != 2 * 1024 * 1024 && size != 1024 * 1024 && size != (512 + 1024) * 1024 &&
size != (256 + 1024) * 1024 && size != 768 * 1024 && size != 512 * 1024)
{
return KAL_FALSE;
}
#endif
engineer_mode_memory_size = size;
return KAL_TRUE;
}
/*****************************************************************************
* FUNCTION
* j2me_internal_mid_start_req_handler
* DESCRIPTION
* To launch a specific MIDlet of a MIDlet suite by MIDS ID and MID ID
* PARAMETERS
* ilm_ptr [?]
* RETURNS
* void
*****************************************************************************/
static void
j2me_internal_mid_start_req_handler(ilm_struct *ilm_ptr)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
ilm_struct *send_ilm;
kal_uint32 mids_id = 0;
kal_uint32 mid_id;
kal_uint32 returnCode = 0;
mmi_java_mid_start_req_struct *start_req_ptr = NULL;
java_java_mid_start_req_struct *java_start_req_ptr = NULL;
mmi_java_mid_start_cnf_struct *start_cnf_ptr;
mmi_java_mid_stop_ind_struct *stop_ind_ptr;
mids_list_info_struct *mids_info_ptr;
mid_struct *mid_info_ptr;
kal_wchar *mid_name_str = NULL;
kal_uint32 start_session_id = 0;
kal_uint32 return_size = 0;
game_type_enum type = GAMETYPE_INVALID_TYPE;
kal_char *user_agent;
WCHAR *wfilename;
kal_int32 handle = -1;
kal_bool abort_received = KAL_FALSE;
#ifdef __MMI_FOURWAYS_KEY_DISABLE__
mmi_java_get_confirm_ind_struct *get_confirm;
kal_uint8 vk_permission_level = 0;
#endif /* __MMI_FOURWAYS_KEY_DISABLE__ */
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (ilm_ptr->msg_id == MSG_ID_MMI_JAVA_MID_START_REQ)
{
start_req_ptr = (mmi_java_mid_start_req_struct*) ilm_ptr->local_para_ptr;
start_session_id = start_req_ptr->session_id;
type = (game_type_enum)start_req_ptr->game_type;
mids_id = start_req_ptr->mids_id;
} else if (ilm_ptr->msg_id == MSG_ID_JAVA_JAVA_MID_START_REQ)
{
java_start_req_ptr = (java_java_mid_start_req_struct*) ilm_ptr->local_para_ptr;
start_session_id = java_start_req_ptr->session_id;
type = (game_type_enum)java_start_req_ptr->game_type;
mids_id = java_start_req_ptr->mids_id;
mid_name_str = java_start_req_ptr->mid_name;
}
/* Update working internal system directory path */
work_sys_dir_path = _jvm_get_dir_path(type);
work_info_ptr = _jvm_get_builtin_file_info(type);
wap_prof.result = WAP_PROF_INVALID_ID; /* reset the previous result */
if (!mmi_java_is_no_network_service())
{
kal_uint8 profile_id;
wap_get_prof_content_req_struct *get_prof;
if (ilm_ptr->msg_id == MSG_ID_MMI_JAVA_MID_START_REQ)
{
profile_id = start_req_ptr->wap_prof_id;
} else
{
profile_id = java_start_req_ptr->wap_prof_id;
}
if( profile_id == 0xFF)
{
/* SHK: We do not have a valid profile_id from incoming START_REQ message.
This is the case when user select a DEFAULT in Java Setting->Java Network. So Java has to get WAP's profile setting. */
wap_get_bra_prof_id_req_struct *msg;
msg = (wap_get_bra_prof_id_req_struct*) construct_local_para(sizeof(wap_get_bra_prof_id_req_struct), TD_CTRL);
msg->sim_id = jam_get_sim_id();
send_ilm = allocate_ilm(MOD_J2ME);
send_ilm->src_mod_id = MOD_J2ME;
send_ilm->dest_mod_id = wap_get_service_module(MSG_ID_WAP_GET_BRA_PROF_ID_REQ);
send_ilm->local_para_ptr = (local_para_struct*) msg;;
send_ilm->peer_buff_ptr = NULL;
send_ilm->msg_id = MSG_ID_WAP_GET_BRA_PROF_ID_REQ;
send_ilm->sap_id = J2ME_MMI_SAP;
msg_send_ext_queue(send_ilm);
get_next_event(KAL_TRUE, MSG_ID_WAP_GET_BRA_PROF_ID_RSP, KAL_FALSE, KAL_TRUE, &abort_received);
J2ME_active_nw_acc_id = wap_bra_prof.net_id;
/* SHK: I should get another CSD ID here.
This section of code does nothing but assign net_id2 directly, we separate the case just in case we want to add some error
handling in the future. */
if(0xff != wap_bra_prof.net_id2)
{
/* Valid CSD ID. */
J2ME_active_nw_acc_id_CSD = wap_bra_prof.net_id2;
}
else
{
/* Invalid CSD ID. */
J2ME_active_nw_acc_id_CSD = 255;
}
J2ME_current_active_nw_id = J2ME_active_nw_acc_id;
if (J2ME_current_active_nw_id == 0xFF)
{
wap_prof.result = WAP_PROF_BUSY;
}
jam_set_wap_prof_id(&wap_bra_prof);
profile_id = wap_bra_prof.prof_id;
}
/* SHK: We have a valid profile_id from incoming START_REQ message. So we can use the profile_id to query the GPRS/CSD NW ID.
This is the case when user select a PROFILE ID in Java Setting->Java Network. */
get_prof = construct_local_para(sizeof(wap_get_prof_content_req_struct), TD_CTRL);
get_prof->id = profile_id; /* SHK: Here we query by WAP profile ID. */
get_prof->sim_id = jam_get_sim_id();
send_ilm = allocate_ilm(MOD_J2ME);
send_ilm->src_mod_id = MOD_J2ME;
send_ilm->dest_mod_id = wap_get_service_module(MSG_ID_WAP_GET_PROF_CONTENT_REQ);
send_ilm->local_para_ptr = (local_para_struct*) get_prof;
send_ilm->peer_buff_ptr = NULL;
send_ilm->msg_id = MSG_ID_WAP_GET_PROF_CONTENT_REQ;
send_ilm->sap_id = J2ME_MMI_SAP;
msg_send_ext_queue(send_ilm);
get_next_event(KAL_TRUE, MSG_ID_WAP_GET_PROF_CONTENT_RSP, KAL_FALSE, KAL_TRUE, &abort_received);
jam_set_wap_prof_content (&wap_prof);
if (wap_prof.result == WAP_PROF_SUCCESS)
{
J2ME_active_nw_acc_id = cbm_encode_data_account_id(wap_prof.net_id,
(always_ask_sim_info_enum)jam_get_app_cbm_sim_id(), jam_get_app_id(), KAL_FALSE);
/* SHK: We should get the 2nd CSD ID here.
This section of code does nothing but assign net_id2 directly, we separate the case just in case we want to add some error
handling in the future. */
if(0xff != wap_prof.net_id2)
{
/* Valid CSD ID. */
J2ME_active_nw_acc_id_CSD = cbm_encode_data_account_id(wap_prof.net_id2,
(always_ask_sim_info_enum)jam_get_app_cbm_sim_id(), jam_get_app_id(), KAL_FALSE);
}
else
{
/* Invalid CSD ID. */
J2ME_active_nw_acc_id_CSD = 255;
}
/* SHK: Set GPRS bearer ID as the default NW ID. */
J2ME_current_active_nw_id = J2ME_active_nw_acc_id;
}
else
{
J2ME_active_nw_acc_id = 255;
J2ME_active_nw_acc_id_CSD = 255;
J2ME_current_active_nw_id = J2ME_active_nw_acc_id;
}
}
else
{
/* SHK: There is no SIM card. */
J2ME_active_nw_acc_id = 255;
J2ME_active_nw_acc_id_CSD = 255;
J2ME_current_active_nw_id = J2ME_active_nw_acc_id;
}
#if defined(MMS_SUPPORT)
if (!mmi_java_is_no_network_service())
{
wap_mmc_get_mms_prof_req_struct *get_mms_prof;
get_mms_prof = construct_local_para(sizeof(wap_mmc_get_mms_prof_req_struct), TD_CTRL);
get_mms_prof->access_id = WAP_MMS_PROF_MMSC_ADDRESS;
send_ilm = allocate_ilm(MOD_J2ME);
send_ilm->src_mod_id = MOD_J2ME;
send_ilm->dest_mod_id = wap_get_service_module(MSG_ID_WAP_MMC_GET_MMS_PROF_REQ);
send_ilm->local_para_ptr = (local_para_struct*) get_mms_prof;
send_ilm->peer_buff_ptr = NULL;
send_ilm->msg_id = MSG_ID_WAP_MMC_GET_MMS_PROF_REQ;
send_ilm->sap_id = J2ME_MMI_SAP;
msg_send_ext_queue(send_ilm);
get_next_event(KAL_TRUE, MSG_ID_WAP_MMC_GET_MMS_PROF_RSP, KAL_FALSE, KAL_TRUE, &abort_received);
}
#endif
/* send_ilm = allocate_ilm(MOD_J2ME);
send_ilm->src_mod_id = MOD_J2ME;
send_ilm->dest_mod_id = MOD_WAP;
send_ilm->local_para_ptr = NULL;
send_ilm->peer_buff_ptr = NULL;
send_ilm->msg_id = MSG_ID_WAP_GET_USER_AGENT_REQ;
send_ilm->sap_id = J2ME_MMI_SAP;
msg_send_ext_queue(send_ilm);
get_next_event(KAL_TRUE, MSG_ID_WAP_GET_USER_AGENT_RSP, KAL_FALSE, KAL_FALSE, NULL);*/
user_agent = wap_get_user_agent();
if(user_agent != NULL)
{
Kputs(user_agent);
jam_set_user_agent((kal_uint8*)user_agent, (kal_int16)strlen(user_agent));
}
/* Error! JVM is running, this should not happen */
if (is_jvm_in_busy || wap_prof.result == WAP_PROF_BUSY || wap_prof.result == WAP_PROF_NOT_READY)
{
start_cnf_ptr = construct_local_para(sizeof(mmi_java_mid_start_cnf_struct), TD_CTRL);
start_cnf_ptr->session_id = start_session_id;
start_cnf_ptr->error_code = J2ME_VM_IS_BUSY;
send_ilm = allocate_ilm(MOD_J2ME);
send_ilm->src_mod_id = MOD_J2ME;
send_ilm->dest_mod_id = MOD_MMI;
send_ilm->local_para_ptr = (local_para_struct*) start_cnf_ptr;
send_ilm->peer_buff_ptr = NULL;
send_ilm->msg_id = MSG_ID_MMI_JAVA_MID_START_CNF;
send_ilm->sap_id = J2ME_MMI_SAP;
msg_send_ext_queue(send_ilm);
return;
}
#ifdef __MMI_FOURWAYS_KEY_DISABLE__
vk_permission_level = jam_get_vk_permission();
if (vk_permission_level == J2ME_CHOICE_ALLOW)
{
set_virtual_direction(KAL_TRUE);
} else if (vk_permission_level == J2ME_CHOICE_NEVER)
{
set_virtual_direction(KAL_FALSE);
} else if (vk_permission_level == J2ME_CHOICE_PROMPT)
{
get_confirm = construct_local_para(sizeof(mmi_java_get_confirm_ind_struct), TD_CTRL);
get_confirm->session_id = start_session_id;
get_confirm->confirm_enum = JAVA_CONFIRM_FOURWAY_KEY_ENUM;
get_confirm->confirm_title = STR_JAVA_CONFIRM_VIRTUAL_KEYPAD_TITLE;
get_confirm->confirm_msg = (kal_char*) GetString(STR_JAVA_CONFIRM_VIRTUAL_KEYPAD);
get_confirm->confirm_image = JAVA_CONFIRM_NOTIFICATION_CATEGORY;
get_confirm->window_category = JAVA_CONFIRM_NOTIFICATION_CATEGORY;
send_ilm = allocate_ilm(MOD_J2ME);
send_ilm->src_mod_id = MOD_J2ME;
send_ilm->dest_mod_id = MOD_MMI;
send_ilm->local_para_ptr = (local_para_struct*) get_confirm;
send_ilm->peer_buff_ptr = NULL;
send_ilm->m
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -