static void Main(string[] args) { _eventHandler += ExitHandler; SetConsoleCtrlHandler(_eventHandler, true); var info = new ComPortInfo() { ComPort = "COM9\0\0\0\0", }; _gpsService = new GpsService(info); _gpsService.RegisterStatusEvent(Action); _gpsService.RegisterDataEvent(GpsdServiceOnLocationChanged); try { _gpsService.Connect(); } catch (UnauthorizedAccessException) { Console.WriteLine("The selected com port is already in use!"); } Console.WriteLine("Press enter to continue..."); Console.ReadKey(); }
static void Main(string[] args) { _eventHandler += ExitHandler; SetConsoleCtrlHandler(_eventHandler, true); _gpsService = new GpsService(GpsType.WindowsLocationApi); _gpsService.RegisterDataEvent(GpsdServiceOnLocationChanged); _gpsService.Connect(); System.Console.WriteLine("Press enter to continue..."); System.Console.ReadKey(); }
static void Main(string[] args) { _eventHandler += ExitHandler; SetConsoleCtrlHandler(_eventHandler, true); var info = new FileGpsInfo { FilePath = "GPS.TXT", FileType = FileType.Nmea }; _gpsService = new GpsService(info); _gpsService.RegisterDataEvent(GpsdServiceOnLocationChanged); _gpsService.Connect(); Console.WriteLine("Press enter to continue..."); Console.ReadKey(); }
static void Main(string[] args) { _eventHandler += ExitHandler; SetConsoleCtrlHandler(_eventHandler, true); var info = new GpsdInfo() { Address = "***.* **.* **.***", //Default //Port = 2947, //IsProxyEnabled = true, //ProxyAddress = "proxy", //ProxyPort = 80, //ProxyCredentials = new ProxyCredentials("*****", "*****") }; _gpsService = new GpsService(info); _gpsService.RegisterDataEvent(GpsdServiceOnLocationChanged); _gpsService.Connect(); Console.WriteLine("Press enter to continue..."); Console.ReadKey(); }