Beispiel #1
0
static void vm_preload_do_connection(vm_preload_ctx_t * ctx_p, VMINT n)
{

    vm_apn_info_ext info = {0};
    VMUINT dtacct_id;
    vm_get_encoded_dtacct_id(VM_TCP_APN_CMWAP, &dtacct_id);
    
    if (vm_wifi_is_connected())
    {
        ctx_p->soc_id = vm_tcp_connect(ctx_p->host, ctx_p->port, ctx_p->apn, _vm_preload_cb); 
        MMI_PRINT(MOD_MRE, MMI_MRE_TRC_MOD_VMSOCK,"preload cnt wifi1[%s, %d] npx[%d]", 
            ctx_p->host, ctx_p->port, n);
    }
    else
    {
        if (0 == vm_get_apn_info(&info)) // px
        {
            memset(&info, 0, sizeof(info));
            if (0 == vm_get_default_apn_info(&info))
            {
                if (info.apn_info_id)
                {
                    //ctx_p->apn = 2;
                    ctx_p->soc_id = vm_tcp_connect(info.proxy_ip, info.proxy_port, VM_TCP_APN_CMWAP, _vm_preload_cb);
                    MMI_PRINT(MOD_MRE, MMI_MRE_TRC_MOD_VMSOCK,"preload cnt [%s, %d] px[%d]", 
                        info.proxy_ip, info.proxy_port, n);
                }
                else
                {
                    ctx_p->soc_id = vm_tcp_connect(ctx_p->host, ctx_p->port, ctx_p->apn, _vm_preload_cb); 
                    MMI_PRINT(MOD_MRE, MMI_MRE_TRC_MOD_VMSOCK,"preload cnt [%s, %d] npx[%d]", 
                        info.proxy_ip, info.proxy_port, n);
                }
            }
            else // wifi without sim
            {
                ctx_p->soc_id = vm_tcp_connect(ctx_p->host, ctx_p->port, ctx_p->apn, _vm_preload_cb); 
                MMI_PRINT(MOD_MRE, MMI_MRE_TRC_MOD_VMSOCK,"preload cnt 1[%s, %d] npx[%d]", 
                    ctx_p->host, ctx_p->port, n);
            }
        }
        else // npx
        {
            ctx_p->soc_id = vm_tcp_connect(ctx_p->host, ctx_p->port, ctx_p->apn, _vm_preload_cb); 
            MMI_PRINT(MOD_MRE, MMI_MRE_TRC_MOD_VMSOCK,"preload cnt 2[%s, %d] npx[%d]", 
                ctx_p->host, ctx_p->port, n);
        }
    }

}
Beispiel #2
0
VMINT LGPRSClass::getAPN() const
{
    vm_apn_info_ext apn_info;
    if(m_customAPN)
    {
        return VM_APN_USER_DEFINE;
    }
    else
    {
        if(0 == vm_get_default_apn_info(&apn_info))
        {
            if(apn_info.apn_info_id == 1)
            {
                return VM_TCP_APN_CMWAP;
            }
            else
            {
                return VM_TCP_APN_CMNET;
            }
        }
        return VM_TCP_APN_CMNET;
    }
}
Beispiel #3
0
VMINT vm_preload_download_ex(VMINT hdl, const VMWCHAR * data, VMBOOL bDLA,void (*callback)(VMINT hdl, void * para), void * user_data)
{
    VMCHAR http_header[BUFFER_LEN] = {0};
    VMINT ret = 0;
    VMINT written = 0;
    vm_preload_ctx_t * ctx_p = NULL;
    VMINT bufSize = 0;

    MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_2997 );			
    if (NULL == data || 0 > hdl)
    {
        MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_3000 );         
        return -2;
    }

    if (vm_res_get_data(VM_RES_TYPE_PRELOAD, 
        hdl, (void**)&ctx_p, &bufSize) != VM_RES_OK)
    {
        MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_3058 , -6);           
        return -6;
    }
    
    if (NULL == ctx_p)
    {
        MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_3009 );      
        return -3;
    }
    
    
    vm_wstrcpy(ctx_p->path, (const VMWSTR)data);
    ctx_p->cb = callback;
    ctx_p->user_data = user_data;
    ctx_p->bDLA = bDLA;
    if (!bDLA || g_no_dla)
    {
        ret = _vm_preload_try_download(ctx_p);
        if (ret <= 0)
            return ret;
    }
    else
    {
#if defined(MMI_DA_HTTP_DOWNLOAD_SUPPORT)   
        VMUINT account_id;
        srv_da_start_download_struct da_param;
        vm_apn_info_ext info = {0};
        
        memset(&da_param,0,sizeof(da_param));
        vm_get_encoded_dtacct_id(VM_TCP_APN_CMWAP, &account_id);
        MMI_PRINT(MOD_MRE, MMI_MRE_TRC_MOD_VMSOCK,"preload dla dt[0x%x]", 
            account_id);
        if (0 == vm_get_apn_info(&info)) // px
        {
            if (0 == vm_get_default_apn_info(&info))
            {
                if (info.apn_info_id)
                {
                    vm_get_encoded_dtacct_id(VM_TCP_APN_CMWAP, &account_id);
                    MMI_PRINT(MOD_MRE, MMI_MRE_TRC_MOD_VMSOCK,"preload dla px[0x%x]", 
                        account_id);
                }
                else
                {
                    vm_get_encoded_dtacct_id(VM_TCP_APN_CMNET, &account_id);
                    MMI_PRINT(MOD_MRE, MMI_MRE_TRC_MOD_VMSOCK,"preload dla npx[0x%x]", 
                        account_id);
                }
            }
            else // wifi without sim
            {
                
            }
        }
        srv_dtcnt_get_auto_acc_id(account_id, &da_param.acc_id);
        mmi_asc_n_to_ucs2((CHAR *)http_header,ctx_p->url,BUFFER_LEN);
        da_param.url = (WCHAR*)http_header;
        //da_param.acc_id = account_id;
        da_param.show_confirm = MMI_FALSE;
        da_param.user_data = ctx_p;
        da_param.filepath = (U16 *)data;
        da_param.dl_progress = vm_preload_download_callback;
        da_param.dispatch_callback = NULL;
        da_param.setting_hdlr = srv_da_default_setting;// MAUI_03202723 srv_da_bypass_setting -> srv_da_default_setting; //vm_preload_download_setting;
        if (NULL == srv_da_start_http_download(&da_param))
        {
            //_vm_preload_clean(ctx_p);
            _vm_preload_free_ctx(ctx_p);
            return -5;
        }
#endif        
    }
    
    MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_3058 , ret);			
    ctx_p->update = 2;
    MMI_TRACE(MMI_MRE_TRC_MOD_VMSOCK, TRC_MRE_VMSOCK_3060 );			
    return 0;
}