×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    49

    Thumbs down [Moved] liblocation signal with global variable problem ?

    Hi,

    I am using liblocation library for gps in n900 phone in my application.
    While I am executing the application program that I got from maemo site for gps,I am not getting gps fix accurately.Its gps refresh that I am getting are not updating while I am moving.The latitude and longitude ,I am getting are not much differ from each interval(1 sec).
    Is there any solution plz reply me.

  2. #2
    Registered User
    Join Date
    Mar 2010
    Posts
    49

    Thumbs down gps update too slow by using liblocation

    I am not getting the proper latitude and longitude ie nearly same from 1 sec interval.Below thread is running from main.Plz suggest how can i get gps refresh quickly.

    void* UserLocation::gpsLocSearch(void *arg)
    {

    g_type_init();
    LocationGPSDControl *control;
    LocationGPSDevice *device;
    GMainLoop *loop;

    control = location_gpsd_control_get_default();
    device = (LocationGPSDevice *)g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL);

    if(loop == NULL)
    loop = g_main_loop_new(NULL, FALSE);

    if(control!=NULL && device!=NULL)
    m_bGPSConnected=true;
    else
    m_bGPSConnected=false;


    g_object_set(G_OBJECT(control),
    "preferred-method",LOCATION_METHOD_GNSS | LOCATION_METHOD_AGNSS,
    "preferred-interval", LOCATION_INTERVAL_DEFAULT,
    NULL);



    g_signal_connect(control, "error-verbose", G_CALLBACK(on_error), loop);
    g_signal_connect(device, "changed", G_CALLBACK(on_changed), control);
    g_signal_connect(control, "gpsd-stopped", G_CALLBACK(on_stop), loop);

    g_idle_add(start_location, control);
    printf("\nI AM running in gpsLocSearch THREAD LOOP\n");
    g_main_loop_run(loop);

    g_object_unref(device);
    g_object_unref(control);

    }
    Last edited by babulamiet; 2010-03-02 at 12:26. Reason: partial

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    49

    Thumbs down liblocation signal with global variable problem ?

    Hi,

    I am getting problem using liblocation library.Though It is implemented using signal.When the "changed" signal occur,I am contineously updating the gps values into my global variable.So sometime it is getting stuck in my application to get the proper values(latitude and longitude).Can any one plz tell me a way so that I can update my global variable when ever the signal is generated.
    Or is there any other way to use liblocation without using these signals.

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: liblocation signal with global variable problem ?

    Did you check this sample application?
    http://discussion.forum.nokia.com/fo...14&postcount=2

  5. #5
    Wiki Moderators
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,779

    Post Re: liblocation signal with global variable problem ?

    Are you using something like this in your slot?

    Code:
    if (device->fix) 
    {
        if (device->fix->fields & LOCATION_GPS_DEVICE_LATLONG_SET) 
          {
          // your action here
          }
    }
    I think you might be loosing the fix, and acquiring a new fix does take some time.
    Pankaj Nathani
    www.croozeus.com

  6. #6
    Registered User
    Join Date
    Mar 2010
    Posts
    49

    Re: liblocation signal with global variable problem ?

    No,I am not loosing the fix,I am getting the fix and writing into file also.THe problem I am getting is due to updating the global variable.I have a tracker thread which will take the global variable every time (in every 1sec).the global variable is getting updated when the new fix comes ie in the signal.But the problem is while the global variable is getting update it may be stuck in access the global variable in tarcker thread.I have used pthread_mutex_lock for this but it is not solving the issue.So if the signal is updating the global varible I should have to make a wait for sometime while accessing the global variable in tracker thread.

  7. #7
    Registered User
    Join Date
    Mar 2010
    Posts
    49

    Re: liblocation signal with global variable problem ?

    yes i am using my application in the same way,u have mention here in the link.But i am getting the fix regularly.But my application some time not access the proper gps values because it is updating the global variable in the signal ("changed") generated at every time when the device change position.

    The problem I am getting is while the location searching is going on it will update the LocationGPSDevice variable.And at same time i m updating into global variable and use it in my application.So which is not working properly as signal will block it while updating the LocationGPSDevice variable.I need some solution how to block the signal while updating the global variable.

  8. #8
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: liblocation signal with global variable problem ?

    Quote Originally Posted by babulamiet View Post
    yes i am using my application in the same way,u have mention here in the link.But i am getting the fix regularly.But my application some time not access the proper gps values because it is updating the global variable in the signal ("changed") generated at every time when the device change position.

    The problem I am getting is while the location searching is going on it will update the LocationGPSDevice variable.And at same time i m updating into global variable and use it in my application.So which is not working properly as signal will block it while updating the LocationGPSDevice variable.I need some solution how to block the signal while updating the global variable.
    gtk uses single thread, while you are in the handler processing something, signal won't be emitted.

  9. #9
    Registered User
    Join Date
    Mar 2010
    Posts
    49

    Re: liblocation signal with global variable problem ?

    may i know a solution for this how to block the signal while accessing the global variable outside the signal handler.I need the gps values in my appl.so only way is through updating into global variable frequently in the signal

  10. #10
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: liblocation signal with global variable problem ?

    Quote Originally Posted by babulamiet View Post
    may i know a solution for this how to block the signal while accessing the global variable outside the signal handler.I need the gps values in my appl.so only way is through updating into global variable frequently in the signal
    To say what is the solution one needs to understand what is the problem. How many threads/processes are you using?

Similar Threads

  1. Replies: 6
    Last Post: 2010-03-20, 14:06
  2. Modules required :)
    By neil.young in forum Symbian
    Replies: 20
    Last Post: 2009-06-07, 11:35
  3. Replies: 5
    Last Post: 2008-10-19, 12:16
  4. Link error with global variable in CW for symbian
    By joe5160 in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2008-08-21, 09:42
  5. problem with static variable
    By prashantpersistent in forum Mobile Java General
    Replies: 3
    Last Post: 2008-08-13, 10:30

Posting Permissions

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