×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    2

    Porting code from 5th Ed to 3rd Ed

    Hi, all.

    I'm trying to porting the following code to 3rd Edition

    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);
    When I compile and Run this code to 5th edition an error occurs in this part:
    Code:
    error = connection.Start(prefs); the error code is -34 (KErrCouldNotConnect)
    but when i compile and run to 3rd Ed, occurs another error in this part, and breaks the application:
    Code:
    	apid = handler->CreateFromDataL(*wlanAp);  //error System Error (-1)
    Why this is happening?

    I'll be gratefull if someone could help me.

    Thanks in advance

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: Porting code from 5th Ed to 3rd Ed

    have you tried making it as it has been done in our wiki: http://wiki.forum.nokia.com/index.ph..._access_points

Similar Threads

  1. S60 5th edition applications in 3rd edition phones
    By radhamanogar in forum Symbian
    Replies: 4
    Last Post: 2012-08-08, 06:47
  2. Replies: 2
    Last Post: 2009-07-07, 09:13
  3. S60 3rd ed FP1 emulator crashes on startup with DEP enabled
    By tchan in forum Symbian Tools & SDKs
    Replies: 18
    Last Post: 2009-02-10, 12:26
  4. Will S60 3rd Ed FP2 emulator have Support for Windows Vista Aero
    By jimgilmour1 in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-10-17, 19:39

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×