1
0
mirror of https://github.com/DarthAffe/OBD.NET.git synced 2025-12-13 09:18:31 +00:00
This commit is contained in:
Roman Lumetsberger 2017-05-08 21:36:03 +02:00
parent 2ca0e8a899
commit 2b5b56a870
2 changed files with 15 additions and 14 deletions

View File

@ -90,6 +90,7 @@ namespace OBD.NET.Devices
} }
} }
public virtual void SendCommand(ATCommand command) public virtual void SendCommand(ATCommand command)
{ {
SendCommand(command.Command); SendCommand(command.Command);
@ -164,12 +165,11 @@ namespace OBD.NET.Devices
if (sendCloseProtocol) if (sendCloseProtocol)
{ {
SendCommand(ATCommand.CloseProtocol); SendCommand(ATCommand.CloseProtocol);
//Thread.Sleep(500);
} }
} }
catch { } catch { }
_dataReceivedEventHandlers = null; _dataReceivedEventHandlers.Clear();
base.Dispose(); base.Dispose();
} }

View File

@ -203,7 +203,8 @@ namespace OBD.NET.Devices
while (!commandCancellationToken.IsCancellationRequested) while (!commandCancellationToken.IsCancellationRequested)
{ {
string command = null; string command = null;
commandQueue.TryTake(out command, Timeout.Infinite, commandCancellationToken.Token); if(commandQueue.TryTake(out command, Timeout.Infinite, commandCancellationToken.Token))
{
Logger?.WriteLine("Writing Command: '" + command.Replace('\r', '\'') + "'", OBDLogLevel.Verbose); Logger?.WriteLine("Writing Command: '" + command.Replace('\r', '\'') + "'", OBDLogLevel.Verbose);
if (Connection.IsAsync) if (Connection.IsAsync)
@ -217,7 +218,7 @@ namespace OBD.NET.Devices
} }
//wait for command to finish //wait for command to finish
commandFinishedEvent.WaitOne(); commandFinishedEvent.WaitOne();
}
} }
} }