Exemplo n.º 1
0
VMINT vm_ivr_end(void)
{
    VMINT result = 0;
    VMINT resid = -1;
    srv_ucm_single_call_act_req_struct req;
    
    if ((resid = vm_res_findfirst(-1, VM_RES_TYPE_IVR)) != VM_RES_NOT_FIND)
	{	
	    VM_P_HANDLE phandle;
	    
	    vm_res_findclose(VM_RES_TYPE_IVR);	    
	    phandle = vm_res_get_process_handle(VM_RES_TYPE_IVR, resid);
	    if (vm_pmng_get_current_handle() != phandle)
	    {
	        result = -2;
	        goto error;
	    }		
    }   
    else
    {
        result = -3;
        goto error;
    }
    memcpy(&req.action_uid,&g_vm_ivr_call_info,sizeof(req.action_uid));
    
    srv_ucm_act_request(SRV_UCM_END_SINGLE_ACT,&req,NULL,NULL);
error:
    MMI_PRINT(MOD_MRE,TRACE_GROUP_9,"vm_ivr_end %d,%d,%d",result,req.action_uid.group_id,req.action_uid.call_id);
    return result;
}
Exemplo n.º 2
0
void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
{
	VMUINT8 data_out[16];
	STCHE   *md5_ctx_p=NULL;
	VMINT res_id;
	
	md5_ctx_p=vm_get_cheinfo_from_processid(vm_pmng_get_current_handle(),&res_id);	

	if (md5_ctx_p)
	{
		if (pms && data && (nbytes>=0))
		{
			che_process(md5_ctx_p, CHE_MD5, CHE_MODE_NULL, CHE_HASH, (VMUINT8*)data, data_out, nbytes,KAL_FALSE);
		} 
		else
		{	
			MMI_TRACE(MMI_MRE_TRC_ERROR, TRC_MRE_VMMD5_247 );
		}
	} 
	else
	{
		MMI_TRACE(MMI_MRE_TRC_ERROR, TRC_MRE_VMMD5_250 );
	}
	
}
Exemplo n.º 3
0
void md5_finish(md5_state_t *pms, md5_byte_t digest[16])
{
	STCHE   *md5_ctx_p=NULL;
	VMINT res_id;
	
	md5_ctx_p=vm_get_cheinfo_from_processid(vm_pmng_get_current_handle(),&res_id);
	
	if (md5_ctx_p)
	{
		if (pms && digest )
		{
			che_process(md5_ctx_p, CHE_MD5, CHE_MODE_NULL, CHE_HASH, NULL, digest, 0, KAL_TRUE);
			che_deinit(md5_ctx_p);
		} 
		else
		{
			MMI_TRACE(MMI_MRE_TRC_ERROR, TRC_MRE_VMMD5_274 );
		}
		
		vm_free(md5_ctx_p);
		md5_ctx_p=NULL;

		vm_res_release_data(VM_RES_TYPE_MD5,res_id);
	}
	else
	{
		MMI_TRACE(MMI_MRE_TRC_ERROR, TRC_MRE_VMMD5_282 );	
	}
}
S32 CALLCC VideoRecordService::gs_video_rec_record_start(S8 *filename, gs_record_result_callback record_result_callback,void* user_data)
{
	S32 ret;
	m_phandle = vm_pmng_get_current_handle();
	m_gs_record_result_callback = record_result_callback;
	m_gs_record_result_user_data = user_data;
	ret = mdi_video_rec_record_start(filename,(mdi_record_result_callback)gs_record_result_callback_helper,m_gs_record_result_user_data);
	kal_prompt_trace(MOD_IDLE,"mdi_video_rec_record_start ret = %d",ret);
	return ret;
}
S32 CALLCC VideoRecordService::gs_video_rec_save_file(S8 *filepath, gs_save_result_callback save_result_callback,void* user_data)
{
	S32 ret;

	m_phandle = vm_pmng_get_current_handle();
	m_gs_save_result_callback = save_result_callback;
	m_gs_save_result_user_data = user_data;
	ret = mdi_video_rec_save_file(filepath,  (mdi_save_result_callback)gs_save_result_callback_helper,m_gs_save_result_user_data);
	kal_prompt_trace(MOD_IDLE,"mdi_video_rec_save_file = %d",ret);

	return ret;
}
Exemplo n.º 6
0
VMINT vm_preload_status(VMINT app_id)
{
    VMINT result;
    vm_preload_ctx_t* ctx_p = _vm_preload_get_ctx(vm_pmng_get_current_handle(),app_id, 0);
    if (!ctx_p)
    {
        result = -2;
    }
    else
    {
        result = ctx_p->status;
    }
    MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_3058 , result);	
    return result;
}
Exemplo n.º 7
0
void CALLCC UcmService::act_request(gs_srv_ucm_act_opcode_enum act_op, void *act_data, void *user_data, gs_srv_callback_func result_callback)
{
    //MMI_PRINT(MOD_MRE, TRACE_GROUP_1, "[MRE] UcmService::act_request");

    addRef();
    release();
    if (gs_is_MRE_free() && result_callback)
    {
        callback_data* pCbData = (callback_data*)vm_malloc(sizeof(callback_data));
        pCbData->p_handle = vm_pmng_get_current_handle();
        pCbData->callback = (void*)result_callback;
        pCbData->user_data = user_data;
        srv_ucm_act_request((srv_ucm_act_opcode_enum)act_op,act_data,pCbData,(mmi_proc_func)&UcmService::callback);
    }   
    srv_ucm_act_request((srv_ucm_act_opcode_enum)act_op,act_data,user_data,(mmi_proc_func)result_callback);
}
Exemplo n.º 8
0
/*****************************************************************************
* FUNCTION
 *    vm_send_msg
 * DESCRIPTION
 *  send message to MRE app or native app, will invoke message procedure directly.
 * PARAMETERS
 *  phandle : [IN] receiver process handle, if receiver is native application, this value should be zero.
 *  msg_id : [IN] user defined message ID, should larger than VM_MESSAGE_ID_BASE.
 *  wparam : [IN] wparam of message.
 *  lparam : [IN] lparam of message.
 * RETURNS
 *  message procedure return value.
*****************************************************************************/
VMINT vm_send_msg(VM_P_HANDLE phandle, VMUINT msg_id, VMINT wparam, VMINT lparam)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    VM_P_HANDLE sender = vm_pmng_get_current_handle();
    VMINT i;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
    {
        if (phandle == 0)
        {
            /* receiver is native application */
            for (i=0; i<VM_APPCOMM_MAPPING_TABLE_SIZE; i++)
            {
                if ((vm_message_mapping_table[i].proc != NULL)&&(vm_message_mapping_table[i].sender == sender||
                    vm_message_mapping_table[i].sender == 0))
                {
                    vm_message_mapping_table[i].proc(sender, msg_id, wparam, lparam);
                }
            }

            return 1;
        }

        else
        {
            /* invoke receiver's message proc directly */
            return vm_pmng_exec_msg_proc(sender, phandle, msg_id, wparam, lparam);
        }
    }
}
Exemplo n.º 9
0
static vm_btcm_context_t * vm_btcm_malloc_ctx(void)
{
    vm_btcm_context_t * ctx_p = NULL;

    if ((ctx_p = _vm_kernel_calloc(sizeof(vm_btcm_context_t))) != NULL)
    {
        if ((ctx_p->res_id = vm_res_save_data(VM_RES_TYPE_BTCM, 
            (void*)ctx_p, sizeof(ctx_p), NULL, vm_pmng_get_current_handle())) >= 0)
        {
            return ctx_p;
        }
        else
        {
            _vm_kernel_free(ctx_p);
        }
    }

    return NULL;
}
Exemplo n.º 10
0
void md5_init(md5_state_t *pms)
{
	VM_P_HANDLE processid=vm_pmng_get_current_handle();
	STCHE   *md5_ctx_p=NULL;
	VMINT res_id;

	md5_ctx_p=vm_get_cheinfo_from_processid(processid,&res_id);
	
	if (!md5_ctx_p )
	{
		if  ((md5_ctx_p=(STCHE  *)vm_calloc(sizeof(STCHE)))==NULL)
		{
			MMI_TRACE(MMI_MRE_TRC_ERROR, TRC_MRE_VMMD5_218  );
			return;
		}
	}

	che_init(md5_ctx_p, CHE_MD5);

	vm_res_save_data(VM_RES_TYPE_MD5, (void*)(md5_ctx_p),sizeof(STCHE), NULL,processid );
}
Exemplo n.º 11
0
/*****************************************************************************
* FUNCTION
 *    vm_post_msg
 * DESCRIPTION
 *  post message to MRE app or native app, will put this message to the end of MRE message queue. 
 *  when this function call finish, MMI task will dispatch MRE message and invoke message procedure. 
 * PARAMETERS
 *  phandle : [IN] receiver process handle, if receiver is native application, this value should be zero.
 *  msg_id : [IN] user defined message ID, should larger than VM_MESSAGE_ID_BASE.
 *  wparam : [IN] wparam of message.
 *  lparam : [IN] lparam of message.
 * RETURNS
 *  message procedure return value.
*****************************************************************************/
VMINT vm_post_msg(VM_P_HANDLE phandle, VMUINT msg_id, VMINT wparam, VMINT lparam)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    vm_message_struct msg;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (msg_id == VM_MESSAGE_INVALID_ID)
    {
        return 0;
    }

    msg.sender = vm_pmng_get_current_handle();
    msg.receiver = phandle;
    msg.msg_id = msg_id;
    msg.wparam = wparam;
    msg.lparam = lparam;
    
    return vm_appcomm_add_msg(msg);
}
Exemplo n.º 12
0
static vm_btspp_context_t * vm_btspp_malloc_ctx(void)
{
    vm_btspp_context_t * ctx_p = NULL;

    if ((ctx_p = _vm_kernel_calloc(sizeof(vm_btspp_context_t))) != NULL)
    {
        if ((ctx_p->res_id = vm_res_save_data(VM_RES_TYPE_BTSPP, 
            (void*)ctx_p, sizeof(ctx_p), NULL, vm_pmng_get_current_handle())) >= 0)
        {
            VMINT i = 0;
            for (i = 0; i < MAX_MRE_SPP_CLIENT; i++)
            {
                ctx_p->conn_id[i] = -1;
            }
            return ctx_p;
        }
        else
        {
            _vm_kernel_free(ctx_p);
        }
    }

    return NULL;
}
Exemplo n.º 13
0
VMINT vm_preload_query(VMINT apn,
                       const VMCHAR * url, 
                       VMINT port,
                       const vm_preload_query_info_t * info,
                       void (*callback)(VMINT hdl, void * para), 
                       void * user_data)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/    
    VMCHAR http_host[128] = {0};
    vm_apn_info_ext apn_info;
    vm_common_t common = {E_PRELOAD_QUERYING, NULL};
    vm_preload_ctx_t * ctx_p = NULL;
    //srv_dtcnt_sim_type_enum sim_type;
    VMINT with_port = 0;
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_2884 );			

    if (NULL == url ||
        0 > port ||
        NULL == info ||
        NULL == info->ua ||
        NULL == callback)
