symbian 中自動尋找cmwap連接點,通殺uiq 2nd 3nd和s60 2nd 3nd 5nd

來源:互聯網
上載者:User

 

全測試過了,鑒於手機型號太多,沒有一一的測試。 找不到連接點,應該自動建立一個的,但這個需要認證,就沒寫了。

今天發現刷了機的一個5800連不上,在二級尋找上,還需比較一下名字。

//尋找可用的連接點, UIQ與Symbian不同

TBool NewCClientEngine::FindIapId(TUint32& iapId)    {    iapId = 0;#ifdef __WINS__    iapId = 1;#elif  UIQ30    jstring cmwapname;    //先找出APN    CCommsDatabase* const comm_db = CCommsDatabase::NewL(EDatabaseTypeIAP);    CleanupStack::PushL(comm_db);    CCommsDbTableView *iap_table_view = comm_db->OpenTableLC(TPtrC(OUTGOING_WCDMA));    TBuf<50> iap_name_buf;    TBuf<50> cmwap_str;     TBuf<32> apn;    TUint32 iap_id = -1;    TBuf<100> log;    // switch pointer to the first iap record     if(iap_table_view->GotoFirstRecord() == KErrNone)        {        // search comm_db for cmnet iap         do            {            // get the iap name from comm_db            iap_name_buf.SetLength(0);            iap_table_view->ReadTextL(TPtrC(COMMDB_NAME), iap_name_buf);            iap_table_view->ReadTextL(TPtrC(GPRS_APN), apn);             // test the cmnet iap name                         DEBUGING(iap_name_buf);            DEBUGING(apn);            if( apn == _L("cmwap") )                {                cmwapname = iap_name_buf;                iap_table_view->ReadUintL(TPtrC(COMMDB_ID), iap_id);                log.Format(_L("id = %d"),iap_id);                DEBUGING(log);                break;                }            }while (KErrNone == iap_table_view->GotoNextRecord());        }    CleanupStack::PopAndDestroy(2, comm_db); // iap_table_view, comm_db     if(cmwapname != _L(""))        {        CCommsDatabase* database = CCommsDatabase::NewL(EDatabaseTypeIAP);        CleanupStack::PushL(database );        CCommsDbTableView* view = database->OpenTableLC(TPtrC(IAP));        if( view->GotoFirstRecord() == KErrNone )            {            do                {                TBuf<50> accessPointName;                view->ReadTextL(TPtrC(COMMDB_NAME),accessPointName);                DEBUGING(accessPointName);                if(cmwapname == accessPointName)                    {                    TUint32 id;                    view->ReadUintL(TPtrC(COMMDB_ID),id);                    log.Format(_L("iapid = %d"),id);                    iapId = id;                    DEBUGING(log);                    break;                    }                }while(view->GotoNextRecord()==KErrNone);            }        CleanupStack::PopAndDestroy(view);        CleanupStack::PopAndDestroy(database );        } #else    CCommsDatabase* const comm_db = CCommsDatabase::NewL(EDatabaseTypeIAP);    CleanupStack::PushL(comm_db);    CCommsDbTableView *iap_table_view = comm_db->OpenTableLC(TPtrC(OUTGOING_WCDMA));    TBuf<20> iap_name_buf;    TBuf<20> iap_name_buf1;    TBuf<20> cmwap_str;    TBuf<100> cmwap_username;    TBuf<100> cmwap_userpass;    TBuf<32> apn;    TUint32 iap_id = -1;    TBuf<100> log;    // switch pointer to the first iap record     if(iap_table_view->GotoFirstRecord() == KErrNone)        {        // search comm_db for cmnet iap         do            {            // get the iap name from comm_db            iap_name_buf.SetLength(0);            iap_table_view->ReadTextL(TPtrC(COMMDB_NAME), iap_name_buf);            iap_table_view->ReadTextL(TPtrC(GPRS_APN), apn);            iap_table_view->ReadTextL(TPtrC(GPRS_IF_AUTH_PASS), cmwap_userpass);            iap_table_view->ReadTextL(TPtrC(GPRS_IF_AUTH_NAME), cmwap_username);            // test the cmnet iap name                         DEBUGING(iap_name_buf);            DEBUGING(cmwap_userpass);            DEBUGING(cmwap_username);            DEBUGING(apn);            if( apn == _L("cmwap") && cmwap_userpass.Length()==0 && cmwap_username.Length()==0 )                {                iap_table_view->ReadUintL(TPtrC(COMMDB_ID), iap_id);                CCommsDbTableView* pIAPView = comm_db->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC(IAP_SERVICE), iap_id);                TInt nErr = pIAPView->GotoFirstRecord();                while(nErr == KErrNone)                    {                    pIAPView->ReadTextL(TPtrC(COMMDB_NAME), iap_name_buf1);                    DEBUGING(iap_name_buf1);                    if(iap_name_buf1 == iap_name_buf)                        {                        pIAPView->ReadUintL(TPtrC(COMMDB_ID), iap_id);                        iapId= iap_id;                        DEBUGING(_L("find iap..."));                        }                    nErr = pIAPView->GotoNextRecord();                    }                CleanupStack::PopAndDestroy(); //pIAPView                }            }while (KErrNone == iap_table_view->GotoNextRecord());        }    CleanupStack::PopAndDestroy(2, comm_db); // iap_table_view, comm_db    if( iap_id < 0)        {        ERRORING(_L("can't find iap"));        }#endif    return (iapId > 0);    }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.