This project is read-only.

Regarding the Exception caught in GPS.Net or Geoframework

Jul 20, 2010 at 3:01 AM

Hi there, I have been facing a problem in using GPS.net or Geoframework, I am not sure which package actually raises such exception, the flow goes like this. If I have started the GPS.net and Geoframework in a desktop program, when a device is not detected, an exception will be thrown from GPS.net which says, System.ArgumentException..... Also my second problem faced, to my mobile device, when I have started the program with GPS.net and Geoframework, I couldnt start at second time, meaning each time a device boot up, I can only manage to start once for the program. If I started second time, Exception will be thrown. The same thing happened to my desktop GPS program. I am not sure what problem is this, might be due to the reference in memory is not disposed. I am just making a wild guess as I have not really look into the codings in GPS.net and try to fix it, if moderator or whoever has fixed this issue before and wouldnt mind to share out as this may save time to not fixing the same issue again. Thanks Best Regard, Bernad www.spgeo.com

Jul 20, 2010 at 7:38 PM

The Interpreter.Start() method will throw an InvalidOperationException if it is unable to detect a GPS device.  This is by design.  You can either catch the exception and handle it appropriately, or you can use the Interpreter.Start(Device) overload and pass it the specific device that you want to use.  You can obtain a Device object by using the Devices.Any property or by calling the Devices.BeginDetection method to initiate a device search and then calling the Devices.WaitForDevice method or responding to the Devices.DeviceDetected event.

As for the second problem...  Serial streams (such as GPS devices) can only be opened by a single reader at a time.  So, it's not possible for two instances or your application to connect to the same device.  Once the first app instance has connected to the device, the second instance will not be able to detect that device and will thus get an InvalidOperationException when calling the Interpreter.Start() method, as described above.

Jul 21, 2010 at 2:31 AM

Allright, I will try to catch the exception in the interpreter.Start(), though I have tried to catch it but not successfully. Will try again tonite.

Regarding the second problem, which is the second detection. I have actually closed the device and call device.undetect() and disposed it. When recall the interpreter.start(Device) using new instance of device and interpreter, the exception is still thrown. My problem is that when everything is stop even after interpreter.Stop(), the exception will still be thrown.

 

Please advise.

Thanks

 

Bernad

Jul 21, 2010 at 3:50 PM

Hmmm... I'm not certain as to why you're seeing such odd behavior, but I suspect that it may be something subtle about the way the code is written or the order of execution.  Take a look at the example app that comes with GPS.Net and see if you can reproduce the same problem with that app.  If not, then compare the example code to your app's code and hopefully you'll find some key difference that resolves the problem.

Jul 21, 2010 at 3:53 PM

What is the example apps that you mentioned? Can i find in this forum? or do you have any links regarding that.

 

Thanks

Bernad

Jul 21, 2010 at 3:58 PM

When you download the GPS.Net source code from CodePlex, it includes a folder named "Examples".  Beneath that folder, there are various example files and projects in both VB.Net and C#.

Jun 23, 2012 at 5:22 PM

I am struggling with same problem and couldn't find solution in Examples.. 

I try to get GPS Coordinates and first time I can do that, but as soon as I stop interpreter or dispose it, It can't be loaded second time. It's very odd, because I close whole form (where is Interpreter used) and recreate it.. So can't really get, why it can't be disposed..

Couldn't find any solution to solve this problem..

Is anybody solved that problem?? 

Thanks