locked
Can't get the position of GPS - WM5 RRS feed

  • Question

  • Hi, I'm trying to get GPS position, using the GPSSample from WM6 SDK. When I run the application on emulator with fake GPS everything runs ok. When I rum the application on a Motorola with WM6 the software get the position, satelittes in view ...

    The problem is when i'm trying to running this software on Trimble Juno ST that runs WM5.

    The Device info I get OK, like On, On. But the position information always return null ... The signal of GPS is not the problem, I tested the software outside and the same problem occur.

    Any one can help me? I don't know what to do any more..

    Thanks!

    Wednesday, November 3, 2010 9:15 PM

Answers

  • Go to the Settings control panel. Open "System" then "External GPS". Under the "Access" tab, make sure "Manage GPS automatically" is checked. Verify the other settings in that applet too. Restart the device, then try your application.

    See "Configuring the GPS Intermediate Driver with the GPS Settings icon " at http://msdn.microsoft.com/en-us/library/bb158600.aspx for details.

    Your other option is to connect to the GPS as a serial device and decode the NMEA strings in your application.

    MSDN has an article explaining the basics of this here: http://msdn.microsoft.com/en-us/library/aa446565.aspx

    -PaulH

    Friday, November 5, 2010 3:21 PM

All replies

  • Does GPSOpenDevice() return a valid handle? When you call GPSGetPosition(), what is the return value?

    -PaulH

    Thursday, November 4, 2010 2:47 PM
  • GPSOpenDevice() returns a valid value (7471104)

    The device info returns On, On

    The GPSGetPosition returns "null", like this image http://felipecanuso.com.br/error.jpg

    I really don't know what to do...

    Thursday, November 4, 2010 6:14 PM
  • In GPS.CS, GetPosition(), there is a section that looks like this:

     

    // call native method passing in our native buffer
    int result = GPSGetPosition(gpsHandle, ptr, 500000, 0);
    if (result == 0)
    {
      // native call succeeded, marshal native data to our managed data
      gpsPosition = (GpsPosition)Marshal.PtrToStructure(ptr, typeof(GpsPosition));
    
      if (maxAge != TimeSpan.Zero)
      {
        // check to see if the data is recent enough.
        if (!gpsPosition.TimeValid || DateTime.Now - maxAge > gpsPosition.Time)
        {
          gpsPosition = null;
        }
      }
    }
    
    

    This is the part of the code where the GPS position information is being retrieved from the GPS. Step through that in the debugger. What is the value of 'result' returned by 'GPSGetPosition(...)'? If it's 0, does the 'gpsPosition' structure look okay after the 'Marshal.PtrToStructure()' call or is it empty? If it's not 0, what's the error code? That should give you a good clue as to what's wrong.

    -PaulH

    Thursday, November 4, 2010 7:04 PM
  • Paul,

    the software dosen't entry on GetGpsPosition function.... never..

    I just ran the software GPS Controller from trimble and it's took me 9 satelites, so it's not a problem of viewing satelites...

    Thursday, November 4, 2010 7:36 PM
  • Okay, the Form1.UpdateData() function is called when the Form1.LocationChanged event handler is invoked. The Form1.LocationChanged event handler is called by the GPS.WaitForGPSEvents thread function. That calls GPS.GetPosition() which is a shortcut for GPS.GetPosition(TimeSpan). So, I know you're getting to that function.

    Set your breakpoint at the very top of that "GetPosition( TimeSpan ... )" function. You're probably not getting past the "if (Opened)" at the top. Am I right?

    If you're not, then GPSOpenDevice() call failed. Take a second look at the value of "gpsHandle" right after the GPSOpenDevice() call. Are you certain it's a valid value? If it's not, stick a call to Marshal .GetLastWin32Error() in there and see what it says.

    -PaulH

    Edit: Just to verify, you are running this in "debug" mode when you're in the debugger, right?

    Thursday, November 4, 2010 8:22 PM
  • Yes, I'm debugging throught visual studio directly to my device (Trimble Juno ST - WM5).

    I took a printscreen of the result debbug: http://felipecanuso.com.br/error2.jpg

    One thing that I noted is when it's enter on the infinite loop inside WaitForGpsEvents > while (listening), it´s passed at the first time and in switch the case is 1 (device), at the second time it's stucking to get the value of obj...

    Thursday, November 4, 2010 8:49 PM
  • Well, that explains why you're getting in to UpdateData() without location information. When you open the GPS, it's sending a notification that the GPS has been turned on. (that's the case 1 in the loop you mentioned)

    Sometimes it takes a while to get a good GPS fix. Let the program run for about 10 minutes with a good view of the satellites and see if it starts sending valid location information. Try not to move the device around while you're waiting. The more it moves, the longer it takes to calculate a fix. (i.e. don't do this while driving or walking around with it.)

     

    -PaulH

    Friday, November 5, 2010 1:32 PM
  • Paul, I let the Device outside the window (connected to the notebook) for about 20 minutes and I didn't get the Position result... :(
    Friday, November 5, 2010 2:13 PM
  • Go to the Settings control panel. Open "System" then "External GPS". Under the "Access" tab, make sure "Manage GPS automatically" is checked. Verify the other settings in that applet too. Restart the device, then try your application.

    See "Configuring the GPS Intermediate Driver with the GPS Settings icon " at http://msdn.microsoft.com/en-us/library/bb158600.aspx for details.

    Your other option is to connect to the GPS as a serial device and decode the NMEA strings in your application.

    MSDN has an article explaining the basics of this here: http://msdn.microsoft.com/en-us/library/aa446565.aspx

    -PaulH

    Friday, November 5, 2010 3:21 PM
  • Thanks a lot for your support Paul !

    The problem was with the GPS config.. I changed the baud rate to 4800 and it's ran !!!

    Thanks again.

    Cheers.

    Friday, November 5, 2010 5:32 PM
  • It is long time since you last post, but i have the same issue and despriate for any help.

    Could you please advice me, how can i make sure that my configuration is correct.

    thanks in advance. 

    Tuesday, February 14, 2012 5:16 PM
  • Manshy51 - If my solution for Felipe does not solve your issue, then please create a new post describing your situation.

    -PaulH

    Wednesday, February 15, 2012 6:33 PM