/// <summary> /// Begin reading from the modem's serial port and listen for location updates /// </summary> public void Start() { outputPort = serialProxy.Create(config.Positioning.SerialOutput, config.Positioning.SerialBaudRate); SendUpdateRequestSignal(); workThread = threadProxy.Create(ProcessUpdates); }
/// <summary> /// Connects to the remote host and starts the receiving thread /// </summary> public void Connect() { Console.WriteLine("Connecting to TCP interface..."); try { tcpClient.Connect(host, port); tcpClient.ReceiveTimeout = 1000; tcpClient.SendTimeout = 1000; networkStream = tcpClient.GetStream(); thread = threadProxy.Create(Run); thread.Start(); } catch (Exception ex) { Console.WriteLine("Could not connect to vehicle. Retrying..."); Task.Run(() => { Thread.Sleep(1000); Connect(); }); } }