예제 #1
0
파일: Queue.c 프로젝트: jprothwell/sc-fix
/**************************************************************

	FUNCTION NAME		: OslIntCreateMsgQ

  	PURPOSE				: Creates Message Queue

	INPUT PARAMETERS	: nil

	OUTPUT PARAMETERS	: nil

	RETURNS				: nil

 
**************************************************************/
oslMsgqid OslIntCreateMsgQ (
					  PS8 queue_name,
					  U32 max_msg_size,
					  U32 max_msgs)
{
#ifdef MMI_ON_WIN32
	win32_msgqid *msgqid;
	msgqid=(win32_msgqid *)OslMalloc(sizeof(win32_msgqid));
	strcpy(msgqid->q_name, queue_name);
	msgqid->q_max_message_size=max_msg_size;
	msgqid->q_max_messages=max_msgs;
	msgqid->q_messages=0;
	msgqid->q_queue_size=msgqid->q_max_message_size * msgqid->q_max_messages;
	msgqid->q_semaphore_read = CreateSemaphore(NULL, 0,1000 , NULL);
	msgqid->q_semaphore_write = CreateSemaphore(NULL, 0,1000 , NULL);
	msgqid->q_start= (PU32)OslMalloc(msgqid->q_queue_size);
	msgqid->q_message_size= (PU32)OslMalloc(msgqid->q_max_messages * 4);
	msgqid->q_read=0;
	msgqid->q_write=0;
	msgqid->q_tasks_waiting_read=0;
	msgqid->q_tasks_waiting_write=0;
	InitializeCriticalSection(&msgqid->q_cs);
	return	msgqid;
#else
	return NULL;	
#endif

}
예제 #2
0
파일: MExE.c 프로젝트: 12019/mtktest
void mmi_mexe_get_sim_certificate_req(void *info)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_get_sim_certificate_req_struct *sim_certificate_req;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    sim_certificate_req = (mmi_get_sim_certificate_req_struct*) info;

    g_MExE_context.idx_certificate = 0;
    g_MExE_context.sender_module = sim_certificate_req->mod_id;

    if (!g_MExE_context.MExE_valid)
    {
        mmi_mexe_get_sim_certificate_rsp();
        return;
    }

    g_MExE_context.required_type = sim_certificate_req->type;
    g_MExE_context.ORPK_finish = 0;
    g_MExE_context.ARPK_finish = 0;
    g_MExE_context.TPRPK_finish = 0;
    g_MExE_context.key_identifier = OslMalloc(MAX_MExE_IDENTIFIER_LEN);
    g_MExE_context.certificate_identifier = OslMalloc(MAX_MExE_IDENTIFIER_LEN);
    g_MExE_context.certificate_data = OslMalloc(MAX_MExE_DATA_LEN);

    SetProtocolEventHandler(mmi_mexe_send_sim_certificate_record_res, MSG_ID_MMI_SEND_SIM_CERTIFICATE_RECORD_RES);

    mmi_mexe_retrieve_certificate_handler();
}
예제 #3
0
/*****************************************************************************
 * FUNCTION
 *  mmi_ss_copy_act_req
 * DESCRIPTION
 *  copy action request structure
 * PARAMETERS
 *  op              [IN]    operation code
 *  from            [IN]    data
 * RETURNS
 *  void*
 *****************************************************************************/
