Click here to Skip to main content
15,894,410 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey all...
1- i used microsft sample to get long and lat but it always response zero to my mobile .....?? any idea about this.

1- i used different dll. to get position its name is OGL but it is response me schema like this GGA$6756a...h762

how can i convert this schema to use it as x,y coordinate to mark userr position in my map....

and thx all

[Added]
--hey wiliam am sry about this :)
but yes i mean this OGL in http://ogl-lib.sourceforge.net/index.html
C#
using OGL_Library;

//...

GPSReceive gps = new GPSReceive(3);

this is my code afor OGL library

C#
gps.PortOpen = true;
GPSReceive.MSG_GGA ggs = gps.ReceiveGGA();
label1.Text = gps.ReceiveGGA();


and about microsoft sample in this url
C:\Program Files\Windows Mobile 6 SDK\Samples\PocketPC\CS\GPS

[modified: don't post an answer to your question when clarifying. It should go here as I did]
Posted
Updated 1-Jun-10 7:52am
v3
Comments
William Winner 1-Jun-10 12:20pm    
You haven't written a clear question. We don't know what microsoft sample you're talking about so how can we know what's going on?

And, I'm assuming that you are saying that you're using the OGL library found here: http://ogl-lib.sourceforge.net/index.html

But you didn't tell us what code you're running, so we can't tell you what to do. GGA is the standard message for sending GPS data. Lat and Long in WGS84 are directly available from the GGA message. If you're using a library, you need to read the documentation on it.

You also need to be clearer in your question or we can't help.
William Winner 2-Jun-10 11:40am    
If you're not getting any data, then you need to make sure that the gps receiver is on the correct port and that it is set to transmit the NMEA data in the way that GPSReceive requires.
Ashraf ELHakim 3-Jun-10 9:22am    
Okay really am sry to bother u :) but when i use the correct port ,i had this error {"Specified argument was out of the range of valid values."}
in this part GPSReceive.MSG_GGA gga = gps.ReceiveGGA();
any idea or i made mistake?? and thx again :( i am timid from u

1 solution

ok, so you just made one mistake. You did everything right up until the last point.

You created the GPSReceive. You created the GGA message (ggs) and received the data from the GPSReceive.

Then, you set the textbox to the next ReceiveGGA. What this line:
C#
label1.Text = gps.ReceiveGGA();

does is tells the compiler to use the MSG_GGA class's ToString method and store that in the label. It doesn't look like the MSG_GGA ToString method was overwritten, so it probably was showing up as something like
"OGL_Library.GPSReceive.MSG_GGA, ..."

First, you need to use ggs. Then, you need to use it's methods to parse the GGA method.

You can do any number of things as found here: MSG_GGA Struct Reference[^]

it could look like:
C#
label1.Text = ggs.Latitude + ggs.NS_Indicator + "," + ggs.Longitude + EW_Indicator;
 
Share this answer
 
Comments
Ashraf ELHakim 1-Jun-10 19:28pm    
really thx to ur effort but still have problem the latitude and longtitude and all is always null
GPSReceive gps = new GPSReceive(5);
gps.PortOpen = true;
GPSReceive.MSG_GGA ggs = gps.ReceiveGGA();
label1.Text = ggs.Latitude + ggs.NS_Indicator + "," + ggs.Longitude + EW_Indicator;


and nothing appear in my label and when i set this code it is write latitude is null on my label:
if(ggs.Latitude == null)
{
label1.text="Latitude is null";
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900