//        NULL == user_data)
    {
        MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_2893 );            
        return -2;
    }


    if (VM_TCP_APN_CMNET == apn || 
    VM_TCP_APN_CMNET_ONLY == apn ||
    VM_TCP_APN_WIFI == apn &&
        apn != VM_APN_USER_DEFINE)
    {
        VMINT pos = 7; // http://
        for(; url[pos]; pos ++)
        {
            if (url[pos] == ':')
            {
                with_port = atoi(&url[pos] + 1);
                break;
            }
            if (url[pos] == '/')
                break;
        }
        strncpy(http_host, url + 7, pos - 7);
        MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_2907 , http_host);
    }
    else if (VM_TCP_APN_CMWAP == apn ||
    VM_TCP_APN_CMWAP_ONLY == apn)
    {
        VMUINT dtacct_id;
        vm_get_encoded_dtacct_id(VM_TCP_APN_CMWAP, &dtacct_id);
        if (0 == vm_get_apn_info(&apn_info) && !apn_info.apn_info_id)
        {
            VMINT pos = 7; // http://
            for(; url[pos]; pos ++)
            {
                if (url[pos] == ':')
                {
                    with_port = atoi(&url[pos] + 1);
                    break;
                }
                if (url[pos] == '/')
                    break;
            }
            strncpy(http_host, url + 7, pos - 7);
            MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_2923 , apn_info.proxy_ip);
        }
        else
        {
            with_port = apn_info.proxy_port;// atoi(&url[pos] + 1);
            strncpy(http_host, apn_info.proxy_ip, sizeof(apn_info.proxy_ip));
        }
        MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_2929 , http_host);
    }
    else
    {
        MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_2933 );            
        return -3;
    }

    ctx_p = _vm_preload_get_ctx(vm_pmng_get_current_handle(), info->app_id, 0);
    if (NULL == ctx_p)
    {
        ctx_p = _vm_preload_malloc_ctx();
        if (NULL == ctx_p)
        {
            MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_2943 );            
            return -4;
        }
    }
    /*
    else
    {
        if (1 == ctx_p->update)
        {
            vm_trace("vm_preload_query res not enough -5");            
            return -5;
        }
    }
    */
    ctx_p->p_hdl = vm_pmng_get_current_handle();
    ctx_p->app_id = info->app_id;
    ctx_p->user_data = user_data;
    ctx_p->cb = callback;
    strcpy(ctx_p->url, url);
    ctx_p->port = with_port ? with_port : port;
    strcpy(ctx_p->host, http_host);
    ctx_p->apn = apn;
    ctx_p->update = 0;
    memcpy(&(ctx_p->query_info), info, sizeof(vm_preload_query_info_t));
    ctx_p->twice_confirmed = 0;

    MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_2959 , ctx_p->host, ctx_p->port, apn);            