void *mmi_ss_copy_act_req(srv_ss_act_enum op, void *from)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    void *to;

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

    switch (op)
    {
        case SRV_SS_ACT_CALL_FORWARD:
            to = OslMalloc(sizeof(srv_ss_call_forward_req_struct));
            memcpy(to, from, sizeof(srv_ss_call_forward_req_struct));
            break;

        case SRV_SS_ACT_CALL_BAR:
            to = OslMalloc(sizeof(srv_ss_call_bar_req_struct));
            memcpy(to, from, sizeof(srv_ss_call_bar_req_struct));
            break;

        case SRV_SS_ACT_CALL_WAIT:
            to = OslMalloc(sizeof(srv_ss_call_wait_req_struct));
            memcpy(to, from, sizeof(srv_ss_call_wait_req_struct));
            break;

        case SRV_SS_ACT_SS_OPERATION:
            to = OslMalloc(sizeof(srv_ss_operation_req_struct));
            memcpy(to, from, sizeof(srv_ss_operation_req_struct));
            break;

        case SRV_SS_ACT_ABORT:
            to = OslMalloc(sizeof(srv_ss_abort_req_struct));
            memcpy(to, from, sizeof(srv_ss_abort_req_struct));
            break;

        case SRV_SS_ACT_CALL_IDENTIFICATION:
        case SRV_SS_ACT_CNAP:
        case SRV_SS_ACT_CCBS:
        case SRV_SS_ACT_EMLPP:
        case SRV_SS_ACT_USSD:
        default:
            to = NULL;
            break;
    }

    return to;
}
예제 #4
0
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;
    }
}
예제 #5
0
파일: bmi.c 프로젝트: jprothwell/sc-fix
/*****************************************************************************
* FUNCTION
*	EntryBMIWelcomeScreen
* DESCRIPTION
*   Display welcome screen of BMI application
* PARAMETERS
*	None
* RETURNS
*	None
* GLOBALS AFFECTED
*	None
*****************************************************************************/
void EntryBMIWelcomeScreen(void) 
{
	U8 *guiBuffer;

	EntryNewScreen(SCR_BMI_WELCOME, NULL, EntryBMIWelcomeScreen, NULL);
	guiBuffer = GetCurrGuiBuffer(SCR_BMI_WELCOME);

	if(g_bmi_cntx == NULL)
		g_bmi_cntx = OslMalloc(sizeof(bmi_context_struct));
	
	memset(g_bmi_cntx, 0, sizeof(bmi_context_struct));

	ShowCategory129Screen((U8*)get_string(STR_BMI_WELCOME_CAPTION), GetRootTitleIcon(ORGANIZER_HEALTH_MENU), 
					STR_GLOBAL_OK, IMG_GLOBAL_OK, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, 
					IMG_BMI_WELCOME_SCREEN, guiBuffer);
	
	SetLeftSoftkeyFunction(EntryBMIInputScreen ,KEY_EVENT_UP);
	SetRightSoftkeyFunction(BmiFreeMemAndGoBack,KEY_EVENT_UP);
	
	#ifdef __MMI_NOKIA_STYLE_N800__
        ClearKeyHandler( KEY_LSK,  KEY_EVENT_DOWN);
        ClearKeyHandler( KEY_RSK,  KEY_EVENT_DOWN);
        SetKeyHandler(EntryBMIInputScreen , KEY_LSK,  KEY_EVENT_UP);
        SetKeyHandler(BmiFreeMemAndGoBack , KEY_RSK,  KEY_EVENT_UP);
	#endif
}
예제 #6
0
파일: gcj_net.c 프로젝트: jprothwell/sc-fix
void gcjEventAPI_StopGprs()
{
	int ret = DEBUG_SIGN;
	int tmpSem = gcj_StubNewSemphone();
	gcj_TraceOut(0,"func:%s,tmpSem=%d\n",__FUNCTION__,tmpSem);	
	COS_EVENT evt;
	_NET_EVENT_T *data = (_NET_EVENT_T *)OslMalloc(sizeof (_NET_EVENT_T));
	if (!data)
		abort();
	
	data->semp = tmpSem;
	data->finish = EventNetworkFinishNoRet;
	//data->result = &ret;
	evt.nEventId = (unsigned int)MSG_ID_GCJ_STOP_GPRS_REQ;
	evt.nParam1 = data;
	gcj_StubSendEvent(&evt,MOD_MMI);	
/*	
	recordSempInEventApi(tmpSem);
	gcj_StubTakeSemphone(tmpSem);
	ret = gcjEventApi_NetRet;
	if (gcjEventApi_NetRet == DEBUG_SIGN)
		abort();
	gcjEventApi_NetRet = DEBUG_SIGN;
	
	removeSempInEventApi(tmpSem);
	//sxr_ReleaseSemaphore(netResultSem);
*/	
}
예제 #7
0
파일: gcj_net.c 프로젝트: jprothwell/sc-fix
int gcjEventAPI_GetHostName(const unsigned char * domain,unsigned char *address,unsigned char *address_len)
{
	int ret = DEBUG_SIGN;
	int tmpSem = gcj_StubNewSemphone();
	gcj_TraceOut(0,"func:%s,tmpSem=%d\n",__FUNCTION__,tmpSem);	
	COS_EVENT evt;
	_NET_EVENT_GET_HOST_T *data = (_NET_EVENT_GET_HOST_T *)OslMalloc(sizeof (_NET_EVENT_GET_HOST_T));
	if (!data)
		abort();
	
	data->semp = tmpSem;
	data->domain = domain;
	data->address = address;
	data->adress_len = address_len;
	data->finish = EventNetworkFinish;
	data->result = &ret;
	evt.nEventId = (unsigned int)MSG_ID_GCJ_GET_HOST_NAME_REQ;
	evt.nParam1 = data;
	recordSempInEventApi(tmpSem);	
	gcj_StubSendEvent(&evt,MOD_MMI);	
	gcj_StubTakeSemphone(tmpSem);
	/*
	ret = gcjEventApi_NetRet;
	if (gcjEventApi_NetRet == DEBUG_SIGN)
		abort();
	gcjEventApi_NetRet = DEBUG_SIGN;
	*/
	removeSempInEventApi(tmpSem);
	//sxr_ReleaseSemaphore(netResultSem);
	if (ret == DEBUG_SIGN)
		abort();
	return ret;
}
예제 #8
0
파일: gcj_net.c 프로젝트: jprothwell/sc-fix
int gcjEventAPI_SocketClose(SOCKET nSocket)
{
	int ret = DEBUG_SIGN;
	
	if (nSocket>5)
		abort();
	int tmpSem = gcj_StubNewSemphone();
	gcj_TraceOut(0,"func:%s,tmpSem=%d\n",__FUNCTION__,tmpSem);	
	COS_EVENT evt;
	_NET_EVENT_SOC_CLOSE_T *data = (_NET_EVENT_SOC_CLOSE_T *)OslMalloc(sizeof (_NET_EVENT_SOC_CLOSE_T));
	if (!data)
		abort();
	
	data->semp = tmpSem;
	data->nSocket = nSocket;
	data->finish = EventNetworkFinish;	
	data->result = &ret;
	evt.nEventId = (unsigned int)MSG_ID_GCJ_SOCKET_CLOSE_REQ;
	evt.nParam1 = data;
	recordSempInEventApi(tmpSem);	
	gcj_StubSendEvent(&evt,MOD_MMI);	
	gcj_StubTakeSemphone(tmpSem);
	/*
	ret = gcjEventApi_NetRet;
	if (gcjEventApi_NetRet == DEBUG_SIGN)
		abort();
	gcjEventApi_NetRet = DEBUG_SIGN;
	*/
	removeSempInEventApi(tmpSem);
	//sxr_ReleaseSemaphore(netResultSem);
	
	if (ret == DEBUG_SIGN)
		abort();
	return ret;
}
예제 #9
0
파일: bmi.c 프로젝트: jprothwell/sc-fix
/*****************************************************************************
* FUNCTION
*	EntryBMIInputScreen
* DESCRIPTION
*   Display inline editor screen for entering gender, height, and weight
* PARAMETERS
*	None
* RETURNS
*	None
* GLOBALS AFFECTED
*	None
*****************************************************************************/
void EntryBMIInputScreen(void) 
{
	U8 *guiBuffer;
	U8* inputBuffer;                       //added for inline edit history
	U16 inputBufferSize;                //added for inline edit history
	U16 BMIImageList[6] = {0,0,0,0,0,0};

	//to malloc memory
	if(g_bmi_cntx == NULL)
	{
		g_bmi_cntx = OslMalloc(sizeof(bmi_context_struct));
		memset(g_bmi_cntx, 0, sizeof(bmi_context_struct));
	}		
	//
	
	EntryNewScreen(SCR_BMI_INPUT, ExitBMIInputScreen, NULL, NULL);
	SetDelScrnIDCallbackHandler(SCR_BMI_INPUT, (HistoryDelCBPtr)BmiExit);

	InitializeCategory57Screen();							

	guiBuffer = GetCurrGuiBuffer(SCR_BMI_INPUT);

	BMIFillInlineStruct();

	RegisterHighlightHandler(HighlightBMIInlineEditor);

	if(g_bmi_cntx->Gender == 0)
		BMIImageList[ENUM_GENDER] = IMG_BMI_BLUE_FLOWER;
	else
		BMIImageList[ENUM_GENDER] = IMG_BMI_RED_FLOWER;

	inputBuffer = GetCurrNInputBuffer(SCR_BMI_INPUT, &inputBufferSize);    //added for inline edit history
	
	if(inputBuffer!=NULL)                                            //added for inline edit history
		SetCategory57Data(wgui_inline_items, ENUM_INLINE_TOTAL, inputBuffer);//sets the data 

 	DisableCategory57ScreenDone();
 	
 	#ifdef __MMI_SLIM_LISTMENU_NUMBER__ 
 		wgui_override_list_menu_slim_style(WGUI_LIST_MENU_SLIM_STYLE_DRAW_ICON);
 	#endif
 
	 
 	//Category57AppendTopImage(IMG_BMI_WELCOME_SCREEN, TRUE);
 	 
	ShowCategory57Screen(STR_BMI_INPUT_CAPTION,GetRootTitleIcon(ORGANIZER_HEALTH_MENU), 
	                     STR_GLOBAL_OK, IMG_GLOBAL_OK, 
	                     STR_GLOBAL_BACK, IMG_GLOBAL_BACK, 
						 ENUM_INLINE_TOTAL, 
						 BMIImageList,
						 wgui_inline_items, 
						 g_bmi_cntx->CurrHilite, 
						 guiBuffer);
 
	SetCategory57RightSoftkeyFunctions(BmiComputeResult, GoBackHistory);

}
예제 #10
0
파일: Queue.c 프로젝트: jprothwell/sc-fix
void * OslIntConstructDataPtr(U32 size)
{

	#ifdef MMI_ON_HARDWARE_P
	       //dyj modify start 20060630
	 	//return(construct_local_para(size, TD_CTRL));
	 	void *ptr;
		ptr = OslMalloc(size);
		((LOCAL_PARA_HDR_T *)ptr)->msg_len = size; 
	 	return ptr;
	 	//dyj modify end
	#else
		void *ptr;
		TSIZE *temp, tempdata;
		temp = OslMalloc(size + sizeof(tempdata));
		tempdata.s=size;
		memcpy(temp, &tempdata, sizeof(tempdata));
		ptr = (void*)((char*)temp + sizeof(tempdata));
		return ptr;	
	#endif	
}
예제 #11
0
파일: Queue.c 프로젝트: jprothwell/sc-fix
ilm_struct *allocate_ilm(module_type module_id)
{
     ilm_struct *pilm;
	  UINT32  nCallerAdd = 0x00;
	  COS_GET_RA(&nCallerAdd);
	 
     pilm = (ilm_struct *)OslMalloc(sizeof(ilm_struct));
	 memset(pilm, 0, sizeof(ilm_struct));
     pilm->src_mod_id = module_id;
	 	  COS_UpdateMemCallAdd(pilm,nCallerAdd);

     return pilm;
}
예제 #12
0
void Msg_Adaption_PHB_Finish_Init(void)
{
	ilm_struct ilm_ptr;
	U8 i;
	mmi_phb_startup_finish_ind_struct *localPtr = OslMalloc(sizeof(mmi_phb_startup_finish_ind_struct));
	ASSERT(localPtr != NULL);
	memset(localPtr, 0, sizeof(mmi_phb_startup_finish_ind_struct));

	localPtr->phb_len = MAX_ABBREVIATED_DIAL_NUMBER_LEN;
	localPtr->fdn_len = MAX_FIX_DIALLING_NUMBER_LEN;
	localPtr->bdn_len = MAX_ABBREVIATED_DIAL_NUMBER_LEN;
	localPtr->owner_len = MAX_OWNER_NUMBER_LEN;
	localPtr->phb_max_num = MAX_PB_PHONE_ENTRIES;

	for(i = 0; i < ADP_SIM_NUMBER; i++)
	{
		localPtr->sim_max_num[i] = adp_gPHBContex[i].nSIMTotalSlot;
	}
		
	ilm_ptr.dest_mod_id = MOD_MMI;
	ilm_ptr.src_mod_id = MOD_L4C;
	ilm_ptr.msg_id = MSG_ID_MMI_PHB_STARTUP_FINISH_IND;
	ilm_ptr.local_para_ptr = (local_para_struct *)localPtr;
	OslMsgSendExtQueue(&ilm_ptr);
	mmi_trace(g_sw_ADP_PHB, TSTXT("PHB MSG_ID_MMI_PHB_STARTUP_READ_NEXT_REQ STARTUP_FINISH_IND.  \n"));

	flag_init_ok = TRUE;

	{
		U8 nSimIndex;
		for(nSimIndex = 0; nSimIndex< ADP_SIM_NUMBER;nSimIndex++)
		{
			if(bNeedInit[nSimIndex])
			{
				#ifdef __ADP_MULTI_SIM__
				mmi_trace(g_sw_ADP_SS, "SS Init Call Forwarding Start for sim%d", nSimIndex);
				AdpInitCallFwowardingStart(nSimIndex);
				#else
				AdpInitCallFwowardingStart();
				#endif
				break;
			}
		}
	}

#ifdef ADP_DUALSIM_MODE_CLOSE_NOSIM
	ADP_CloseNoSIM();
#endif
	
}
예제 #13
0
파일: DLAgentWPS.c 프로젝트: 12019/mtktest
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;
}
예제 #14
0
/**************************************************************

	FUNCTION NAME		: Msg_Adaption_PHB_Init

	PURPOSE				: Init about the PHB of Adaption

	INPUT PARAMETERS	: void

	OUTPUT PARAMETERS	: nil

	RETURNS				: void

	REMARKS			:

**************************************************************/
void  Msg_Adaption_PHB_Init(void)
{
    U8 i = 0;
    
	if (nMEusedSlot > 0)
	{

		/* induct init procedure */
		ilm_struct  ilm_ptr;
		CFW_PBK_ENTRY_INFO *entryInfo = NULL;
		mmi_phb_startup_read_ind_struct *phb = OslMalloc(sizeof(mmi_phb_startup_read_ind_struct));
		ASSERT(phb != NULL);
		memset(phb, 0x00, sizeof(mmi_phb_startup_read_ind_struct));

		/* start from the first index */
		entryInfo = &(pb_coolsand[MEUsedIndex[0]]);
        #ifdef __ADP_MULTI_SIM__
		phb->access_id = 1;
		for(i = 0; i < ADP_SIM_NUMBER; i++)
		{
			if(g_PHBSIMStartFinish[i])
			{
				phb->access_id += adp_gPHBContex[i].nSIMTotalSlot;
			}
		}
        #else
		phb->access_id = nCurAccess;  //entryInfo->nAppIndex + 1;// 1;
        #endif	
		phb->phb_entry.storage = MMI_NVRAM;
		phb->phb_entry.record_index = entryInfo->nAppIndex;

		memcpy(&(phb->phb_entry.alpha_id), &(entryInfo->alpha_id), sizeof(l4_name_struct));
		memcpy(&(phb->phb_entry.tel), &(entryInfo->tel), sizeof(l4_addr_bcd_struct));

		//vivian add for bug 10769
		phb->phb_entry.tel.addr_length = entryInfo->tel.addr_length + 1;
		ilm_ptr.dest_mod_id = MOD_MMI;
		ilm_ptr.src_mod_id = MOD_L4C;
		ilm_ptr.msg_id = MSG_ID_MMI_PHB_STARTUP_READ_IND;
		ilm_ptr.local_para_ptr = (local_para_struct *)phb;
		OslMsgSendExtQueue(&ilm_ptr);
		mmi_trace(g_sw_ADP_PHB, TSTXT("PHB Init Func: %s***access_id:%d******nAppIndex:%d*** MEUsedIndex[0] = %d"), __FUNCTION__, phb->access_id, entryInfo->nAppIndex, MEUsedIndex[0]);
	}
	else
	{
		Msg_Adaption_PHB_Finish_Init();
	}
}
예제 #15
0
/**************************************************************
	FUNCTION NAME		: adp_phb_del_entry_ok_rsp
	PURPOSE			       : respond PRT_PHB_DEL_ENTRY_REQ.
	INPUT PARAMETERS	: void
	OUTPUT PARAMETERS	: nil
	RETURNS			       : void
	REMARKS			:
**************************************************************/
void adp_phb_del_entry_ok_rsp(void)
{
	ilm_struct ilm_ptr;
	mmi_phb_del_entry_rsp_struct *localPtr = OslMalloc(sizeof(mmi_phb_del_entry_rsp_struct));
	ASSERT(localPtr != NULL);
	memset(localPtr, 0, sizeof(mmi_phb_del_entry_rsp_struct));
  mmi_trace(g_sw_ADP_PHB, "adp_phb_del_entry_ok_rsp");

	localPtr->result.flag = L4C_OK;

	ilm_ptr.dest_mod_id = MOD_MMI;
	ilm_ptr.src_mod_id = MOD_L4C;
	ilm_ptr.msg_id = PRT_PHB_DEL_ENTRY_RSP;
	ilm_ptr.local_para_ptr = (local_para_struct *)localPtr;
	OslMsgSendExtQueue(&ilm_ptr);
}
예제 #16
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
}
예제 #17
0
/**************************************************************
	FUNCTION NAME		: adp_phb_del_entry_error_rsp
	PURPOSE			       : respond PRT_PHB_DEL_ENTRY_REQ.
	INPUT PARAMETERS	: void
	OUTPUT PARAMETERS	: nil
	RETURNS			       : void
	REMARKS			:
**************************************************************/
void adp_phb_del_entry_error_rsp(void)
{
	ilm_struct ilm_ptr;
	mmi_phb_del_entry_rsp_struct *localPtr = OslMalloc(sizeof(mmi_phb_del_entry_rsp_struct));
	ASSERT(localPtr != NULL);
	memset(localPtr, 0, sizeof(mmi_phb_del_entry_rsp_struct));
  mmi_trace(g_sw_ADP_PHB, "adp_phb_del_entry_error_rsp");
 //add by chenq for bug 5889 and 5800, 20070803 B  
  COS_KillTimerEX(GetMmiTaskHandle(MOD_ADP), PHBLIST_COPY_OR_DELETE_TIMEROUTID );
 //add by chenq for bug 5889 and 5800, 20070803 E  
	localPtr->result.flag = L4C_ERROR;

	ilm_ptr.dest_mod_id = MOD_MMI;
	ilm_ptr.src_mod_id = MOD_L4C;
	ilm_ptr.msg_id = PRT_PHB_DEL_ENTRY_RSP;
	ilm_ptr.local_para_ptr = (local_para_struct *)localPtr;
	OslMsgSendExtQueue(&ilm_ptr);
}
예제 #18
0
/*****************************************************************************
 * 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);
}
예제 #19
0
파일: jamr.c 프로젝트: jprothwell/sc-fix
Media_Handle *JAmr_Open( void (*handler)( Media_Handle *handle, Media_Event event ), Media_AMR_Param **param )
{
   Media_Handle_Internal *handle;

   handle = (Media_Handle_Internal*)OslMalloc( sizeof(Media_Handle_Internal) );
   handle->mh.handler      = handler;
   handle->mh.start_time   = 0;
   handle->mh.stop_time    = 0x7FFFFFFF;
   handle->mh.volume_level = 100;
   handle->mh.state        = AMR_STATE_READY;
   handle->aud_id          = 0;//L1Audio_GetAudioID();
   handle->param.amrfile   = 0;
   *param = &handle->param;
 //  L1Audio_SetEventHandler( handle->aud_id, jamrTask );
   return (Media_Handle*)handle;


   return (Media_Handle*)1;
}
예제 #20
0
void *mmi_widget_view_lock_canvas(int instance_id, void *view_handle, void **ptr_buffer, int width, int height)
{
    canvas_lock_struct *lock = NULL;
    
    int buffer_size = width * height * 2;
        
#ifdef WIDGET_DETAILS_VIEW_ARGB8888_COLOR_FORMAT
    buffer_size = width * height * 4;
#endif

    ASSERT(ptr_buffer);
    if (mmi_frm_scrn_get_active_id() != SCR_ID_WIDGET_VIEW)
    {
        return NULL;
    }

    kal_take_mutex(g_widget_view_lock);

    if (!g_widget_view_cntx || g_widget_view_cntx->widget_id != instance_id || g_widget_view_cntx->view_handle != view_handle || !g_widget_view_cntx->render_layer ||
        g_widget_view_cntx->view_width != width || g_widget_view_cntx->view_height != height)
    {
        kal_give_mutex(g_widget_view_lock);
        return NULL;
    }

    lock = (canvas_lock_struct *)OslMalloc(sizeof(canvas_lock_struct));
    memset(lock, 0, sizeof(canvas_lock_struct));
    lock->mutex = g_widget_view_lock;
    lock->view_type = g_widget_view_cntx->view_type;
    lock->unlock_canvas = mmi_widget_view_unlock_canvas;
    gdi_layer_push_and_set_active(g_widget_view_cntx->render_layer);


    memset(gdi_act_layer->buf_ptr1, 0xff, buffer_size);
    //gdi_layer_get_buffer_ptr(&layer_buffer);
    *ptr_buffer = gdi_act_layer->buf_ptr1;

    gdi_layer_pop_and_restore_active();

    return lock;
}
예제 #21
0
/**************************************************************
	FUNCTION NAME		: adp_phb_set_entry_capacity_exceeded_rsp
	PURPOSE			       : respond PRT_PHB_SET_ENTRY_REQ.
	INPUT PARAMETERS	: void
	OUTPUT PARAMETERS	: nil
	RETURNS			       : void
	REMARKS			:
**************************************************************/
void adp_phb_set_entry_capacity_exceeded_rsp(void)
{
	ilm_struct  ilm_ptr;
	mmi_phb_set_entry_rsp_struct *phb = OslMalloc(sizeof(mmi_phb_set_entry_rsp_struct));

	mmi_trace(g_sw_PHB,"PHB Func: %s PRT_PHB_SET_ENTRY_RSP", __FUNCTION__);
	ASSERT(phb != NULL);
	memset(phb, 0x00, sizeof(mmi_phb_set_entry_rsp_struct));

	//add by chenq for bug 5889 and 5800, 20070803 B  
	COS_KillTimerEX(GetMmiTaskHandle(MOD_ADP),PHBLIST_COPY_OR_DELETE_TIMEROUTID );
	//add by chenq for bug 5889 and 5800, 20070803 E  
	phb->result.flag = L4C_ERROR;
	phb->result.cause = MMI_PHB_CAUSE_CAPACITY_EXCEEDED;
	phb->no_list = 1;

	ilm_ptr.dest_mod_id = MOD_MMI;
	ilm_ptr.src_mod_id = MOD_L4C;
	ilm_ptr.msg_id = PRT_PHB_SET_ENTRY_RSP;
	ilm_ptr.local_para_ptr = (local_para_struct *)phb;
	OslMsgSendExtQueue(&ilm_ptr);
}
예제 #22
0
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;
    }
}
예제 #23
0
파일: gcj_net.c 프로젝트: jprothwell/sc-fix
void gcj_StubPlatformRequest(unsigned short *url)
{
#ifdef JATAAYU_SUPPORT
	unsigned char urlstring  [200];
	UnicodeToAnsii(urlstring,url);
	gcj_TraceOut(0,"gcj_StubPlatformRequest URL :%s",urlstring);

     	unsigned short  *urldata = OslMalloc(mmi_ucs2strlen(url)*sizeof(unsigned short)+2) ;
	if (!urldata)
		abort();
	UCS2Strncpy(urldata, url, mmi_ucs2strlen(url));
       
	COS_EVENT evt;
	evt.nEventId = (unsigned int)MSG_ID_MMI_JAVA_RUN_WAP_REQ;
	evt.nParam1 = urldata;
	gcj_StubSendEvent(&evt,MOD_MMI);
//	gcj_media_semId = gcj_StubNewSemphone();
//	gcj_StubTakeSemphone(gcj_media_semId);
//	gcj_SoundEnd = 1;
      #else

	#endif
}
예제 #24
0
파일: gcj_net.c 프로젝트: jprothwell/sc-fix
int gcjEventAPI_SetSocketOpt(SOCKET socketId,unsigned short option, unsigned char *value, unsigned char value_size)
{
	int ret = DEBUG_SIGN;
	if (socketId>5)
		abort();
	int tmpSem = gcj_StubNewSemphone();
	gcj_TraceOut(0,"func:%s,tmpSem=%d\n",__FUNCTION__,tmpSem);	
	COS_EVENT evt;
	_NET_EVENT_SET_OPT_T *data = (_NET_EVENT_SET_OPT_T *)OslMalloc(sizeof (_NET_EVENT_SET_OPT_T));
	if (!data)
		abort();
	
	data->semp = tmpSem;
	data->socketId = socketId;
	data->option = option;
	data->value = value;
	data->value_size = value_size;
	data->finish = EventNetworkFinish;
	data->result = &ret;	
	evt.nEventId = (unsigned int)MSG_ID_GCJ_SET_SOCKET_OPT_REQ;
	evt.nParam1 = data;
	recordSempInEventApi(tmpSem);	
	gcj_StubSendEvent(&evt,MOD_MMI);	
	gcj_StubTakeSemphone(tmpSem);
	/*
	ret = gcjEventApi_NetRet;
	if (gcjEventApi_NetRet == DEBUG_SIGN)
		abort();
	gcjEventApi_NetRet = DEBUG_SIGN;
	*/
	removeSempInEventApi(tmpSem);
	//sxr_ReleaseSemaphore(netResultSem);
	if (ret == DEBUG_SIGN)
		abort();
	return ret;
}
예제 #25
0
/*****************************************************************************
 * FUNCTION
 *  mmi_syncml_get_record_res_req
 * DESCRIPTION
 *  Protocol event sender
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_syncml_get_record_res_req(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MYQUEUE Message;
    mmi_syncml_get_record_res_req_struct *dataPtr;

    FS_HANDLE fs_handle;
    U32 read_length, fs_size;

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

    if (g_syncml_sync_context.operation != SYNCML_RECORD_GET_DEL_NOTIFY)
    {
        if (g_syncml_sync_context.result == SYNCML_OK)
        {
            fs_handle = FS_Open(SYNCML_VOBJ_PATH, FS_READ_ONLY);
            FS_GetFileSize(fs_handle, &fs_size);
            mmi_syncml_free_vobj_buffer();
            g_syncml_sync_context.vobj_ptr = OslMalloc(fs_size);
            FS_Read(fs_handle, (void*) g_syncml_sync_context.vobj_ptr, fs_size, &read_length);
            FS_Close(fs_handle);
            FS_Delete(SYNCML_VOBJ_PATH);
         }
         else
        {
            mmi_syncml_free_vobj_buffer();
            fs_size = 0;
            g_syncml_sync_context.result = SYNCML_FAIL;
            PRINT_INFORMATION_2(MMI_TRACE_G7_MISC, "[SyncML] Get record fail");
        }
    }

    Message.oslSrcId = MOD_MMI;
    Message.oslDestId = MOD_SYNCML;
    Message.oslMsgId = MSG_ID_MMI_SYNCML_GET_RECORD_RES_REQ;

    dataPtr =
        (mmi_syncml_get_record_res_req_struct*) OslConstructDataPtr(sizeof(mmi_syncml_get_record_res_req_struct));

    dataPtr->result = g_syncml_sync_context.result;
    if (g_syncml_sync_context.operation != SYNCML_RECORD_GET_DEL_NOTIFY)
    {
        dataPtr->data_length = fs_size;
        dataPtr->data = g_syncml_sync_context.vobj_ptr;
        dataPtr->more_data = 0;
    }

    Message.oslDataPtr = (oslParaType*) dataPtr;
    Message.oslPeerBuffPtr = NULL;
    OslMsgSendExtQueue(&Message);

    /* update to show the current progress */
 
    if (g_syncml_sync_context.database == SYNCML_DB_PHONEBOOK)
    {
        g_syncml_context.contact_send_current++;
        mmi_syncml_update_progress_string(PROGRESS_CONTACT_DATASTORE_SENDING);
    }
    else if (g_syncml_sync_context.database == SYNCML_DB_TODOLIST)
    {
        g_syncml_context.calendar_send_current++;
        mmi_syncml_update_progress_string(PROGRESS_TASK_DATASTORE_SENDING);
    }
    
}
예제 #26
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;
}
예제 #27
0
파일: gcj_net.c 프로젝트: jprothwell/sc-fix
/**
 * 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;
}
예제 #28
0
파일: DLAgentWPS.c 프로젝트: 12019/mtktest
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;
}
예제 #29
0
/*****************************************************************************
 * FUNCTION
 *  widget_show_view_handler
 * DESCRIPTION
 *  Phonebook launch proc function
 * PARAMETERS
 *  evt
 * RETURNS
 *  void
 *****************************************************************************/
