mirror of
https://github.com/DarthAffe/OBD.NET.git
synced 2025-12-13 01:08:30 +00:00
Applied code-style
This commit is contained in:
parent
09d23dbaa9
commit
18b0fec0f2
@ -30,8 +30,8 @@ public class Program
|
|||||||
|
|
||||||
string comPort = args[0];
|
string comPort = args[0];
|
||||||
|
|
||||||
using SerialConnection connection = new SerialConnection(comPort);
|
using SerialConnection connection = new(comPort);
|
||||||
using ELM327 dev = new ELM327(connection, new OBDConsoleLogger(OBDLogLevel.Debug));
|
using ELM327 dev = new(connection, new OBDConsoleLogger(OBDLogLevel.Debug));
|
||||||
|
|
||||||
dev.SubscribeDataReceived<EngineRPM>((sender, data) => Console.WriteLine("EngineRPM: " + data.Data.Rpm));
|
dev.SubscribeDataReceived<EngineRPM>((sender, data) => Console.WriteLine("EngineRPM: " + data.Data.Rpm));
|
||||||
dev.SubscribeDataReceived<EngineFuelRate>((sender, data) => Console.WriteLine("VehicleSpeed: " + data.Data));
|
dev.SubscribeDataReceived<EngineFuelRate>((sender, data) => Console.WriteLine("VehicleSpeed: " + data.Data));
|
||||||
@ -63,8 +63,8 @@ public class Program
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static async Task MainAsync(string comPort)
|
public static async Task MainAsync(string comPort)
|
||||||
{
|
{
|
||||||
using SerialConnection connection = new SerialConnection(comPort);
|
using SerialConnection connection = new(comPort);
|
||||||
using ELM327 dev = new ELM327(connection, new OBDConsoleLogger(OBDLogLevel.Debug));
|
using ELM327 dev = new(connection, new OBDConsoleLogger(OBDLogLevel.Debug));
|
||||||
|
|
||||||
dev.Initialize();
|
dev.Initialize();
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,9 @@ using Windows.Devices.Bluetooth.Rfcomm;
|
|||||||
using Windows.Networking.Sockets;
|
using Windows.Networking.Sockets;
|
||||||
using Windows.Storage.Streams;
|
using Windows.Storage.Streams;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Windows.Devices.Enumeration;
|
||||||
|
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
namespace OBD.NET.Communication
|
namespace OBD.NET.Communication
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -16,6 +18,7 @@ namespace OBD.NET.Communication
|
|||||||
/// <seealso cref="OBD.NET.Communication.ISerialConnection" />
|
/// <seealso cref="OBD.NET.Communication.ISerialConnection" />
|
||||||
public class BluetoothSerialConnection : ISerialConnection
|
public class BluetoothSerialConnection : ISerialConnection
|
||||||
{
|
{
|
||||||
|
#region Properties & Fields
|
||||||
|
|
||||||
private StreamSocket _socket;
|
private StreamSocket _socket;
|
||||||
private DataWriter _writer;
|
private DataWriter _writer;
|
||||||
@ -25,26 +28,33 @@ namespace OBD.NET.Communication
|
|||||||
private CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
|
private CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
|
||||||
private Task _readerTask;
|
private Task _readerTask;
|
||||||
|
|
||||||
private string device;
|
private string _device;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="BluetoothSerialConnection"/> class.
|
/// Initializes a new instance of the <see cref="BluetoothSerialConnection"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BluetoothSerialConnection()
|
public BluetoothSerialConnection()
|
||||||
{
|
{
|
||||||
device = null;
|
_device = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="BluetoothSerialConnection"/> class.
|
/// Initializes a new instance of the <see cref="BluetoothSerialConnection"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceName">Name of the device.</param>
|
/// <param name="deviceName">Name of the _device.</param>
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
public BluetoothSerialConnection(string deviceName)
|
public BluetoothSerialConnection(string deviceName)
|
||||||
{
|
{
|
||||||
device = deviceName;
|
this._device = deviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this instance is open.
|
/// Gets a value indicating whether this instance is open.
|
||||||
@ -72,10 +82,7 @@ namespace OBD.NET.Communication
|
|||||||
/// Connects the serial port.
|
/// Connects the serial port.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <exception cref="System.NotSupportedException">Synchronous operations not supported</exception>
|
/// <exception cref="System.NotSupportedException">Synchronous operations not supported</exception>
|
||||||
public void Connect()
|
public void Connect() => throw new NotSupportedException("Synchronous operations not supported on UWP platform");
|
||||||
{
|
|
||||||
throw new NotSupportedException("Synchronous operations not supported on UWP platform");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connects the serial port asynchronously
|
/// Connects the serial port asynchronously
|
||||||
@ -83,31 +90,28 @@ namespace OBD.NET.Communication
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task ConnectAsync()
|
public async Task ConnectAsync()
|
||||||
{
|
{
|
||||||
var services = await Windows.Devices.Enumeration.DeviceInformation
|
DeviceInformationCollection services = await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort));
|
||||||
.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort));
|
|
||||||
|
|
||||||
//use first serial service
|
//use first serial service
|
||||||
if (services.Count > 0)
|
if (services.Count > 0)
|
||||||
{
|
{
|
||||||
var id = services[0].Id;
|
string id = services[0].Id;
|
||||||
|
|
||||||
//use predefined device from constructor
|
//use predefined _device from constructor
|
||||||
if (!string.IsNullOrWhiteSpace(device))
|
if (!string.IsNullOrWhiteSpace(_device))
|
||||||
{
|
{
|
||||||
id = services.Where(x => x.Name.Equals(device, StringComparison.OrdinalIgnoreCase))
|
id = services.Where(x => x.Name.Equals(_device, StringComparison.OrdinalIgnoreCase))
|
||||||
.Select(x => x.Id).FirstOrDefault();
|
.Select(x => x.Id)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
throw new InvalidOperationException($"Device {_device} not found");
|
||||||
throw new InvalidOperationException($"Device {device} not found");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the target Bluetooth device
|
// Initialize the target Bluetooth _device
|
||||||
var service = await RfcommDeviceService.FromIdAsync(id);
|
RfcommDeviceService service = await RfcommDeviceService.FromIdAsync(id);
|
||||||
|
|
||||||
// Check that the service meets this App's minimum requirement
|
// Check that the service meets this App's minimum requirement
|
||||||
|
|
||||||
_socket = new StreamSocket();
|
_socket = new StreamSocket();
|
||||||
await _socket.ConnectAsync(service.ConnectionHostName,
|
await _socket.ConnectAsync(service.ConnectionHostName,
|
||||||
service.ConnectionServiceName);
|
service.ConnectionServiceName);
|
||||||
@ -120,17 +124,12 @@ namespace OBD.NET.Communication
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified text to the serial connection
|
/// Writes the specified text to the serial connection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text">The text.</param>
|
|
||||||
/// <exception cref="System.NotImplementedException">Synchronous operations not supported</exception>
|
/// <exception cref="System.NotImplementedException">Synchronous operations not supported</exception>
|
||||||
public void Write(byte[] data)
|
public void Write(byte[] data) => throw new NotSupportedException("Synchronous operations not supported on UWP platform");
|
||||||
{
|
|
||||||
throw new NotImplementedException("Synchronous operations not supported on UWP platform");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified text to the serial connection asynchronously
|
/// Writes the specified text to the serial connection asynchronously
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text">The text.</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task WriteAsync(byte[] data)
|
public async Task WriteAsync(byte[] data)
|
||||||
{
|
{
|
||||||
@ -141,23 +140,19 @@ namespace OBD.NET.Communication
|
|||||||
|
|
||||||
private Task StartReader()
|
private Task StartReader()
|
||||||
{
|
{
|
||||||
return Task.Factory.StartNew(async () =>
|
return Task.Factory.StartNew(async () =>
|
||||||
{
|
{
|
||||||
|
|
||||||
var buffer = _readBuffer.AsBuffer();
|
IBuffer buffer = _readBuffer.AsBuffer();
|
||||||
while (!_cancellationTokenSource.IsCancellationRequested)
|
while (!_cancellationTokenSource.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
var readData = await _socket.InputStream.ReadAsync(buffer, buffer.Capacity, InputStreamOptions.Partial);
|
IBuffer readData = await _socket.InputStream.ReadAsync(buffer, buffer.Capacity, InputStreamOptions.Partial);
|
||||||
SerialPortOnDataReceived(readData);
|
SerialPortOnDataReceived(readData);
|
||||||
}
|
}
|
||||||
}, _cancellationTokenSource.Token);
|
}, _cancellationTokenSource.Token);
|
||||||
}
|
|
||||||
|
|
||||||
private void SerialPortOnDataReceived(IBuffer buffer)
|
|
||||||
{
|
|
||||||
DataReceived?.Invoke(this, new DataReceivedEventArgs((int)buffer.Length, _readBuffer));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SerialPortOnDataReceived(IBuffer buffer) => DataReceived?.Invoke(this, new DataReceivedEventArgs((int)buffer.Length, _readBuffer));
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
@ -165,6 +160,7 @@ namespace OBD.NET.Communication
|
|||||||
_readerTask?.Wait();
|
_readerTask?.Wait();
|
||||||
_socket?.Dispose();
|
_socket?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,20 +7,20 @@ public class ATCommand
|
|||||||
|
|
||||||
//TODO DarthAffe 26.06.2016: Implement all commands
|
//TODO DarthAffe 26.06.2016: Implement all commands
|
||||||
|
|
||||||
public static readonly ATCommand RepeatLastCommand = new ATCommand("\r");
|
public static readonly ATCommand RepeatLastCommand = new("\r");
|
||||||
public static readonly ATCommand ResetDevice = new ATCommand("ATZ");
|
public static readonly ATCommand ResetDevice = new("ATZ");
|
||||||
public static readonly ATCommand ReadVoltage = new ATCommand("ATRV");
|
public static readonly ATCommand ReadVoltage = new("ATRV");
|
||||||
public static readonly ATCommand EchoOn = new ATCommand("ATE1", "^OK$");
|
public static readonly ATCommand EchoOn = new("ATE1", "^OK$");
|
||||||
public static readonly ATCommand EchoOff = new ATCommand("ATE0", "^OK$");
|
public static readonly ATCommand EchoOff = new("ATE0", "^OK$");
|
||||||
public static readonly ATCommand HeadersOn = new ATCommand("ATH1", "^OK$");
|
public static readonly ATCommand HeadersOn = new("ATH1", "^OK$");
|
||||||
public static readonly ATCommand HeadersOff = new ATCommand("ATH0", "^OK$");
|
public static readonly ATCommand HeadersOff = new("ATH0", "^OK$");
|
||||||
public static readonly ATCommand PrintSpacesOn = new ATCommand("ATS1", "^OK$");
|
public static readonly ATCommand PrintSpacesOn = new("ATS1", "^OK$");
|
||||||
public static readonly ATCommand PrintSpacesOff = new ATCommand("ATS0", "^OK$");
|
public static readonly ATCommand PrintSpacesOff = new("ATS0", "^OK$");
|
||||||
public static readonly ATCommand LinefeedsOn = new ATCommand("ATL1", "^OK$");
|
public static readonly ATCommand LinefeedsOn = new("ATL1", "^OK$");
|
||||||
public static readonly ATCommand LinefeedsOff = new ATCommand("ATL0", "^OK$");
|
public static readonly ATCommand LinefeedsOff = new("ATL0", "^OK$");
|
||||||
public static readonly ATCommand SetProtocolAuto = new ATCommand("ATSP0", "^OK$");
|
public static readonly ATCommand SetProtocolAuto = new("ATSP0", "^OK$");
|
||||||
public static readonly ATCommand PrintVersion = new ATCommand("ATI", "^ELM327.*");
|
public static readonly ATCommand PrintVersion = new("ATI", "^ELM327.*");
|
||||||
public static readonly ATCommand CloseProtocol = new ATCommand("ATPC");
|
public static readonly ATCommand CloseProtocol = new("ATPC");
|
||||||
|
|
||||||
// ReSharper restore InconsistentNaming
|
// ReSharper restore InconsistentNaming
|
||||||
#endregion
|
#endregion
|
||||||
@ -36,8 +36,8 @@ public class ATCommand
|
|||||||
|
|
||||||
private ATCommand(string command, string expectedResult = null)
|
private ATCommand(string command, string expectedResult = null)
|
||||||
{
|
{
|
||||||
Command = command;
|
this.Command = command;
|
||||||
ExpectedResult = expectedResult;
|
this.ExpectedResult = expectedResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -7,14 +7,14 @@ public class STCommand
|
|||||||
|
|
||||||
//TODO DarthAffe 19.03.2017: Implement all commands
|
//TODO DarthAffe 19.03.2017: Implement all commands
|
||||||
|
|
||||||
internal static readonly STCommand AddPassFilter = new STCommand("STFAP");
|
internal static readonly STCommand AddPassFilter = new("STFAP");
|
||||||
internal static readonly STCommand AddBlockFilter = new STCommand("STFAB");
|
internal static readonly STCommand AddBlockFilter = new("STFAB");
|
||||||
internal static readonly STCommand AddFlowControlFilter = new STCommand("STFAFC");
|
internal static readonly STCommand AddFlowControlFilter = new("STFAFC");
|
||||||
internal static readonly STCommand ClearPassFilters = new STCommand("STFCP");
|
internal static readonly STCommand ClearPassFilters = new("STFCP");
|
||||||
internal static readonly STCommand ClearBlockFilters = new STCommand("STFCB");
|
internal static readonly STCommand ClearBlockFilters = new("STFCB");
|
||||||
internal static readonly STCommand ClearFlowControlFilters = new STCommand("STFCFC");
|
internal static readonly STCommand ClearFlowControlFilters = new("STFCFC");
|
||||||
internal static readonly STCommand Monitor = new STCommand("STM");
|
internal static readonly STCommand Monitor = new("STM");
|
||||||
internal static readonly STCommand MonitorAll = new STCommand("STMA");
|
internal static readonly STCommand MonitorAll = new("STMA");
|
||||||
|
|
||||||
// ReSharper restore InconsistentNaming
|
// ReSharper restore InconsistentNaming
|
||||||
#endregion
|
#endregion
|
||||||
@ -29,7 +29,7 @@ public class STCommand
|
|||||||
|
|
||||||
protected STCommand(string command)
|
protected STCommand(string command)
|
||||||
{
|
{
|
||||||
Command = command;
|
this.Command = command;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -28,8 +28,8 @@ public class DataReceivedEventArgs : System.EventArgs
|
|||||||
/// <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;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -16,9 +16,9 @@ public class SerialConnection : ISerialConnection
|
|||||||
public bool IsAsync => false;
|
public bool IsAsync => false;
|
||||||
|
|
||||||
private readonly byte[] _readBuffer = new byte[1024];
|
private readonly byte[] _readBuffer = new byte[1024];
|
||||||
private readonly StringBuilder _lineBuffer = new StringBuilder();
|
private readonly StringBuilder _lineBuffer = new();
|
||||||
|
|
||||||
private readonly AutoResetEvent _hasPrompt = new AutoResetEvent(true);
|
private readonly AutoResetEvent _hasPrompt = new(true);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -17,17 +17,19 @@ public abstract class GenericData
|
|||||||
|
|
||||||
protected GenericData(double value, double minValue, double maxValue)
|
protected GenericData(double value, double minValue, double maxValue)
|
||||||
{
|
{
|
||||||
Value = value;
|
this.Value = value;
|
||||||
MinValue = minValue;
|
this.MinValue = minValue;
|
||||||
MaxValue = maxValue;
|
this.MaxValue = maxValue;
|
||||||
|
|
||||||
IsFloatingPointValue = true;
|
IsFloatingPointValue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected GenericData(int value, int minValue, int maxValue)
|
protected GenericData(int value, int minValue, int maxValue)
|
||||||
{
|
{
|
||||||
Value = value;
|
this.Value = value;
|
||||||
MinValue = minValue;
|
this.MinValue = minValue;
|
||||||
MaxValue = maxValue;
|
this.MaxValue = maxValue;
|
||||||
|
|
||||||
IsFloatingPointValue = false;
|
IsFloatingPointValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ public class Kilopascal : GenericData
|
|||||||
|
|
||||||
#region Operators
|
#region Operators
|
||||||
|
|
||||||
public static explicit operator Pascal(Kilopascal pa) => new Pascal(pa.Value / 1000.0, pa.MinValue / 1000.0, pa.MaxValue / 1000.0);
|
public static explicit operator Pascal(Kilopascal pa) => new(pa.Value / 1000.0, pa.MinValue / 1000.0, pa.MaxValue / 1000.0);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@ -22,7 +22,7 @@ public class Second : GenericData
|
|||||||
|
|
||||||
#region Operators
|
#region Operators
|
||||||
|
|
||||||
public static explicit operator Minute(Second s) => new Minute(s.Value / 60.0, s.MinValue / 60.0, s.MaxValue / 60.0);
|
public static explicit operator Minute(Second s) => new(s.Value / 60.0, s.MinValue / 60.0, s.MaxValue / 60.0);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@ -7,7 +7,7 @@ public class QueuedCommand
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public string CommandText { get; private set; }
|
public string CommandText { get; }
|
||||||
|
|
||||||
public CommandResult CommandResult { get; }
|
public CommandResult CommandResult { get; }
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ public class QueuedCommand
|
|||||||
|
|
||||||
public QueuedCommand(string commandText)
|
public QueuedCommand(string commandText)
|
||||||
{
|
{
|
||||||
CommandText = commandText;
|
this.CommandText = commandText;
|
||||||
|
|
||||||
CommandResult = new CommandResult();
|
CommandResult = new CommandResult();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,10 +14,10 @@ public class ELM327 : SerialDevice
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
protected readonly Dictionary<Type, IDataEventManager> DataReceivedEventHandlers = new Dictionary<Type, IDataEventManager>();
|
protected readonly Dictionary<Type, IDataEventManager> DataReceivedEventHandlers = new();
|
||||||
|
|
||||||
protected static Dictionary<Type, byte> PidCache { get; } = new Dictionary<Type, byte>();
|
protected static Dictionary<Type, byte> PidCache { get; } = new();
|
||||||
protected static Dictionary<byte, Type> DataTypeCache { get; } = new Dictionary<byte, Type>();
|
protected static Dictionary<byte, Type> DataTypeCache { get; } = new();
|
||||||
|
|
||||||
protected Mode Mode { get; set; } = Mode.ShowCurrentData; //TODO DarthAffe 26.06.2016: Implement different modes
|
protected Mode Mode { get; set; } = Mode.ShowCurrentData; //TODO DarthAffe 26.06.2016: Implement different modes
|
||||||
|
|
||||||
|
|||||||
@ -14,14 +14,14 @@ public abstract class SerialDevice : IDisposable
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
private readonly BlockingCollection<QueuedCommand> _commandQueue = new BlockingCollection<QueuedCommand>();
|
private readonly BlockingCollection<QueuedCommand> _commandQueue = new();
|
||||||
private readonly StringBuilder _lineBuffer = new StringBuilder();
|
private readonly StringBuilder _lineBuffer = new();
|
||||||
private readonly AutoResetEvent _commandFinishedEvent = new AutoResetEvent(false);
|
private readonly AutoResetEvent _commandFinishedEvent = new(false);
|
||||||
private Task _commandWorkerTask;
|
private Task _commandWorkerTask;
|
||||||
private CancellationTokenSource _commandCancellationToken;
|
private CancellationTokenSource _commandCancellationToken;
|
||||||
|
|
||||||
private volatile int _queueSize = 0;
|
private volatile int _queueSize = 0;
|
||||||
private readonly ManualResetEvent _queueEmptyEvent = new ManualResetEvent(true);
|
private readonly ManualResetEvent _queueEmptyEvent = new(true);
|
||||||
|
|
||||||
public int QueueSize => _queueSize;
|
public int QueueSize => _queueSize;
|
||||||
|
|
||||||
@ -42,9 +42,9 @@ public abstract class SerialDevice : IDisposable
|
|||||||
/// <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)
|
||||||
{
|
{
|
||||||
Connection = connection;
|
this.Connection = connection;
|
||||||
Terminator = terminator;
|
this.Terminator = terminator;
|
||||||
Logger = logger;
|
this.Logger = logger;
|
||||||
|
|
||||||
connection.DataReceived += OnDataReceived;
|
connection.DataReceived += OnDataReceived;
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ public abstract class SerialDevice : IDisposable
|
|||||||
command = PrepareCommand(command);
|
command = PrepareCommand(command);
|
||||||
Logger?.WriteLine("Queuing Command: '" + command.Replace('\r', '\'') + "'", OBDLogLevel.Verbose);
|
Logger?.WriteLine("Queuing Command: '" + command.Replace('\r', '\'') + "'", OBDLogLevel.Verbose);
|
||||||
|
|
||||||
QueuedCommand cmd = new QueuedCommand(command);
|
QueuedCommand cmd = new(command);
|
||||||
_queueEmptyEvent.Reset();
|
_queueEmptyEvent.Reset();
|
||||||
_queueSize++;
|
_queueSize++;
|
||||||
_commandQueue.Add(cmd);
|
_commandQueue.Add(cmd);
|
||||||
|
|||||||
@ -15,8 +15,8 @@ public class DataReceivedEventArgs<T> where T : IOBDData
|
|||||||
|
|
||||||
public DataReceivedEventArgs(T data, DateTime timestamp)
|
public DataReceivedEventArgs(T data, DateTime timestamp)
|
||||||
{
|
{
|
||||||
Data = data;
|
this.Data = data;
|
||||||
Timestamp = timestamp;
|
this.Timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -13,8 +13,8 @@ public class RawDataReceivedEventArgs
|
|||||||
|
|
||||||
public RawDataReceivedEventArgs(string data, DateTime timestamp)
|
public RawDataReceivedEventArgs(string data, DateTime timestamp)
|
||||||
{
|
{
|
||||||
Data = data;
|
this.Data = data;
|
||||||
Timestamp = timestamp;
|
this.Timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -14,22 +14,22 @@ public class UnexpectedResultException : Exception
|
|||||||
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)
|
||||||
{
|
{
|
||||||
Result = result;
|
this.Result = result;
|
||||||
ExpectedResult = expectedResult;
|
this.ExpectedResult = expectedResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UnexpectedResultException(string message, string result, string expectedResult)
|
public UnexpectedResultException(string message, string result, string expectedResult)
|
||||||
: base(message)
|
: base(message)
|
||||||
{
|
{
|
||||||
Result = result;
|
this.Result = result;
|
||||||
ExpectedResult = expectedResult;
|
this.ExpectedResult = expectedResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UnexpectedResultException(string message, Exception innerException, string result, string expectedResult)
|
public UnexpectedResultException(string message, Exception innerException, string result, string expectedResult)
|
||||||
: base(message, innerException)
|
: base(message, innerException)
|
||||||
{
|
{
|
||||||
Result = result;
|
this.Result = result;
|
||||||
ExpectedResult = expectedResult;
|
this.ExpectedResult = expectedResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -16,7 +16,7 @@ public class OBDConsoleLogger : IOBDLogger
|
|||||||
|
|
||||||
public OBDConsoleLogger(OBDLogLevel level = OBDLogLevel.None)
|
public OBDConsoleLogger(OBDLogLevel level = OBDLogLevel.None)
|
||||||
{
|
{
|
||||||
LogLevel = level;
|
this.LogLevel = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -19,7 +19,7 @@ public class OBDDebugLogger : IOBDLogger
|
|||||||
|
|
||||||
public OBDDebugLogger(OBDLogLevel level = OBDLogLevel.None)
|
public OBDDebugLogger(OBDLogLevel level = OBDLogLevel.None)
|
||||||
{
|
{
|
||||||
LogLevel = level;
|
this.LogLevel = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class CalculatedEngineLoad : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Load => new Percent(A / 2.55, 0, 100);
|
public Percent Load => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class EngineCoolantTemperature : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public DegreeCelsius Temperature => new DegreeCelsius(A - 40, -40, 215);
|
public DegreeCelsius Temperature => new(A - 40, -40, 215);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class EngineRPM : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public RevolutionsPerMinute Rpm => new RevolutionsPerMinute(((256 * A) + B) / 4.0, 0, 16383.75);
|
public RevolutionsPerMinute Rpm => new(((256 * A) + B) / 4.0, 0, 16383.75);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class FuelPressure : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Kilopascal Pressure => new Kilopascal(3 * A, 0, 765);
|
public Kilopascal Pressure => new(3 * A, 0, 765);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class IntakeAirTemperature : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public DegreeCelsius Temperature => new DegreeCelsius(A - 40, -40, 215);
|
public DegreeCelsius Temperature => new(A - 40, -40, 215);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class IntakeManifoldAbsolutePressure : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Kilopascal Pressure => new Kilopascal(A, 0, 255);
|
public Kilopascal Pressure => new(A, 0, 255);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class LongTermFuelTrimBank1 : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Trim => new Percent((A / 1.28) - 100, -100, 99.2);
|
public Percent Trim => new((A / 1.28) - 100, -100, 99.2);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class LongTermFuelTrimBank2 : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Trim => new Percent((A / 1.28) - 100, -100, 99.2);
|
public Percent Trim => new((A / 1.28) - 100, -100, 99.2);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class MAFAirFlowRate : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public GramPerSec Rate => new GramPerSec(((256 * A) + B) / 100.0, 0, 655.35);
|
public GramPerSec Rate => new(((256 * A) + B) / 100.0, 0, 655.35);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor1FuelTrim : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Volt Voltage => new Volt(A / 200.0, 0, 1.275);
|
public Volt Voltage => new(A / 200.0, 0, 1.275);
|
||||||
public Percent ShortTermFuelTrim => new Percent((B / 1.28) - 100, -100, 99.2);
|
public Percent ShortTermFuelTrim => new((B / 1.28) - 100, -100, 99.2);
|
||||||
public bool IsSensorUsed => B != 0xFF;
|
public bool IsSensorUsed => B != 0xFF;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor2FuelTrim : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Volt Voltage => new Volt(A / 200.0, 0, 1.275);
|
public Volt Voltage => new(A / 200.0, 0, 1.275);
|
||||||
public Percent ShortTermFuelTrim => new Percent((B / 1.28) - 100, -100, 99.2);
|
public Percent ShortTermFuelTrim => new((B / 1.28) - 100, -100, 99.2);
|
||||||
public bool IsSensorUsed => B != 0xFF;
|
public bool IsSensorUsed => B != 0xFF;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor3FuelTrim : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Volt Voltage => new Volt(A / 200.0, 0, 1.275);
|
public Volt Voltage => new(A / 200.0, 0, 1.275);
|
||||||
public Percent ShortTermFuelTrim => new Percent((B / 1.28) - 100, -100, 99.2);
|
public Percent ShortTermFuelTrim => new((B / 1.28) - 100, -100, 99.2);
|
||||||
public bool IsSensorUsed => B != 0xFF;
|
public bool IsSensorUsed => B != 0xFF;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor4FuelTrim : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Volt Voltage => new Volt(A / 200.0, 0, 1.275);
|
public Volt Voltage => new(A / 200.0, 0, 1.275);
|
||||||
public Percent ShortTermFuelTrim => new Percent((B / 1.28) - 100, -100, 99.2);
|
public Percent ShortTermFuelTrim => new((B / 1.28) - 100, -100, 99.2);
|
||||||
public bool IsSensorUsed => B != 0xFF;
|
public bool IsSensorUsed => B != 0xFF;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor5FuelTrim : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Volt Voltage => new Volt(A / 200.0, 0, 1.275);
|
public Volt Voltage => new(A / 200.0, 0, 1.275);
|
||||||
public Percent ShortTermFuelTrim => new Percent((B / 1.28) - 100, -100, 99.2);
|
public Percent ShortTermFuelTrim => new((B / 1.28) - 100, -100, 99.2);
|
||||||
public bool IsSensorUsed => B != 0xFF;
|
public bool IsSensorUsed => B != 0xFF;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor6FuelTrim : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Volt Voltage => new Volt(A / 200.0, 0, 1.275);
|
public Volt Voltage => new(A / 200.0, 0, 1.275);
|
||||||
public Percent ShortTermFuelTrim => new Percent((B / 1.28) - 100, -100, 99.2);
|
public Percent ShortTermFuelTrim => new((B / 1.28) - 100, -100, 99.2);
|
||||||
public bool IsSensorUsed => B != 0xFF;
|
public bool IsSensorUsed => B != 0xFF;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor7FuelTrim : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Volt Voltage => new Volt(A / 200.0, 0, 1.275);
|
public Volt Voltage => new(A / 200.0, 0, 1.275);
|
||||||
public Percent ShortTermFuelTrim => new Percent((B / 1.28) - 100, -100, 99.2);
|
public Percent ShortTermFuelTrim => new((B / 1.28) - 100, -100, 99.2);
|
||||||
public bool IsSensorUsed => B != 0xFF;
|
public bool IsSensorUsed => B != 0xFF;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor8FuelTrim : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Volt Voltage => new Volt(A / 200.0, 0, 1.275);
|
public Volt Voltage => new(A / 200.0, 0, 1.275);
|
||||||
public Percent ShortTermFuelTrim => new Percent((B / 1.28) - 100, -100, 99.2);
|
public Percent ShortTermFuelTrim => new((B / 1.28) - 100, -100, 99.2);
|
||||||
public bool IsSensorUsed => B != 0xFF;
|
public bool IsSensorUsed => B != 0xFF;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class RunTimeSinceEngineStart : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Second Runtime => new Second((256 * A) + B, 0, 65535);
|
public Second Runtime => new((256 * A) + B, 0, 65535);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class ShortTermFuelTrimBank1 : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Trim => new Percent((A / 1.28) - 100, -100, 99.2);
|
public Percent Trim => new((A / 1.28) - 100, -100, 99.2);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class ShortTermFuelTrimBank2 : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Trim => new Percent((A / 1.28) - 100, -100, 99.2);
|
public Percent Trim => new((A / 1.28) - 100, -100, 99.2);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class ThrottlePosition : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Position => new Percent(A / 2.55, 0, 100);
|
public Percent Position => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class TimingAdvance : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Degree Timing => new Degree((A / 2.0) - 64, -64, 63.5);
|
public Degree Timing => new((A / 2.0) - 64, -64, 63.5);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class VehicleSpeed : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public KilometrePerHour Speed => new KilometrePerHour(A, 0, 255);
|
public KilometrePerHour Speed => new(A, 0, 255);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class AbsoluteBarometricPressure : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Kilopascal Pressure => new Kilopascal(A, 0, 255);
|
public Kilopascal Pressure => new(A, 0, 255);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class CatalystTemperatureBank1Sensor1 : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public DegreeCelsius Temperature => new DegreeCelsius((((256 * A) + B) / 10.0) - 40, -40, 6513.5);
|
public DegreeCelsius Temperature => new((((256 * A) + B) / 10.0) - 40, -40, 6513.5);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class CatalystTemperatureBank1Sensor2 : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public DegreeCelsius Temperature => new DegreeCelsius((((256 * A) + B) / 10.0) - 40, -40, 6513.5);
|
public DegreeCelsius Temperature => new((((256 * A) + B) / 10.0) - 40, -40, 6513.5);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class CatalystTemperatureBank2Sensor1 : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public DegreeCelsius Temperature => new DegreeCelsius((((256 * A) + B) / 10.0) - 40, -40, 6513.5);
|
public DegreeCelsius Temperature => new((((256 * A) + B) / 10.0) - 40, -40, 6513.5);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class CatalystTemperatureBank2Sensor2 : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public DegreeCelsius Temperature => new DegreeCelsius((((256 * A) + B) / 10.0) - 40, -40, 6513.5);
|
public DegreeCelsius Temperature => new((((256 * A) + B) / 10.0) - 40, -40, 6513.5);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class CommandedEGR : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent EGR => new Percent(A / 2.55, 0, 100);
|
public Percent EGR => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class CommandedEvaporativePurge : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Purge => new Percent(A / 2.55, 0, 100);
|
public Percent Purge => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class DistanceTraveledSinceCodesCleared : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Kilometre Distance => new Kilometre((256 * A) + B, 0, 65535);
|
public Kilometre Distance => new((256 * A) + B, 0, 65535);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class DistanceTraveledWithMILOn : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Kilometre Distance => new Kilometre((256 * A) + B, 0, 65535);
|
public Kilometre Distance => new((256 * A) + B, 0, 65535);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class EGRError : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Error => new Percent((A / 1.28) - 100, -100, 99.2);
|
public Percent Error => new((A / 1.28) - 100, -100, 99.2);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class EvapSystemVaporPressure : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Pascal Pressure => new Pascal(((256 * A) + B) / 4.0, -8192, 8191.75);
|
public Pascal Pressure => new(((256 * A) + B) / 4.0, -8192, 8191.75);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class FuelRailGaugePressure : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Kilopascal Pressure => new Kilopascal(10 * ((256 * A) + B), 0, 655350);
|
public Kilopascal Pressure => new(10 * ((256 * A) + B), 0, 655350);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class FuelRailPressure : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Kilopascal Pressure => new Kilopascal(0.079 * ((256 * A) + B), 0, 5177.265);
|
public Kilopascal Pressure => new(0.079 * ((256 * A) + B), 0, 5177.265);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class FuelTankLevelInput : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Level => new Percent(A / 2.55, 0, 100);
|
public Percent Level => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor1FuelAir : 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((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Volt Voltage => new Volt((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
public Volt Voltage => new((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ 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((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((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor2FuelAir : 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((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Volt Voltage => new Volt((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
public Volt Voltage => new((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ 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((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((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor3FuelAir : 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((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Volt Voltage => new Volt((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
public Volt Voltage => new((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ 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((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((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor4FuelAir : 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((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Volt Voltage => new Volt((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
public Volt Voltage => new((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ 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((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((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor5FuelAir : 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((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Volt Voltage => new Volt((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
public Volt Voltage => new((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ 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((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((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor6FuelAir : 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((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Volt Voltage => new Volt((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
public Volt Voltage => new((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ 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((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((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor7FuelAir : 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((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Volt Voltage => new Volt((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
public Volt Voltage => new((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ 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((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((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class OxygenSensor8FuelAir : 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((2.0 / 25536.0) * ((256 * A) + B), 0, 2 - double.Epsilon);
|
||||||
public Volt Voltage => new Volt((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
public Volt Voltage => new((80 / 25536.0) * ((256 * C) + D), 0, 8 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ 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((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((C + (D / 256.0)) - 128, -128, 128 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class WarmUpsSinceCodesCleared : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Count WarmUps => new Count(A, 0, 255);
|
public Count WarmUps => new(A, 0, 255);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class AbsoluteEvapSystemVaporPressure : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Kilopascal Pressure => new Kilopascal(((256 * A) + B) / 200.0, 0, 327.675);
|
public Kilopascal Pressure => new(((256 * A) + B) / 200.0, 0, 327.675);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class AbsoluteLoadValue : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Load => new Percent(((256 * A) + B) / 2.55, 0, 25700);
|
public Percent Load => new(((256 * A) + B) / 2.55, 0, 25700);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class AbsoluteThrottlePositionB : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Position => new Percent(A / 2.55, 0, 100);
|
public Percent Position => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class AbsoluteThrottlePositionC : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Position => new Percent(A / 2.55, 0, 100);
|
public Percent Position => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class AcceleratorPedalPositionD : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Position => new Percent(A / 2.55, 0, 100);
|
public Percent Position => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class AcceleratorPedalPositionE : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Position => new Percent(A / 2.55, 0, 100);
|
public Percent Position => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class AcceleratorPedalPositionF : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Position => new Percent(A / 2.55, 0, 100);
|
public Percent Position => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class AmbientAirTemperature : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public DegreeCelsius Temperature => new DegreeCelsius(A - 40, -40, 215);
|
public DegreeCelsius Temperature => new(A - 40, -40, 215);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class CommandedThrottleActuator : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Value => new Percent(A / 2.55, 0, 100);
|
public Percent Value => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class ControlModuleVoltage : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Volt Voltage => new Volt(((256 * A) + B) / 1000.0, 0, 65.535);
|
public Volt Voltage => new(((256 * A) + B) / 1000.0, 0, 65.535);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class EngineFuelRate : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public LitresPerHour FuelRate => new LitresPerHour(((256 * A) + B) / 20.0, 0, 3212.75);
|
public LitresPerHour FuelRate => new(((256 * A) + B) / 20.0, 0, 3212.75);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class EngineOilTemperature : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public DegreeCelsius Temperature => new DegreeCelsius(A - 40, -40, 210);
|
public DegreeCelsius Temperature => new(A - 40, -40, 210);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class EthanolFuel : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Value => new Percent(A / 2.55, 0, 100);
|
public Percent Value => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class EvapSystemVaporPressure2 : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Pascal Pressure => new Pascal(((A * 256) + B) - 32767, -32767, 32768);
|
public Pascal Pressure => new(((A * 256) + B) - 32767, -32767, 32768);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class FuelAirCommandedEquivalenceRatio : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Ratio Ratio => new Ratio((2.0 / 65536.0) * ((256 * A) + B), 0, 2.0 - double.Epsilon);
|
public Ratio Ratio => new((2.0 / 65536.0) * ((256 * A) + B), 0, 2.0 - double.Epsilon);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class FuelInjectionTiming : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Degree Timing => new Degree((((256 * A) + B) / 128.0) - 210, -210, 301.992);
|
public Degree Timing => new((((256 * A) + B) / 128.0) - 210, -210, 301.992);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class FuelRailAbsolutePressure : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Kilopascal Pressure => new Kilopascal(10 * ((256 * A) + B), 0, 655350);
|
public Kilopascal Pressure => new(10 * ((256 * A) + B), 0, 655350);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class HybridBatteryPackRemainingLife : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent RemainingLife => new Percent(A / 2.55, 0, 100);
|
public Percent RemainingLife => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class LongtTermSecondaryOxygenSensorTrimBank13 : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Bank1 => new Percent((A / 1.28) - 100, -100, 99.2);
|
public Percent Bank1 => new((A / 1.28) - 100, -100, 99.2);
|
||||||
public Percent Bank3 => new Percent((B / 1.28) - 100, -100, 99.2);
|
public Percent Bank3 => new((B / 1.28) - 100, -100, 99.2);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class LongTermSecondaryOxygenSensorTrimBank24 : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Bank2 => new Percent((A / 1.28) - 100, -100, 99.2);
|
public Percent Bank2 => new((A / 1.28) - 100, -100, 99.2);
|
||||||
public Percent Bank4 => new Percent((B / 1.28) - 100, -100, 99.2);
|
public Percent Bank4 => new((B / 1.28) - 100, -100, 99.2);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class MaximumValueForAirFlowRate : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public GramPerSec Value => new GramPerSec(A * 10, 0, 2550);
|
public GramPerSec Value => new(A * 10, 0, 2550);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,10 +6,10 @@ public class MaximumValues : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Ratio FuelAirEquivalenceRatio => new Ratio(A, 0, 255);
|
public Ratio FuelAirEquivalenceRatio => new(A, 0, 255);
|
||||||
public Volt OxygenSensorVoltage => new Volt(B, 0, 255);
|
public Volt OxygenSensorVoltage => new(B, 0, 255);
|
||||||
public Milliampere OxygenSensorCurrent => new Milliampere(C, 0, 255);
|
public Milliampere OxygenSensorCurrent => new(C, 0, 255);
|
||||||
public Kilopascal IntakeManifoldAbsolutePressure => new Kilopascal(D * 10, 0, 2550);
|
public Kilopascal IntakeManifoldAbsolutePressure => new(D * 10, 0, 2550);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class RelativeAcceleratorPedalPosition : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent PedalPosition => new Percent(A / 2.55, 0, 100);
|
public Percent PedalPosition => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class RelativeThrottlePosition : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Position => new Percent(A / 2.55, 0, 100);
|
public Percent Position => new(A / 2.55, 0, 100);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class ShortTermSecondaryOxygenSensorTrimBank13 : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Bank1 => new Percent((A / 1.28) - 100, -100, 99.2);
|
public Percent Bank1 => new((A / 1.28) - 100, -100, 99.2);
|
||||||
public Percent Bank3 => new Percent((B / 1.28) - 100, -100, 99.2);
|
public Percent Bank3 => new((B / 1.28) - 100, -100, 99.2);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class ShortTermSecondaryOxygenSensorTrimBank24 : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Bank2 => new Percent((A / 1.28) - 100, -100, 99.2);
|
public Percent Bank2 => new((A / 1.28) - 100, -100, 99.2);
|
||||||
public Percent Bank4 => new Percent((B / 1.28) - 100, -100, 99.2);
|
public Percent Bank4 => new((B / 1.28) - 100, -100, 99.2);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class TimeRunWithMILOn : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Minute Time => new Minute((256 * A) + B, 0, 65535);
|
public Minute Time => new((256 * A) + B, 0, 65535);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class TimeSinceTroubleCodesCleared : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Minute Time => new Minute((256 * A) + B, 0, 65535);
|
public Minute Time => new((256 * A) + B, 0, 65535);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class ActualEnginePercentTorque : AbstractOBDData
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
public Percent Torque => new Percent(A - 125, -125, 125);
|
public Percent Torque => new(A - 125, -125, 125);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
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