/***************************************************************************** * FUNCTION * mmi_java_send_get_imsi_req * DESCRIPTION * Send the message PRT_GET_IMSI_REQ * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_java_send_l4_get_imsi_req(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ SetProtocolEventHandler(mmi_java_recv_l4_get_imsi_rsp, PRT_GET_IMSI_RSP); mmi_java_send_message(MOD_MMI, MOD_L4C, MMI_L4C_SAP, PRT_GET_IMSI_REQ, NULL, NULL); }
/***************************************************************************** * FUNCTION * mdi_webcam_start * DESCRIPTION * start webcam * PARAMETERS * rotate [IN] Preview rotate * banding [IN] Banding * event_callback [IN] Webcam event callback * RETURNS * MDI_RESULT *****************************************************************************/ MDI_RESULT mdi_webcam_start(U16 rotate, U16 banding, mdi_webcam_event_callback event_callback) { #ifdef MDI_WEBCAM_DRIVER_AVAIALBE /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ media_webcam_start_req_struct start_data; S32 ret; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ PRINT_INFORMATION("[MDI_WEBCAM] mdi_webcam_start()"); /* check if size is set or not */ MMI_ASSERT(g_mdi_webcam_cntx.is_pause_jpeg_size_set); MMI_ASSERT(event_callback != NULL); SetProtocolEventHandler(mdi_webcam_start_result_hdlr, MSG_ID_MEDIA_WEBCAM_START_CNF); SetProtocolEventHandler(mdi_webcam_abort_indication_hdlr, MSG_ID_MEDIA_WEBCAM_ABORT_IND); start_data.banding = banding; start_data.rotate = rotate + CAM_IMAGE_NORMAL; start_data.seq_num = g_mdi_webcam_cntx.start_seq_num; mdi_webcam_event_callback_funcptr = event_callback; ret = media_webcam_start(MOD_MMI, &start_data); if (ret != MED_RES_OK) { return MDI_RES_WEBCAM_ERR_FAILED; } else { return MDI_RES_WEBCAM_SUCCEED; } #endif /* MDI_WEBCAM_DRIVER_AVAIALBE */ return MDI_RES_WEBCAM_SUCCEED; }
static BOOL mmi_da_wps_send_set_channel_req(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ wps_set_channel_req_struct *set_channel_req; peer_buff_struct *peer_buff_ptr = NULL; wps_set_channel_req_var_struct set_channel_req_var; U16 len, pdu_length; U16 msg_len, ref_count; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ DA_WPS_TRACE(MMI_DA_WPS_TRACE_GROUP, MMI_DA_OMA_SEND_SET_CHANNEL_REQ); set_channel_req = (wps_set_channel_req_struct *) construct_local_para(sizeof(wps_set_channel_req_struct), TD_CTRL); msg_len = set_channel_req->msg_len; ref_count = set_channel_req->ref_count; memset(set_channel_req, 0 , sizeof(wps_set_channel_req_struct)); set_channel_req->msg_len = msg_len; set_channel_req->ref_count = ref_count; set_channel_req->use_default = KAL_TRUE; set_channel_req_var.static_header_len = len = strlen("User-Agent: ")+ strlen((S8*)da_wps_context.user_agent)+ strlen("\r\n")+ strlen(STATIC_HEADER); set_channel_req_var.static_header = get_ctrl_buffer((len+1)); sprintf((S8*)set_channel_req_var.static_header,"User-Agent: %s\r\n%s", da_wps_context.user_agent, STATIC_HEADER); pdu_length= wps_pun_var_part(WPS_PUN_SIZE,MSG_ID_WPS_SET_CHANNEL_REQ,&set_channel_req_var,NULL); if( pdu_length > 0) { peer_buff_ptr = construct_peer_buff(pdu_length, 0, 0, TD_RESET); if (wps_pun_var_part(WPS_PUN_PACK, MSG_ID_WPS_SET_CHANNEL_REQ, &set_channel_req_var, get_pdu_ptr(peer_buff_ptr, &len)) != pdu_length) { free_peer_buff(peer_buff_ptr); peer_buff_ptr = NULL; } } free_ctrl_buffer(set_channel_req_var.static_header); mmi_da_send_ilm(set_channel_req, peer_buff_ptr, MSG_ID_WPS_SET_CHANNEL_REQ, MOD_WPS); SetProtocolEventHandler((PsFuncPtr) mmi_da_wps_recv_set_channel_rsp, MSG_ID_WPS_SET_CHANNEL_RSP); return MMI_TRUE; }
/***************************************************************************** * FUNCTION * mmi_nfc_setting_init * DESCRIPTION * nfc boot up init function * PARAMETERS * void * * * RETURNS * void *****************************************************************************/ void mmi_nfc_setting_init(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ U8 status = 0; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ status = mmi_nfc_get_nvram_status(); SetProtocolEventHandler(mmi_nfc_lib_init_rsp, MSG_ID_NFC_LIB_INIT_RSP); SetProtocolEventHandler(mmi_nfc_lib_deinit_rsp, MSG_ID_NFC_LIB_DEINIT_RSP); SetProtocolEventHandler(mmi_nfc_lib_error_notify_rsp, MSG_ID_NFC_LIB_MMI_EVENT_NOTIFY); if (status) { mmi_nfc_sent_msg_to_nfc_lib(status); } }
/************************************************************** FUNCTION NAME : SendBarrQuery(void) PURPOSE : function to send req for call barring query status. INPUT PARAMETERS : nil OUTPUT PARAMETERS : nil RETURNS : void **************************************************************/ void SendBarrQuery(void) { S8 input_string[(MAX_DIGITS_USSD * ENCODING_LENGTH)]; S8 string_type[30]; memset(input_string,0,( MAX_DIGITS_USSD * ENCODING_LENGTH)); memset(string_type,0,30); switch(g_callset_cntx_p->SSBarType) { /* incase of call barring all outgoing calls */ case BARRING_OUTGOING_ALLCALLS: strcpy((S8*) string_type, "*#33#"); AnsiiToUnicodeString((PS8) input_string,(PS8)string_type); break; /* incase of call barring all outgoing international calls */ case BARRING_OUTGOING_INTERCALL : strcpy((S8*) string_type, "*#331#"); AnsiiToUnicodeString((PS8) input_string,(PS8)string_type); break; /* incase of call barring all outgoing international calls expect home */ case BARRING_OUTGOING_INTEREXCEPTHOME : strcpy((S8*)string_type, "*#332#"); AnsiiToUnicodeString((PS8) input_string,(PS8)string_type); break; /* incase of call barring all incoming calls */ case BARRING_INCOMING_ALLCALLS : strcpy((S8*) string_type, "*#35#"); AnsiiToUnicodeString((PS8) input_string,(PS8)string_type); break; /* incase of call barring all incoming roaming calls */ case BARRING_INCOMING_ROAMING : strcpy((S8*) string_type, "*#351#"); AnsiiToUnicodeString((PS8) input_string,(PS8)string_type); break; } /* set protocol event handler for the call barring response */ #ifdef __MMI_MULTI_SIM__ MTPNP_CallSetSetProtocolEventHandler(CALLSETBarringRsp, PRT_MMI_SS_CALL_BARRING_RSP); #else SetProtocolEventHandler(CALLSETBarringRsp, PRT_MMI_SS_CALL_BARRING_RSP); #endif #ifdef __MMI_MULTI_SIM__ MTPNP_AD_Set_Channel(MTPNP_AD_CALL_CHANNEL, g_callset_cntx_p->nSimId); #endif /* make a corresponding ss string for call barring option */ MakeCall((PS8) input_string); return; }
/***************************************************************************** * FUNCTION * mdi_motion_start_listen_tile * DESCRIPTION * listen to tile event * PARAMETERS * sensitive [IN] * min_callback_time [IN] Min callback time * max_callback_time [IN] Max callback time * tile_event_callback [IN] Event callback * senstive(?) [IN] Sensitivity * RETURNS * MDI_RESULT *****************************************************************************/ MDI_RESULT mdi_motion_start_listen_tile( U16 sensitive, S32 min_callback_time, S32 max_callback_time, mdi_motion_tile_callback tile_event_callback) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ U32 threshold; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ g_mdi_motion_cntx.tile_callback = tile_event_callback; g_mdi_motion_cntx.sense_type = MOTION_SENSE_TILE; g_mdi_motion_cntx.sensitve = sensitive; g_mdi_motion_cntx.min_time = min_callback_time; g_mdi_motion_cntx.max_time = max_callback_time; g_mdi_motion_cntx.state = MOTION_STATE_LISTENING; g_mdi_motion_cntx.is_mute = FALSE; switch (g_mdi_motion_cntx.sensitve) { case MDI_MOTION_SENSITIVE_HIGH: threshold = MOTION_TILE_THRESHOLD_HIGH; break; case MDI_MOTION_SENSITIVE_NORMAL: threshold = MOTION_TILE_THRESHOLD_NORMAL; break; case MDI_MOTION_SENSITIVE_LOW: threshold = MOTION_TILE_THRESHOLD_LOW; break; } #ifdef MDI_MOTION_DRIVER_AVAIALBE /* register callback to retrive data */ motion_sensor_cb_registration(mdi_motion_driver_data_state_hdlr, NULL); SetProtocolEventHandler(mdi_motion_tile_data_hdlr, MSG_ID_MDI_MOTION_DATA_STATE_RSP); motion_sensor_conf_filter(threshold); /* star sampling */ motion_sensor_sample(TRUE); #endif /* MDI_MOTION_DRIVER_AVAIALBE */ return MDI_RES_MOTION_SUCCEED; }
/***************************************************************************** * FUNCTION * mmi_java_ui_common_init * DESCRIPTION * * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_java_ui_common_init(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ SetProtocolEventHandler( (PsFuncPtr) mmi_java_ui_common_touch_feedback_play_handler, MSG_ID_MMI_JAVA_UI_TOUCH_FEEDBACK_PLAY_REQ); SetProtocolEventHandler( (PsFuncPtr) mmi_java_ui_common_update_mmi_status_icon, MSG_ID_MMI_JAVA_UI_MMI_STATUS_ICON_UPDATE_REQ); SetProtocolEventHandler( (PsFuncPtr) mmi_java_ui_common_update_mmi_status_audio_icon, MSG_ID_MMI_JAVA_UI_MMI_STATUS_ICON_UPDATE_RSP); SetProtocolEventHandler( (PsFuncPtr) jui_widget_update_fullscreen_status_icons, MSG_ID_MMI_JAVA_UI_JAVA_STATUS_ICON_UPDATE_REQ); }
/***************************************************************************** * FUNCTION * mmi_vrsi_redial_read_call_log_num_req * DESCRIPTION * This function send request to get call log from L4 * PARAMETERS * type [IN] Call log type * RETURNS * void *****************************************************************************/ void mmi_vrsi_redial_read_call_log_num_req(U8 type) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ MYQUEUE Message; GET_LAST_NUMBER_REQ *dataPtr; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ #if !defined(__MMI_CH_MIXED_CALL_LOG__) if (type == PHB_LND) { chis_p->dialedCalls = (LOG_CALL*) chis_p->callsLog; } else if (type == PHB_LNM) { chis_p->missedCalls = (LOG_CALL*) chis_p->callsLog; } else if (type == PHB_LNR) { chis_p->recvdCalls = (LOG_CALL*) chis_p->callsLog; } #endif /* !defined(__MMI_CH_MIXED_CALL_LOG__) */ dataPtr = (GET_LAST_NUMBER_REQ*) OslConstructDataPtr(sizeof(GET_LAST_NUMBER_REQ)); dataPtr->type = type; dataPtr->seq_id = 1; /* Only need 1 record, so just get once */ Message.oslSrcId = MOD_MMI; Message.oslDestId = MOD_L4C; Message.oslMsgId = PRT_MMI_PHB_GET_LAST_NUMBER_REQ; Message.oslDataPtr = (oslParaType*) dataPtr; Message.oslPeerBuffPtr = NULL; if (chis_p->isFirstTime == FALSE) { AlmDisableExpiryHandler(); ClearInputEventHandler(MMI_DEVICE_ALL); } SetProtocolEventHandler(mmi_vrsi_redial_read_call_log_num_rsp, PRT_MMI_PHB_GET_LAST_NUMBER_RSP); OslMsgSendExtQueue(&Message); chis_p->isReqSent = TRUE; }
/***************************************************************************** * FUNCTION * ResetGPRSCounterReq * DESCRIPTION * * PARAMETERS * void * RETURNS * void *****************************************************************************/ void ResetGPRSCounterReq(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ #ifdef __MMI_GPRS_UNIT_TEST__ gprsTotalSent = 0; gprsTotalReceived = 0; gprsLastSent = 0; gprsLastReceived = 0; DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, CS_NOTIFYDURATION, SUCCESS_TONE); DeleteUptoScrID(SCR8004_GPRS_COUNTER); #else /* __MMI_GPRS_UNIT_TEST__ */ /* micha1020 */ #ifdef __MMI_GPRS_FEATURES__ MYQUEUE Message; ClearInputEventHandler(MMI_DEVICE_ALL); ClearKeyHandler(KEY_END, KEY_EVENT_UP); ClearKeyHandler(KEY_END, KEY_EVENT_DOWN); /* micha1020 */ SetProtocolEventHandler(ResetGPRSCounterRsp, PRT_MMI_PS_RESET_GPRS_DATA_COUNTER_RSP); /* format message to send req for get plmn list */ Message.oslSrcId = MOD_MMI; Message.oslDestId = MOD_L4C; /* micha1020 */ Message.oslMsgId = PRT_MMI_PS_RESET_GPRS_DATA_COUNTER_REQ; Message.oslDataPtr = NULL; Message.oslPeerBuffPtr = NULL; OslMsgSendExtQueue(&Message); #endif /* __MMI_GPRS_FEATURES__ */ #endif /* __MMI_GPRS_UNIT_TEST__ */ return; }
/***************************************************************************** * FUNCTION * mmi_syncml_get_imei_req * DESCRIPTION * Protocol event sender * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_syncml_get_imei_req(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ MYQUEUE Message; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ Message.oslSrcId = MOD_MMI; Message.oslDestId = MOD_L4C; Message.oslMsgId = MSG_ID_MMI_NW_GET_IMEI_REQ; Message.oslDataPtr = NULL; Message.oslPeerBuffPtr = NULL; OslMsgSendExtQueue(&Message); SetProtocolEventHandler(mmi_syncml_get_imei_rsp, MSG_ID_MMI_NW_GET_IMEI_RSP); }
/***************************************************************************** * FUNCTION * mdi_motion_stop_listen * DESCRIPTION * stop listen to event * PARAMETERS * void * RETURNS * MDI_RESULT *****************************************************************************/ MDI_RESULT mdi_motion_stop_listen(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ g_mdi_motion_cntx.shake_callback = NULL; g_mdi_motion_cntx.tile_callback = NULL; g_mdi_motion_cntx.state = MOTION_STATE_IDLE; #ifdef MDI_MOTION_DRIVER_AVAIALBE gui_cancel_timer(mdi_motion_disable_mute_timeout); SetProtocolEventHandler(NULL, MSG_ID_MDI_MOTION_DATA_STATE_RSP); #endif /* MDI_MOTION_DRIVER_AVAIALBE */ return MDI_RES_MOTION_SUCCEED; }
/***************************************************************************** * FUNCTION * mmi_drm_send_get_imsi_req * DESCRIPTION * Send the message PRT_GET_IMSI_REQ * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_drm_send_l4_get_imsi_req(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ MYQUEUE Message; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ SetProtocolEventHandler(mmi_drm_recv_l4_get_imsi_rsp, PRT_GET_IMSI_RSP); Message.oslSrcId = MOD_MMI; Message.oslDestId = MOD_L4C; Message.oslSapId = MMI_L4C_SAP; Message.oslMsgId = PRT_GET_IMSI_REQ; Message.oslDataPtr = NULL; Message.oslPeerBuffPtr = NULL; OslMsgSendExtQueue(&Message); }
/***************************************************************************** * FUNCTION * mmi_bth_init_simap_event_handler * DESCRIPTION * This function is to * * PARAMETERS * a IN/OUT first variable, used as returns * b IN second variable * RETURNS * NONE. * GLOBALS AFFECTED * external_global *****************************************************************************/ void mmi_bth_init_simap_event_handler(void) { MMI_TRACE(MMI_TRACE_G7_MISC, MMI_BT_G7_INIT_EVENT_HDLR ); /* Init protocol event handler */ SetProtocolEventHandler(mmi_bth_simap_activate_cnf_hdler, MSG_ID_BT_SIMAP_ACTIVATE_CNF); SetProtocolEventHandler(mmi_bth_simap_deactivate_cnf_hdler, MSG_ID_BT_SIMAP_DEACTIVATE_CNF); SetProtocolEventHandler(mmi_bth_simap_disconnect_cnf_hdler, MSG_ID_BT_SIMAP_DISCONNECT_CNF); SetProtocolEventHandler(mmi_bth_simap_connect_ind_hdler, MSG_ID_BT_SIMAP_CONNECT_IND); SetProtocolEventHandler(mmi_bth_simap_disconnect_ind_hdler, MSG_ID_BT_SIMAP_DISCONNECT_IND); /* Add by stanley: 2007-0111 : for upper layer to determine accept this SAP connection or nor */ SetProtocolEventHandler(mmi_bth_simap_authroize_hdler, MSG_ID_BT_SIMAP_AUTH_REQ); }
void MTPNP_PFAL_boot_up(void * inMsg) { if (MTPNP_AD_Get_Card1Status() > 0x0 && MTPNP_AD_Get_Card2Status() > 0x0) { ClearProtocolEventHandler(MSG_ID_MTPNP_WAIT_DUALSIM_READY); FlightModeCheckBeforeAnimation(); } else { MYQUEUE Message; SetProtocolEventHandler(MTPNP_PFAL_boot_up, MSG_ID_MTPNP_WAIT_DUALSIM_READY); Message.oslSrcId = MOD_MMI; Message.oslDestId = MOD_MMI; Message.oslMsgId = MSG_ID_MTPNP_WAIT_DUALSIM_READY; Message.oslDataPtr = NULL; Message.oslPeerBuffPtr = NULL; OslMsgSendExtQueue(&Message); } }
/***************************************************************************** * FUNCTION * srv_ctm_med_connect_req * DESCRIPTION * * PARAMETERS * void * RETURNS * void *****************************************************************************/ void srv_ctm_med_connect_req(void) { #ifndef __CTM_DEBUG /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ MMI_TRACE(MMI_COMMON_TRC_G5_CALL, FUNC_SRV_CTM_MED_CONNECT_REQ); ClearInputEventHandler(MMI_DEVICE_ALL); SetProtocolEventHandler(srv_ctm_phdlr_connect_rsp, MSG_ID_MEDIA_CTM_CONNECT_CNF); mmi_frm_send_ilm(MOD_MED, MSG_ID_MEDIA_CTM_CONNECT_REQ, NULL, NULL); #else /* __CTM_DEBUG */ StartTimer(CM_NOTIFYDURATION_TIMER, 2000, (FuncPtr) srv_ctm_phdlr_connect_rsp); #endif /* __CTM_DEBUG */ }
/***************************************************************************** * FUNCTION * mmi_syncml_init_message_handlers * DESCRIPTION * Protocol event handlers of SyncML messages * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_syncml_init_message_handlers(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ SetProtocolEventHandler(mmi_syncml_set_record_req_ind, MSG_ID_MMI_SYNCML_SET_RECORD_REQ_IND); SetProtocolEventHandler(mmi_syncml_get_record_req_ind, MSG_ID_MMI_SYNCML_GET_RECORD_REQ_IND); SetProtocolEventHandler(mmi_syncml_query_luid_list_req_ind, MSG_ID_MMI_SYNCML_QUERY_LUID_LIST_REQ_IND); SetProtocolEventHandler(mmi_syncml_clean_luid_list_req_ind, MSG_ID_MMI_SYNCML_CLEAN_LUID_LIST_REQ_IND); SetProtocolEventHandler(mmi_syncml_finish_sync_ind, MSG_ID_MMI_SYNCML_FINISH_SYNC_IND); SetProtocolEventHandler(mmi_syncml_progress_info_ind, MSG_ID_MMI_SYNCML_PROGRESS_INFO_IND); }
void mmi_mexe_read_rpk_file_info_req(U8 file_id) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ MYQUEUE Message; mmi_smu_read_file_info_req_struct *dataPtr; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ SetProtocolEventHandler(mmi_mexe_read_rpk_file_info_rsp, PRT_MMI_SMU_READ_FILE_INFO_RSP); Message.oslSrcId = MOD_MMI; Message.oslDestId = MOD_L4C; Message.oslMsgId = PRT_MMI_SMU_READ_FILE_INFO_REQ; dataPtr = (mmi_smu_read_file_info_req_struct*) OslConstructDataPtr(sizeof(mmi_smu_read_file_info_req_struct)); dataPtr->file_idx = file_id; Message.oslDataPtr = (oslParaType*) dataPtr; Message.oslPeerBuffPtr = NULL; OslMsgSendExtQueue(&Message); }
/***************************************************************************** * FUNCTION * srv_ctm_med_close_req * DESCRIPTION * * PARAMETERS * void * RETURNS * void *****************************************************************************/ void srv_ctm_med_close_req(void) { #ifndef __CTM_DEBUG /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ MMI_TRACE(MMI_COMMON_TRC_G5_CALL, FUNC_SRV_CTM_MED_CLOSE_REQ); #ifdef __MMI_BT_AUDIO_VIA_SCO__ srv_btsco_enable_sco_connection(SRV_BT_SCO_INT_CTM); #endif SetProtocolEventHandler(srv_ctm_phdlr_close_rsp, MSG_ID_MEDIA_CTM_CLOSE_CNF); mmi_frm_send_ilm(MOD_MED, MSG_ID_MEDIA_CTM_CLOSE_REQ, NULL, NULL); #else /* __CTM_DEBUG */ StartTimer(CM_CTM_ALERT_NOTIFYDURATION_TIMER, 2000, (FuncPtr) srv_ctm_phdlr_close_rsp); #endif /* __CTM_DEBUG */ }
/***************************************************************************** * FUNCTION * mmi_mexe_init * DESCRIPTION * MExE initialization * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_mexe_init(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ SetProtocolEventHandler(mmi_mexe_get_sim_certificate_req, MSG_ID_MMI_GET_SIM_CERTIFICATE_REQ); memset(&g_MExE_context, 0, sizeof(mexe_context_struct)); #ifdef __GEMINI__ if (sim_service_table_query(SERVICE_MEXE, SIM1) == SERVICE_SUPPORT) #else if (sim_service_table_query(SERVICE_MEXE) == SERVICE_SUPPORT) #endif { /* search for MExE service table */ mmi_mexe_read_service_table_req(); } }
void ntyGetHostByName(char *domainName) { S32 ret; //S8 char_plmn[SRV_MAX_PLMN_LEN + 1]; kal_uint32 acct_id= CBM_INVALID_NWK_ACCT_ID; kal_uint8 addr_len = 0; sockaddr_struct *add; void *pNetwork = ntyNetworkInstance(); acct_id = ntyGetAccountId(pNetwork);; nty_printf("acct_id %d\r\n",acct_id); ret = soc_gethostbyname(KAL_FALSE, MOD_MMI, 1, domainName, add->addr, &addr_len,0,acct_id); kal_prompt_trace(MOD_IDLE,"card_get_host_by_name_plateform22222 %d\r\n",ret); if (ret == SOC_SUCCESS) { // success nty_printf("SOC_SUCCESS_gethostbyname \r\n"); //gps_connect(); } else if (ret == SOC_WOULDBLOCK) { // block nty_printf("SOC_WOULDBLOCK_gethostbyname \r\n"); SetProtocolEventHandler(ntyGetHostByNameIndCallback, MSG_ID_APP_SOC_GET_HOST_BY_NAME_IND); } }
/***************************************************************************** * FUNCTION * mmi_da_wps_send_cancel_req * DESCRIPTION * Send "cancel request" to WAP task to cancel an action. * PARAMETERS * request_id IN action, reference to mmi_da_oma_request_id_enum * RETURNS * MMI_TRUE: OK * MMI_FALSE: false *****************************************************************************/ static BOOL mmi_da_wps_send_cancel_req(U8 request_id) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ wps_cancel_req_struct *abort_req; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ DA_WPS_TRACE(MMI_DA_WPS_TRACE_GROUP, MMI_DA_OMA_SEND_CANCEL_REQ); ASSERT(_da_wps_is_ready()); abort_req = (wps_cancel_req_struct *) construct_local_para(sizeof(wps_cancel_req_struct), TD_CTRL); abort_req->request_id = request_id + MMI_DA_WPS_REQUEST_ID_BASE; abort_req->channel_id = da_wps_context.channel_id; mmi_da_send_ilm(abort_req, NULL, MSG_ID_WPS_CANCEL_REQ, MOD_WPS); SetProtocolEventHandler((PsFuncPtr) mmi_da_wps_recv_cancel_rsp, MSG_ID_WPS_CANCEL_RSP); return MMI_TRUE; }
/***************************************************************************** * FUNCTION * srv_cbm_init * DESCRIPTION * * PARAMETERS * void * RETURNS * void *****************************************************************************/ mmi_ret srv_cbm_init(mmi_event_struct *evt) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ memset(&g_cbm_srv_cxt, 0, sizeof(g_cbm_srv_cxt)); #ifdef __CBM_DISALLOW_NWK_SRV_SUPPRT__ srv_cbm_create_sem(); #endif /* __CBM_DISALLOW_NWK_SRV_SUPPRT__ */ SetProtocolEventHandler(srv_cbm_app_bearer_info_ind_hdlr, MSG_ID_APP_CBM_BEARER_INFO_IND); mmi_frm_set_multi_protocol_event_handler(MSG_ID_MMI_ABM_BEARER_INFO_IND, (PsIntFuncPtr)srv_cbm_bearer_info_ind_hdlr); SetProtocolEventHandler(srv_cbm_bearer_event_notify_ind_hdlr, MSG_ID_APP_CBM_BEARER_EVENT_NOTIFY_IND); SetProtocolEventHandler(srv_cbm_bearer_init_ind_hdlr, MSG_ID_MMI_ABM_BEARER_INIT_IND); SetProtocolEventHandler(srv_cbm_bearer_deinit_ind_hdlr, MSG_ID_MMI_ABM_BEARER_DEINIT_IND); SetProtocolEventHandler(srv_cbm_bearer_connect_result_ind_hdlr, MSG_ID_MMI_ABM_BEARER_CONNECT_RESULT_IND); #ifdef __PS_PDP_SWITCH_SUPPORT__ SetProtocolEventHandler(srv_cbm_bearer_disconnect_cnf_hdlr, MSG_ID_MMI_ABM_BEARER_DISCONNECT_CNF); SetProtocolEventHandler(srv_cbm_bearer_status_ind_hdlr, MSG_ID_MMI_ABM_BEARER_STATUS_IND); #endif /* __PS_PDP_SWITCH_SUPPORT__ */ #ifdef __MMI_WLAN_FEATURES__ srv_cbm_start_wlan_auto_search_timer(); #endif #ifdef CBM_UT_TEST mmi_frm_set_multi_protocol_event_handler(MSG_ID_TST_INJECT_STRING, (PsIntFuncPtr)srv_cbm_process_tst_inject_str); #endif /* CBM_UT_TEST */ return MMI_RET_OK; }
/************************************************************** FUNCTION NAME : SendChangePswdReq(void ) PURPOSE : function for sending req for call barring change passwd. INPUT PARAMETERS : nil OUTPUT PARAMETERS : nil RETURNS : void **************************************************************/ void SendChangePswdReq(void) { U8 input_string[MAX_DIGITS_USSD]; U8 string_type[20]; PS8 hash_string = NULL ; U8 uni_string[10]; memset(uni_string,0,10); /* format the string for the ss string handling */ memset(input_string,0, MAX_DIGITS_USSD); memset(string_type,0,20); strcpy((PS8) string_type,(PS8)"*03**"); hash_string = (PS8) GetString(STR_HASH_VALUE); AnsiiToUnicodeString((PS8) input_string,(PS8)string_type); pfnUnicodeStrcat((PS8) input_string,(PS8) g_callset_cntx_p->SSBarPassOld); strcpy((PS8) string_type,(PS8) "*"); AnsiiToUnicodeString((PS8) uni_string,(PS8)string_type); pfnUnicodeStrcat((PS8) input_string,(PS8) uni_string); pfnUnicodeStrcat((PS8) input_string,(PS8) g_callset_cntx_p->SSBarPassNew); pfnUnicodeStrcat((PS8) input_string,(PS8) uni_string); pfnUnicodeStrcat((PS8) input_string,(PS8) g_callset_cntx_p->SSBarPassCfrm); pfnUnicodeStrcat((PS8) input_string,(PS8) hash_string); /* set protocol event handler for the call barring passwd change response */ #ifdef __MMI_MULTI_SIM__ MTPNP_CallSetSetProtocolEventHandler(CALLSETBarringPassRsp, PRT_MMI_SS_CHANGE_PASSWORD_RSP); #else SetProtocolEventHandler(CALLSETBarringPassRsp, PRT_MMI_SS_CHANGE_PASSWORD_RSP); #endif #ifdef __MMI_MULTI_SIM__ MTPNP_AD_Set_Channel(MTPNP_AD_CALL_CHANNEL, g_callset_cntx_p->nSimId); #endif /* make a corresponding ss string for call barring passwd change response option */ MakeCall((PS8) input_string); return; }
void mmi_mexe_read_service_table_req(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ MYQUEUE Message; mmi_smu_read_sim_req_struct *dataPtr; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ SetProtocolEventHandler(mmi_mexe_read_service_table_rsp, PRT_MMI_SMU_READ_SIM_RSP); Message.oslSrcId = MOD_MMI; Message.oslDestId = MOD_L4C; /* message back to the sender */ Message.oslMsgId = PRT_MMI_SMU_READ_SIM_REQ; dataPtr = (mmi_smu_read_sim_req_struct*) OslConstructDataPtr(sizeof(mmi_smu_read_sim_req_struct)); dataPtr->file_idx = (U8) FILE_MEXE_ST_IDX; dataPtr->para = 0; dataPtr->length = 1; Message.oslDataPtr = (oslParaType*) dataPtr; Message.oslPeerBuffPtr = NULL; OslMsgSendExtQueue(&Message); }
/***************************************************************************** * FUNCTION * mmi_idle_get_spdi_data_req * DESCRIPTION * Request of read EF_SPDI data * PARAMETERS * spdi_data_size [IN] * RETURNS * void *****************************************************************************/ void mmi_idle_get_spdi_data_req(U16 spdi_data_size) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ MYQUEUE Message; mmi_smu_read_sim_req_struct *dataPtr; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ SetProtocolEventHandler(mmi_idle_get_spdi_data_rsp, PRT_MMI_SMU_READ_SIM_RSP); Message.oslSrcId = MOD_MMI; Message.oslDestId = MOD_L4C; Message.oslMsgId = PRT_MMI_SMU_READ_SIM_REQ; dataPtr = (mmi_smu_read_sim_req_struct*) OslConstructDataPtr(sizeof(mmi_smu_read_sim_req_struct)); dataPtr->file_idx = (U8) FILE_SPDI_IDX; /* SPDI...FILE_SPDI_IDX */ dataPtr->para = 0; dataPtr->length = spdi_data_size; Message.oslDataPtr = (oslParaType*) dataPtr; Message.oslPeerBuffPtr = NULL; OslMsgSendExtQueue(&Message); }
/***************************************************************************** * FUNCTION * mmi_da_wps_send_unset_channel_req * DESCRIPTION * Send "Unset channel" request to wap to destory channel * PARAMETERS * void * RETURNS * MMI_TRUE: OK * MMI_FALSE: FAIL *****************************************************************************/ static BOOL mmi_da_wps_send_unset_channel_req(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ wps_unset_channel_req_struct *unset_channel_req = NULL; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ DA_WPS_TRACE(MMI_DA_WPS_TRACE_GROUP, MMI_DA_OMA_SEND_UNSET_CHANNEL_REQ); if(da_wps_context.busy_flag != MMI_DA_WPS_STATE_FREE) return MMI_FALSE; /* only unset when no session */ ASSERT(!da_wps_context.session_num); if (da_wps_context.channel_id != MMI_DA_WPS_INVALID_CHANNEL) { unset_channel_req = (wps_unset_channel_req_struct *) construct_local_para(sizeof(wps_unset_channel_req_struct), TD_CTRL); unset_channel_req->channel_id = da_wps_context.channel_id; mmi_da_send_ilm(unset_channel_req, NULL, MSG_ID_WPS_UNSET_CHANNEL_REQ, MOD_WPS); SetProtocolEventHandler((PsFuncPtr) mmi_da_wps_recv_unset_channel_rsp, MSG_ID_WPS_UNSET_CHANNEL_RSP); da_wps_context.busy_flag = MMI_DA_WPS_STATE_BUSY_UNSET; return MMI_TRUE; } else { ASSERT(0); } return MMI_FALSE; }
void InitEngineerEvent(void) { /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ /********************* Network **********************/ #ifdef __MODEM_EM_MODE__ #ifdef __MMI_EM_NW_NETWORK_INFO__ SetProtocolEventHandler(EngineerModeStartRes, MSG_ID_MMI_EM_UPDATE_RSP); #endif #if defined(__MMI_EM_NW_EVENT_NOTIFY__) /* under construction !*/ /* under construction !*/ #endif /* #if defined(__MMI_EM_NW_EVENT_NOTIFY__) */ #endif /* #ifdef __MODEM_EM_MODE__ */ /********************** Device **********************/ /* Set UART */ SetProtocolEventHandler(EngineerModeSetUartRes, MSG_ID_EM_SET_UART_RSP); #ifdef __DYNAMIC_UART_PORT_SWITCHING__ SetProtocolEventHandler(EngineerModeAttachUartRes, MSG_ID_MMI_ATTACH_UART_PORT_RSP); SetProtocolEventHandler(EngineerModeDetachUartRes, MSG_ID_MMI_DETACH_UART_PORT_RSP); #endif /* Set Default Level */ #ifdef __MMI_EM_DEV_SET_HW_LEVEL__ SetProtocolEventHandler(SendSetHWLevelInfoRsp, MSG_ID_MMI_EQ_SET_HW_LEVEL_RSP); #endif /* Sleep mode */ SetProtocolEventHandler(EngineerModeSetSleepModeRes, MSG_ID_MMI_EQ_SET_SLEEP_MODE_RSP); #ifdef __MMI_EM_DEV_FM_RADIO__ /* FM Radio */ SetProtocolEventHandler (EMFMRadioSendRes, MSG_ID_MMI_EQ_FM_RADIO_CONFIG_RSP); #endif /*********************** RF Tool *********************/ #ifdef __MMI_EM_RF_GSM__ SetProtocolEventHandler(EMRFTestGsmSendRes , MSG_ID_MMI_EQ_RF_TEST_GSM_RSP); #endif /* __MMI_EM_RF_GSM__ */ /************************ GPRS ***********************/ #if (defined(__MOD_TCM__) && defined(__MMI_EM_GPRS_PDP__)) SetProtocolEventHandler(EngineerModeGprsDeactivatePDPRes, MSG_ID_MMI_PS_ACT_TEST_RSP); SetProtocolEventHandler(EngineerModeGprsSendDataRes, MSG_ID_MMI_PS_SEND_DATA_RSP); SetProtocolEventHandler(EngineerModeGprsSetDefinitionRes, MSG_ID_MMI_PS_SET_DEFINITION_RSP); SetProtocolEventHandler(EngineerModeGprsSetDefinitionRes, MSG_ID_MMI_PS_SET_SEC_DEFINITION_RSP); #ifdef __R99__ SetProtocolEventHandler(EngineerModeGprsSetEQosRes, MSG_ID_MMI_PS_SET_EQOS_RSP); #endif SetProtocolEventHandler(EngineerModeGprsSetQosRes, MSG_ID_MMI_PS_SET_QOS_RSP); SetProtocolEventHandler(EngineerModeGprsActTestRes, MSG_ID_MMI_PS_ACT_TEST_RSP); #endif /* defined(__MOD_TCM__) && defined(__MMI_EM_GPRS_PDP__) */ }
/***************************************************************************** * FUNCTION * DeinitEngineerEvent * DESCRIPTION * * PARAMETERS * void * RETURNS * void *****************************************************************************/ void DeinitEngineerEvent(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /********************* Network **********************/ const U16 eventIDs[] = { #ifdef __MODEM_EM_MODE__ #ifdef __MMI_EM_NW_NETWORK_INFO__ MSG_ID_MMI_EM_UPDATE_RSP, #endif #if defined(__MMI_EM_NW_EVENT_NOTIFY__) /* under construction !*/ /* under construction !*/ #endif /* #if defined(__MMI_EM_NW_EVENT_NOTIFY__) */ #endif /* #ifdef __MODEM_EM_MODE__ */ /********************** Device **********************/ /* Set UART */ MSG_ID_EM_SET_UART_RSP, #ifdef __DYNAMIC_UART_PORT_SWITCHING__ MSG_ID_MMI_ATTACH_UART_PORT_RSP, MSG_ID_MMI_DETACH_UART_PORT_RSP, #endif /* Set Default Level */ #ifdef __MMI_EM_DEV_SET_HW_LEVEL__ MSG_ID_MMI_EQ_SET_HW_LEVEL_RSP, #endif /* Sleep mode */ MSG_ID_MMI_EQ_SET_SLEEP_MODE_RSP, #ifdef __MMI_EM_DEV_FM_RADIO__ /* FM Radio */ MSG_ID_MMI_EQ_FM_RADIO_CONFIG_RSP, #endif /*********************** RF Tool *********************/ #ifdef __MMI_EM_RF_GSM__ MSG_ID_MMI_EQ_RF_TEST_GSM_RSP, #endif /* __MMI_EM_RF_GSM__ */ /************************ GPRS ***********************/ #if (defined(__MOD_TCM__) && defined(__MMI_EM_GPRS_PDP__)) MSG_ID_MMI_PS_ACT_TEST_RSP, MSG_ID_MMI_PS_SEND_DATA_RSP, MSG_ID_MMI_PS_SET_DEFINITION_RSP, MSG_ID_MMI_PS_SET_SEC_DEFINITION_RSP, #ifdef __R99__ MSG_ID_MMI_PS_SET_EQOS_RSP, #endif MSG_ID_MMI_PS_SET_QOS_RSP, MSG_ID_MMI_PS_ACT_TEST_RSP #endif /* defined(__MOD_TCM__) && defined(__MMI_EM_GPRS_PDP__) */ }; U16 eventNum = (sizeof(eventIDs)/sizeof(U16)); U16 index = 0; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ for(index = 0; index < eventNum; ++index) { SetProtocolEventHandler(DummyEmCBHandler, eventIDs[index]); } }
/** * Opens a TCP connection to a server. * @param ipAddress Byte array that represents a raw IP address * @param port TCP port at host * @return a native handle to the network connection. */ int gcj_StubSocketOpen(char *ipAddress, int port) { int handle=-1; int ret; unsigned char val=1; CFW_TCPIP_SOCKET_ADDR stSockConnect; unsigned char buff[5]; unsigned char ip_validity=0; _SOCKET_T *thisH = OslMalloc(sizeof (_SOCKET_T)); if (!thisH) return -1; memset(thisH,0,sizeof(_SOCKET_T)); gcj_StubTakeMutex(&netMutex); if (socketHead.next == NULL) socketHead.next = thisH; else { _SOCKET_T *tmp = socketHead.next; while (tmp) { if (tmp->next == NULL) { tmp->next = thisH; break; } else tmp = tmp->next; } } gcj_StubReleaseMutex(&netMutex); gcj_socke_count++; gcj_TraceOut(0,"j2me: task=%d, file %s,function %s,ipAddress=%s,port=%d,gcj_socke_count=%d,gcj_IsGprsActived=%d",sxr_GetCurrentTaskId(),__FILE__,__FUNCTION__,ipAddress,port,gcj_socke_count,gcj_IsGprsActived); //if (gcj_sockedId>=0) // abort(); //ret = soc_ip_check((kal_char *)ipAddress, buff, &ip_validity); //if (!ip_validity ||!ret ) // return -1; thisH->thisReadSem = gcj_StubNewSemphone(); unsigned char count=0; while (!gcj_IsGprsActived && count <5) { //gprsStateSemaphore = gcj_StubNewSemphone(); //gcjEventAPI_PrepareNetwork(); thisH->isWaitForGprs = 1; //gcj_StubTakeSemphone(thisH->thisReadSem); gcj_StubThreadSleep(5000); count ++; } thisH->socketId = -1; if (!gcj_IsGprsActived) { gcj_TraceOut(0,"j2me:function %s,line %d,ipAddress=%s,handle=%d",__FUNCTION__,__LINE__,ipAddress,thisH->socketId); netCleanErrorSocket(thisH); return -1; } thisH->socketId = gcjEventAPI_GetTcpipSocket();//CFW_TcpipSocket(CFW_TCPIP_AF_INET,CFW_TCPIP_SOCK_STREAM,CFW_TCPIP_IPPROTO_IP); gcj_TraceOut(0,"j2me: file %s,function %s,ipAddress=%s,handle=%d",__FILE__,__FUNCTION__,ipAddress,thisH->socketId); if (thisH==NULL || thisH->socketId <0) { gcj_TraceOut(0,"j2me:function %s,line %d,ipAddress=%s,handle=%d",__FUNCTION__,__LINE__,ipAddress,thisH->socketId); netCleanErrorSocket(thisH); return -1; } else { /* // set socket to non-blocking mode ret =gcjEventAPI_SetSocketOpt(thisH->socketId, SOC_NBIO, &val, sizeof(val)); gcj_TraceOut(1,"gcj_StubSocketOpen: soc_setsockopt, ,ret=%d",ret); if( ret< 0 ) { gcj_TraceOut(0,"j2me:function %s,line %d,ipAddress=%s,handle=%d,ret =%d",__FUNCTION__,__LINE__,ipAddress,thisH->socketId,ret); netCleanErrorSocket(thisH); return -1; } // set socket to Async mode val = SOC_READ | SOC_WRITE | SOC_CONNECT | SOC_CLOSE | SOC_ACCEPT; ret = gcjEventAPI_SetSocketOpt(thisH->socketId, SOC_ASYNC, &val, sizeof(val)); gcj_TraceOut(1,"gcj_StubSocketOpen: setsockopt SOC_ASYNC,ret=%d",ret); if(ret < 0) { gcj_TraceOut(0,"j2me:function %s,line %d,ipAddress=%s,handle=%d,ret =%d",__FUNCTION__,__LINE__,ipAddress,thisH->socketId,ret); netCleanErrorSocket(thisH); return -1; } */ ret=gcjEventAPI_GetHostName((const kal_char *)ipAddress, gcj_dnsBuff, &gcj_dnsLen); gcj_TraceOut(1,"soc_gethostbyname,re=%d",ret); if (ret == SOC_WOULDBLOCK) { thisH->isWaitForGprs = 1; SetProtocolEventHandler( gcjDnsEvent, MSG_ID_APP_SOC_GET_HOST_BY_NAME_IND/*MSG_ID_APP_SOC_GET_HOST_BY_NAME_IND*/); gcj_StubTakeSemphone(thisH->thisReadSem); if (gcj_dnsLen == 0xff) ret = SOC_ERROR; else ret = SOC_SUCCESS; } else if (ret != 0) { gcj_TraceOut(0,"j2me:function %s,line %d,ipAddress=%s,handle=%d,ret =%d",__FUNCTION__,__LINE__,ipAddress,thisH->socketId,ret); netCleanErrorSocket(thisH); return -1; } if(ret == SOC_SUCCESS) { // Step 3: Connect the Socket UINT32 s_addr = (gcj_dnsBuff[0]<<24)||(gcj_dnsBuff[1]<<16)||(gcj_dnsBuff[2]<<8)||(gcj_dnsBuff[3]<<0); gcj_TraceOut(1,"gcj_StubSocketOpen: sock_addr,%d.%d.%d.%d:%d",gcj_dnsBuff[0],gcj_dnsBuff[1],gcj_dnsBuff[2],gcj_dnsBuff[3],port); CFW_SetTCPIPCallBackEx (gcj_SocketEventcb,thisH->socketId); char buff[20]=""; char tmp[4]; strcat(buff,CharType2String(gcj_dnsBuff[0],tmp)); strcat(buff,"."); strcat(buff,CharType2String(gcj_dnsBuff[1],tmp)); strcat(buff,"."); strcat(buff,CharType2String(gcj_dnsBuff[2],tmp)); strcat(buff,"."); strcat(buff,CharType2String(gcj_dnsBuff[3],tmp)); gcj_TraceOut(0,"ipAddress = %s\n",buff); memset (&stSockConnect, 0, sizeof (CFW_TCPIP_SOCKET_ADDR)) ; stSockConnect.sin_len = 0 ; stSockConnect.sin_family = CFW_TCPIP_AF_INET ; stSockConnect.sin_port = htons(port) ; //stSockConnect.sin_addr.s_addr = *pcIpAddress ; stSockConnect.sin_addr.s_addr = CFW_TcpipInetAddr(buff) ; if ((ret = gcjEventAPI_SocketConnect (thisH->socketId, &stSockConnect, sizeof (CFW_TCPIP_SOCKET_ADDR)))== SOCKET_ERROR) { gcj_TraceOut(0,"j2me:function %s,line %d,ipAddress=%s,handle=%d,ret =%d",__FUNCTION__,__LINE__,ipAddress,thisH->socketId,ret); netCleanErrorSocket(thisH); return -1; } else { unsigned char count=0; thisH->isWaitForGprs = 1; while (count <5 && thisH->isWaitForGprs) { //gprsStateSemaphore = gcj_StubNewSemphone(); //gcjEventAPI_PrepareNetwork(); //gcj_StubTakeSemphone(thisH->thisReadSem); gcj_StubThreadSleep(5000); count ++; } if (thisH->isWaitForGprs) { gcj_TraceOut(0,"j2me:function %s,line %d,ipAddress=%s,handle=%d,ret =%d",__FUNCTION__,__LINE__,ipAddress,thisH->socketId,ret); netCleanErrorSocket(thisH); return -1; } } } else { gcj_TraceOut(0,"j2me:function %s,line %d,ipAddress=%s,handle=%d,ret =%d",__FUNCTION__,__LINE__,ipAddress,thisH->socketId,ret); netCleanErrorSocket(thisH); return -1; } } return (int)thisH; }
static BOOL mmi_da_wps_send_http_req(U8 request_id, U8 http_method, S8 * url, S8 * post_data, PU16 file_path) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ wps_http_req_struct *http_req; wps_http_req_var_struct http_req_var; peer_buff_struct *peer_buff_ptr = NULL; U16 pdu_length; U16 len; FS_HANDLE hd; static S8 range_header[30]; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ DA_WPS_TRACE(MMI_DA_WPS_TRACE_GROUP, MMI_DA_OMA_SEND_HTTP_REQ, request_id); ASSERT(_da_wps_is_ready()); ASSERT(request_id < MMI_DA_WPS_REQUEST_ID_RANGE); http_req = (wps_http_req_struct *) construct_local_para(sizeof(wps_http_req_struct), TD_CTRL); http_req->channel_id = da_wps_context.channel_id; http_req->request_id = request_id + MMI_DA_WPS_REQUEST_ID_BASE; http_req->method = http_method; http_req->option = WPS_HTTP_OPTION_NO_CACHE; http_req_var.request_url_len = (kal_uint32) strlen(url); http_req_var.request_url = (kal_uint8 *) url; http_req_var.request_header_len = 0; http_req_var.request_header = NULL; if (http_method == WPS_HTTP_METHOD_POST) { ASSERT(post_data != NULL); http_req->reply_type = WPS_DATA_TYPE_BUFFER; http_req->reply_segment_len = 0; /* no use here */ http_req->post_type = WPS_DATA_TYPE_BUFFER; http_req->post_path[0] = '\0'; http_req->post_path[1] = '\0'; http_req->post_total_len = strlen(post_data); http_req->more_post = MMI_FALSE; http_req_var.post_segment_len = strlen(post_data); http_req_var.post_segment = (kal_uint8 *) post_data; http_req_var.request_header_len = strlen("Content-Type: text/plain; charset=UTF-8\r\n"); http_req_var.request_header = (kal_uint8 *)"Content-Type: text/plain; charset=UTF-8\r\n"; } else { ASSERT(file_path != NULL && mmi_ucs2strlen((S8 *) file_path) < 256); http_req->reply_type = WPS_DATA_TYPE_FILE; mmi_ucs2cpy((S8 *) http_req->reply_path, (S8 *) file_path); http_req->reply_segment_len = 0; /* no use here */ http_req->post_type = WPS_DATA_TYPE_BUFFER; http_req->post_path[0] = '\0'; http_req->post_path[1] = '\0'; http_req->post_total_len = 0; http_req->more_post = MMI_FALSE; http_req_var.post_segment_len = 0; http_req_var.post_segment = NULL; // If the target file exist, it means RESUME if ((hd = FS_Open((PU16)file_path, FS_READ_ONLY)) >= 0) { UINT file_size; FS_GetFileSize(hd, &file_size); sprintf(range_header, "Range:bytes=%d-", file_size); FS_Close(hd); http_req_var.request_header_len = strlen(range_header); http_req_var.request_header = (kal_uint8 *)range_header; } } pdu_length = wps_pun_var_part(WPS_PUN_SIZE, MSG_ID_WPS_HTTP_REQ, &http_req_var, NULL); if (pdu_length > 0) { peer_buff_ptr = construct_peer_buff(pdu_length, 0, 0, TD_RESET); if (wps_pun_var_part(WPS_PUN_PACK, MSG_ID_WPS_HTTP_REQ, &http_req_var, get_pdu_ptr(peer_buff_ptr, &len)) != pdu_length) { free_peer_buff(peer_buff_ptr); peer_buff_ptr = NULL; } } mmi_da_send_ilm(http_req, peer_buff_ptr, MSG_ID_WPS_HTTP_REQ, MOD_WPS); SetProtocolEventHandler((PsFuncPtr) mmi_da_wps_recv_http_rsp, MSG_ID_WPS_HTTP_RSP); SetProtocolEventHandler((PsFuncPtr) mmi_da_wps_recv_dl_progress_ind, MSG_ID_WPS_DL_PROGRESS_IND); SetProtocolEventHandler((PsFuncPtr) mmi_da_wps_recv_http_auth_ind, MSG_ID_WPS_HTTP_AUTH_IND); return MMI_TRUE; }