#ifdef WIN32
    //strcpy(ctx_p->host, "172.21.87.241");
#endif
    if (ctx_p->soc_id > 0)
    {
        MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_2965 );       
        vm_tcp_close(ctx_p->soc_id);
    }
    //srv_dtcnt_get_sim_preference(&sim_type);
    if ((stub_tcp_is_support_wifi() && VM_TCP_APN_WIFI == ctx_p->apn)
#ifdef __COSMOS_MMI_PACKAGE__      
      //  || (srv_mre_da_get_account_id(SRV_MRE_DA_WIFI_ONLY) == 1)
      //  || (sim_type == SRV_DTCNT_SIM_TYPE_NONE)
#endif
        )
    {
        if (SRV_DTCNT_WLAN_STATUS_INACTIVE == srv_dtcnt_wlan_status())
        {
            //MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_UDP_E3, 2, __LINE__);
            _vm_preload_free_ctx(ctx_p);
            return -6;
        }
    }

#if 1
    vm_preload_do_connection(ctx_p, 1);
#else
/* under construction !*/
#endif

    if (0 > ctx_p->soc_id)
    {
        MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_2973 );       
        _vm_preload_free_ctx(ctx_p);
        return -5;
    }
    
    common.user_data = ctx_p->user_data;
    common.state = E_PRELOAD_CONNECTING;
    PRELOAD_PMNG_WRAP_CALLBACK(ctx_p->p_hdl, 
        ctx_p->cb, ctx_p->res_id, (void*)&common);
        
    MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_2983 );			

    ctx_p->status = E_PRELOAD_DOWNLOADING;
    
    return ctx_p->res_id;
}
Exemplo n.º 14
0
VMINT vm_callout_ex(VMWSTR phnum, VM_CALLOUT_RESPONSE_T callback)
{
	VM_P_HANDLE phandle =  vm_pmng_get_current_handle();
//	VMINT resid = -1;
	
	mmi_ucm_make_call_para_struct  make_call_para;
	VMUINT16 gid = 0;  

	if (vm_pmng_state(phandle) != VM_PMNG_FOREGROUND)
	{
		vm_log_debug("vm_callout: state is not foreground");
		return VM_CALLOUT_ERR_STATE;
	}
#ifdef __MRE_SAL_SIM__
 
	if (vm_sim_card_count() <= 0)
	{
		vm_log_debug("vm_callout: no sim card");
		return VM_CALLOUT_ERR_NO_SIM;
	}
#endif
 
	if (!srv_mode_switch_is_network_service_available())
	{
		vm_log_debug("vm_callout: flight mode");
		return VM_CALLOUT_ERR_FLIGHT;
	}
 
	if (vm_callout_status != VM_CALLOUT_IDEL)
	{
		vm_log_debug("vm_callout: device is busy now");
		return VM_CALLOUT_ERR_BUSY;
	}
	 
	if (phnum == NULL)
	{
		vm_log_debug("vm_callout : the ptr of phnum is NULL");
		return VM_CALLOUT_ERR_PHONE_NUM;
	}
	if ((vm_wstrlen(phnum) <= 0) || (vm_wstrlen(phnum) >= 40))
	{
		vm_log_debug("vm_callout : the len of phnum is error");
		return VM_CALLOUT_ERR_PHONE_NUM;
	}
	if (vm_available_phnum(phnum) == FALSE)
	{
		vm_log_debug("vm_callout : the content of phnum is error");
		return VM_CALLOUT_ERR_PHONE_NUM;
	}
	if (phandle < 0)
	{
		vm_log_debug("vm_callout : phandle is error");
		return VM_CALLOUT_ERR_PROCESS;
	}
	 
	if ((vm_res_save_data(VM_RES_TYPE_CALLOUT, phnum, (vm_wstrlen(phnum) * 2), (void*)callback, phandle)) < 0)
	{
	    VMINT resid = -1;
	    if ((resid = vm_res_findfirst(-1, VM_RES_TYPE_CALLOUT)) != VM_RES_NOT_FIND)
    	{
    		vm_res_release_data(VM_RES_TYPE_CALLOUT, resid);   		
    		vm_res_findclose(VM_RES_TYPE_CALLOUT);    		
    	}
		
		if ((vm_res_save_data(VM_RES_TYPE_CALLOUT, phnum, (vm_wstrlen(phnum) * 2), (void*)callback, phandle)) < 0)
		{
		    vm_log_debug("vm_callout: res save error");
		    return VM_CALLOUT_ERR_NO_RES;
		}
	}

 
	vm_log_debug("vm_callout : before mmi_ucm_init_call_para");
	mmi_ucm_init_call_para(&make_call_para);  
	vm_log_debug("vm_callout : after mmi_ucm_init_call_para");

    switch (vm_sim_get_active_sim_card())
    {
    case 1:
        make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE;
        break;
    case 2:
        make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE_SIM2;
        break;
    case 3:
        make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE_SIM3;
        break;
    case 4:
        make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE_SIM4;
        break;
    default:
        return VM_CALLOUT_ERR_NO_SIM;
    }
    
	make_call_para.ucs2_num_uri = (U16*)phnum;
    
	vm_log_debug("vm_callout : before mmi_ucm_call_launch");
	mmi_ucm_call_launch(gid, &make_call_para);	
	vm_log_debug("vm_callout : after mmi_ucm_call_launch");
	
	return VM_CALLOUT_NO_ERR;
}
Exemplo n.º 15
0
VMINT vm_ivr_call(vm_ivr_call_data* data)
{   
    VMINT result = 0;
    srv_ucm_dial_act_req_struct req;

    memset(&req, 0, sizeof(req));
    if (data->sim_card > vm_sim_max_card_count() || data->sim_card < 1)
    {
        result = -2;
        goto error;
    }

	if (srv_ucm_query_call_count(SRV_UCM_CALL_STATE_ALL, SRV_UCM_CALL_TYPE_ALL, NULL) > 0)
	{
	    result = -3;
        goto error;
	}
	
    if ((vm_res_save_data(VM_RES_TYPE_IVR, data->user_data, 4, (void*)data->callback, vm_pmng_get_current_handle())) < 0)
	{
		result = -4;
        goto error;
	}
	req.call_type = 1<< ((data->sim_card-1)*8);
	kal_wstrncpy(req.num_uri,data->phone_num,SRV_UCM_MAX_NUM_URI_LEN+1);
	req.module_id = SRV_UCM_MODULE_ORIGIN_COMMON;
	req.is_ip_dial = 0;
	req.phb_data = NULL;
	
	srv_ucm_act_request(SRV_UCM_DIAL_ACT,&req,NULL,_vm_ivr_call_callback);
error:
    MMI_PRINT(MOD_MRE,TRACE_GROUP_9,"vm_ivr_call %d,%d",result,data->sim_card);
    return result;
}
Exemplo n.º 16
0
VMINT vm_tls_new_ctx(vm_tls_version_enum ver, vm_socket_type_enum sock_type, VMINT apn, vm_tls_side_enum side, callback_t cb)
{
    kal_int32 ret;
    vm_tls_context_t * ctx_p = NULL;
    VMUINT acct_id = 0;
    kal_uint8 val;
    
    MMI_TRACE(TRACE_GROUP_8, TRC_MRE_SSL_S, 1, __LINE__);

    
    ctx_p = vm_tls_malloc_ctx();

    if (NULL == ctx_p)
    {
        MMI_TRACE(TRACE_GROUP_8, TRC_MRE_SSL_E1, 1, __LINE__);
        return VM_TLS_RET_BASE -2;
    }

    ret = tls_new_ctx((tls_version_enum)ver,
        (tls_side_enum)side,
        MOD_MMI,
        STR_MRE_TITLE);

    if (ret < 0)
    {
        vm_tls_free_ctx(ctx_p);
        MMI_TRACE(TRACE_GROUP_8, TRC_MRE_SSL_E2, 1, ret);
        return ret;
    }

    ctx_p->tls_ctx = ret;
    ctx_p->cb = cb;
    ctx_p->soc_id = 0;
    ctx_p->p_hdl = vm_pmng_get_current_handle();


    if (VM_E_SOC_SUCCESS != vm_get_encoded_dtacct_id(apn, &acct_id))
    {
        MMI_TRACE(TRACE_GROUP_8, TRC_MRE_SSL_E3, 1, __LINE__);
        return VM_TLS_RET_BASE -3;
    }

    
    ctx_p->soc_id = soc_create(SOC_PF_INET, sock_type, 0, MOD_MMI, acct_id);
    if (0 > ctx_p->soc_id)
    {
        // TODO: print ctx_p->soc_id
        ctx_p->soc_id = 0;
        MMI_TRACE(TRACE_GROUP_8, TRC_MRE_SSL_E4, 1, __LINE__);
        return VM_TLS_RET_BASE -3;
    }
    
    val = KAL_TRUE;
    ret = soc_setsockopt(ctx_p->soc_id, SOC_NBIO, &val, sizeof(val));
    if (ret < 0)
    {
        MMI_TRACE(TRACE_GROUP_8, TRC_MRE_SSL_E5, 1, __LINE__);
        return VM_TLS_RET_BASE -5;
    }

    val = SOC_READ | SOC_WRITE | SOC_CONNECT | SOC_CLOSE;
    ret = soc_setsockopt(ctx_p->soc_id, SOC_ASYNC, &val, sizeof(val));
    if (ret < 0)
    {
        MMI_TRACE(TRACE_GROUP_8, TRC_MRE_SSL_E6, 1, __LINE__);
        return VM_TLS_RET_BASE -6;
    }
    
    MMI_TRACE(TRACE_GROUP_8, TRC_MRE_DLS_LOG, 
        ctx_p->tls_ctx,
        ctx_p->soc_id,
        ctx_p->p_hdl,
        0,
        0,
        ctx_p->cb,
        1, __LINE__);
    
    if (0 == g_ref_count++)
    {
        mmi_frm_set_protocol_event_handler(MSG_ID_APP_SOC_NOTIFY_IND, (PsIntFuncPtr)vm_tls_notify_cb, MMI_TRUE);
        mmi_frm_set_protocol_event_handler(MSG_ID_APP_TLS_NOTIFY_IND, (PsIntFuncPtr)vm_tls_notify_ind, MMI_TRUE);
        mmi_frm_set_protocol_event_handler(MSG_ID_APP_TLS_ALERT_IND, (PsIntFuncPtr)vm_tls_alert_ind, MMI_TRUE);
        mmi_frm_set_protocol_event_handler(MSG_ID_APP_TLS_INVALID_CERT_IND, (PsIntFuncPtr)vm_tls_invalid_cert_ind, MMI_TRUE);
        mmi_frm_set_protocol_event_handler(MSG_ID_APP_TLS_CLIENT_AUTH_IND, (PsIntFuncPtr)vm_tls_client_auth_ind, MMI_TRUE);
        MMI_TRACE(TRACE_GROUP_8, TRC_MRE_SSL_E7, 1, __LINE__);
    }

    MMI_TRACE(TRACE_GROUP_8, TRC_MRE_SSL_E, 1, ctx_p->res_id);
    return ctx_p->res_id;
    
    
}
Exemplo n.º 17
0
/*
static mmi_ret _vm_ivr_dial_callback(mmi_event_struct *param)
{
    srv_ucm_act_rsp_struct* rsp = (srv_ucm_act_rsp_struct*)((srv_ucm_act_result_evt_struct*)param)->act_result;
    VMINT resid = -1;

    MMI_PRINT(MOD_MRE,TRACE_GROUP_9,"_vm_ivr_dial_callback 1");
    
    if ((resid = vm_res_findfirst(-1, VM_RES_TYPE_IVR)) != VM_RES_NOT_FIND)
	{	
        VM_P_HANDLE phandle = vm_res_get_process_handle(VM_RES_TYPE_IVR, resid);
        void* user_data;
        VMINT size = 4;
        vm_ivr_cb callback;
        ivr_callback_data data;

        MMI_PRINT(MOD_MRE,TRACE_GROUP_9,"_vm_ivr_dial_callback %d",rsp->result_info.result);
        
        vm_res_get_callback(VM_RES_TYPE_IVR, resid, (void**)&callback);
        vm_res_get_data(VM_RES_TYPE_IVR, resid, (void**)&user_data, &size);
        data.user_data = user_data;
        

		if (rsp && SRV_UCM_RESULT_OK == rsp->result_info.result)
        {
            data.status = VM_IVR_DIALED;
        }
        else
        {
            data.status = VM_IVR_DIAL_FAIL;
        }
        
        if (vm_pmng_set_ctx(phandle) == VM_PMNG_OP_OK)
		{
			if (callback != NULL)
			{
				callback(&data);
			}

			vm_pmng_reset_ctx();
		}
		vm_res_findclose(VM_RES_TYPE_IVR); 
    }   
    MMI_PRINT(MOD_MRE,TRACE_GROUP_9,"_vm_ivr_dial_callback end");
    return MMI_RET_OK; 
}
*/
VMINT vm_ivr_dial_number(VMCHAR number)
{
    VMINT result = 0;
    srv_ucm_dtmf_struct digits;
    mmi_keypads_enum key;
    VMINT resid =1;
    
    if (!number)
    {
        result = -2;
        goto error;
    }

    if ((resid = vm_res_findfirst(-1, VM_RES_TYPE_IVR)) != VM_RES_NOT_FIND)
	{	
	    VM_P_HANDLE phandle;
	    
	    vm_res_findclose(VM_RES_TYPE_IVR);
	    phandle = vm_res_get_process_handle(VM_RES_TYPE_IVR, resid);
	    if (vm_pmng_get_current_handle() != phandle)
	    {
	        result = -3;
	        goto error;
	    }
		
    }   
    else
    {
        result = -4;
        goto error;
    }

	switch (number)
	{
	case '1':
	    key = KEY_1;
	    break;
	case '2':
	    key = KEY_2;
	    break;
	case '3': 
	    key = KEY_3;
	    break;
	case '4':
	    key = KEY_4;
	    break;
	case '5':
	    key = KEY_5;
	    break;
	case '6':
	    key = KEY_6;
	    break;
	case '7':
	    key = KEY_7;
	    break;
	case '8':
	    key = KEY_8;
	    break;
	case '9':
	    key = KEY_9;
	    break;
	case '0':
	    key = KEY_0;
	    break;
    case '*':
	    key = KEY_STAR;
	    break;
    case '#':
	    key = KEY_POUND;
	    break;	
    default:
        result = -5;
        goto error;
	}	
	
	digits.digit = key;
	srv_ucm_act_request(SRV_UCM_START_DTMF_ACT,&digits,NULL,NULL);
	srv_ucm_act_request(SRV_UCM_STOP_DTMF_ACT,&digits,NULL,NULL);
error:	
    MMI_PRINT(MOD_MRE,TRACE_GROUP_9,"vm_ivr_dial_number %d",result);
	return result;
}