AnsweredAssumed Answered

GPS Connection and Position

Question asked by fannonj on Nov 22, 2012
Latest reply on Oct 24, 2013 by fannonj
Hi All

I've got a requirement to connect to the GPS device and log the current position to a file on a mobile unit running windows - there's no requirement to show the position on a map. I've put together some ArcObjects (v10) code based on some of the samples that uses IRealTimeFeedManager, IGPSFeed and IGPSConnection, but am struggling to get it reporting the position.

The code is basically similar to the following:

IRealTimeFeedManager realTimeFeedMgr = new RealTimeFeedManagerClass(); IGpsFeed gpsFeed = realTimeFeedMgr.GpsFeed;  IGpsConnection gpsConnection = gpsFeed.Connection; gpsConnection.CommPort = 1; gpsConnection.BaudRate = (short)esriGpsBaudRate.esriGpsBaudRate9600; gpsConnection.DataBits = 8; gpsConnection.Parity = esriGpsParity.esriGpsParityNone; gpsConnection.StopBits = 1; gpsFeed.Connection = gpsConnection;  realTimeFeedMgr.RealTimeFeed = (IRealTimeFeed)gpsFeed; realTimeFeed.Start();  System.Diagnostics.Debug.WriteLine("Status: " + realTimeFeed.Status.ToString());  esriGpsConnectionError conError = realTimeFeed.ConnectionError; System.Diagnostics.Debug.WriteLine(conError.ToString());  esriGpsPositionInfo posInfo = realTimeFeed.CurrentPosition; System.Diagnostics.Debug.WriteLine("Position: " + posInfo.latitude.ToString() + "," + posInfo.longitude);  realTimeFeed.Stop();


When I debug the code, the output is always:

Status: esriGpsConnectionStatusOpen
esriGpsConnectionErrorNone
Position: 0,0


I've messed around a little with the baud settings etc, but can't get it to report the status as esriGpsConnectionStatusReceiving, which I guess is why it's returning the position as 0,0.

Has anyone got any pointers as to what I'm doing wrong or perhaps can you confirm that the above should work? There aren't too many samples that use IGPSFeed, they mainly use a simulated feed.

Anyway. I'd appreciate any thoughts on this. Otherwise I may have to take another, possibly non-Esri route.

Thanks

John

Outcomes