Hi, all.
I'm trying to porting the following code to 3rd Edition
When I compile and Run this code to 5th edition an error occurs in this part:Code:TInt64 errorCode; CCommsDatabase* db = CCommsDatabase::NewL(); CleanupStack::PushL(db); TInt err = db->BeginTransaction(); // Create a wlan AP and fill its mandatory fields. CApAccessPointItem* wlanAp = CApAccessPointItem::NewLC(); CApAccessPointItem* wlanNewItem = CApAccessPointItem::NewLC(); wlanAp->SetNamesL(_L("WRS_AP2")); wlanAp->SetBearerTypeL(EApBearerTypeWLAN); wlanAp->WriteTextL(EApWlanNetworkName, _L("WRS_AP")); //Lan network mode should be 1 for infrastructure, 0 for adhoc wlanAp->WriteUint(EApWlanNetworkMode,0); wlanAp->WriteUint(EApWlanChannelId ,3); // Setting up advanced settings for IP addressing wlanAp->WriteTextL(EApWlanIpAddr ,_L("192.168.1.1")); wlanAp->WriteTextL(EApWlanIpNetMask ,_L("255.255.255.0")); wlanAp->WriteTextL(EApWlanIpGateway ,_L("192.168.1.0")); TBool val =ETrue; TUint32 newalanid; CApDataHandler* handler = CApDataHandler::NewLC(*db); TUint32 apid; apid = handler->CreateFromDataL(*wlanAp); //error System Error (-1) handler->UpdateAccessPointDataL(*wlanAp,val); handler->AccessPointDataL(apid,*wlanNewItem); CApUtils *aputil = CApUtils::NewLC(*db); TUint32 wapuid = wlanAp->WapUid(); TInt Iap = aputil->IapIdFromWapIdL(wapuid); wlanNewItem->ReadUint( EApIapServiceId, newalanid ); TBuf<50> ibuff; wlanNewItem->ReadTextL( EApWlanNetworkName, ibuff ); CCommsDbTableView* wLanServiceTable = db->OpenViewMatchingUintLC( TPtrC( WLAN_SERVICE ), TPtrC( WLAN_SERVICE_ID ), newalanid ); errorCode = wLanServiceTable->GotoFirstRecord(); if ( errorCode == KErrNone ) { wLanServiceTable->UpdateRecord(); } else { TUint32 dummyUid( 10 ); //KUidNone User::LeaveIfError( wLanServiceTable->InsertRecord( dummyUid ) ); wLanServiceTable->WriteUintL( TPtrC( WLAN_SERVICE_ID ), apid ); } wLanServiceTable->PutRecordChanges(); err = db->CommitTransaction(); CleanupStack::PopAndDestroy(5); // Create an RConnection using a defined IAP TInt error; error = server.Connect(KESockDefaultMessageSlots); error = connection.Open(server, KConnectionTypeDefault); TCommDbConnPref prefs; prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); prefs.SetDirection(ECommDbConnectionDirectionUnknown); prefs.SetIapId(Iap); error = connection.Start(prefs);
but when i compile and run to 3rd Ed, occurs another error in this part, and breaks the application:Code:error = connection.Start(prefs); the error code is -34 (KErrCouldNotConnect)
Why this is happening?Code:apid = handler->CreateFromDataL(*wlanAp); //error System Error (-1)
I'll be gratefull if someone could help me.
Thanks in advance



