diff --git a/.gitignore b/.gitignore
index 94420dc..5aa37d5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -234,3 +234,5 @@ _Pvt_Extensions
# FAKE - F# Make
.fake/
+.DS_Store
+OBD.NET/.idea
diff --git a/OBD.NET/ConsoleClient/ConsoleClient.csproj b/OBD.NET/ConsoleClient/ConsoleClient.csproj
new file mode 100644
index 0000000..ed1d504
--- /dev/null
+++ b/OBD.NET/ConsoleClient/ConsoleClient.csproj
@@ -0,0 +1,14 @@
+
+
+
+ Exe
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/OBD.NET/ConsoleClient/Program.cs b/OBD.NET/ConsoleClient/Program.cs
new file mode 100644
index 0000000..937e945
--- /dev/null
+++ b/OBD.NET/ConsoleClient/Program.cs
@@ -0,0 +1,83 @@
+using OBD.NET.Communication;
+using OBD.NET.Devices;
+using OBD.NET.Extensions;
+using OBD.NET.Logging;
+using OBD.NET.OBDData;
+using OBD.NET.OBDData._00_1F;
+using OBD.NET.OBDData._40_5F;
+
+namespace ConsoleClient;
+
+public class Program
+{
+ public static void Main(string[] args)
+ {
+ if (args.Length < 1)
+ {
+ Console.WriteLine("Parameter ComPort needed.");
+
+ IEnumerable availablePorts = SerialConnection.GetAvailablePorts();
+
+ Console.WriteLine("\nAvailable ports:");
+
+ foreach (string port in availablePorts)
+ {
+ Console.WriteLine(port);
+ }
+
+ return;
+ }
+
+ string comPort = args[0];
+
+ using SerialConnection connection = new SerialConnection(comPort);
+ using ELM327 dev = new ELM327(connection, new OBDConsoleLogger(OBDLogLevel.Debug));
+
+ dev.SubscribeDataReceived((sender, data) => Console.WriteLine("EngineRPM: " + data.Data.Rpm));
+ dev.SubscribeDataReceived((sender, data) => Console.WriteLine("VehicleSpeed: " + data.Data));
+
+ dev.SubscribeDataReceived((sender, data) => Console.WriteLine($"PID {data.Data.PID.ToHexString()}: {data.Data}"));
+
+ dev.Initialize();
+ dev.RequestData();
+
+ for (int i = 0; i < 5; i++)
+ {
+ dev.RequestData();
+ dev.RequestData();
+ Thread.Sleep(1000);
+ }
+
+ Console.ReadLine();
+
+ //Async example
+ // MainAsync(comPort).Wait();
+
+ //Console.ReadLine();
+ }
+
+ ///
+ /// Async example using new RequestDataAsync
+ ///
+ /// The COM port.
+ ///
+ public static async Task MainAsync(string comPort)
+ {
+ using SerialConnection connection = new SerialConnection(comPort);
+ using ELM327 dev = new ELM327(connection, new OBDConsoleLogger(OBDLogLevel.Debug));
+
+ dev.Initialize();
+
+ EngineRPM engineRpm = await dev.RequestDataAsync();
+ Console.WriteLine("Data: " + engineRpm.Rpm);
+
+ engineRpm = await dev.RequestDataAsync();
+ Console.WriteLine("Data: " + engineRpm.Rpm);
+
+ VehicleSpeed vehicleSpeed = await dev.RequestDataAsync();
+ Console.WriteLine("Data: " + vehicleSpeed.Speed);
+
+ engineRpm = await dev.RequestDataAsync();
+ Console.WriteLine("Data: " + engineRpm.Rpm);
+ }
+}
\ No newline at end of file
diff --git a/OBD.NET/OBD.NET.Common/Commands/ATCommand.cs b/OBD.NET/OBD.NET.Common/Commands/ATCommand.cs
deleted file mode 100644
index 04c6a45..0000000
--- a/OBD.NET/OBD.NET.Common/Commands/ATCommand.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-namespace OBD.NET.Common.Commands
-{
- public class ATCommand
- {
- #region Commands
- // ReSharper disable InconsistentNaming
-
- //TODO DarthAffe 26.06.2016: Implement all commands
-
- public static readonly ATCommand RepeatLastCommand = new ATCommand("\r");
- public static readonly ATCommand ResetDevice = new ATCommand("ATZ");
- public static readonly ATCommand ReadVoltage = new ATCommand("ATRV");
- public static readonly ATCommand EchoOn = new ATCommand("ATE1", "^OK$");
- public static readonly ATCommand EchoOff = new ATCommand("ATE0", "^OK$");
- public static readonly ATCommand HeadersOn = new ATCommand("ATH1", "^OK$");
- public static readonly ATCommand HeadersOff = new ATCommand("ATH0", "^OK$");
- public static readonly ATCommand PrintSpacesOn = new ATCommand("ATS1", "^OK$");
- public static readonly ATCommand PrintSpacesOff = new ATCommand("ATS0", "^OK$");
- public static readonly ATCommand LinefeedsOn = new ATCommand("ATL1", "^OK$");
- public static readonly ATCommand LinefeedsOff = new ATCommand("ATL0", "^OK$");
- public static readonly ATCommand SetProtocolAuto = new ATCommand("ATSP0", "^OK$");
- public static readonly ATCommand PrintVersion = new ATCommand("ATI", "^ELM327.*");
- public static readonly ATCommand CloseProtocol = new ATCommand("ATPC");
-
- // ReSharper restore InconsistentNaming
- #endregion
-
- #region Properties & Fields
-
- public string Command { get; }
- public string ExpectedResult { get; }
-
- #endregion
-
- #region Constructors
-
- private ATCommand(string command, string expectedResult = null)
- {
- this.Command = command;
- this.ExpectedResult = expectedResult;
- }
-
- #endregion
-
- #region Methods
-
- public override string ToString() => Command;
-
- #endregion
-
- #region Operators
-
- public static implicit operator string(ATCommand command) => command.ToString();
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/Commands/STCommand.cs b/OBD.NET/OBD.NET.Common/Commands/STCommand.cs
deleted file mode 100644
index 818ceeb..0000000
--- a/OBD.NET/OBD.NET.Common/Commands/STCommand.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-namespace OBD.NET.Common.Commands
-{
- public class STCommand
- {
- #region Values
- // ReSharper disable InconsistentNaming
-
- //TODO DarthAffe 19.03.2017: Implement all commands
-
- internal static readonly STCommand AddPassFilter = new STCommand("STFAP");
- internal static readonly STCommand AddBlockFilter = new STCommand("STFAB");
- internal static readonly STCommand AddFlowControlFilter = new STCommand("STFAFC");
- internal static readonly STCommand ClearPassFilters = new STCommand("STFCP");
- internal static readonly STCommand ClearBlockFilters = new STCommand("STFCB");
- internal static readonly STCommand ClearFlowControlFilters = new STCommand("STFCFC");
- internal static readonly STCommand Monitor = new STCommand("STM");
- internal static readonly STCommand MonitorAll = new STCommand("STMA");
-
- // ReSharper restore InconsistentNaming
- #endregion
-
- #region Properties & Fields
-
- public string Command { get; }
-
- #endregion
-
- #region Constructors
-
- protected STCommand(string command)
- {
- this.Command = command;
- }
-
- #endregion
-
- #region Methods
-
- public override string ToString() => Command;
-
- #endregion
-
- #region Operators
-
- public static implicit operator string(STCommand command) => command.ToString();
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/Communication/EventArgs/DataReceivedEventArgs.cs b/OBD.NET/OBD.NET.Common/Communication/EventArgs/DataReceivedEventArgs.cs
deleted file mode 100644
index 07231b3..0000000
--- a/OBD.NET/OBD.NET.Common/Communication/EventArgs/DataReceivedEventArgs.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-namespace OBD.NET.Common.Communication.EventArgs
-{
- ///
- /// Event args for receiving serial data
- ///
- public class DataReceivedEventArgs : System.EventArgs
- {
- #region Properties & Fields
-
- ///
- /// Count of valid data bytes in the buffer
- ///
- public int Count { get; }
-
- ///
- /// Data buffer holding the bytes
- ///
- public byte[] Data { get; }
-
- #endregion
-
- #region Constructors
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The count.
- /// The data.
- public DataReceivedEventArgs(int count, byte[] data)
- {
- this.Count = count;
- this.Data = data;
- }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/Communication/ISerialConnection.cs b/OBD.NET/OBD.NET.Common/Communication/ISerialConnection.cs
deleted file mode 100644
index 0fec8a8..0000000
--- a/OBD.NET/OBD.NET.Common/Communication/ISerialConnection.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using OBD.NET.Common.Communication.EventArgs;
-
-namespace OBD.NET.Common.Communication
-{
- ///
- /// Serial connection interface
- ///
- ///
- public interface ISerialConnection : IDisposable
- {
- ///
- /// Gets a value indicating whether this instance is open.
- ///
- ///
- /// true if this instance is open; otherwise, false.
- ///
- bool IsOpen { get; }
-
- ///
- /// Gets a value indicating whether this instance uses asynchronous IO
- ///
- ///
- /// Has to be set to true if asynchronous IO is supported.
- /// If true async methods have to be implemented
- ///
- bool IsAsync { get; }
-
- ///
- /// Occurs when a full line was received
- ///
- event EventHandler DataReceived;
-
- ///
- /// Connects the serial port.
- ///
- void Connect();
-
- ///
- /// Connects the serial port asynchronous
- ///
- ///
- Task ConnectAsync();
-
- ///
- /// Writes the specified data to the serial connection
- ///
- /// The data.
- void Write(byte[] data);
-
- ///
- /// Writes the specified data to the serial connection asynchronous
- ///
- /// The data.
- Task WriteAsync(byte[] data);
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/Count.cs b/OBD.NET/OBD.NET.Common/DataTypes/Count.cs
deleted file mode 100644
index d8e6675..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/Count.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class Count : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => null;
-
- #endregion
-
- #region Constructors
-
- public Count(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public Count(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/Degree.cs b/OBD.NET/OBD.NET.Common/DataTypes/Degree.cs
deleted file mode 100644
index 1d982f7..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/Degree.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class Degree : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "°";
-
- #endregion
-
- #region Constructors
-
- public Degree(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public Degree(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
-
- #region Methods
-
- public override string ToString() => (IsFloatingPointValue ? Value.ToString("0.00") : Value.ToString()) + (Unit ?? string.Empty);
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/DegreeCelsius.cs b/OBD.NET/OBD.NET.Common/DataTypes/DegreeCelsius.cs
deleted file mode 100644
index cc39dd9..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/DegreeCelsius.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class DegreeCelsius : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "°C";
-
- #endregion
-
- #region Constructors
-
- public DegreeCelsius(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public DegreeCelsius(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
-
- #region Methods
-
- public override string ToString() => (IsFloatingPointValue ? Value.ToString("0.00") : Value.ToString()) + (Unit ?? string.Empty);
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/GenericData.cs b/OBD.NET/OBD.NET.Common/DataTypes/GenericData.cs
deleted file mode 100644
index 3db09e3..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/GenericData.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System;
-
-namespace OBD.NET.Common.DataTypes
-{
- public abstract class GenericData
- {
- #region Properties & Fields
-
- public double Value { get; }
- public double MinValue { get; }
- public double MaxValue { get; }
- public bool IsFloatingPointValue { get; }
-
- protected abstract string Unit { get; }
-
- #endregion
-
- #region Constructors
-
- protected GenericData(double value, double minValue, double maxValue)
- {
- this.Value = value;
- this.MinValue = minValue;
- this.MaxValue = maxValue;
- this.IsFloatingPointValue = true;
- }
-
- protected GenericData(int value, int minValue, int maxValue)
- {
- this.Value = value;
- this.MinValue = minValue;
- this.MaxValue = maxValue;
- this.IsFloatingPointValue = false;
- }
-
- #endregion
-
- #region Operators
-
- public static implicit operator double(GenericData p) => p.Value;
-
- public static implicit operator int(GenericData p) => (int)Math.Round(p.Value);
-
- #endregion
-
- #region Methods
-
- public override string ToString() => (IsFloatingPointValue ? Value.ToString("0.00") : Value.ToString()) + (Unit == null ? string.Empty : (" " + Unit));
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/GramPerSec.cs b/OBD.NET/OBD.NET.Common/DataTypes/GramPerSec.cs
deleted file mode 100644
index 76ccd5f..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/GramPerSec.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class GramPerSec : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "g/s";
-
- #endregion
-
- #region Constructors
-
- public GramPerSec(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public GramPerSec(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/Kilometre.cs b/OBD.NET/OBD.NET.Common/DataTypes/Kilometre.cs
deleted file mode 100644
index 9368e76..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/Kilometre.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class Kilometre : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "km";
-
- #endregion
-
- #region Constructors
-
- public Kilometre(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public Kilometre(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/KilometrePerHour.cs b/OBD.NET/OBD.NET.Common/DataTypes/KilometrePerHour.cs
deleted file mode 100644
index d265720..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/KilometrePerHour.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class KilometrePerHour : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "km/h";
-
- #endregion
-
- #region Constructors
-
- public KilometrePerHour(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public KilometrePerHour(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/Kilopascal.cs b/OBD.NET/OBD.NET.Common/DataTypes/Kilopascal.cs
deleted file mode 100644
index 73b7c28..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/Kilopascal.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class Kilopascal : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "kPa";
-
- #endregion
-
- #region Constructors
-
- public Kilopascal(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public Kilopascal(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
-
- #region Operators
-
- public static explicit operator Pascal(Kilopascal pa) => new Pascal(pa.Value / 1000.0, pa.MinValue / 1000.0, pa.MaxValue / 1000.0);
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/LitresPerHour.cs b/OBD.NET/OBD.NET.Common/DataTypes/LitresPerHour.cs
deleted file mode 100644
index 232bc29..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/LitresPerHour.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class LitresPerHour : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "l/h";
-
- #endregion
-
- #region Constructors
-
- public LitresPerHour(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public LitresPerHour(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/Milliampere.cs b/OBD.NET/OBD.NET.Common/DataTypes/Milliampere.cs
deleted file mode 100644
index 5a3d176..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/Milliampere.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class Milliampere : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "mA";
-
- #endregion
-
- #region Constructors
-
- public Milliampere(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public Milliampere(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/Minute.cs b/OBD.NET/OBD.NET.Common/DataTypes/Minute.cs
deleted file mode 100644
index 104ec73..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/Minute.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class Minute : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "min";
-
- #endregion
-
- #region Constructors
-
- public Minute(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public Minute(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
-
- #region Operators
-
- public static explicit operator Second(Minute m) => m.IsFloatingPointValue
- ? new Second(m.Value * 60, m.MinValue * 60, m.MaxValue * 60)
- : new Second((int)(m.Value * 60), (int)(m.MinValue * 60), (int)(m.MaxValue * 60));
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/NewtonMetre.cs b/OBD.NET/OBD.NET.Common/DataTypes/NewtonMetre.cs
deleted file mode 100644
index 25651be..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/NewtonMetre.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class NewtonMetre : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "N";
-
- #endregion
-
- #region Constructors
-
- public NewtonMetre(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public NewtonMetre(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/Pascal.cs b/OBD.NET/OBD.NET.Common/DataTypes/Pascal.cs
deleted file mode 100644
index f81f42b..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/Pascal.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class Pascal : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "Pa";
-
- #endregion
-
- #region Constructors
-
- public Pascal(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public Pascal(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
-
- #region Operators
-
- public static explicit operator Kilopascal(Pascal pa) => pa.IsFloatingPointValue
- ? new Kilopascal(pa.Value * 1000, pa.MinValue * 1000, pa.MaxValue * 1000)
- : new Kilopascal((int)(pa.Value * 1000), (int)(pa.MinValue * 1000), (int)(pa.MaxValue * 1000));
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/Percent.cs b/OBD.NET/OBD.NET.Common/DataTypes/Percent.cs
deleted file mode 100644
index 55541cc..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/Percent.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class Percent : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "%";
-
- #endregion
-
- #region Constructors
-
- public Percent(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public Percent(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/Ratio.cs b/OBD.NET/OBD.NET.Common/DataTypes/Ratio.cs
deleted file mode 100644
index cf871f5..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/Ratio.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class Ratio : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => null;
-
- #endregion
-
- #region Constructors
-
- public Ratio(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public Ratio(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/RevolutionsPerMinute.cs b/OBD.NET/OBD.NET.Common/DataTypes/RevolutionsPerMinute.cs
deleted file mode 100644
index 3162590..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/RevolutionsPerMinute.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class RevolutionsPerMinute : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "rpm";
-
- #endregion
-
- #region Constructors
-
- public RevolutionsPerMinute(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public RevolutionsPerMinute(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/Second.cs b/OBD.NET/OBD.NET.Common/DataTypes/Second.cs
deleted file mode 100644
index 3072a2c..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/Second.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class Second : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "s";
-
- #endregion
-
- #region Constructors
-
- public Second(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public Second(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
-
- #region Operators
-
- public static explicit operator Minute(Second s) => new Minute(s.Value / 60.0, s.MinValue / 60.0, s.MaxValue / 60.0);
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/DataTypes/Volt.cs b/OBD.NET/OBD.NET.Common/DataTypes/Volt.cs
deleted file mode 100644
index 3d372b3..0000000
--- a/OBD.NET/OBD.NET.Common/DataTypes/Volt.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace OBD.NET.Common.DataTypes
-{
- public class Volt : GenericData
- {
- #region Properties & Fields
-
- protected override string Unit => "V";
-
- #endregion
-
- #region Constructors
-
- public Volt(double value, double minValue, double maxValue)
- : base(value, minValue, maxValue)
- { }
-
- public Volt(int value, int minValue, int maxValue)
- : base(value, minValue, maxValue)
- { }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/Devices/Command.cs b/OBD.NET/OBD.NET.Common/Devices/Command.cs
deleted file mode 100644
index 4a6d766..0000000
--- a/OBD.NET/OBD.NET.Common/Devices/Command.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-namespace OBD.NET.Common.Devices
-{
- ///
- /// Class used for queued command
- ///
- public class QueuedCommand
- {
- #region Properties & Fields
-
- public string CommandText { get; private set; }
-
- public CommandResult CommandResult { get; }
-
- #endregion
-
- #region Constructors
-
- public QueuedCommand(string commandText)
- {
- this.CommandText = commandText;
-
- CommandResult = new CommandResult();
- }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/Devices/CommandResult.cs b/OBD.NET/OBD.NET.Common/Devices/CommandResult.cs
deleted file mode 100644
index 3c30514..0000000
--- a/OBD.NET/OBD.NET.Common/Devices/CommandResult.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using OBD.NET.Common.Util;
-
-namespace OBD.NET.Common.Devices
-{
- public class CommandResult
- {
- #region Properties & Fields
-
- public object Result { get; set; }
- public AsyncManualResetEvent WaitHandle { get; }
-
- #endregion
-
- #region Constructors
-
- public CommandResult()
- {
- WaitHandle = new AsyncManualResetEvent();
- }
-
- #endregion
- }
-}
diff --git a/OBD.NET/OBD.NET.Common/Devices/ELM327.cs b/OBD.NET/OBD.NET.Common/Devices/ELM327.cs
deleted file mode 100644
index 87e5c3f..0000000
--- a/OBD.NET/OBD.NET.Common/Devices/ELM327.cs
+++ /dev/null
@@ -1,288 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Threading.Tasks;
-using OBD.NET.Common.Commands;
-using OBD.NET.Common.Communication;
-using OBD.NET.Common.Enums;
-using OBD.NET.Common.Events;
-using OBD.NET.Common.Events.EventArgs;
-using OBD.NET.Common.Extensions;
-using OBD.NET.Common.Logging;
-using OBD.NET.Common.OBDData;
-
-namespace OBD.NET.Common.Devices
-{
- public class ELM327 : SerialDevice
- {
- #region Properties & Fields
-
- protected readonly Dictionary DataReceivedEventHandlers = new Dictionary();
-
- protected static Dictionary PidCache { get; } = new Dictionary();
- protected static Dictionary DataTypeCache { get; } = new Dictionary();
-
- protected Mode Mode { get; set; } = Mode.ShowCurrentData; //TODO DarthAffe 26.06.2016: Implement different modes
-
- protected string MessageChunk { get; set; }
-
- #endregion
-
- #region Events
-
- public delegate void DataReceivedEventHandler(object sender, DataReceivedEventArgs args) where T : IOBDData;
-
- public delegate void RawDataReceivedEventHandler(object sender, RawDataReceivedEventArgs args);
- public event RawDataReceivedEventHandler RawDataReceived;
-
- #endregion
-
- #region Constructors
-
- public ELM327(ISerialConnection connection, IOBDLogger logger = null)
- : base(connection, logger: logger)
- { }
-
- #endregion
-
- #region Methods
-
- public override async Task InitializeAsync()
- {
- await base.InitializeAsync();
- InternalInitialize();
- }
-
- public override void Initialize()
- {
- base.Initialize();
- InternalInitialize();
- }
-
- private void InternalInitialize()
- {
- Logger?.WriteLine("Initializing ...", OBDLogLevel.Debug);
-
- try
- {
- Logger?.WriteLine("Resetting Device ...", OBDLogLevel.Debug);
- SendCommand(ATCommand.ResetDevice);
-
- Logger?.WriteLine("Turning Echo Off ...", OBDLogLevel.Debug);
- SendCommand(ATCommand.EchoOff);
-
- Logger?.WriteLine("Turning Linefeeds Off ...", OBDLogLevel.Debug);
- SendCommand(ATCommand.LinefeedsOff);
-
- Logger?.WriteLine("Turning Headers Off ...", OBDLogLevel.Debug);
- SendCommand(ATCommand.HeadersOff);
-
- Logger?.WriteLine("Turning Spaced Off ...", OBDLogLevel.Debug);
- SendCommand(ATCommand.PrintSpacesOff);
-
- Logger?.WriteLine("Setting the Protocol to 'Auto' ...", OBDLogLevel.Debug);
- SendCommand(ATCommand.SetProtocolAuto);
-
- WaitQueue();
- }
- // DarthAffe 21.02.2017: This seems to happen sometimes, i don't know why - just retry.
- catch
- {
- Logger?.WriteLine("Failed to initialize the device!", OBDLogLevel.Error);
- throw;
- }
- }
-
- ///
- /// Sends the AT command.
- ///
- /// The command.
- public virtual void SendCommand(ATCommand command) => SendCommand(command.Command);
-
- ///
- /// Requests the data and calls the handler
- ///
- ///
- public virtual void RequestData()
- where T : class, IOBDData, new()
- {
- Logger?.WriteLine("Requesting Type " + typeof(T).Name + " ...", OBDLogLevel.Debug);
-
- byte pid = ResolvePid();
- RequestData(pid);
- }
-
- ///
- /// Request data based on a pid
- ///
- /// The pid of the requested data
- public virtual void RequestData(byte pid)
- {
- Logger?.WriteLine("Requesting PID " + pid.ToString("X2") + " ...", OBDLogLevel.Debug);
- SendCommand(((byte)Mode).ToString("X2") + pid.ToString("X2"));
- }
-
- ///
- /// Requests the data asynchronous and return the data when available
- ///
- ///
- ///
- public virtual async Task RequestDataAsync()
- where T : class, IOBDData, new()
- {
- Logger?.WriteLine("Requesting Type " + typeof(T).Name + " ...", OBDLogLevel.Debug);
- byte pid = ResolvePid();
- return await RequestDataAsync(pid) as T;
- }
-
- ///
- /// Requests the data asynchronous and return the data when available
- ///
- ///
- ///
- public virtual async Task RequestDataAsync(Type type)
- {
- Logger?.WriteLine("Requesting Type " + type.Name + " ...", OBDLogLevel.Debug);
- byte pid = ResolvePid(type);
- return await RequestDataAsync(pid) as IOBDData;
- }
-
- ///
- /// Request data based on a pid
- ///
- /// The pid of the requested data
- public virtual async Task