void OslIntDeleteMsgQ (oslMsgqid msgqid) { #ifdef MMI_ON_WIN32 DeleteCriticalSection (&msgqid->q_cs); CloseHandle(msgqid->q_semaphore_read); CloseHandle(msgqid->q_semaphore_write); OslMfree(msgqid->q_start); OslMfree(msgqid->q_message_size); OslMfree(msgqid); #endif }
void OslIntFreeDataPtr(void * ptr) { #ifdef MMI_ON_HARDWARE_P //dyj modify start 20060630 //free_local_para(ptr); OslMfree(ptr); //dyj modify end #else TSIZE *temp; temp = (void*)((char*)ptr - sizeof(TSIZE)); OslMfree(temp); #endif }
kal_int32 xml_generate_write_filetobuf (char * dest, FS_HANDLE src, kal_uint32 *len) { char *load = NULL, *p; INT32 length; kal_int32 ret; load = OslMalloc(COM_BUF_SIZE); if (load == NULL) { return XG_E_NO_MEMORY; } p = dest; *len = 0; while ((ret = MMI_FS_Read(src, load, COM_BUF_SIZE-1, &length)) >= FS_NO_ERROR) { if (length == 0) { break; } memcpy(p, load, length); p += length; *len += length; } OslMfree(load); if (ret < FS_NO_ERROR) { return XG_E_FAIL; } else { return 0; } }
/***************************************************************************** * FUNCTION * mmi_opp_notify_scr_browse * DESCRIPTION * This function is to browse the received folder * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_opp_notify_scr_browse(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ S8 *path_tmpbuf; FMGR_FILTER filter; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ FMGR_FILTER_INIT(&filter); FMGR_FILTER_SET_ALL(&filter); path_tmpbuf = (S8*) OslMalloc(FMGR_PATH_BUFFER_SIZE); ASSERT(path_tmpbuf != NULL); kal_wstrcpy((WCHAR *)path_tmpbuf,(WCHAR *)MMI_OPP_CTX(recived_file_path)); #ifdef __USB_IN_NORMAL_MODE__ if (mmi_usb_is_in_mass_storage_mode()) { /* in mass storage mode */ if (mmi_usb_check_path_exported(path_tmpbuf)) { /* phone drive is exported, cant use this app */ mmi_usb_app_unavailable_popup(0); /* pass 0 will show default string */ OslMfree(path_tmpbuf); return; } } #endif /* __USB_IN_NORMAL_MODE__ */ mmi_fmgr_select_path_and_enter( APP_EXTDEVICE, FMGR_SELECT_BROWSE, filter, path_tmpbuf, /* (PS8)L"D:\\Received", */ mmi_opp_notify_scr_browse_cb); OslMfree(path_tmpbuf); mmi_opp_set_recv_files_cnt(0); /* After take action */ #ifdef __MMI_BIP_SUPPORT__ mmi_bt_bip_set_recv_images_cnt(0); #endif }
/***************************************************************************** * FUNCTION * BmiExit * DESCRIPTION * Free allocated memory. * PARAMETERS * None. * RETURNS * None. * GLOBALS AFFECTED * None *****************************************************************************/ void BmiExit(void *param_p) { if(g_bmi_cntx) { OslMfree(g_bmi_cntx); g_bmi_cntx = NULL; } }
/***************************************************************************** * FUNCTION * BmiDeInit * DESCRIPTION * Free allocated memory. * PARAMETERS * None. * RETURNS * None. * GLOBALS AFFECTED * None *****************************************************************************/ void BmiDeInit(void) { if(g_bmi_cntx) { OslMfree(g_bmi_cntx); g_bmi_cntx = NULL; } }
/************************************************************************* Local Functions *************************************************************************/ static mmi_ret mmi_widget_view_event_handler_proc(mmi_event_struct *evt) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ switch(evt->evt_id) { case EVT_ID_GROUP_DEINIT: { mmi_frm_set_protocol_event_handler(MSG_ID_WIDGET_NOTIFY_CONTENT_UPDATE_IND, NULL, KAL_FALSE); mmi_frm_set_protocol_event_handler(MSG_ID_WIDGET_CLOSE_VIEW_IND, NULL, KAL_FALSE); mmi_frm_set_protocol_event_handler(MSG_ID_WIDGET_TERMINATE_WGT_IND, NULL, KAL_FALSE); mmi_frm_set_protocol_event_handler(MSG_ID_WIDGET_TERMINATE_ALL_WGT_IND, NULL, KAL_FALSE); gadget_adp_avplugin_notify_close(); kal_take_mutex(g_widget_view_lock); if (!g_widget_view_cntx->closed_by_engine) { widget_close_view(g_widget_view_cntx->widget_id, g_widget_view_cntx->view_handle, g_widget_view_cntx->view_type, g_widget_view_cntx->view_response); } if (g_widget_view_cntx->gdi_buffer1) { med_free_asm_mem(GRP_ID_WIDGET_VIEW, (void **) &g_widget_view_cntx->gdi_buffer1); } if (g_widget_view_cntx->gdi_buffer2) { med_free_asm_mem(GRP_ID_WIDGET_VIEW, (void **) &g_widget_view_cntx->gdi_buffer2); } if (g_widget_view_cntx->render_layer) { gdi_layer_free(g_widget_view_cntx->render_layer); } OslMfree(g_widget_view_cntx); g_widget_view_cntx = NULL; kal_give_mutex(g_widget_view_lock); widget_disable_view_cache(); break; } default: break; } return MMI_RET_OK; }
/***************************************************************************** * FUNCTION * mmi_da_wps_recv_set_channel_rsp * DESCRIPTION * Handler function to handle set channel response, save channel_id to context * PARAMETERS * Message * RETURNS * void *****************************************************************************/ static void mmi_da_wps_recv_set_channel_rsp(void *MsgStruct) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ wps_set_channel_rsp_struct *p = (wps_set_channel_rsp_struct *) MsgStruct; S32 i; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ DA_WPS_TRACE(MMI_DA_WPS_TRACE_GROUP, MMI_DA_OMA_RECV_SET_CHANNEL_RSP); ASSERT(da_wps_context.busy_flag == MMI_DA_WPS_STATE_BUSY_SET); ASSERT(!da_wps_context.inited_flag); if (p->result == WPS_OK) { da_wps_context.channel_id = p->channel_id; da_wps_context.inited_flag = MMI_TRUE; } da_wps_context.busy_flag = MMI_DA_WPS_STATE_FREE; /* if there is pending action */ if(da_wps_context.inited_flag) { if(da_wps_context.session_num == 0) { mmi_da_wps_send_unset_channel_req(); return; } for(i=0;i<MMI_DA_WPS_MAX_SESSION;i++) { if(da_wps_context.session_table[i] && da_wps_context.session_table[i]->state == MMI_DA_WPS_SESSION_STATE_INIT) { da_wps_context.session_table[i]->state = MMI_DA_WPS_SESSION_STATE_READY; da_wps_context.session_table[i]->create_cb((wps_session_handle)da_wps_context.session_table[i], da_wps_context.session_table[i]->arg); } } } else { /* error, clear all session */ for(i=0;i<MMI_DA_WPS_MAX_SESSION;i++) { if(da_wps_context.session_table[i]) { da_wps_context.session_table[i]->create_cb(MMI_DA_INVALID_SESSION_HANDLE, da_wps_context.session_table[i]->arg); OslMfree(da_wps_context.session_table[i]); da_wps_context.session_table[i] = NULL; } } da_wps_context.session_num = 0; } }
/***************************************************************************** * FUNCTION * mmi_idle_entry_dial_pad_option * DESCRIPTION * Entry function of dial pad screen option menu (only available for __MMI_UCM__) * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_idle_entry_dial_pad_option(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ PU8 guiBuffer; U16 nNumofItem; #if defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__) U16 nStrItemList[4]; /* dial, save, input method, and change dial mode */ #else U16 nStrItemList[2]; /* dial and save */ #endif historyNode *History; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ EntryNewScreen(IDLE_SCREEN_DIGIT_OPTIONS_ID, NULL, mmi_idle_entry_dial_pad_option, NULL); guiBuffer = GetCurrGuiBuffer(IDLE_SCREEN_DIGIT_OPTIONS_ID); nNumofItem = GetNumOfChild_Ext(MENU_ID_DIALER_SCREEN_OPTIONS); GetSequenceStringIds_Ext(MENU_ID_DIALER_SCREEN_OPTIONS, nStrItemList); SetParentHandler(MENU_ID_DIALER_SCREEN_OPTIONS); RegisterHighlightHandler(ExecuteCurrHiliteHandler); ShowCategory15Screen( STR_GLOBAL_OPTIONS, 0, STR_GLOBAL_OK, IMG_GLOBAL_OK, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, nNumofItem, nStrItemList, (PU16) gIndexIconsImageList, LIST_MENU, 0, guiBuffer); SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP); SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN); /* reset the guiBuffer to enable long press after go back to the digit dialer screen */ if (GetHistoryScrID(IDLE_SCREEN_DIGIT_HANDLER_ID, &History) == ST_SUCCESS) { if (History->guiBuffer != NULL) { OslMfree(History->guiBuffer); History->guiBuffer = NULL; } } }
void mmi_widget_view_unlock_canvas(void *p) { canvas_lock_struct * lock = (canvas_lock_struct *)p; ASSERT(lock); ASSERT(lock->mutex == g_widget_view_lock); kal_give_mutex(g_widget_view_lock); OslMfree(lock); return; }
void mmi_mexe_get_sim_certificate_rsp(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ MYQUEUE Message; mmi_get_sim_certificate_rsp_struct *sim_certificate_rsp; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ ClearProtocolEventHandler(MSG_ID_MMI_SEND_SIM_CERTIFICATE_RECORD_RES); if (g_MExE_context.key_identifier != NULL) { OslMfree(g_MExE_context.key_identifier); g_MExE_context.key_identifier = NULL; } if (g_MExE_context.certificate_identifier != NULL) { OslMfree(g_MExE_context.certificate_identifier); g_MExE_context.certificate_identifier = NULL; } if (g_MExE_context.certificate_data != NULL) { OslMfree(g_MExE_context.certificate_data); g_MExE_context.certificate_data = NULL; } Message.oslSrcId = MOD_MMI; Message.oslDestId = g_MExE_context.sender_module; Message.oslMsgId = MSG_ID_MMI_GET_SIM_CERTIFICATE_RSP; sim_certificate_rsp = (mmi_get_sim_certificate_rsp_struct*) OslConstructDataPtr(sizeof(mmi_get_sim_certificate_rsp_struct)); sim_certificate_rsp->total = g_MExE_context.idx_certificate; Message.oslDataPtr = (oslParaType*) sim_certificate_rsp; Message.oslPeerBuffPtr = NULL; OslMsgSendExtQueue(&Message); }
kal_int32 xml_generate_write_filetofile(FS_HANDLE dest, FS_HANDLE src, kal_uint32 *len) { char *load = NULL; INT32 len_read, len_write; kal_int32 ret; load = OslMalloc(COM_BUF_SIZE); if (load == NULL) { return XG_E_NO_MEMORY; } *len = 0; while ((ret = MMI_FS_Read(src, load, COM_BUF_SIZE-1, &len_read)) >= FS_NO_ERROR) { if (len_read == 0) { break; } ret = MMI_FS_Write(dest, load, len_read, &len_write); if (ret < FS_NO_ERROR) { OslMfree(load); return XG_E_FAIL; } *len += len_write; } OslMfree(load); if (ret < FS_NO_ERROR) { return XG_E_FAIL; } else { return 0; } }
MMI_BOOL mmi_da_wps_session_auth_UCS2(wps_session_handle session, U16 *username, U16 *password) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ U8 *usr, *pwd; MMI_BOOL bret; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ ASSERT(username && password); usr = OslMalloc(mmi_ucs2strlen((S8*)username)+1); mmi_ucs2_to_asc((S8*)usr, (S8*)username); pwd = OslMalloc(mmi_ucs2strlen((S8*)password)+1); mmi_ucs2_to_asc((S8*)pwd, (S8*)password); bret = mmi_da_wps_session_auth(session, usr, pwd); OslMfree(usr); OslMfree(pwd); return bret; }
/***************************************************************************** * FUNCTION * mmi_syncml_free_vobj_buffer * DESCRIPTION * Free the vObject buffer * PARAMETERS * void * RETURNS * void *****************************************************************************/ static void mmi_syncml_free_vobj_buffer(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if (g_syncml_sync_context.vobj_ptr != NULL) { OslMfree(g_syncml_sync_context.vobj_ptr); g_syncml_sync_context.vobj_ptr = NULL; } }
/***************************************************************************** * FUNCTION * mmi_brw_address_list_entry_options * DESCRIPTION * Entry function for Enter Address Options screen. * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_brw_address_list_entry_options(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ U16* UC_list_of_items; U8 *guiBuffer; S32 num_of_items; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ EntryNewScreen(SCR_ID_BRW_ENTER_ADDRESS_OPTIONS, NULL, mmi_brw_address_list_entry_options, NULL); guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_ENTER_ADDRESS_OPTIONS); /*it saves the current screen as the browser top most screen*/ mmi_brw_set_top_screen_id(); num_of_items = GetNumOfChild(MENU_ID_BRW_ENTER_ADR_OPTIONS); UC_list_of_items = OslMalloc(sizeof(U16)*num_of_items); GetSequenceStringIds(MENU_ID_BRW_ENTER_ADR_OPTIONS, UC_list_of_items); SetParentHandler(MENU_ID_BRW_ENTER_ADR_OPTIONS); RegisterHighlightHandler(ExecuteCurrHiliteHandler); ShowCategory15Screen( STR_GLOBAL_OPTIONS, GetRootTitleIcon(SERVICES_WAP_MENU_ID), STR_GLOBAL_OPTIONS, 0, STR_GLOBAL_BACK, 0, num_of_items, UC_list_of_items, (U16*) gIndexIconsImageList, LIST_MENU, 0, guiBuffer); ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK); SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP); SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN); OslMfree(UC_list_of_items); }
static void mmi_da_wps_free_session(mmi_da_wps_session *s) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ ASSERT(s); ASSERT(s->state == MMI_DA_WPS_SESSION_STATE_READY); ASSERT(da_wps_context.session_table[s->request_id] == s); da_wps_context.session_table[s->request_id] = NULL; da_wps_context.session_num--; OslMfree(s); DA_WPS_TRACE_FUNC2(mmi_da_wps_free_session, da_wps_context.busy_flag, da_wps_context.session_num); if(da_wps_context.session_num == 0) mmi_da_wps_send_unset_channel_req(); }
void mmi_da_wps_cancel_create_session(U32 arg) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ S32 i; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ ASSERT(da_wps_context.busy_flag != MMI_DA_WPS_STATE_FREE); for(i=0;i<MMI_DA_WPS_MAX_SESSION;i++) { if(da_wps_context.session_table[i] && da_wps_context.session_table[i]->state == MMI_DA_WPS_SESSION_STATE_INIT && da_wps_context.session_table[i]->arg == arg) { OslMfree(da_wps_context.session_table[i]); da_wps_context.session_num--; da_wps_context.session_table[i] = NULL; } } }
/***************************************************************************** * FUNCTION * mmi_opp_fmgr_forward_to_opp_callback * DESCRIPTION * This function is the call back used when the transfer gets completed * PARAMETERS * buf_p [?] * result [IN] * RETURNS * void *****************************************************************************/ void mmi_opp_fmgr_forward_to_opp_callback(void *buf_p, U32 result) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if (buf_p) { OslMfree(buf_p); } if (result == MMI_OPP_ERR_SUCCESS) { DisplayPopup( (PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE); } else { DisplayPopup( (PU8) GetString(STR_GLOBAL_UNFINISHED), IMG_GLOBAL_UNFINISHED, 1, UI_POPUP_NOTIFYDURATION_TIME, WARNING_TONE); } DeleteScreenIfPresent(SCR_OPP_SENDING); StopTimer(FMGR_PROG_UPDATE_TIMER); }
void EmPingSendPkt(void) { kal_uint16 i = 0; kal_uint16 j = 0; kal_bool ret_val = KAL_FALSE; kal_int16 ret = 0; for(j = PING_CONTEXT_INFO(currCount); j < PING_CONTEXT_INFO(pingCount);j++) { PING_CONTEXT_INFO(pingStartFN) = 0; PING_CONTEXT_INFO(pingEndFN) = 0; kal_mem_set(PING_CONTEXT_INFO(echo_req), 0, PING_CONTEXT_INFO(pingSize)+8); PING_CONTEXT_INFO(echo_req[0]) = 8;//echo req PING_CONTEXT_INFO(echo_req[4]) = 0;//identifier PING_CONTEXT_INFO(echo_req[5]) = 100; PING_CONTEXT_INFO(echo_req[6]) = (kal_uint8)(PING_CONTEXT_INFO(seqNo) >> 8);//seq no PING_CONTEXT_INFO(echo_req[7]) = (kal_uint8)(PING_CONTEXT_INFO(seqNo) & 0x00ff); for(i=8;i<PING_CONTEXT_INFO(pingSize);i++)//dummy data PING_CONTEXT_INFO(echo_req[i])= (kal_uint8)(j+1); //there are two choices: connect->send or sendto //where addr specifies the destionation of ping //sendto directly ret = soc_sendto(PING_CONTEXT_INFO(socketId),PING_CONTEXT_INFO(echo_req), (PING_CONTEXT_INFO(pingSize)+8), 0, &PING_CONTEXT_INFO(pingSrvAddr)); if(ret != (PING_CONTEXT_INFO(pingSize)+8)) { if(ret == SOC_WOULDBLOCK) { kal_print("Socket said send it later"); return; } kal_print("send ping error"); soc_close(PING_CONTEXT_INFO(socketId)); if(PING_CONTEXT_INFO(echo_req) != NULL) { OslMfree(PING_CONTEXT_INFO(echo_req)); } if(PING_CONTEXT_INFO(echo_rsp) != NULL) { OslMfree(PING_CONTEXT_INFO(echo_rsp)); } PING_CONTEXT_INFO(echo_req) = NULL; PING_CONTEXT_INFO(echo_rsp) = NULL; PING_CONTEXT_INFO(state) = PING_INACTIVE; return; } else { EmPingStartTimer(PING_CONTEXT_INFO(seqNo)); //PING_CONTEXT_INFO(currCount)++; PING_CONTEXT_INFO(seqNo)++; PING_CONTEXT_INFO(pingStartFN) = TMD_System_Clock; } ret_val = EmPingRecvPkt(); if(ret_val == KAL_FALSE) { break; } } return; }
void mmi_da_wps_create_session(U32 arg, mmi_da_wps_session_created_funcptr_type create_cb, mmi_da_wps_http_response_funcptr_type http_rsp_cb, mmi_da_wps_http_auth_ind_funcptr_type http_auth_cb, mmi_da_wps_dl_progress_funcptr_type dl_progress_cb) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ S32 i; mmi_da_wps_session *session; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ /* find a empty slot */ if(da_wps_context.session_num == MMI_DA_WPS_MAX_SESSION) { create_cb(MMI_DA_INVALID_SESSION_HANDLE, arg); return; } for(i=0; i<MMI_DA_WPS_MAX_SESSION; i++) { if(!da_wps_context.session_table[i]) break; } ASSERT(i != MMI_DA_WPS_MAX_SESSION); /* alloc resource */ session = OslMalloc(sizeof(mmi_da_wps_session)); if(!session) { create_cb(MMI_DA_INVALID_SESSION_HANDLE, arg); return; } memset(session, 0, sizeof(mmi_da_wps_session)); da_wps_context.session_table[i] = session; da_wps_context.session_num++; session->request_id = i; session->arg = arg; session->create_cb = create_cb; session->http_rsp_cb = http_rsp_cb; session->http_auth_cb = http_auth_cb; session->dl_progress_cb = dl_progress_cb; session->state = MMI_DA_WPS_SESSION_STATE_INIT; DA_WPS_TRACE_FUNC3(mmi_da_wps_create_session, da_wps_context.busy_flag, da_wps_context.session_num, i); if(da_wps_context.inited_flag) { switch(da_wps_context.busy_flag) { case MMI_DA_WPS_STATE_FREE: session->state = MMI_DA_WPS_SESSION_STATE_READY; create_cb((wps_session_handle)session, arg); break; case MMI_DA_WPS_STATE_BUSY_UNSET: /* do nothing, when unset_rsp we will check if there are session or not */ break; case MMI_DA_WPS_STATE_BUSY_SET: default: ASSERT(0); goto func_err; break; } } else /* not inited yet */ { switch(da_wps_context.busy_flag) { case MMI_DA_WPS_STATE_FREE: /* init now */ mmi_da_wps_send_get_user_agent_req(); break; case MMI_DA_WPS_STATE_BUSY_SET: /* already in setting. do nothing */ break; case MMI_DA_WPS_STATE_BUSY_UNSET: default: ASSERT(0); goto func_err; break; } } return; func_err: da_wps_context.session_table[i] = NULL; da_wps_context.session_num--; OslMfree(session); create_cb(MMI_DA_INVALID_SESSION_HANDLE, arg); return; }
/************************************************************** FUNCTION NAME : SECSETGetFdlEntriesRsp(void) PURPOSE : getting all entries rsp INPUT PARAMETERS : nil OUTPUT PARAMETERS : nil RETURNS : void Author : Vanita Jain **************************************************************/ void SECSETGetFdlEntriesRsp(void *info) { MSG_PHB_GET_ENTRY_BY_INDEX_RSP_STRUCT* localPtr; U8 i= 0,j=0; //micha0317 U8 TempBuff[(MAX_PB_NUMBER_LENGTH+2)*ENCODING_LENGTH]; U8 *tmpConvertBuf = NULL; U16 convertOutLen = 0; U8 name_dcs;//Renwy add 2008/06/25 for '$' error U8 nSimID; nSimID = MTPNP_AD_get_protocol_event_src_mode(); mmi_trace(1, TSTXT("SECSETGetFdlEntriesRsp")); SetProtocolEventHandlerExt(NULL, PRT_PHB_GET_ENTRY_BY_INDEX_RSP,nSimID); localPtr = (MSG_PHB_GET_ENTRY_BY_INDEX_RSP_STRUCT *)info; if (localPtr->result.flag == 0 /*OK*/) { mmi_trace(1, TSTXT("if (localPtr->result.flag == 0 /*OK*/) ")); i = gpFDLBDLContext->FDNBDNCount; gpFDLBDLContext->FDNBDNCount += localPtr->no_list; //Add number of new entries in current list length. if (gpFDLBDLContext->FDNBDNCount > MAX_SIM_ENTRIES) gpFDLBDLContext->FDNBDNCount = MAX_SIM_ENTRIES; for (; i < gpFDLBDLContext->FDNBDNCount; i++, j++) { gpFDLBDLContext->FDLBDLEntries[i].storage = localPtr->list[j].storage; gpFDLBDLContext->FDLBDLEntries[i].index = localPtr->list[j].index; gpFDLBDLContext->FDLBDLEntries[i].record_index = localPtr->list[j].record_index; memset(gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name, 0, MAX_NAME_LEN_FSB_LIST*ENCODING_LENGTH); memset(gpFDLBDLContext->FDLBDLEntries[i].tel.number, 0, MAX_NUMBER_LEN_FSB_LIST*ENCODING_LENGTH); gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name_length = localPtr->list[j].alpha_id.name_length; gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name_dcs = localPtr->list[j].alpha_id.name_dcs; {//Renwy add begine 2008/06/25 for '$' error name_dcs = gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name_dcs; if (MMI_PHB_ASCII == gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name_dcs) { name_dcs = MMI_8BIT_DCS; } }//Renwy add end 2008/06/25 for '$' error tmpConvertBuf = CovertStringForPlatform(localPtr->list[j].alpha_id.name, gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name_length,name_dcs,&convertOutLen);//Renwy modify 2008/06/25 //tmpConvertBuf = CovertStringForPlatform(localPtr->list[j].alpha_id.name, gFDLBDLContext.FDLBDLEntries[i].alpha_id.name_length,gFDLBDLContext.FDLBDLEntries[i].alpha_id.name_dcs,&convertOutLen); gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name_length = (U8) convertOutLen; if (pfnUnicodeStrlen((PS8) tmpConvertBuf) <= MAX_PB_NAME_LENGTH) { pfnUnicodeStrcpy((PS8) gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name, (PS8) tmpConvertBuf); } else { pfnUnicodeStrncpy((PS8) gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name, (PS8) tmpConvertBuf, MAX_PB_NAME_LENGTH); } if (tmpConvertBuf!=NULL) OslMfree(tmpConvertBuf); if (localPtr->list[j].tel.type == MMI_CSMCC_INTERNATIONAL_ADDR) { gpFDLBDLContext->FDLBDLEntries[i].tel.type = localPtr->list[j].tel.type; gpFDLBDLContext->FDLBDLEntries[i].tel.number[0] = '+';//insert '+' before the number. gpFDLBDLContext->FDLBDLEntries[i].tel.length = localPtr->list[j].tel.length; AnsiiToUnicodeString((PS8)TempBuff, (PS8)localPtr->list[j].tel.number); memcpy(gpFDLBDLContext->FDLBDLEntries[i].tel.number + ENCODING_LENGTH, TempBuff, (localPtr->list[j].tel.length)*ENCODING_LENGTH); } else { gpFDLBDLContext->FDLBDLEntries[i].tel.type = localPtr->list[j].tel.type; gpFDLBDLContext->FDLBDLEntries[i].tel.length = localPtr->list[j].tel.length; AnsiiToUnicodeString((PS8)TempBuff, (PS8)localPtr->list[j].tel.number); memcpy(gpFDLBDLContext->FDLBDLEntries[i].tel.number, (PS8)TempBuff, (localPtr->list[j].tel.length)*ENCODING_LENGTH); } } if (localPtr->no_list == MAX_ENTRIES_IN_LIST) { mmi_trace(1, TSTXT(" if (localPtr->no_list == MAX_ENTRIES_IN_LIST) ")); SECSETGetFdlEntriesReq(); } else { mmi_trace(1, TSTXT(" ViewFDList ")); if(g_FixedInit[nSimID] != TRUE)////man for fdn { ViewFDList(); } gSimReady[nSimID] = TRUE; /* * Retrieve FDN list to ADN buffer when FDN is enable. * Because ADN will not read when FDN is on, so use ADN's buffer to store FDN temporarily * This is for call lookup FDN number usage. */ // if(g_SecuritySetupContext.FdlStatus) // mmi_phb_fdn_get_list_to_ram(); } } else if (localPtr->result.flag == 1 && localPtr->result.cause == 5) { // gFDLBDLContext.FDNBDNCount = 0; gSimReady[nSimID] = TRUE; ViewFDList(); } else { DisplayPopup((PU8)GetString(STR_GLOBAL_UNFINISHED) ,IMG_GLOBAL_UNFINISHED, 1,ST_NOTIFYDURATION,ERROR_TONE); DeleteUptoScrID(SCR_ID_SECSET_FIX_DIAL); } }
/***************************************************************************** * FUNCTION * mmi_opp_obj_receive_ind * DESCRIPTION * This function is to notify user that opp received a unrecognized object * PARAMETERS * path_src [?] * filename [?] * RETURNS * void *****************************************************************************/ MMI_OPP_NFY_TYPE mmi_opp_obj_receive_ind(void *path_src, void *filename) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ kal_uint8 fcnt = 0; U8 *path_buf; FS_HANDLE h; U8 recv_cnt = 0; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ /* Get total pending objects */ recv_cnt = mmi_opp_get_recv_files_cnt(); if (recv_cnt == 0xFF) { mmi_opp_set_recv_files_cnt(0xFF); } else { MMI_OPP_CTX(cur_recv_file_cnt) ++; mmi_opp_set_recv_files_cnt((U8) (recv_cnt + 1)); } /* Get file path buffer */ path_buf = OslMalloc(FMGR_MAX_PATH_LEN * ENCODING_LENGTH); MMI_OPP_ASSERT(path_buf != NULL); /* Build actually file name */ //MMI_OPP_MAKE_RECV_PATH(path_buf); /* kal_wstrcat( (kal_uint16 *)path_buf, L"\\" ); */ kal_wstrcpy((WCHAR *)path_buf,(WCHAR *)MMI_OPP_CTX(recived_file_path)); kal_wstrcat((kal_uint16*) path_buf, (kal_uint16*) filename); /* Rename temp file name to actually object name as file name */ h = MMI_FS_Rename((UINT8*) path_src, (UINT8*) path_buf); /* Check if file exist */ if (h < FS_NO_ERROR) { fcnt++; while (fcnt < 0xFF) { kal_wstrcpy((WCHAR *)path_buf,(WCHAR *)MMI_OPP_CTX(recived_file_path)); csd_wsprintf((kal_uint16*) nPrintableStr, "Dup(%d)", fcnt); kal_wstrcat((kal_uint16*) nPrintableStr, (kal_uint16*) filename); kal_wstrcat((kal_uint16*) path_buf, (kal_uint16*) nPrintableStr); h =MMI_FS_Rename((UINT8*) path_src, (UINT8*) path_buf); if (h < FS_NO_ERROR) { fcnt++; } else { break; } } } /* free path buffer */ OslMfree(path_buf); return MMI_OPP_NFY_SUCCESS; }
//added by guojian :get the fdn list to gFDLBDLContext, not PhoneBook[]. for our fdn process, not the same with previous one void GetFDLToContext(void *info) { MSG_PHB_GET_ENTRY_BY_INDEX_RSP_STRUCT* localPtr; U8 i= 0,j=0; //micha0317 U8 TempBuff[(MAX_PB_NUMBER_LENGTH+2)*ENCODING_LENGTH]; U8 *tmpConvertBuf = NULL; U16 convertOutLen = 0; U8 name_dcs;//Renwy add 2008/06/25 for '$' error U8 nSimId = 0; #ifdef __MMI_MULTI_SIM__ nSimId = gSecSetupMenuSimID; #endif mmi_trace(1, TSTXT("GetFDLToContext")); localPtr = (MSG_PHB_GET_ENTRY_BY_INDEX_RSP_STRUCT *)info; if (localPtr->result.flag == 0 /*OK*/) { mmi_trace(1, TSTXT("if GetFDLToContext (localPtr->result.flag == 0 /*OK*/) ")); i = gFDLBDLContext[nSimId].FDNBDNCount; gFDLBDLContext[nSimId].FDNBDNCount = localPtr->no_list; //Add number of new entries in current list length. mmi_trace(TRUE," Func: %s gpFDLBDLContext->FDNBDNCount=%d", __FUNCTION__,gFDLBDLContext[nSimId].FDNBDNCount); if (gFDLBDLContext[nSimId].FDNBDNCount > MAX_SIM_ENTRIES) gFDLBDLContext[nSimId].FDNBDNCount = MAX_SIM_ENTRIES; for (; i < gFDLBDLContext[nSimId].FDNBDNCount; i++, j++) { gFDLBDLContext[nSimId].FDLBDLEntries[i].storage = localPtr->list[j].storage; gFDLBDLContext[nSimId].FDLBDLEntries[i].index = localPtr->list[j].index; gFDLBDLContext[nSimId].FDLBDLEntries[i].record_index = localPtr->list[j].record_index; memset(gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name, 0, MAX_NAME_LEN_FSB_LIST*ENCODING_LENGTH); memset(gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.number, 0, MAX_NUMBER_LEN_FSB_LIST*ENCODING_LENGTH); gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name_length = localPtr->list[j].alpha_id.name_length; gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name_dcs = localPtr->list[j].alpha_id.name_dcs; {//Renwy add begine 2008/06/25 for '$' error name_dcs = gFDLBDLContext[0].FDLBDLEntries[i].alpha_id.name_dcs; if (MMI_PHB_ASCII == gFDLBDLContext[0].FDLBDLEntries[i].alpha_id.name_dcs) { name_dcs = MMI_8BIT_DCS; } }//Renwy add end 2008/06/25 for '$' error tmpConvertBuf = CovertStringForPlatform(localPtr->list[j].alpha_id.name, gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name_length,name_dcs,&convertOutLen);//Renwy modify 2008/06/25 //tmpConvertBuf = CovertStringForPlatform(localPtr->list[j].alpha_id.name, gFDLBDLContext.FDLBDLEntries[i].alpha_id.name_length,gFDLBDLContext.FDLBDLEntries[i].alpha_id.name_dcs,&convertOutLen); gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name_length = (U8) convertOutLen; if (pfnUnicodeStrlen((PS8) tmpConvertBuf) <= MAX_PB_NAME_LENGTH) { pfnUnicodeStrcpy((PS8) gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name, (PS8) tmpConvertBuf); } else { pfnUnicodeStrncpy((PS8) gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name, (PS8) tmpConvertBuf, MAX_PB_NAME_LENGTH); } if (tmpConvertBuf!=NULL) OslMfree(tmpConvertBuf); if (localPtr->list[j].tel.type == MMI_CSMCC_INTERNATIONAL_ADDR) { gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.type = localPtr->list[j].tel.type; gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.number[0] = '+';//insert '+' before the number. gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.length = localPtr->list[j].tel.length; AnsiiToUnicodeString((PS8)TempBuff, (PS8)localPtr->list[j].tel.number); memcpy(gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.number + ENCODING_LENGTH, TempBuff, (localPtr->list[j].tel.length)*ENCODING_LENGTH); } else { gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.type = localPtr->list[j].tel.type; gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.length = localPtr->list[j].tel.length; AnsiiToUnicodeString((PS8)TempBuff, (PS8)localPtr->list[j].tel.number); memcpy(gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.number, (PS8)TempBuff, (localPtr->list[j].tel.length)*ENCODING_LENGTH); } } } }
//========================================== //=== Ping Lib //========================================== void EmPingTimeourHandler(void) { kal_char str_buff[100]; kal_uint32 duration = 0; kal_uint32 avgRspMS = 0; sockaddr_struct *addr = NULL; addr = &PING_CONTEXT_INFO(pingSrvAddr); PING_CONTEXT_INFO(currCount)++; kal_sprintf(str_buff, "Timedout !seqNO: %d, currCounterL: %d", PING_CONTEXT_INFO(seqNo), PING_CONTEXT_INFO(currCount)); kal_print(str_buff); if(PING_CONTEXT_INFO(pingCount) == PING_CONTEXT_INFO(currCount)) { kal_print("Request timed out"); EmPingUpdateScreen( EM_PING_TIMEOUT, -1 ); PING_CONTEXT_INFO(lostCounter)++; soc_close(PING_CONTEXT_INFO(socketId)); if(PING_CONTEXT_INFO(echo_req) != NULL) { OslMfree(PING_CONTEXT_INFO(echo_req)); } if(PING_CONTEXT_INFO(echo_rsp) != NULL) { OslMfree(PING_CONTEXT_INFO(echo_rsp)); } PING_CONTEXT_INFO(echo_req) = NULL; PING_CONTEXT_INFO(echo_rsp) = NULL; PING_CONTEXT_INFO(state) = PING_INACTIVE; if(PING_CONTEXT_INFO(avgRspMS) == 0) { avgRspMS = 0; } else { avgRspMS = PING_CONTEXT_INFO(avgRspMS)/PING_CONTEXT_INFO(rcvdCounter); } /* Output the statistics */ kal_mem_set(&str_buff[0], 0, 100); kal_sprintf(str_buff,"Ping statstics for %d.%d.%d.%d:", addr->addr[0], addr->addr[1], addr->addr[2], addr->addr[3], PING_CONTEXT_INFO(pingSize), duration); kal_print(str_buff); kal_mem_set(&str_buff[0], 0, 100); kal_sprintf(str_buff, " Packets: Sent = %d, Received = %d, Lost = %d (%d%c loss)", PING_CONTEXT_INFO(pingCount), PING_CONTEXT_INFO(rcvdCounter), PING_CONTEXT_INFO(lostCounter), ((PING_CONTEXT_INFO(lostCounter)*100)/PING_CONTEXT_INFO(pingCount)), '%'); kal_print(str_buff); kal_mem_set(&str_buff[0], 0, 100); kal_sprintf(str_buff, " Min: %dms, Max: %dms, Avg: %dms", PING_CONTEXT_INFO(minRspMS), PING_CONTEXT_INFO(maxRspMS), avgRspMS); kal_print(str_buff); EmPingUpdateScreen( EM_PING_FIN, avgRspMS ); } else { if(PING_CONTEXT_INFO(state) == PING_ACTIVE) { PING_CONTEXT_INFO(lostCounter)++; kal_print("Request timed out"); EmPingUpdateScreen( EM_PING_TIMEOUT, -1 ); EmPingSendPkt(); } } return; }
void EmPingStartAct(kal_char *serv_addr) { kal_uint32 acc_id = 5;//account id kal_uint16 i, j = 0; kal_char str_buff[50]; kal_uint8 val = 1; PING_CONTEXT_INFO(state) = PING_ACTIVE; /* Clean all the statistics for the previous session */ PING_CONTEXT_INFO(maxRspMS) = 0; PING_CONTEXT_INFO(minRspMS) = 0; PING_CONTEXT_INFO(avgRspMS) = 0; PING_CONTEXT_INFO(rcvdCounter) = 0; PING_CONTEXT_INFO(lostCounter) = 0; if(PING_CONTEXT_INFO(echo_req) != NULL) { OslMfree(PING_CONTEXT_INFO(echo_req)); } if(PING_CONTEXT_INFO(echo_rsp) != NULL) { OslMfree(PING_CONTEXT_INFO(echo_rsp)); } //PING_CONTEXT_INFO(socketId) = soc_create(PF_INET, SOCK_RAW, IPPROTO_ICMP, MOD_PING, acc_id); PING_CONTEXT_INFO(socketId) = soc_create(PF_INET, SOCK_RAW, IPPROTO_ICMP, MOD_MMI, acc_id); if(PING_CONTEXT_INFO(socketId) >= 0) { if(soc_setsockopt(PING_CONTEXT_INFO(socketId), SOC_NBIO, &val, sizeof(val)) < 0) { kal_print("Set socket to nonblock mode error !!"); return ; } val = SOC_READ | SOC_WRITE; if(soc_setsockopt(PING_CONTEXT_INFO(socketId), SOC_ASYNC, &val, sizeof(val)) < 0) { kal_print("Set socket to nonblock mode error !!"); return ; } PING_CONTEXT_INFO(echo_req) = (kal_uint8*)OslMalloc(PING_CONTEXT_INFO(pingSize)+8); PING_CONTEXT_INFO(echo_rsp) = (kal_uint8*)OslMalloc(PING_CONTEXT_INFO(pingSize)+8); PING_CONTEXT_INFO(seqNo) = 0; PING_CONTEXT_INFO(currCount) = 0; PING_CONTEXT_INFO(pingSrvAddr.port) = 100;//identifier PING_CONTEXT_INFO(pingSrvAddr.addr_len) = 4;//any PING_CONTEXT_INFO(pingSrvAddr.addr[0])=0; PING_CONTEXT_INFO(pingSrvAddr.addr[1])=0; PING_CONTEXT_INFO(pingSrvAddr.addr[2])=0; PING_CONTEXT_INFO(pingSrvAddr.addr[3])=0; #ifdef MMI_ON_HARDWARE_P if(soc_bind(PING_CONTEXT_INFO(socketId), &PING_CONTEXT_INFO(pingSrvAddr)) != 0) { soc_close(PING_CONTEXT_INFO(socketId)); if(PING_CONTEXT_INFO(echo_req) != NULL) { OslMfree(PING_CONTEXT_INFO(echo_req)); } if(PING_CONTEXT_INFO(echo_rsp) != NULL) { OslMfree(PING_CONTEXT_INFO(echo_rsp)); } PING_CONTEXT_INFO(echo_req) = NULL; PING_CONTEXT_INFO(echo_rsp) = NULL; kal_print("bind error"); } #endif PING_CONTEXT_INFO(pingSrvAddr.addr[0]) = atoi(strtok(serv_addr, "."));//ip string: "140.112.1.1" to integer PING_CONTEXT_INFO(pingSrvAddr.addr[1]) = atoi(strtok(NULL, ".")); PING_CONTEXT_INFO(pingSrvAddr.addr[2]) = atoi(strtok(NULL, ".")); PING_CONTEXT_INFO(pingSrvAddr.addr[3]) = atoi(strtok(NULL, ".")); PING_CONTEXT_INFO(pingSrvAddr.addr_len) = 4; kal_sprintf(str_buff, "Pinging %d.%d.%d.%d with %d bytes of data", PING_CONTEXT_INFO(pingSrvAddr.addr[0]) , PING_CONTEXT_INFO(pingSrvAddr.addr[1]) , PING_CONTEXT_INFO(pingSrvAddr.addr[2]) , PING_CONTEXT_INFO(pingSrvAddr.addr[3]) , PING_CONTEXT_INFO(pingSize)); kal_print(str_buff); EmPingUpdateScreen(EM_PING_START, -1); EmPingSendPkt(); } //if(s >= 0) else { ASSERT(PING_CONTEXT_INFO(socketId) >= 0); } }
/***************************************************************************** * FUNCTION * mmi_ucm_app_make_call_with_source * DESCRIPTION * Sample code * PARAMETERS * call_type [IN] Call type * num_uri [IN] Number or URI in unicode string * RETURNS * void *****************************************************************************/ MMI_BOOL mmi_ucm_app_make_call_with_source(mmi_ucm_module_origin_enum module_id, mmi_ucm_call_type_enum call_type, U8 *num_uri) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ S32 unicodeLen = 0; U8* num_uri_ascii = NULL; MMI_BOOL result = TRUE; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if ((mmi_bootup_get_active_flight_mode())) { result = FALSE; return result; } #ifdef __MMI_WLAN_FEATURES__ else if ((mmi_netset_get_active_preferred_mode() == P_WLAN_ONLY) && (call_type != MMI_UCM_VOIP_CALL_TYPE)) { result = FALSE; return result; } #endif /* __MMI_WLAN_FEATURES__ */ else if (mmi_ucm_is_pending_action() == MMI_TRUE) { result = FALSE; return result; } unicodeLen = (MMI_UCM_MAX_NUM_URI_LEN > mmi_ucs2strlen((S8*)num_uri)) ? (mmi_ucs2strlen((S8*)num_uri)) : (MMI_UCM_MAX_NUM_URI_LEN - 1); num_uri_ascii = OslMalloc((unicodeLen + 1) * ENCODING_LENGTH); memset(num_uri_ascii, 0, (unicodeLen + 1) * ENCODING_LENGTH); mmi_ucs2_n_to_asc((S8*)num_uri_ascii, (S8*)num_uri, unicodeLen * ENCODING_LENGTH); /* do not check sos number for SAT call */ if ((module_id != MMI_UCM_FROM_SAT) && (mmi_ucm_is_sos_number(call_type, num_uri_ascii) == TRUE)) { if (mmi_ucm_is_sos_in_call_list() == FALSE) { #if defined(__MMI_DUAL_SIM_MASTER__) mmi_ucm_set_call_channel(call_type); #endif /* __MMI_DUAL_SIM_MASTER__ */ g_ucm_p->mo_info.module_id = module_id; g_ucm_p->mo_info.dial_type = call_type; memset(g_ucm_p->mo_info.dial_num.num_uri, 0, MMI_UCM_MAX_NUM_URI_LEN); mmi_ucs2_n_to_asc((S8*)g_ucm_p->mo_info.dial_num.num_uri, (S8*)num_uri, unicodeLen * ENCODING_LENGTH); /* If CSD number is ECC, the CSD call fails while ECC voice should be dialed. */ if (call_type & MMI_UCM_CSD_CALL_TYPE) { g_ucm_p->mo_info.dial_type = MMI_UCM_VOICE_CALL_TYPE; if (g_ucm_p->mo_info.module_id == MMI_UCM_FROM_ABM) { g_ucm_p->mo_info.module_id = MMI_UCM_FROM_IDLE; } result = FALSE; } else if (call_type & MMI_UCM_CSD_CALL_TYPE_SIM2) { g_ucm_p->mo_info.dial_type = MMI_UCM_VOICE_CALL_TYPE_SIM2; if (g_ucm_p->mo_info.module_id == MMI_UCM_FROM_ABM) { g_ucm_p->mo_info.module_id = MMI_UCM_FROM_IDLE; } result = FALSE; } if (mmi_ucm_app_total_call(MMI_UCM_CALL_TYPE_ALL) != 0) { PRINT_INFORMATION("\n[mmi_ucm_app_make_call_with_source] End All Calls before Dial SOS\n"); g_ucm_p->mo_info.is_wait_dial = TRUE; mmi_ucm_end_all_action(); } else { PRINT_INFORMATION("\n[mmi_ucm_app_make_call_with_source] Directly Dial SOS\n"); g_ucm_p->mo_info.is_wait_dial = TRUE; mmi_ucm_dial_action(); } } else /* not allow to dial this sos number */ { result = FALSE; } } else /* not a sos number */ { if (!strlen((S8*)num_uri_ascii)) /* empty number */ { result = FALSE; } else if ((!mmi_bootup_is_sim_valid()) && (call_type != MMI_UCM_VOIP_CALL_TYPE) && !(call_type & MMI_UCM_SIM2_CALL_TYPE_ALL)) { result = FALSE; } #if defined(__MMI_DUAL_SIM_MASTER__) else if ((!mmi_bootup_is_sim2_valid()) && (call_type & MMI_UCM_SIM2_CALL_TYPE_ALL)) { result = FALSE; } #endif /* __MMI_DUAL_SIM_MASTER__ */ /* Data/CSD call priority is lower than voice call priority. */ else if (mmi_ucm_app_total_call(MMI_UCM_CALL_TYPE_ALL) && (call_type & (MMI_UCM_CALL_TYPE_DATA_CSD_ALL))) { result = FALSE; } else if ((mmi_ucm_is_busy() == FALSE) && (mmi_ucm_dial_option() == TRUE)) { #if defined(__MMI_DUAL_SIM_MASTER__) mmi_ucm_set_call_channel(call_type); #endif /* __MMI_DUAL_SIM_MASTER__ */ g_ucm_p->mo_info.module_id = module_id; g_ucm_p->mo_info.dial_type = call_type; memset(g_ucm_p->mo_info.dial_num.num_uri, 0, MMI_UCM_MAX_NUM_URI_LEN); mmi_ucs2_n_to_asc((S8*)g_ucm_p->mo_info.dial_num.num_uri, (S8*)num_uri, unicodeLen * ENCODING_LENGTH); if ((g_ucm_p->mo_info.dial_type & MMI_UCM_VOICE_CALL_TYPE_ALL) && (SS_OPERATION == applib_ss_string_parsing((U8*)g_ucm_p->mo_info.dial_num.num_uri, (U8)strlen((S8*)g_ucm_p->mo_info.dial_num.num_uri)))) { /* dial directly if SS operation or SIM operation */ mmi_ucm_dial_action(); } else if (mmi_ucm_app_total_call(MMI_UCM_CALL_TYPE_DATA_CSD_ALL) && (g_ucm_p->mo_info.dial_type & MMI_UCM_CALL_TYPE_NO_DATA_CSD)) { /* normal call and data call cannot co-exist */ PRINT_INFORMATION("\n[mmi_ucm_app_make_call_with_source] End All Calls before Dial %d\n", g_ucm_p->mo_info.dial_type); g_ucm_p->mo_info.is_wait_dial = TRUE; mmi_ucm_end_all_action(); } else if (mmi_ucm_get_active_group(MMI_UCM_CALL_TYPE_ALL, FALSE, g_ucm_p->call_misc.index_list) == MMI_UCM_MAX_ACTIVE_TAB) { mmi_ucm_hold_and_dial_action(); } else { mmi_ucm_dial_action(); } result = TRUE; } else { result = FALSE; } } if (result == TRUE) { /* abort auto redial if necessary */ if (GetExitScrnID() == SCR_ID_UCM_AUTO_REDIAL || IsScreenPresent(SCR_ID_UCM_AUTO_REDIAL)) { StopTimer(UCM_AUTO_REDIAL_TIMER); ClearDelScrnIDCallbackHandler(SCR_ID_UCM_AUTO_REDIAL, NULL); if (GetExitScrnID() == SCR_ID_UCM_AUTO_REDIAL) { EntryNewScreen(GLOBAL_SCR_DUMMY, NULL, NULL, NULL); } DeleteScreenIfPresent(SCR_ID_UCM_AUTO_REDIAL); if (g_ucm_p->auto_redial.abort_hdlr) { g_ucm_p->auto_redial.abort_hdlr(); } memset(&g_ucm_p->auto_redial, 0, sizeof(mmi_ucm_auto_redial_struct)); } } OslMfree(num_uri_ascii); return result; }
kal_bool EmPingRecvPkt(void) { kal_int32 ret_val = -1; kal_uint16 i = 0; kal_uint32 duration = 0; sockaddr_struct *addr = NULL; kal_char str_buff[100]; addr = &PING_CONTEXT_INFO(pingSrvAddr); ret_val = soc_recv(PING_CONTEXT_INFO(socketId), PING_CONTEXT_INFO(echo_rsp), (PING_CONTEXT_INFO(pingSize)+8), 0); kal_sprintf(str_buff, "Rcvd !seqNO: %d, currCounterL: %d", PING_CONTEXT_INFO(seqNo), PING_CONTEXT_INFO(currCount)); kal_print(str_buff); if(ret_val > 0) { if((PING_CONTEXT_INFO(echo_rsp[6]) *256+PING_CONTEXT_INFO(echo_rsp[7])) < PING_CONTEXT_INFO(currCount)) { /* The is a invalid RSP for the waittime of this PING packet had been expiry, just ignore it */ kal_print("Received a timed out response"); return KAL_FALSE; } PING_CONTEXT_INFO(pingEndFN) = TMD_System_Clock; /* Stop timer */ EmPingStopTimer(); PING_CONTEXT_INFO(currCount)++; //check identifier if((PING_CONTEXT_INFO(echo_rsp[4]) *256+ PING_CONTEXT_INFO(echo_rsp[5])) != 100) { PING_CONTEXT_INFO(lostCounter)++; kal_print("Ping identifier wrong"); } else { //check seq no if((PING_CONTEXT_INFO(echo_rsp[6]) *256+PING_CONTEXT_INFO(echo_rsp[7])) != (PING_CONTEXT_INFO(seqNo)-1)) { PING_CONTEXT_INFO(lostCounter)++; kal_print("Ping seq no wrong"); } else { //check ping data for(i=8;i<PING_CONTEXT_INFO(pingSize);i++) { if(PING_CONTEXT_INFO(echo_rsp[i]) != (kal_uint8)PING_CONTEXT_INFO(currCount)) { PING_CONTEXT_INFO(lostCounter)++; kal_print("Ping data is wrong"); break; } } if(i==PING_CONTEXT_INFO(pingSize)) { /* Pass all check */ /* Calculate the time period */ if(PING_CONTEXT_INFO(pingEndFN) >= PING_CONTEXT_INFO(pingStartFN) ) { duration = (((PING_CONTEXT_INFO(pingEndFN) - PING_CONTEXT_INFO(pingStartFN)) * 462) / 100); } else { duration = (((2715647 + PING_CONTEXT_INFO(pingEndFN) - PING_CONTEXT_INFO(pingStartFN)) * 462) / 100); } /* Update statistics */ if(PING_CONTEXT_INFO(maxRspMS) < duration) PING_CONTEXT_INFO(maxRspMS) = duration; if((PING_CONTEXT_INFO(minRspMS) == 0) || (PING_CONTEXT_INFO(minRspMS) > duration)) PING_CONTEXT_INFO(minRspMS) = duration; PING_CONTEXT_INFO(avgRspMS) += duration; PING_CONTEXT_INFO(rcvdCounter)++; /* Output the result */ kal_sprintf(str_buff,"Reply from %d.%d.%d.%d: bytes=%d time=%dms", addr->addr[0], addr->addr[1], addr->addr[2], addr->addr[3], PING_CONTEXT_INFO(pingSize), duration); kal_print(str_buff); EmPingUpdateScreen(EM_PING_RECV, duration); if(PING_CONTEXT_INFO(pingCount) == PING_CONTEXT_INFO(currCount)) { soc_close(PING_CONTEXT_INFO(socketId)); if(PING_CONTEXT_INFO(echo_req) != NULL) { OslMfree(PING_CONTEXT_INFO(echo_req)); } if(PING_CONTEXT_INFO(echo_rsp) != NULL) { OslMfree(PING_CONTEXT_INFO(echo_rsp)); } PING_CONTEXT_INFO(echo_req) = NULL; PING_CONTEXT_INFO(echo_rsp) = NULL; PING_CONTEXT_INFO(state) = PING_INACTIVE; /* Output the statistics */ kal_mem_set(&str_buff[0], 0, 100); kal_sprintf(str_buff,"Ping statstics for %d.%d.%d.%d:", addr->addr[0], addr->addr[1], addr->addr[2], addr->addr[3], PING_CONTEXT_INFO(pingSize), duration); kal_print(str_buff); kal_mem_set(&str_buff[0], 0, 100); kal_sprintf(str_buff, " Packets: Sent = %d, Received = %d, Lost = %d (%d%c loss)", PING_CONTEXT_INFO(pingCount), PING_CONTEXT_INFO(rcvdCounter), PING_CONTEXT_INFO(lostCounter), ((PING_CONTEXT_INFO(lostCounter)*100)/PING_CONTEXT_INFO(pingCount)), '%'); kal_print(str_buff); kal_mem_set(&str_buff[0], 0, 100); kal_sprintf(str_buff, " Min: %dms, Max: %dms, Avg: %dms", PING_CONTEXT_INFO(minRspMS), PING_CONTEXT_INFO(maxRspMS), (PING_CONTEXT_INFO(avgRspMS)/PING_CONTEXT_INFO(rcvdCounter))); kal_print(str_buff); EmPingUpdateScreen(EM_PING_FIN, (PING_CONTEXT_INFO(avgRspMS)/PING_CONTEXT_INFO(rcvdCounter)) ); } } } //PING_CONTEXT_INFO(seqNo)++; } return KAL_TRUE; } else if(ret_val == SOC_WOULDBLOCK) { /* return KAL_FALSE to break out the for loop and wait for notification or timeout message */ return KAL_FALSE; } else { /* If happen, ask Kavien to have a look */ ASSERT(ret_val > 0); } return KAL_TRUE; }
/***************************************************************************** FUNCTION NAME : Entry_SP_Msg_Service PURPOSE :From Mobile Paradise back to the previous screen. INPUT PARAMETERS : void OUTPUT PARAMETERS : void RETURNS : Entry_MobileEden Entry_SP_Level1 SP_Pre_Entry_Level2 Entry_SP_Msg_Service | | | | | /Level1/ | /Level2/ | | Mobile Paradise | | | | | | ->New Style World | | | ---->Joke | -------->Request | -------------> ... <----- <----- SP_EDEN_GoBackHistory SP_Level1_GoBackHistory ******************************************************************************/ void Entry_SP_Msg_Service (void) { S8 textbuf[SP_CODE_LENGTH*ENCODING_LENGTH]; EMSData* pEMS; byte result; history_t temphistory; U8 service = sp_level_3_service_index; S8 codeNum[SP_LONG_CODE_LENGTH]; S8 dest_number[12]= "10664321";//now only china Mobile has SP, the destination number is only one. SP_SMS_Service_Code_Struct sp_level2_service_code; int i=0; mmi_trace(g_sw_SP,"niej service[%d]", service); /****************phone number********************/ memset(textbuf, 0, SP_CODE_LENGTH*ENCODING_LENGTH); memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS+1)*ENCODING_LENGTH); AnsiiToUnicodeString((S8*)textbuf, (S8*)dest_number); pfnUnicodeStrcat(g_msg_cntx.smsPhoneNumber, textbuf); mmi_trace(g_sw_SP,"niej 1textbuf[%s]", textbuf); mmi_trace(g_sw_SP,"niej g_msg_cntx.smsPhoneNumber[%s]", g_msg_cntx.smsPhoneNumber); /*Service code*/ ReleaseEMSEditBuffer(); memset(textbuf, 0, SP_CODE_LENGTH*ENCODING_LENGTH); memset(codeNum, 0, SP_LONG_CODE_LENGTH-1); SP_Get_Level2_Service_Code(sp_level1_scr.sp_menu_id, sp_level1_scr.sp_menu_id+sp_level_2_index+1, &sp_level2_service_code); switch(service) { case SP_SERVICE_SUBSCRIBE: memcpy(codeNum, sp_level2_service_code.Code_Subscribe, SP_LONG_CODE_LENGTH-1); break; case SP_SERVICE_ORDER: memcpy(codeNum, sp_level2_service_code.Code_Order, SP_LONG_CODE_LENGTH-1); break; case SP_SERVICE_COST: if((MENU_ID_SP_NEW_WORLD_THUMB_FUN == sp_level2_service_code.Level2_Menu_Id) ||(MENU_ID_SP_NEW_WORLD_CHALLENGER == sp_level2_service_code.Level2_Menu_Id) ||(MENU_ID_SP_FUN_EVERYDAY_JOY_TEST == sp_level2_service_code.Level2_Menu_Id) ||(MENU_ID_SP_FUN_EVERYDAY_SWEET_WORD == sp_level2_service_code.Level2_Menu_Id) ||(MENU_ID_SP_FUN_EVERYDAY_GUESS_WIN == sp_level2_service_code.Level2_Menu_Id) ) { int len = strlen(sp_level2_service_code.Code_Cost); int strid = 0; for(; i<len; i++) { strid += (sp_level2_service_code.Code_Cost[i]-48)*N_Multiplication(10, (len-i-1)); } mmi_trace(g_sw_SP,"niej strid[%d]",strid); Sp_Entry_Explain_Screen(strid);//43519 is id of title in next screen(Price Explanation) return; } else { memcpy(codeNum, sp_level2_service_code.Code_Cost, SP_LONG_CODE_LENGTH-1); } break; case SP_SERVICE_CANCEL: memcpy(codeNum, sp_level2_service_code.Code_Order, SP_LONG_CODE_LENGTH-1); break; case SP_SERVICE_EXPLAIN: Sp_Entry_Explain_Screen(sp_level2_service_code.Explain_StrId);//43520 is id of title in next screen(Description) return; case SP_SERVICE_CUSTOMER: SP_Entry_Make_Call(); return; default: mmi_trace(g_sw_SP,"niej invalid service[%d]", service); return; } mmi_trace(g_sw_SP,"niej codeNum[%s]",codeNum); memset(textbuf, 0, SP_CODE_LENGTH*ENCODING_LENGTH); AnsiiToUnicodeString(textbuf, (S8*)codeNum); mmi_trace(g_sw_SP,"niej 2textbuf[%s]",textbuf); memset (& temphistory, 0, sizeof (temphistory)); GetHistory (SCR_ID_MSG_WRITE, &temphistory); pEMS = GetEMSDataForEdit (0, 0); result = AppendEMSString_Ext(INPUT_TYPE_ALPHANUMERIC_SENTENCECASE, pEMS, (U8*)textbuf, SMSAL_DEFAULT_DCS, temphistory.guiBuffer ); mmi_trace(g_sw_SP,"niej result[%d]", result); if(result) { mmi_frm_sms_send_struct * sendData=OslMalloc(sizeof(mmi_frm_sms_send_struct)); memset((S8*)sendData, 0, sizeof(mmi_frm_sms_send_struct)); memset(sendData->number, 0, SP_MAX_DIGITS_SMS); if(pfnUnicodeStrlen((S8*)g_msg_cntx.smsPhoneNumber)) UnicodeToAnsii((S8*)sendData->number, (S8*)g_msg_cntx.smsPhoneNumber); mmi_trace(g_sw_SP,"niej sendData->number[%s]", sendData->number); mmi_frm_sms_send_sms(Sp_Send_Msg_Rsp, MOD_MMI, sendData); OslMfree(sendData); } else { DisplayPopup ((PU8)GetString (STR_SMS_DOES_NOT_SUPPORT), IMG_GLOBAL_UNFINISHED, 1, MESSAGES_POPUP_TIME_OUT, (U8)ERROR_TONE); } }