This project is read-only.

Redetect GPS device that has re-established a lost physical connection

Jan 18, 2013 at 10:30 PM

Hello everyone!

I'm working on trying to auto-detect a GPS device whenever it is plugged into a computer.  I have been successful with finding the device when it is first plugged in while the application is running, but unplugging and then replugging has not been working.  I am a bit confused with the correct pathway one should take when trying to do this with DotSpatial.

One of the problems I have encountered is that the DetectDevices will only run 100 times per port before forcing itself to stop.  Is there any way to change this?  I couldn't find a public facing method to set the value to 0 (which looks like the value needed to continue detection)

I have tried a threaded While loop to cancel detection and fire off a new Detection whenever the initial Devices.BeginDetection() completes without finding a device.  This method seemed promising, but I ran into issues where CancelDetection would not officially kill the detectionThread (meaning the detection code will never run because it thinks it's already running.  i.e. _detectionThread != null && _detectionThread.IsAlive == true)

I can post code if necessary, but maybe somebody just knows the proper way to use DotSpatial to listen for GPS devices and gracefully handle losing physical connection and regaining it (especially plugging the GPS into another port).  I couldn't find anything like this in the demo projects.

Hopefully this makes some sense.  Thank you SO MUCH in advance!!!