• 关于接入点,cmwap,代理设置,WIFI


    [J2ME之家-Symbian网络编程]include commdb.h
    添加commdb.lib到mmp文件library列表

    1.枚举所有接入点,包括grps,蓝牙,WIFI
    参考代码如下:
    ...
    CCommsDatabase* db;
    CCommsDbTableView* view;
    TBuf<KCommsDbSvrMaxColumnNameLength> iapName;
    TUint32 iapId;
    TInt result;
    //open database
    db = CCommsDatabase::NewL( EDatabaseTypeIAP );
    CleanupStack::PushL(db);
    view = db->OpenTableLC(TPtrC(IAP)); //IAP is the table name
    result = view->GotoFirstRecord();
    TInt nCount = 0;
    while((result == KErrNone) &&(nCount<30))
    {
    view->ReadTextL(TPtrC( COMMDB_NAME),iapName );
    view->ReadUintL(TPtrC( COMMDB_ID),iapId );
    AddItem( iapName );
    nCount ;
    result = view->GotoNextRecord();
    }
    CleanupStack::PopAndDestroy(2);
    ...

    2.使用户选择接入点后查询连接信息,包括区分grps和wifi,代理信息
    参考代码:
    ...
    m_bIsGRPS = ETrue;
    proxy.Zero();
    port = 0;

    TInt result = KErrNone;
    TBool bok = EFalse;
    //1.Is GRPS ? 

    CCommsDatabase* db = CCommsDatabase::NewL( EDatabaseTypeIAP ); 
    TUint32 id = 0;
    TBuf<KCommsDbSvrMaxColumnNameLength> iapName;
    TUint32 iapService;
    TBuf<KCommsDbSvrMaxColumnNameLength> serviceType;
    CCommsDbTableView* view = db->OpenTableLC(TPtrC(IAP)); //IAP is the table name
    result = view->GotoFirstRecord();
    while ( result == KErrNone )
    {
    view->ReadUintL(TPtrC(COMMDB_ID), id);
    view->ReadTextL(TPtrC(COMMDB_NAME), iapName); 
    view->ReadUintL(TPtrC(IAP_SERVICE), iapService); 
    view->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType);
    if ( iap == id )


    if ( 0 == serviceType.Compare(TPtrC(OUTGOING_GPRS)) )
    {
    m_bIsGRPS = ETrue;
    }
    else
    {
    m_bIsGRPS = EFalse;
    }
    bok = ETrue;
    break;
    }
    result = view->GotoNextRecord();
    }
    CleanupStack::PopAndDestroy();
    if (!bok)

    return KErrNotFound;
    }
    //2.Get Proxy 
    CCommsDatabase* commsDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
    CCommsDbTableView* commsView = commsDb->OpenViewOnProxyRecordLC( iapService, serviceType ); 
    result = commsView->GotoFirstRecord();
    if ( KErrNone != result ) 

    CleanupStack::PopAndDestroy(); 
    return KErrNotFound;
    }
    TBool proxyEnabled( EFalse );
    commsView->ReadBoolL(TPtrC(PROXY_USE_PROXY_SERVER), proxyEnabled);
    if ( !proxyEnabled ) 

    CleanupStack::PopAndDestroy(); 
    return KErrNotFound;

    proxy.Copy( *commsView->ReadLongTextLC(TPtrC(PROXY_SERVER_NAME))); 
    commsView->ReadUintL(TPtrC(PROXY_PORT_NUMBER), port );
    CleanupStack::PopAndDestroy(2); 
    ... 
  • 相关阅读:
    struts2文件上传大小限制问题
    kindeditor使用方法
    ajaxFileUpload SyntaxError: syntax error
    Attempted to lock an already-locked dir异常解决方法
    Simditor图片上传
    心理学
    Vue.JS
    SQL Server 日常维护经典应用
    12 个 JS 技巧
    Linq to js
  • 原文地址:https://www.cnblogs.com/yaoliang11/p/1847832.html
Copyright © 2020-2023  润新知