×

Discussion Board

Results 1 to 1 of 1
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    18

    KErrGeneral on getting GPS Updates

    Hey guys,
    I get some strange errors while using the GPS Module. I'm not very familiar with Symbian C++ as I use Qt to write my software. There is only this tiny little part using Symbian C++, and I don't know what I'm doing wrong.

    This is my code:
    Code:
    //PositionProvider.hpp
    RPositionServer positionServer;
    RPositioner positioner;
    RRequestorStack requestorStack;
    TRequestStatus requestStatus;
    TPositionInfo posInfo;
    TPositionCourseInfo posCourseInfo;
    TPosition symbianPos;
    TCourse symbianCourse;
    
    CRequestor* contact;
    CRequestor* service;
    
    
    //PositionProvider.cpp
    	User::LeaveIfError(positionServer.Connect());
    	CleanupClosePushL(positionServer);
    
    	// use default positioning module
    	User::LeaveIfError(positioner.Open(positionServer));
    	CleanupClosePushL(positioner);
    
    	_LIT(KCntPhone, "+491791234567");
    	_LIT(KSrvName, "QtTester");
    	
    	contact = CRequestor::NewLC( CRequestor::ERequestorContact, CRequestor::EFormatTelephone, KCntPhone);
    	requestorStack.Append(contact);
    	service = CRequestor::NewLC(CRequestor::ERequestorService,	CRequestor::EFormatApplication, 	KSrvName);
    	requestorStack.Append(service);
    	
    	User::LeaveIfError(positioner.SetRequestor(requestorStack));
    	
    	while (this->threadRunning)
    	{
    		
    		//Known Issue KIS000850.
    		positioner.SetUpdateOptions(TPositionUpdateOptions( 1,
    		                             TTimeIntervalMicroSeconds(0), /* timeout */
    		                             TTimeIntervalMicroSeconds(0), /* max age */
    		                             false));
    
    		positioner.NotifyPositionUpdate(posCourseInfo, requestStatus); 	//asynchroner Request
    		User::WaitForRequest(requestStatus);
    		//User::LeaveIfError(requestStatus.Int());					//Here I get KErrGeneral after some updates
    		if (requestStatus.Int() != 0)
    		{
    			Toolbox::log("GPS: Error. Retry.", Toolbox::WARNING);
    			continue;
    		}
    		
    		posCourseInfo.GetPosition(symbianPos);
    		posCourseInfo.GetCourse(symbianCourse);
    		
    		mutex.lock();			//Schloss verschließen.
    		pos.setLat(symbianPos.Latitude());
    		pos.setLon(symbianPos.Longitude());
    
    		speed = symbianCourse.Speed();
    		course = symbianCourse.Heading();
    		mutex.unlock();			//Schloss aufschließen.
    		emit positionUpdate();
    		
    		sleep(1);
    	};
    	
    	requestorStack.Reset();
    	CleanupStack::PopAndDestroy(service);
    	CleanupStack::PopAndDestroy(contact);
    	CleanupStack::PopAndDestroy(&positioner); // this will call Close() method
    	CleanupStack::PopAndDestroy(&positionServer); // this will call Close() method
    I want to get position updates every second. Because I did not know how to do it with Symbian-C++-like things, I copied most of the code from the Nokia Tutorial and built some Code around it. It works as a thread (QThread).

    I marked the line where I get the error. I do get some position updates, after some time I get an "KErrGeneral (-2)". Sometimes I get 3-5 updates before it gets stuck, sometimes I get around 30, sometimes around 50. First, I thought it might be a known issue with GPS (marked in code), but that did not help.

    Any ideas?

    Thanks,
    Lena

    EDIT: I forgot to say that I do not have any problems within the emulator....
    EDIT2: I also forgot to say that this version contains a workaround: The if-clause directly after the commented User::LeaveIfError does the job. But that does not say why the error occurs and I think its a bit quick-and-dirty...
    Last edited by lenalebt; 2010-06-28 at 20:22.

Similar Threads

  1. KerrGeneral
    By federicopalumbo in forum Symbian
    Replies: 6
    Last Post: 2008-03-26, 16:11
  2. CMMFDevVideoRecord::Initilize() returns with KErrGeneral
    By pncbose in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2007-04-30, 07:26
  3. CMMFDevVideoRecord::Initilize() returns with KErrGeneral
    By pncbose in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2007-04-30, 07:26
  4. RecvFrom => KErrGeneral in an endless loop
    By glr in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2006-08-29, 10:49
  5. KErrGeneral returned from AknIconUtils::SetSize
    By JamesLockett in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2006-06-16, 14:40

Posting Permissions

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