×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    46

    Question Little help needed with 'Retrieving locaiton information' example from wiki

    Hi All,

    I have this example:
    http://wiki.forum.nokia.com/index.ph...on_information

    First I tell you where I am stuck:
    How to use:
    * implement interface MPositionReaderObserver in your class
    I do not know what the text above means. How do I do what it says?

    Now I tell you what I have done so far to try to implement the example from the wiki in my own project:
    - Made new symbian c++ project called GPSLoc with UI designer
    - Linked the .mmp file to the lbs.lib file
    - Created a file CustomClass.h in the inc directory
    - Created a file CustomClass.cpp in the src directory
    - Copied all the classes from the example from wiki into the CustomClass.h file
    - Copied 'The body:' from the example into the CustomClass.cpp file
    - Putted the following code in the CustomClass.h file:
    Code:
    #include <lbs.h>
    #include <lbspositioninfo.h>
    #include <lbssatellite.h>
    - Done 'include CPositionReader* iReader as a class member' by putting this in the GPSLocContainerView.h file:
    Code:
    class CPositionReader; //Comes after the includes
    // [[[ begin generated region: do not modify [Generated Instance Variables]
    	CGPSLocContainer* iGPSLocContainer;
    	// ]]] end generated region [Generated Instance Variables]
    	CPositionReader* iReader;
    What is the next step?
    I know that it has something to do with that 'class MPositionReaderObserver' but I do now know what I am supposed to do.


    Thank you very much in advance for trying to help this newbie.

  2. #2
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: Little help needed with 'Retrieving locaiton information' example from wiki

    The SDK comes with ready to build Location Acquisition API example, a perfect start for somebody that has yet to understand what "implement M*" means. A wiki article usually contains a code snippet that you are expected to integrate yourself, assuming that you have the knowledge.

    Anyhow, an M class is a interface that needs to be implemented by a C class (e.g. your view class) so that external classes can call the methods implemented by C without having to know anything about its implementation, other that it implements M.

    Code:
    // interface
    class M
    {
    virtual void DoSomething() = 0;
    }
    
    // class implementing the interface
    class C: public CBase, public M
    {
    // declaration, from M, definition is mandatory
    void DoSomething();
    }
    
    //definition
    void C::DoSomething()
    {
     // I'm doing something
    }
    Now any object that knows how to use the M interface can manipulate C objects but only through that interface. So the code below

    Code:
    void CAnyObject::UseTheMInterface(M& aMDerivedObject)
    {
    aMDerivedObject.DoSomething();
    }
    can be used in the context:

    Code:
    C *c = new (ELeave) C();
    CAnyObject *anyObject = new (ELeave) CAnyObject();
    ...
    anyObject->UseTheMInterface(*c);
    ...
    although CAnyObject is not aware of C's definition.

    So, check the declaration of MPositionReaderObserver and see which class in your project should provide the implementation for this interface in order to receive notifications when location info is available.
    Last edited by ltomuta; 2008-05-30 at 17:59. Reason: Typo
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    46

    Re: Little help needed with 'Retrieving locaiton information' example from wiki

    What you have described comes down to the description/character of virtual functions no?
    Together with your explaination and the principle in mind of virtual functions I think I managed to put the code together. Unfortunately I can not test the project because my N82 phone says the following when I execute the request for getting the GPS data:
    "unable to execute file for security reasons". (The program does start on my phone)

    I have read about setting capabilities in Carbide but I can not find where to do it. So far I am looking for Project -> Properties -> ... ?

    When I run the project in the emulator (quiet useless of course for GPS) I get this message:
    295.885 *PlatSec* WARNING - Capability check would have failed - A Message (function number=0x0000200a) from Thread GPSLoc[eeb72e83]0001::GPSLoc, sent to Server PosServer, was checked by Thread EPosServer.EXE[101f97b2]0001::PosServer and was found to be missing the capabilities: Location . Additional diagnostic message: Checked by CPolicyServer::RunL
    295.885 EPos: Server: EPositionerNotifyPositionUpdate
    295.885 EPos: Server: calling CPositioner::NotifyPositionUpdate()
    295.885 EPos: DefaultProxy: UsePositioner
    295.930 EPos: Server: ReportStatus()
    296.255 Thread GPSLoc::GPSLoc Panic KERN-EXEC 3

    The SDK comes with ready to build Location Acquisition API example
    Is it called "LocationSatViewRefApp" in probably this dir: "C:\Symbian\9.1\S60_3rd_MR\S60Ex"?

    Thanks for helping!

  4. #4
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: Little help needed with 'Retrieving locaiton information' example from wiki

    Yes, with M classes it all goes down to pure virtual methods.

    Capabilities are declared in plain text in the *.mmp file. You can open that file in Carbide or Notepad and make the edit accordingly. Carbide has a specialised MMP editor but I'm sure you will find the way to add the capability, if not it also can edit the file in text mode, see the last tab in the editor.

    The example I had in mind is LocationRefAppForS60, the one you mention focuses on displaying the Satellite Info dialogue.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    46

    Re: Little help needed with 'Retrieving locaiton information' example from wiki

    Thank you for helping me so far. Capabilities can indeed be set using the Carbide mmp file editor. The fourth tab called 'Options' let you set the capabilities under the heading 'Runtime'. To be sure I have checked all the capabilities. Though I still get the message: "unable to execute file for security reasons".

    A real bummer after finally being able to integrate example code into my project.

    Do you have any tips left for me what to do?

    I prefer being able to the example code because then I know I managed to include some example code! Though I will take a look at the example project but in any case I dont think it will give a clue about this stupid warning. I am signing my app with a certificate for my phone. I have choosen to have all the capabilities possible.

    Thanks again and in advance for helping me!

  6. #6
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: Little help needed with 'Retrieving locaiton information' example from wiki

    Quote Originally Posted by mikedeklerk View Post
    I have choosen to have all the capabilities possible.
    That is a bad habit you should try not to catch. An application should always have the minimum set of capabilities it requires, no more and no less.

    See raghukiran's thread, you two guys have the same problems.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  7. #7
    Registered User
    Join Date
    Jan 2008
    Posts
    46

    Re: Little help needed with 'Retrieving locaiton information' example from wiki

    The problem with the security message is solved on my application. I defined only the location capability and the app worked. For the record, also see this thread: Location based services - error

    New problem:
    In the code the time-out time is set to 50 seconds. When I wait that long, after requesting the GPS data I do not see any message after 50 seconds. Though I have put in some code to display a message in the following functons: ReadingComplete() and ReadingComplete()

    What happens if the time-out occures? I can not see what the code does then...

    Also another question, does it matter in *.h file the M class is put? As long as that *.h file is included in the *.cpp file specifying its function right?

    Thanks in advance,

  8. #8
    Registered User
    Join Date
    Jan 2008
    Posts
    46

    Exclamation Re: Little help needed with 'Retrieving locaiton information' example from wiki

    So I managed, I overlooked something in the inplementation of the observer class. Now I can retrieve the GPS data.

    How can I update these values faster then they are now?? Now they are updated once in 20 seconds or so.

    So the function ReadingComplete is called and values in my screen can be set from the obtained data. After those values are set, called by ReadingComplete, I use DrawDeffered(); to update the screen. But it does not update continously. Only in 20 seconds. Though when I press the option button again to obtain the GPS data I can see that the data is updated right away. I use the satellite time to check how fast it updates.
    Option button calls:
    Code:
    iReader = CPositionReader :: NewL( this ); // new reader
    iReader->ReadSatelliteInfo();   // request satellites info
    When I put the above code in a function and call the function after my data has been set, so I get a loop, I get an error saying that I have too few memory left and I should close other applications.

    How can I loop this retreiving of the GPS data properly, or how do I clean up the memory in the right way so I don't get this memory problem? Or can I set an interval somewhere to speed up this GPS data retreival?

    Thanks

Similar Threads

  1. SyncMl Api Information needed
    By bharatuppal in forum Symbian
    Replies: 4
    Last Post: 2008-05-14, 08:28
  2. random information needed... lol.
    By reedy81 in forum General Development Questions
    Replies: 1
    Last Post: 2008-02-04, 18:40
  3. GPS Information needed
    By swapnilgp in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2006-05-01, 15:07
  4. Information about SMSC remote access needed
    By Nopik in forum General Messaging
    Replies: 3
    Last Post: 2003-10-03, 15:15
  5. DLR-3P cable information needed
    By Nokia_Archived in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2002-05-27, 15:45

Posting Permissions

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