mirror of
https://github.com/DarthAffe/OBD.NET.git
synced 2025-12-13 01:08:30 +00:00
Applied consistend code-style; Changed target of desktop parts to 4.6.1
This commit is contained in:
parent
ea2ac35046
commit
27fd4aba40
@ -1,8 +1,9 @@
|
|||||||
namespace OBD.NET.Commands
|
namespace OBD.NET.Common.Commands
|
||||||
{
|
{
|
||||||
public class ATCommand
|
public class ATCommand
|
||||||
{
|
{
|
||||||
#region Values
|
#region Commands
|
||||||
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
//TODO DarthAffe 26.06.2016: Implement all commands
|
//TODO DarthAffe 26.06.2016: Implement all commands
|
||||||
|
|
||||||
@ -21,6 +22,7 @@
|
|||||||
public static readonly ATCommand PrintVersion = new ATCommand("ATI", "^ELM327.*");
|
public static readonly ATCommand PrintVersion = new ATCommand("ATI", "^ELM327.*");
|
||||||
public static readonly ATCommand CloseProtocol = new ATCommand("ATPC");
|
public static readonly ATCommand CloseProtocol = new ATCommand("ATPC");
|
||||||
|
|
||||||
|
// ReSharper restore InconsistentNaming
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
@ -42,19 +44,13 @@
|
|||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString() => Command;
|
||||||
{
|
|
||||||
return Command;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Operators
|
#region Operators
|
||||||
|
|
||||||
public static implicit operator string(ATCommand command)
|
public static implicit operator string(ATCommand command) => command.ToString();
|
||||||
{
|
|
||||||
return command.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
namespace OBD.NET.Commands
|
namespace OBD.NET.Common.Commands
|
||||||
{
|
{
|
||||||
public class STCommand
|
public class STCommand
|
||||||
{
|
{
|
||||||
#region Values
|
#region Values
|
||||||
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
//TODO DarthAffe 19.03.2017: Implement all commands
|
//TODO DarthAffe 19.03.2017: Implement all commands
|
||||||
|
|
||||||
@ -15,6 +16,7 @@
|
|||||||
internal static readonly STCommand Monitor = new STCommand("STM");
|
internal static readonly STCommand Monitor = new STCommand("STM");
|
||||||
internal static readonly STCommand MonitorAll = new STCommand("STMA");
|
internal static readonly STCommand MonitorAll = new STCommand("STMA");
|
||||||
|
|
||||||
|
// ReSharper restore InconsistentNaming
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
@ -34,19 +36,13 @@
|
|||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString() => Command;
|
||||||
{
|
|
||||||
return Command;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Operators
|
#region Operators
|
||||||
|
|
||||||
public static implicit operator string(STCommand command)
|
public static implicit operator string(STCommand command) => command.ToString();
|
||||||
{
|
|
||||||
return command.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,8 +3,24 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Event args for receiving serial data
|
/// Event args for receiving serial data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DataReceivedEventArgs:System.EventArgs
|
public class DataReceivedEventArgs : System.EventArgs
|
||||||
{
|
{
|
||||||
|
#region Properties & Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Count of valid data bytes in the buffer
|
||||||
|
/// </summary>
|
||||||
|
public int Count { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data buffer holding the bytes
|
||||||
|
/// </summary>
|
||||||
|
public byte[] Data { get; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="DataReceivedEventArgs"/> class.
|
/// Initializes a new instance of the <see cref="DataReceivedEventArgs"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -12,18 +28,10 @@
|
|||||||
/// <param name="data">The data.</param>
|
/// <param name="data">The data.</param>
|
||||||
public DataReceivedEventArgs(int count, byte[] data)
|
public DataReceivedEventArgs(int count, byte[] data)
|
||||||
{
|
{
|
||||||
Count = count;
|
this.Count = count;
|
||||||
Data = data;
|
this.Data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Count of valid data bytes in the buffer
|
|
||||||
/// </summary>
|
|
||||||
public int Count { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Data buffer holding the bytes
|
|
||||||
/// </summary>
|
|
||||||
public byte[] Data { get; private set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
using OBD.NET.Common.Communication.EventArgs;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using OBD.NET.Common.Communication.EventArgs;
|
||||||
|
|
||||||
namespace OBD.NET.Communication
|
namespace OBD.NET.Common.Communication
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Serial connection interface
|
/// Serial connection interface
|
||||||
@ -46,14 +46,13 @@ namespace OBD.NET.Communication
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified data to the serial connection
|
/// Writes the specified data to the serial connection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text">The text.</param>
|
/// <param name="data">The data.</param>
|
||||||
void Write(byte[] data);
|
void Write(byte[] data);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified data to the serial connection asynchronous
|
/// Writes the specified data to the serial connection asynchronous
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text">The text.</param>
|
/// <param name="data">The data.</param>
|
||||||
Task WriteAsync(byte[] data);
|
Task WriteAsync(byte[] data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class Count : GenericData
|
public class Count : GenericData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class Degree : GenericData
|
public class Degree : GenericData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class DegreeCelsius : GenericData
|
public class DegreeCelsius : GenericData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public abstract class GenericData
|
public abstract class GenericData
|
||||||
{
|
{
|
||||||
@ -17,7 +17,7 @@ namespace OBD.NET.DataTypes
|
|||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public GenericData(double value, double minValue, double maxValue)
|
protected GenericData(double value, double minValue, double maxValue)
|
||||||
{
|
{
|
||||||
this.Value = value;
|
this.Value = value;
|
||||||
this.MinValue = minValue;
|
this.MinValue = minValue;
|
||||||
@ -25,7 +25,7 @@ namespace OBD.NET.DataTypes
|
|||||||
this.IsFloatingPointValue = true;
|
this.IsFloatingPointValue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericData(int value, int minValue, int maxValue)
|
protected GenericData(int value, int minValue, int maxValue)
|
||||||
{
|
{
|
||||||
this.Value = value;
|
this.Value = value;
|
||||||
this.MinValue = minValue;
|
this.MinValue = minValue;
|
||||||
@ -37,24 +37,15 @@ namespace OBD.NET.DataTypes
|
|||||||
|
|
||||||
#region Operators
|
#region Operators
|
||||||
|
|
||||||
public static implicit operator double(GenericData p)
|
public static implicit operator double(GenericData p) => p.Value;
|
||||||
{
|
|
||||||
return p.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator int(GenericData p)
|
public static implicit operator int(GenericData p) => (int)Math.Round(p.Value);
|
||||||
{
|
|
||||||
return (int)Math.Round(p.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString() => (IsFloatingPointValue ? Value.ToString("0.00") : Value.ToString()) + (Unit == null ? string.Empty : (" " + Unit));
|
||||||
{
|
|
||||||
return (IsFloatingPointValue ? Value.ToString("0.00") : Value.ToString()) + (Unit == null ? string.Empty : (" " + Unit));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class GramPerSec : GenericData
|
public class GramPerSec : GenericData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class Kilometre : GenericData
|
public class Kilometre : GenericData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class KilometrePerHour : GenericData
|
public class KilometrePerHour : GenericData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class Kilopascal : GenericData
|
public class Kilopascal : GenericData
|
||||||
{
|
{
|
||||||
@ -22,10 +22,7 @@
|
|||||||
|
|
||||||
#region Operators
|
#region Operators
|
||||||
|
|
||||||
public static explicit operator Pascal(Kilopascal pa)
|
public static explicit operator Pascal(Kilopascal pa) => new Pascal(pa.Value / 1000.0, pa.MinValue / 1000.0, pa.MaxValue / 1000.0);
|
||||||
{
|
|
||||||
return new Pascal(pa.Value / 1000.0, pa.MinValue / 1000.0, pa.MaxValue / 1000.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class LitresPerHour : GenericData
|
public class LitresPerHour : GenericData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class Milliampere : GenericData
|
public class Milliampere : GenericData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class Minute : GenericData
|
public class Minute : GenericData
|
||||||
{
|
{
|
||||||
@ -22,12 +22,9 @@
|
|||||||
|
|
||||||
#region Operators
|
#region Operators
|
||||||
|
|
||||||
public static explicit operator Second(Minute m)
|
public static explicit operator Second(Minute m) => m.IsFloatingPointValue
|
||||||
{
|
|
||||||
return m.IsFloatingPointValue
|
|
||||||
? new Second(m.Value * 60, m.MinValue * 60, m.MaxValue * 60)
|
? 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));
|
: new Second((int)(m.Value * 60), (int)(m.MinValue * 60), (int)(m.MaxValue * 60));
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class NewtonMetre : GenericData
|
public class NewtonMetre : GenericData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class Pascal : GenericData
|
public class Pascal : GenericData
|
||||||
{
|
{
|
||||||
@ -22,12 +22,9 @@
|
|||||||
|
|
||||||
#region Operators
|
#region Operators
|
||||||
|
|
||||||
public static explicit operator Kilopascal(Pascal pa)
|
public static explicit operator Kilopascal(Pascal pa) => pa.IsFloatingPointValue
|
||||||
{
|
|
||||||
return pa.IsFloatingPointValue
|
|
||||||
? new Kilopascal(pa.Value * 1000, pa.MinValue * 1000, pa.MaxValue * 1000)
|
? 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));
|
: new Kilopascal((int)(pa.Value * 1000), (int)(pa.MinValue * 1000), (int)(pa.MaxValue * 1000));
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class Percent : GenericData
|
public class Percent : GenericData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class Ratio : GenericData
|
public class Ratio : GenericData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class RevolutionsPerMinute : GenericData
|
public class RevolutionsPerMinute : GenericData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class Second : GenericData
|
public class Second : GenericData
|
||||||
{
|
{
|
||||||
@ -22,10 +22,7 @@
|
|||||||
|
|
||||||
#region Operators
|
#region Operators
|
||||||
|
|
||||||
public static explicit operator Minute(Second s)
|
public static explicit operator Minute(Second s) => new Minute(s.Value / 60.0, s.MinValue / 60.0, s.MaxValue / 60.0);
|
||||||
{
|
|
||||||
return new Minute(s.Value / 60.0, s.MinValue / 60.0, s.MaxValue / 60.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.DataTypes
|
namespace OBD.NET.Common.DataTypes
|
||||||
{
|
{
|
||||||
public class Volt : GenericData
|
public class Volt : GenericData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,27 +1,27 @@
|
|||||||
using System;
|
namespace OBD.NET.Common.Devices
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace OBD.NET.Common.Devices
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class used for queued command
|
/// Class used for queued command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class QueuedCommand
|
public class QueuedCommand
|
||||||
{
|
{
|
||||||
|
#region Properties & Fields
|
||||||
|
|
||||||
/// <summary>
|
public string CommandText { get; private set; }
|
||||||
/// Initializes a new instance
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="commandText"></param>
|
|
||||||
public QueuedCommand(string commandText)
|
|
||||||
{
|
|
||||||
CommandResult = new CommandResult();
|
|
||||||
CommandText = commandText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string CommandText { get; set; }
|
|
||||||
|
|
||||||
public CommandResult CommandResult { get; }
|
public CommandResult CommandResult { get; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public QueuedCommand(string commandText)
|
||||||
|
{
|
||||||
|
this.CommandText = commandText;
|
||||||
|
|
||||||
|
CommandResult = new CommandResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,18 +1,23 @@
|
|||||||
using System;
|
using OBD.NET.Common.Util;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using OBD.NET.Util;
|
|
||||||
|
|
||||||
namespace OBD.NET.Common.Devices
|
namespace OBD.NET.Common.Devices
|
||||||
{
|
{
|
||||||
public class CommandResult
|
public class CommandResult
|
||||||
{
|
{
|
||||||
|
#region Properties & Fields
|
||||||
|
|
||||||
|
public object Result { get; set; }
|
||||||
|
public AsyncManualResetEvent WaitHandle { get; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
public CommandResult()
|
public CommandResult()
|
||||||
{
|
{
|
||||||
WaitHandle = new AsyncManualResetEvent();
|
WaitHandle = new AsyncManualResetEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Result { get; set; }
|
#endregion
|
||||||
public AsyncManualResetEvent WaitHandle { get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,23 +1,22 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
|
||||||
using OBD.NET.Commands;
|
|
||||||
using OBD.NET.Communication;
|
|
||||||
using OBD.NET.Enums;
|
|
||||||
using OBD.NET.Events;
|
|
||||||
using OBD.NET.Events.EventArgs;
|
|
||||||
using OBD.NET.Extensions;
|
|
||||||
using OBD.NET.Logging;
|
|
||||||
using OBD.NET.OBDData;
|
|
||||||
using System.Threading.Tasks;
|
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.Devices
|
namespace OBD.NET.Common.Devices
|
||||||
{
|
{
|
||||||
public class ELM327 : SerialDevice
|
public class ELM327 : SerialDevice
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
protected Dictionary<Type, IDataEventManager> _dataReceivedEventHandlers = new Dictionary<Type, IDataEventManager>();
|
protected readonly Dictionary<Type, IDataEventManager> DataReceivedEventHandlers = new Dictionary<Type, IDataEventManager>();
|
||||||
|
|
||||||
protected static Dictionary<Type, byte> PidCache { get; } = new Dictionary<Type, byte>();
|
protected static Dictionary<Type, byte> PidCache { get; } = new Dictionary<Type, byte>();
|
||||||
protected static Dictionary<byte, Type> DataTypeCache { get; } = new Dictionary<byte, Type>();
|
protected static Dictionary<byte, Type> DataTypeCache { get; } = new Dictionary<byte, Type>();
|
||||||
@ -90,15 +89,11 @@ namespace OBD.NET.Devices
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends the AT command.
|
/// Sends the AT command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="command">The command.</param>
|
/// <param name="command">The command.</param>
|
||||||
public virtual void SendCommand(ATCommand command)
|
public virtual void SendCommand(ATCommand command) => SendCommand(command.Command);
|
||||||
{
|
|
||||||
SendCommand(command.Command);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Requests the data and calls the handler
|
/// Requests the data and calls the handler
|
||||||
@ -130,14 +125,12 @@ namespace OBD.NET.Devices
|
|||||||
Logger?.WriteLine("Requesting Type " + typeof(T).Name + " ...", OBDLogLevel.Debug);
|
Logger?.WriteLine("Requesting Type " + typeof(T).Name + " ...", OBDLogLevel.Debug);
|
||||||
byte pid = ResolvePid<T>();
|
byte pid = ResolvePid<T>();
|
||||||
Logger?.WriteLine("Requesting PID " + pid.ToString("X2") + " ...", OBDLogLevel.Debug);
|
Logger?.WriteLine("Requesting PID " + pid.ToString("X2") + " ...", OBDLogLevel.Debug);
|
||||||
var result = SendCommand(((byte)Mode).ToString("X2") + pid.ToString("X2"));
|
CommandResult result = SendCommand(((byte)Mode).ToString("X2") + pid.ToString("X2"));
|
||||||
|
|
||||||
await result.WaitHandle.WaitAsync();
|
await result.WaitHandle.WaitAsync();
|
||||||
return result.Result as T;
|
return result.Result as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected override object ProcessMessage(string message)
|
protected override object ProcessMessage(string message)
|
||||||
{
|
{
|
||||||
DateTime timestamp = DateTime.Now;
|
DateTime timestamp = DateTime.Now;
|
||||||
@ -152,14 +145,12 @@ namespace OBD.NET.Devices
|
|||||||
if (mode == (byte)Mode)
|
if (mode == (byte)Mode)
|
||||||
{
|
{
|
||||||
byte pid = (byte)message.Substring(2, 2).GetHexVal();
|
byte pid = (byte)message.Substring(2, 2).GetHexVal();
|
||||||
Type dataType;
|
if (DataTypeCache.TryGetValue(pid, out Type dataType))
|
||||||
if (DataTypeCache.TryGetValue(pid, out dataType))
|
|
||||||
{
|
{
|
||||||
IOBDData obdData = (IOBDData)Activator.CreateInstance(dataType);
|
IOBDData obdData = (IOBDData)Activator.CreateInstance(dataType);
|
||||||
obdData.Load(message.Substring(4, message.Length - 4));
|
obdData.Load(message.Substring(4, message.Length - 4));
|
||||||
|
|
||||||
IDataEventManager dataEventManager;
|
if (DataReceivedEventHandlers.TryGetValue(dataType, out IDataEventManager dataEventManager))
|
||||||
if (_dataReceivedEventHandlers.TryGetValue(dataType, out dataEventManager))
|
|
||||||
dataEventManager.RaiseEvent(this, obdData, timestamp);
|
dataEventManager.RaiseEvent(this, obdData, timestamp);
|
||||||
|
|
||||||
return obdData;
|
return obdData;
|
||||||
@ -173,8 +164,7 @@ namespace OBD.NET.Devices
|
|||||||
protected virtual byte ResolvePid<T>()
|
protected virtual byte ResolvePid<T>()
|
||||||
where T : class, IOBDData, new()
|
where T : class, IOBDData, new()
|
||||||
{
|
{
|
||||||
byte pid;
|
if (!PidCache.TryGetValue(typeof(T), out byte pid))
|
||||||
if (!PidCache.TryGetValue(typeof(T), out pid))
|
|
||||||
{
|
{
|
||||||
T data = Activator.CreateInstance<T>();
|
T data = Activator.CreateInstance<T>();
|
||||||
pid = data.PID;
|
pid = data.PID;
|
||||||
@ -185,40 +175,33 @@ namespace OBD.NET.Devices
|
|||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose() => Dispose(true);
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose(bool sendCloseProtocol)
|
public void Dispose(bool sendCloseProtocol)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (sendCloseProtocol)
|
if (sendCloseProtocol)
|
||||||
{
|
|
||||||
SendCommand(ATCommand.CloseProtocol);
|
SendCommand(ATCommand.CloseProtocol);
|
||||||
}
|
}
|
||||||
}
|
catch { /* Well at least we tried ... */ }
|
||||||
catch { }
|
|
||||||
|
|
||||||
_dataReceivedEventHandlers.Clear();
|
DataReceivedEventHandlers.Clear();
|
||||||
|
|
||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SubscribeDataReceived<T>(DataReceivedEventHandler<T> eventHandler) where T : IOBDData
|
public void SubscribeDataReceived<T>(DataReceivedEventHandler<T> eventHandler) where T : IOBDData
|
||||||
{
|
{
|
||||||
IDataEventManager eventManager;
|
if (!DataReceivedEventHandlers.TryGetValue(typeof(T), out IDataEventManager eventManager))
|
||||||
if (!_dataReceivedEventHandlers.TryGetValue(typeof(T), out eventManager))
|
DataReceivedEventHandlers.Add(typeof(T), (eventManager = new GenericDataEventManager<T>()));
|
||||||
_dataReceivedEventHandlers.Add(typeof(T), (eventManager = new GenericDataEventManager<T>()));
|
|
||||||
|
|
||||||
((GenericDataEventManager<T>)eventManager).DataReceived += eventHandler;
|
((GenericDataEventManager<T>)eventManager).DataReceived += eventHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UnsubscribeDataReceived<T>(DataReceivedEventHandler<T> eventHandler) where T : IOBDData
|
public void UnsubscribeDataReceived<T>(DataReceivedEventHandler<T> eventHandler) where T : IOBDData
|
||||||
{
|
{
|
||||||
IDataEventManager eventManager;
|
if (DataReceivedEventHandlers.TryGetValue(typeof(T), out IDataEventManager eventManager))
|
||||||
if (_dataReceivedEventHandlers.TryGetValue(typeof(T), out eventManager))
|
|
||||||
((GenericDataEventManager<T>)eventManager).DataReceived -= eventHandler;
|
((GenericDataEventManager<T>)eventManager).DataReceived -= eventHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
using OBD.NET.Communication;
|
using OBD.NET.Common.Commands;
|
||||||
using OBD.NET.Logging;
|
using OBD.NET.Common.Communication;
|
||||||
|
using OBD.NET.Common.Logging;
|
||||||
|
|
||||||
namespace OBD.NET.Devices
|
namespace OBD.NET.Common.Devices
|
||||||
{
|
{
|
||||||
public class STN1170 : ELM327 // Fully compatible device
|
public class STN1170 : ELM327 // Fully compatible device
|
||||||
{
|
{
|
||||||
//TODO DarthAffe 26.06.2016: Add ST-Commands and stuff
|
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public STN1170(ISerialConnection connection, IOBDLogger logger = null)
|
public STN1170(ISerialConnection connection, IOBDLogger logger = null)
|
||||||
@ -14,5 +13,15 @@ namespace OBD.NET.Devices
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sends the ST command.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command">The command.</param>
|
||||||
|
public virtual void SendCommand(STCommand command) => SendCommand(command.Command);
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,59 +1,37 @@
|
|||||||
using System;
|
using System;
|
||||||
using OBD.NET.Communication;
|
using System.Collections.Concurrent;
|
||||||
using OBD.NET.Exceptions;
|
|
||||||
using OBD.NET.Logging;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using OBD.NET.Common.Communication.EventArgs;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Collections.Concurrent;
|
using System.Threading.Tasks;
|
||||||
using OBD.NET.Common.Devices;
|
using OBD.NET.Common.Communication;
|
||||||
|
using OBD.NET.Common.Communication.EventArgs;
|
||||||
|
using OBD.NET.Common.Exceptions;
|
||||||
|
using OBD.NET.Common.Logging;
|
||||||
|
|
||||||
namespace OBD.NET.Devices
|
namespace OBD.NET.Common.Devices
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base class used for communicating with the device
|
/// Base class used for communicating with the device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class SerialDevice : IDisposable
|
public abstract class SerialDevice : IDisposable
|
||||||
{
|
{
|
||||||
private BlockingCollection<QueuedCommand> commandQueue;
|
#region Properties & Fields
|
||||||
|
|
||||||
|
private readonly BlockingCollection<QueuedCommand> _commandQueue = new BlockingCollection<QueuedCommand>();
|
||||||
private readonly StringBuilder _lineBuffer = new StringBuilder();
|
private readonly StringBuilder _lineBuffer = new StringBuilder();
|
||||||
|
private readonly AutoResetEvent _commandFinishedEvent = new AutoResetEvent(false);
|
||||||
|
private Task _commandWorkerTask;
|
||||||
|
private CancellationTokenSource _commandCancellationToken;
|
||||||
|
|
||||||
private readonly AutoResetEvent commandFinishedEvent = new AutoResetEvent(false);
|
protected QueuedCommand CurrentCommand;
|
||||||
|
|
||||||
private Task commandWorkerTask;
|
|
||||||
|
|
||||||
private CancellationTokenSource commandCancellationToken;
|
|
||||||
|
|
||||||
protected QueuedCommand currentCommand;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Logger instance
|
|
||||||
/// </summary>
|
|
||||||
protected IOBDLogger Logger { get; }
|
protected IOBDLogger Logger { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Low level connection
|
|
||||||
/// </summary>
|
|
||||||
protected ISerialConnection Connection { get; }
|
protected ISerialConnection Connection { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Terminator of the protocol message
|
|
||||||
/// </summary>
|
|
||||||
protected char Terminator { get; set; }
|
protected char Terminator { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Prevents a default instance of the <see cref="SerialDevice"/> class from being created.
|
|
||||||
/// </summary>
|
|
||||||
private SerialDevice()
|
|
||||||
{
|
|
||||||
commandQueue = new BlockingCollection<QueuedCommand>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SerialDevice"/> class.
|
/// Initializes a new instance of the <see cref="SerialDevice"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -61,21 +39,18 @@ namespace OBD.NET.Devices
|
|||||||
/// <param name="terminator">terminator used for terminating the command message</param>
|
/// <param name="terminator">terminator used for terminating the command message</param>
|
||||||
/// <param name="logger">logger instance</param>
|
/// <param name="logger">logger instance</param>
|
||||||
protected SerialDevice(ISerialConnection connection, char terminator = '\r', IOBDLogger logger = null)
|
protected SerialDevice(ISerialConnection connection, char terminator = '\r', IOBDLogger logger = null)
|
||||||
:this()
|
|
||||||
{
|
{
|
||||||
Connection = connection;
|
this.Connection = connection;
|
||||||
Terminator = terminator;
|
this.Terminator = terminator;
|
||||||
Logger = logger;
|
this.Logger = logger;
|
||||||
|
|
||||||
connection.DataReceived += OnDataReceived;
|
connection.DataReceived += OnDataReceived;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes the device
|
/// Initializes the device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -105,13 +80,11 @@ namespace OBD.NET.Devices
|
|||||||
Logger?.WriteLine("Failed to open Serial-Connection.", OBDLogLevel.Error);
|
Logger?.WriteLine("Failed to open Serial-Connection.", OBDLogLevel.Error);
|
||||||
throw new SerialException("Failed to open Serial-Connection.");
|
throw new SerialException("Failed to open Serial-Connection.");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Logger?.WriteLine("Opened Serial-Connection!", OBDLogLevel.Debug);
|
|
||||||
}
|
|
||||||
|
|
||||||
commandCancellationToken = new CancellationTokenSource();
|
Logger?.WriteLine("Opened Serial-Connection!", OBDLogLevel.Debug);
|
||||||
commandWorkerTask = Task.Factory.StartNew(CommandWorker);
|
|
||||||
|
_commandCancellationToken = new CancellationTokenSource();
|
||||||
|
_commandWorkerTask = Task.Factory.StartNew(CommandWorker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,16 +96,14 @@ namespace OBD.NET.Devices
|
|||||||
protected virtual CommandResult SendCommand(string command)
|
protected virtual CommandResult SendCommand(string command)
|
||||||
{
|
{
|
||||||
if (!Connection.IsOpen)
|
if (!Connection.IsOpen)
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Not connected");
|
throw new InvalidOperationException("Not connected");
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
command = PrepareCommand(command);
|
command = PrepareCommand(command);
|
||||||
Logger?.WriteLine("Queuing Command: '" + command.Replace('\r', '\'') + "'", OBDLogLevel.Verbose);
|
Logger?.WriteLine("Queuing Command: '" + command.Replace('\r', '\'') + "'", OBDLogLevel.Verbose);
|
||||||
|
|
||||||
var cmd = new QueuedCommand(command);
|
QueuedCommand cmd = new QueuedCommand(command);
|
||||||
commandQueue.Add(cmd);
|
_commandQueue.Add(cmd);
|
||||||
|
|
||||||
return cmd.CommandResult;
|
return cmd.CommandResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,8 +139,8 @@ namespace OBD.NET.Devices
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '>':
|
case '>':
|
||||||
currentCommand.CommandResult.WaitHandle.Set();
|
CurrentCommand.CommandResult.WaitHandle.Set();
|
||||||
commandFinishedEvent.Set();
|
_commandFinishedEvent.Set();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\n':
|
case '\n':
|
||||||
@ -203,8 +174,8 @@ namespace OBD.NET.Devices
|
|||||||
/// <param name="message">The message.</param>
|
/// <param name="message">The message.</param>
|
||||||
private void InternalProcessMessage(string message)
|
private void InternalProcessMessage(string message)
|
||||||
{
|
{
|
||||||
var data = ProcessMessage(message);
|
object data = ProcessMessage(message);
|
||||||
currentCommand.CommandResult.Result = data;
|
CurrentCommand.CommandResult.Result = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -219,24 +190,20 @@ namespace OBD.NET.Devices
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private async void CommandWorker()
|
private async void CommandWorker()
|
||||||
{
|
{
|
||||||
while (!commandCancellationToken.IsCancellationRequested)
|
while (!_commandCancellationToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
currentCommand = null;
|
CurrentCommand = null;
|
||||||
if(commandQueue.TryTake(out currentCommand, Timeout.Infinite, commandCancellationToken.Token))
|
if (_commandQueue.TryTake(out CurrentCommand, Timeout.Infinite, _commandCancellationToken.Token))
|
||||||
{
|
{
|
||||||
Logger?.WriteLine("Writing Command: '" + currentCommand.CommandText.Replace('\r', '\'') + "'", OBDLogLevel.Verbose);
|
Logger?.WriteLine("Writing Command: '" + CurrentCommand.CommandText.Replace('\r', '\'') + "'", OBDLogLevel.Verbose);
|
||||||
|
|
||||||
if (Connection.IsAsync)
|
if (Connection.IsAsync)
|
||||||
{
|
await Connection.WriteAsync(Encoding.ASCII.GetBytes(CurrentCommand.CommandText));
|
||||||
await Connection.WriteAsync(Encoding.ASCII.GetBytes(currentCommand.CommandText));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
Connection.Write(Encoding.ASCII.GetBytes(CurrentCommand.CommandText));
|
||||||
Connection.Write(Encoding.ASCII.GetBytes(currentCommand.CommandText));
|
|
||||||
|
|
||||||
}
|
|
||||||
//wait for command to finish
|
//wait for command to finish
|
||||||
commandFinishedEvent.WaitOne();
|
_commandFinishedEvent.WaitOne();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -246,8 +213,9 @@ namespace OBD.NET.Devices
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void Dispose()
|
public virtual void Dispose()
|
||||||
{
|
{
|
||||||
commandCancellationToken?.Cancel();
|
_commandCancellationToken?.Cancel();
|
||||||
commandWorkerTask?.Wait();
|
_commandWorkerTask?.Wait();
|
||||||
|
|
||||||
Connection?.Dispose();
|
Connection?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.Enums
|
namespace OBD.NET.Common.Enums
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// https://en.wikipedia.org/wiki/OBD-II_PIDs#Modes
|
/// https://en.wikipedia.org/wiki/OBD-II_PIDs#Modes
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using OBD.NET.OBDData;
|
using OBD.NET.Common.OBDData;
|
||||||
|
|
||||||
namespace OBD.NET.Events.EventArgs
|
namespace OBD.NET.Common.Events.EventArgs
|
||||||
{
|
{
|
||||||
public class DataReceivedEventArgs<T> where T : IOBDData
|
public class DataReceivedEventArgs<T> where T : IOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace OBD.NET.Events.EventArgs
|
namespace OBD.NET.Common.Events.EventArgs
|
||||||
{
|
{
|
||||||
public class RawDataReceivedEventArgs
|
public class RawDataReceivedEventArgs
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,32 +1,22 @@
|
|||||||
using System;
|
using System;
|
||||||
using OBD.NET.Devices;
|
using OBD.NET.Common.Devices;
|
||||||
using OBD.NET.Events.EventArgs;
|
using OBD.NET.Common.Events.EventArgs;
|
||||||
using OBD.NET.OBDData;
|
using OBD.NET.Common.OBDData;
|
||||||
|
|
||||||
namespace OBD.NET.Events
|
namespace OBD.NET.Common.Events
|
||||||
{
|
{
|
||||||
public class GenericDataEventManager<T> : IDataEventManager where T : IOBDData
|
public class GenericDataEventManager<T> : IDataEventManager
|
||||||
|
where T : IOBDData
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Events
|
#region Events
|
||||||
|
|
||||||
internal event ELM327.DataReceivedEventHandler<T> DataReceived;
|
internal event ELM327.DataReceivedEventHandler<T> DataReceived;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
public void RaiseEvent(object sender, IOBDData data, DateTime timestamp)
|
public void RaiseEvent(object sender, IOBDData data, DateTime timestamp) => DataReceived?.Invoke(sender, new DataReceivedEventArgs<T>((T)data, timestamp));
|
||||||
{
|
|
||||||
DataReceived?.Invoke(sender, new DataReceivedEventArgs<T>((T)data, timestamp));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using OBD.NET.OBDData;
|
using OBD.NET.Common.OBDData;
|
||||||
|
|
||||||
namespace OBD.NET.Events
|
namespace OBD.NET.Common.Events
|
||||||
{
|
{
|
||||||
public interface IDataEventManager
|
public interface IDataEventManager
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace OBD.NET.Exceptions
|
namespace OBD.NET.Common.Exceptions
|
||||||
{
|
{
|
||||||
public class SerialException : Exception
|
public class SerialException : Exception
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace OBD.NET.Exceptions
|
namespace OBD.NET.Common.Exceptions
|
||||||
{
|
{
|
||||||
public class UnexpectedResultException : Exception
|
public class UnexpectedResultException : Exception
|
||||||
{
|
{
|
||||||
@ -14,7 +14,7 @@ namespace OBD.NET.Exceptions
|
|||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public UnexpectedResultException(string result, string expectedResult)
|
public UnexpectedResultException(string result, string expectedResult)
|
||||||
:this($"Unexpected result '{result}'. Expected was '{expectedResult}'", result, expectedResult)
|
: this($"Unexpected result '{result}'. Expected was '{expectedResult}'", result, expectedResult)
|
||||||
{
|
{
|
||||||
this.Result = result;
|
this.Result = result;
|
||||||
this.ExpectedResult = expectedResult;
|
this.ExpectedResult = expectedResult;
|
||||||
@ -34,7 +34,6 @@ namespace OBD.NET.Exceptions
|
|||||||
this.ExpectedResult = expectedResult;
|
this.ExpectedResult = expectedResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,24 +1,22 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace OBD.NET.Extensions
|
namespace OBD.NET.Common.Extensions
|
||||||
{
|
{
|
||||||
public static class HexExtension
|
public static class HexExtension
|
||||||
{
|
{
|
||||||
public static int GetHexVal(this char hex)
|
#region Methods
|
||||||
{
|
|
||||||
return hex - (hex < 58 ? 48 : (hex < 97 ? 55 : 87));
|
public static int GetHexVal(this char hex) => hex - (hex < 58 ? 48 : (hex < 97 ? 55 : 87));
|
||||||
}
|
|
||||||
|
|
||||||
public static int GetHexVal(this string hex)
|
public static int GetHexVal(this string hex)
|
||||||
{
|
{
|
||||||
if ((hex.Length % 2) == 1)
|
if ((hex.Length % 2) == 1)
|
||||||
throw new ArgumentException("The binary key cannot have an odd number of digits");
|
throw new ArgumentException("The binary key cannot have an odd number of digits");
|
||||||
|
|
||||||
int result = 0;
|
return hex.Aggregate(0, (current, c) => (current << 4) + (GetHexVal(c)));
|
||||||
foreach (char c in hex)
|
|
||||||
result = (result << 4) + (GetHexVal(c));
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.Logging
|
namespace OBD.NET.Common.Logging
|
||||||
{
|
{
|
||||||
public interface IOBDLogger
|
public interface IOBDLogger
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
using OBD.NET.Logging;
|
using System.Diagnostics;
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace OBD.NET.Common.Logging
|
namespace OBD.NET.Common.Logging
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Simple debug logger
|
/// Simple debug logger
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="OBD.NET.Logging.IOBDLogger" />
|
/// <seealso cref="IOBDLogger" />
|
||||||
public class OBDDebugLogger : IOBDLogger
|
public class OBDDebugLogger : IOBDLogger
|
||||||
{
|
{
|
||||||
public void WriteLine(string text, OBDLogLevel level)
|
#region Methods
|
||||||
{
|
|
||||||
Debug.WriteLine($"{level}: {text}");
|
public void WriteLine(string text, OBDLogLevel level) => Debug.WriteLine($"{level}: {text}");
|
||||||
}
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.Logging
|
namespace OBD.NET.Common.Logging
|
||||||
{
|
{
|
||||||
public enum OBDLogLevel
|
public enum OBDLogLevel
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class AuxiliaryInputStatus : AbstractOBDData
|
public class AuxiliaryInputStatus : AbstractOBDData
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public bool PowerTakeOffStatus => (A & 1 << 0) != 0;
|
public bool PowerTakeOffStatus => (A & (1 << 0)) != 0;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class CalculatedEngineLoad : AbstractOBDData
|
public class CalculatedEngineLoad : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class CommandedSecondaryAirStatus : AbstractOBDData
|
public class CommandedSecondaryAirStatus : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class EngineCoolantTemperature : AbstractOBDData
|
public class EngineCoolantTemperature : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class EngineRPM : AbstractOBDData
|
public class EngineRPM : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class FuelPressure : AbstractOBDData
|
public class FuelPressure : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class FuelSystemStatus : AbstractOBDData
|
public class FuelSystemStatus : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class IntakeAirTemperature : AbstractOBDData
|
public class IntakeAirTemperature : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class IntakeManifoldAbsolutePressure : AbstractOBDData
|
public class IntakeManifoldAbsolutePressure : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class LongTermFuelTrimBank1 : AbstractOBDData
|
public class LongTermFuelTrimBank1 : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class LongTermFuelTrimBank2 : AbstractOBDData
|
public class LongTermFuelTrimBank2 : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class MAFAirFlowRate : AbstractOBDData
|
public class MAFAirFlowRate : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OBDStandards : AbstractOBDData
|
public class OBDStandards : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor1FuelTrim : AbstractOBDData
|
public class OxygenSensor1FuelTrim : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor2FuelTrim : AbstractOBDData
|
public class OxygenSensor2FuelTrim : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor3FuelTrim : AbstractOBDData
|
public class OxygenSensor3FuelTrim : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor4FuelTrim : AbstractOBDData
|
public class OxygenSensor4FuelTrim : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor5FuelTrim : AbstractOBDData
|
public class OxygenSensor5FuelTrim : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor6FuelTrim : AbstractOBDData
|
public class OxygenSensor6FuelTrim : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor7FuelTrim : AbstractOBDData
|
public class OxygenSensor7FuelTrim : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor8FuelTrim : AbstractOBDData
|
public class OxygenSensor8FuelTrim : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensorPresent : AbstractOBDData
|
public class OxygenSensorPresent : AbstractOBDData
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public bool IsSensor1Present => (A & 1 << 0) != 0;
|
public bool IsSensor1Present => (A & (1 << 0)) != 0;
|
||||||
public bool IsSensor2Present => (A & 1 << 1) != 0;
|
public bool IsSensor2Present => (A & (1 << 1)) != 0;
|
||||||
public bool IsSensor3Present => (A & 1 << 2) != 0;
|
public bool IsSensor3Present => (A & (1 << 2)) != 0;
|
||||||
public bool IsSensor4Present => (A & 1 << 3) != 0;
|
public bool IsSensor4Present => (A & (1 << 3)) != 0;
|
||||||
public bool IsSensor5Present => (A & 1 << 4) != 0;
|
public bool IsSensor5Present => (A & (1 << 4)) != 0;
|
||||||
public bool IsSensor6Present => (A & 1 << 5) != 0;
|
public bool IsSensor6Present => (A & (1 << 5)) != 0;
|
||||||
public bool IsSensor7Present => (A & 1 << 6) != 0;
|
public bool IsSensor7Present => (A & (1 << 6)) != 0;
|
||||||
public bool IsSensor8Present => (A & 1 << 7) != 0;
|
public bool IsSensor8Present => (A & (1 << 7)) != 0;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensorPresent2 : AbstractOBDData
|
public class OxygenSensorPresent2 : AbstractOBDData
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public bool IsSensor1Present => (A & 1 << 0) != 0;
|
public bool IsSensor1Present => (A & (1 << 0)) != 0;
|
||||||
public bool IsSensor2Present => (A & 1 << 1) != 0;
|
public bool IsSensor2Present => (A & (1 << 1)) != 0;
|
||||||
public bool IsSensor3Present => (A & 1 << 2) != 0;
|
public bool IsSensor3Present => (A & (1 << 2)) != 0;
|
||||||
public bool IsSensor4Present => (A & 1 << 3) != 0;
|
public bool IsSensor4Present => (A & (1 << 3)) != 0;
|
||||||
public bool IsSensor5Present => (A & 1 << 4) != 0;
|
public bool IsSensor5Present => (A & (1 << 4)) != 0;
|
||||||
public bool IsSensor6Present => (A & 1 << 5) != 0;
|
public bool IsSensor6Present => (A & (1 << 5)) != 0;
|
||||||
public bool IsSensor7Present => (A & 1 << 6) != 0;
|
public bool IsSensor7Present => (A & (1 << 6)) != 0;
|
||||||
public bool IsSensor8Present => (A & 1 << 7) != 0;
|
public bool IsSensor8Present => (A & (1 << 7)) != 0;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class PidsSupported01_20 : AbstractOBDData
|
public class PidsSupported01_20 : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class RunTimeSinceEngineStart : AbstractOBDData
|
public class RunTimeSinceEngineStart : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class ShortTermFuelTrimBank1 : AbstractOBDData
|
public class ShortTermFuelTrimBank1 : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class ShortTermFuelTrimBank2 : AbstractOBDData
|
public class ShortTermFuelTrimBank2 : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class ThrottlePosition : AbstractOBDData
|
public class ThrottlePosition : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class TimingAdvance : AbstractOBDData
|
public class TimingAdvance : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class VehicleSpeed : AbstractOBDData
|
public class VehicleSpeed : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class AbsoluteBarometricPressure : AbstractOBDData
|
public class AbsoluteBarometricPressure : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class CatalystTemperatureBank1Sensor1 : AbstractOBDData
|
public class CatalystTemperatureBank1Sensor1 : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class CatalystTemperatureBank1Sensor2 : AbstractOBDData
|
public class CatalystTemperatureBank1Sensor2 : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class CatalystTemperatureBank2Sensor1 : AbstractOBDData
|
public class CatalystTemperatureBank2Sensor1 : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class CatalystTemperatureBank2Sensor2 : AbstractOBDData
|
public class CatalystTemperatureBank2Sensor2 : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class CommandedEGR : AbstractOBDData
|
public class CommandedEGR : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class CommandedEvaporativePurge : AbstractOBDData
|
public class CommandedEvaporativePurge : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class DistanceTraveledSinceCodesCleared : AbstractOBDData
|
public class DistanceTraveledSinceCodesCleared : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class DistanceTraveledWithMILOn : AbstractOBDData
|
public class DistanceTraveledWithMILOn : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class EGRError : AbstractOBDData
|
public class EGRError : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class EvapSystemVaporPressure : AbstractOBDData
|
public class EvapSystemVaporPressure : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class FuelRailGaugePressure : AbstractOBDData
|
public class FuelRailGaugePressure : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class FuelRailPressure : AbstractOBDData
|
public class FuelRailPressure : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class FuelTankLevelInput : AbstractOBDData
|
public class FuelTankLevelInput : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor1FuelAir : AbstractOBDData
|
public class OxygenSensor1FuelAir : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor1FuelAir2 : AbstractOBDData
|
public class OxygenSensor1FuelAir2 : AbstractOBDData
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Milliampere Current => new Milliampere(C + (D / 256.0) - 128, -128, 128 - double.Epsilon);
|
public Milliampere Current => new Milliampere((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor2FuelAir : AbstractOBDData
|
public class OxygenSensor2FuelAir : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor2FuelAir2 : AbstractOBDData
|
public class OxygenSensor2FuelAir2 : AbstractOBDData
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Milliampere Current => new Milliampere(C + (D / 256.0) - 128, -128, 128 - double.Epsilon);
|
public Milliampere Current => new Milliampere((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor3FuelAir : AbstractOBDData
|
public class OxygenSensor3FuelAir : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor3FuelAir2 : AbstractOBDData
|
public class OxygenSensor3FuelAir2 : AbstractOBDData
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Milliampere Current => new Milliampere(C + (D / 256.0) - 128, -128, 128 - double.Epsilon);
|
public Milliampere Current => new Milliampere((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor4FuelAir : AbstractOBDData
|
public class OxygenSensor4FuelAir : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor4FuelAir2 : AbstractOBDData
|
public class OxygenSensor4FuelAir2 : AbstractOBDData
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Milliampere Current => new Milliampere(C + (D / 256.0) - 128, -128, 128 - double.Epsilon);
|
public Milliampere Current => new Milliampere((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor5FuelAir : AbstractOBDData
|
public class OxygenSensor5FuelAir : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor5FuelAir2 : AbstractOBDData
|
public class OxygenSensor5FuelAir2 : AbstractOBDData
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Milliampere Current => new Milliampere(C + (D / 256.0) - 128, -128, 128 - double.Epsilon);
|
public Milliampere Current => new Milliampere((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor6FuelAir : AbstractOBDData
|
public class OxygenSensor6FuelAir : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor6FuelAir2 : AbstractOBDData
|
public class OxygenSensor6FuelAir2 : AbstractOBDData
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Milliampere Current => new Milliampere(C + (D / 256.0) - 128, -128, 128 - double.Epsilon);
|
public Milliampere Current => new Milliampere((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor7FuelAir : AbstractOBDData
|
public class OxygenSensor7FuelAir : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor7FuelAir2 : AbstractOBDData
|
public class OxygenSensor7FuelAir2 : AbstractOBDData
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Milliampere Current => new Milliampere(C + (D / 256.0) - 128, -128, 128 - double.Epsilon);
|
public Milliampere Current => new Milliampere((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor8FuelAir : AbstractOBDData
|
public class OxygenSensor8FuelAir : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class OxygenSensor8FuelAir2 : AbstractOBDData
|
public class OxygenSensor8FuelAir2 : AbstractOBDData
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
public Ratio FuelAirEquivalenceRatio => new Ratio((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Milliampere Current => new Milliampere(C + (D / 256.0) - 128, -128, 128 - double.Epsilon);
|
public Milliampere Current => new Milliampere((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class PidsSupported21_40 : AbstractOBDData
|
public class PidsSupported21_40 : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using OBD.NET.DataTypes;
|
using OBD.NET.Common.DataTypes;
|
||||||
|
|
||||||
namespace OBD.NET.OBDData
|
namespace OBD.NET.Common.OBDData
|
||||||
{
|
{
|
||||||
public class WarmUpsSinceCodesCleared : AbstractOBDData
|
public class WarmUpsSinceCodesCleared : AbstractOBDData
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user