void widget_show_view_handler(void *param)
{
    widget_show_view_ind_struct *p = (widget_show_view_ind_struct *)param;

    send_message(NULL, NULL, MSG_ID_WIDGET_SHOW_VIEW_CNF, MOD_GADGET);

    if (!g_widget_view_lock)
    {
        g_widget_view_lock = kal_create_mutex("widget_view_lock");
    }

    if (g_widget_view_cntx)
    {
        ASSERT(mmi_frm_group_is_present(GRP_ID_WIDGET_VIEW));

        mmi_frm_group_close(GRP_ID_WIDGET_VIEW);
    }

    g_widget_view_cntx = OslMalloc(sizeof(widget_view_context_struct));

    ASSERT(g_widget_view_cntx);

    memset(g_widget_view_cntx, 0, sizeof(widget_view_context_struct));

    g_widget_view_cntx->widget_id = p->instance_id;
    g_widget_view_cntx->view_handle = p->view_handle;
    g_widget_view_cntx->view_width = p->width;
    g_widget_view_cntx->view_height = p->height;
    g_widget_view_cntx->view_type = p->type;
    g_widget_view_cntx->view_flags = p->flags;

    if (p->caption[0])
    {
        mmi_chset_utf8_to_ucs2_string(
            (U8*) g_widget_view_cntx->view_caption,
            sizeof(g_widget_view_cntx->view_caption),
            (U8*) p->caption);
    }

    gdi_lcd_get_dimension(&g_widget_view_cntx->lcd_width, &g_widget_view_cntx->lcd_height);

    if (g_confirm_dialog_gid)
    {
        mmi_frm_node_struct group_info;

        group_info.id = GRP_ID_WIDGET_VIEW;
        group_info.entry_proc = mmi_widget_view_event_handler_proc;

        mmi_frm_group_insert(mmi_idle_get_group_id(), g_confirm_dialog_gid, &group_info, MMI_FRM_NODE_BEFORE_FLAG);
        //mmi_frm_group_insert(GRP_ID_ROOT, g_confirm_dialog_gid, &group_info, MMI_FRM_NODE_BEFORE_FLAG);
        mmi_frm_group_set_attribute (GRP_ID_WIDGET_VIEW, MMI_FRM_NODE_SMART_CLOSE_FLAG);
    }
    else
    {
        /*mmi_frm_group_create(
            mmi_idle_get_group_id(),
            GRP_ID_WIDGET_VIEW,
            mmi_widget_view_event_handler_proc,
            g_widget_view_cntx);*/

		mmi_frm_node_struct group_info;

        group_info.id = GRP_ID_WIDGET_VIEW;
        group_info.entry_proc = mmi_widget_view_event_handler_proc;
		group_info.user_data = g_widget_view_cntx;
		
        mmi_frm_group_insert(GRP_ID_ROOT, mmi_idle_get_group_id(), &group_info, MMI_FRM_NODE_AFTER_FLAG);
        mmi_frm_group_enter(GRP_ID_WIDGET_VIEW, MMI_FRM_NODE_SMART_CLOSE_FLAG);
    }

    mmi_widget_entry_view();
}
예제 #30
0
/*****************************************************************************
 * 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;
}