diff --git a/OBD.NET/OBD.NET/Enums/Mode.cs b/OBD.NET/OBD.NET/Enums/Mode.cs new file mode 100644 index 0000000..99bee8c --- /dev/null +++ b/OBD.NET/OBD.NET/Enums/Mode.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.Enums +{ + /// + /// https://en.wikipedia.org/wiki/OBD-II_PIDs#Modes + /// + internal enum Mode + { + ShowCurrentData = 0x01, + ShowFreezeFrameData = 0x02, + ShowStoredDiagnosticTroubleCodes = 0x03, + ClearDiagnosticTroubleCodesAndStoredValues = 0x04, + TestResults_OxygenSensorMonitoring = 0x05, + TestResults_OtherComponentMonitoring = 0x06, + ShowPendingDiagnosticTroubleCodes = 0x07, + ControlOperationOfOnboardComponent = 0x08, + RequestVehicleInformation = 0x09, + PermanentDiagnosticTroubleCodes = 0x0A + } +} diff --git a/OBD.NET/OBD.NET/OBD.NET.csproj b/OBD.NET/OBD.NET/OBD.NET.csproj index 4b782de..1822b1d 100644 --- a/OBD.NET/OBD.NET/OBD.NET.csproj +++ b/OBD.NET/OBD.NET/OBD.NET.csproj @@ -45,6 +45,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OBD.NET/OBD.NET/OBDData/AbstractOBDData.cs b/OBD.NET/OBD.NET/OBDData/AbstractOBDData.cs new file mode 100644 index 0000000..4973b81 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/AbstractOBDData.cs @@ -0,0 +1,73 @@ +using System; +using System.IO; + +namespace OBD.NET.OBDData +{ + public abstract class AbstractOBDData : IOBDData + { + #region Properties & Fields + + public int PID { get; } + private int _length; + + private byte[] _rawData; + public byte[] RawData + { + get { return _rawData; } + set + { + if (value.Length != _length) + throw new ArgumentException("The provided raw-data is not valid", nameof(value)); + _rawData = value; + } + } + + public bool IsValid => RawData.Length == _length; + + protected byte A => RawData.Length > 0 ? RawData[0] : default(byte); + protected byte B => RawData.Length > 1 ? RawData[1] : default(byte); + protected byte C => RawData.Length > 2 ? RawData[2] : default(byte); + protected byte D => RawData.Length > 3 ? RawData[3] : default(byte); + protected byte E => RawData.Length > 4 ? RawData[4] : default(byte); + + #endregion + + #region Constructors + + public AbstractOBDData(int pid, int length) + { + this.PID = pid; + this._length = length; + } + + public AbstractOBDData(int pid, int length, byte[] rawData) + : this(pid, length) + { + this.RawData = rawData; + + if (rawData.Length != _length) + throw new ArgumentException("The provided raw-data is not valid", nameof(rawData)); + } + + #endregion + + #region Methods + + public void Read(Stream stream) + { + try + { + _rawData = new byte[_length]; + if (stream.Read(_rawData, 0, _length) != _length) + throw new InvalidDataException("Couldn't read enough bytes from the stream"); + } + catch + { + _rawData = new byte[0]; + throw; + } + } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/AuxiliaryInputStatus.cs b/OBD.NET/OBD.NET/OBDData/AuxiliaryInputStatus.cs new file mode 100644 index 0000000..dbcca63 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/AuxiliaryInputStatus.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class AuxiliaryInputStatus : AbstractOBDData + { + #region Properties & Fields + + public bool PowerTakeOffStatus => (A & 1 << 0) != 0; + + #endregion + + #region Constructors + + public AuxiliaryInputStatus() + : base(0x1E, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/CalculatedEngineLoad.cs b/OBD.NET/OBD.NET/OBDData/CalculatedEngineLoad.cs new file mode 100644 index 0000000..76217cc --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/CalculatedEngineLoad.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class CalculatedEngineLoad : AbstractOBDData + { + #region Properties & Fields + + public double Load => A / 2.55; + + #endregion + + #region Constructors + + public CalculatedEngineLoad() + : base(0x04, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/CommandedSecondaryAirStatus.cs b/OBD.NET/OBD.NET/OBDData/CommandedSecondaryAirStatus.cs new file mode 100644 index 0000000..ee9d888 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/CommandedSecondaryAirStatus.cs @@ -0,0 +1,38 @@ +using System; + +namespace OBD.NET.OBDData +{ + public class CommandedSecondaryAirStatus : AbstractOBDData + { + #region Properties & Fields + + public CommandedSecondaryAirStatusValue Status => (CommandedSecondaryAirStatusValue)A; + + #endregion + + #region Constructors + + public CommandedSecondaryAirStatus() + : base(0x12, 1) + { } + + #endregion + + #region Enum + + /// + /// https://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_1_PID_12 + /// + [Flags] + public enum CommandedSecondaryAirStatusValue + { + Missing = 0, + Upstream = 1 << 0, + DownstreamOfCatalyticConverter = 1 << 1, + FromTheOutsideAtmosphereOrOff = 1 << 2, + PumpCommandedOnForDiagnostics = 1 << 3 + } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/EngineCoolantTemperature.cs b/OBD.NET/OBD.NET/OBDData/EngineCoolantTemperature.cs new file mode 100644 index 0000000..43cb5c4 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/EngineCoolantTemperature.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class EngineCoolantTemperature : AbstractOBDData + { + #region Properties & Fields + + public int Temperature => A - 40; + + #endregion + + #region Constructors + + public EngineCoolantTemperature() + : base(0x05, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/EngineRPM.cs b/OBD.NET/OBD.NET/OBDData/EngineRPM.cs new file mode 100644 index 0000000..5da0a5d --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/EngineRPM.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class EngineRPM : AbstractOBDData + { + #region Properties & Fields + + public double RPM => ((256 * A) + B) / 4.0; + + #endregion + + #region Constructors + + public EngineRPM() + : base(0x0C, 2) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/FuelPressure.cs b/OBD.NET/OBD.NET/OBDData/FuelPressure.cs new file mode 100644 index 0000000..57075a1 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/FuelPressure.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class FuelPressure : AbstractOBDData + { + #region Properties & Fields + + public int Pressure => 3 * A; + + #endregion + + #region Constructors + + public FuelPressure() + : base(0x0A, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/FuelSystemStatus.cs b/OBD.NET/OBD.NET/OBDData/FuelSystemStatus.cs new file mode 100644 index 0000000..ff863f4 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/FuelSystemStatus.cs @@ -0,0 +1,40 @@ +using System; + +namespace OBD.NET.OBDData +{ + public class FuelSystemStatus : AbstractOBDData + { + #region Properties & Fields + + public FuelSystemStatusValue StatusSystem1 => (FuelSystemStatusValue)A; + public FuelSystemStatusValue StatusSystem2 => (FuelSystemStatusValue)B; + + #endregion + + #region Constructors + + public FuelSystemStatus() + : base(0x03, 2) + { } + + #endregion + + #region Enums + + /// + /// https://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_1_PID_03 + /// + [Flags] + public enum FuelSystemStatusValue + { + Missing = 0, + OpenLoopDueToInsufficientEngineTemperature = 1 << 0, + ClosedLoopUsingOxygenSensorFeedbackToDetermineFuelMix = 1 << 1, + OpenLoopDueToEngineLoadOrFuelCutDueToDeceleration = 1 << 2, + OpenLoopDueToSystemFailure = 1 << 3, + ClosedLoopUsingAtLeastOneOxygenSensorButThereIsAFaultInTheFeedbackSystem = 1 << 4 + } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/IOBDData.cs b/OBD.NET/OBD.NET/OBDData/IOBDData.cs new file mode 100644 index 0000000..95afed5 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/IOBDData.cs @@ -0,0 +1,11 @@ +using System.IO; + +namespace OBD.NET.OBDData +{ + public interface IOBDData + { + int PID { get; } + + void Read(Stream stream); + } +} diff --git a/OBD.NET/OBD.NET/OBDData/IntakeAirTemperature.cs b/OBD.NET/OBD.NET/OBDData/IntakeAirTemperature.cs new file mode 100644 index 0000000..9aa1eca --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/IntakeAirTemperature.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class IntakeAirTemperature : AbstractOBDData + { + #region Properties & Fields + + public int Temperature => A - 40; + + #endregion + + #region Constructors + + public IntakeAirTemperature() + : base(0x0F, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/IntakeManifoldAbsolutePressure.cs b/OBD.NET/OBD.NET/OBDData/IntakeManifoldAbsolutePressure.cs new file mode 100644 index 0000000..71359e3 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/IntakeManifoldAbsolutePressure.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class IntakeManifoldAbsolutePressure : AbstractOBDData + { + #region Properties & Fields + + public int Pressure => A; + + #endregion + + #region Constructors + + public IntakeManifoldAbsolutePressure() + : base(0x0B, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/LongTermFuelTrimBank1.cs b/OBD.NET/OBD.NET/OBDData/LongTermFuelTrimBank1.cs new file mode 100644 index 0000000..265b15d --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/LongTermFuelTrimBank1.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class LongTermFuelTrimBank1 : AbstractOBDData + { + #region Properties & Fields + + public double Trim => (A / 1.28) - 100; + + #endregion + + #region Constructors + + public LongTermFuelTrimBank1() + : base(0x07, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/LongTermFuelTrimBank2.cs b/OBD.NET/OBD.NET/OBDData/LongTermFuelTrimBank2.cs new file mode 100644 index 0000000..6026542 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/LongTermFuelTrimBank2.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class LongTermFuelTrimBank2 : AbstractOBDData + { + #region Properties & Fields + + public double Trim => (A / 1.28) - 100; + + #endregion + + #region Constructors + + public LongTermFuelTrimBank2() + : base(0x09, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/MAFAirFlowRate.cs b/OBD.NET/OBD.NET/OBDData/MAFAirFlowRate.cs new file mode 100644 index 0000000..b56236f --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/MAFAirFlowRate.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class MAFAirFlowRate : AbstractOBDData + { + #region Properties & Fields + + public double Rate => ((256 * A) + B) / 100.0; + + #endregion + + #region Constructors + + public MAFAirFlowRate() + : base(0x10, 2) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/OBDStandards.cs b/OBD.NET/OBD.NET/OBDData/OBDStandards.cs new file mode 100644 index 0000000..6180d1b --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/OBDStandards.cs @@ -0,0 +1,56 @@ +namespace OBD.NET.OBDData +{ + public class OBDStandards : AbstractOBDData + { + #region Properties & Fields + + public OBDStandard Standard => (OBDStandard)A; + + #endregion + + #region Constructors + + public OBDStandards() + : base(0x1C, 1) + { } + + #endregion + + #region Enum + + public enum OBDStandard + { + Missing = 0, + OBDII = 1, + OBD = 2, + OBD_OBDII = 3, + OBDI = 4, + NotOBDCompliant = 5, + EOBD = 6, + EOBD_OBDII = 7, + EOBD_OBD = 8, + EOBD_OBD_OBDII = 9, + JOBD = 10, + JOBD_OBDII = 11, + JOBD_EOBD = 12, + JOBD_EOBD_OBDII = 13, + EMD = 17, + EMDPlus = 18, + HDOBDC = 19, + HDOBD = 20, + WWHOBD = 21, + HDEOBDI = 23, + HDEOBDIN = 24, + HDEOBDII = 25, + HDEOBDIIN = 26, + OBDBr1 = 28, + OBDBr2 = 29, + KOBD = 30, + IOBDI = 31, + IOBDII = 32, + HDEOBDIV = 33 + } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/OxygenSensor1.cs b/OBD.NET/OBD.NET/OBDData/OxygenSensor1.cs new file mode 100644 index 0000000..17ceb85 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/OxygenSensor1.cs @@ -0,0 +1,21 @@ +namespace OBD.NET.OBDData +{ + public class OxygenSensor1 : AbstractOBDData + { + #region Properties & Fields + + public double Voltage => A / 200.0; + public double ShortTermFuelTrim => (B / 1.28) - 100; + public bool IsSensorUsed => B != 0xFF; + + #endregion + + #region Constructors + + public OxygenSensor1() + : base(0x14, 2) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/OxygenSensor2.cs b/OBD.NET/OBD.NET/OBDData/OxygenSensor2.cs new file mode 100644 index 0000000..99e401d --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/OxygenSensor2.cs @@ -0,0 +1,21 @@ +namespace OBD.NET.OBDData +{ + public class OxygenSensor2 : AbstractOBDData + { + #region Properties & Fields + + public double Voltage => A / 200.0; + public double ShortTermFuelTrim => (B / 1.28) - 100; + public bool IsSensorUsed => B != 0xFF; + + #endregion + + #region Constructors + + public OxygenSensor2() + : base(0x15, 2) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/OxygenSensor3.cs b/OBD.NET/OBD.NET/OBDData/OxygenSensor3.cs new file mode 100644 index 0000000..0c87e93 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/OxygenSensor3.cs @@ -0,0 +1,21 @@ +namespace OBD.NET.OBDData +{ + public class OxygenSensor3 : AbstractOBDData + { + #region Properties & Fields + + public double Voltage => A / 200.0; + public double ShortTermFuelTrim => (B / 1.28) - 100; + public bool IsSensorUsed => B != 0xFF; + + #endregion + + #region Constructors + + public OxygenSensor3() + : base(0x16, 2) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/OxygenSensor4.cs b/OBD.NET/OBD.NET/OBDData/OxygenSensor4.cs new file mode 100644 index 0000000..6a75c2d --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/OxygenSensor4.cs @@ -0,0 +1,21 @@ +namespace OBD.NET.OBDData +{ + public class OxygenSensor4 : AbstractOBDData + { + #region Properties & Fields + + public double Voltage => A / 200.0; + public double ShortTermFuelTrim => (B / 1.28) - 100; + public bool IsSensorUsed => B != 0xFF; + + #endregion + + #region Constructors + + public OxygenSensor4() + : base(0x17, 2) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/OxygenSensor5.cs b/OBD.NET/OBD.NET/OBDData/OxygenSensor5.cs new file mode 100644 index 0000000..e40768b --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/OxygenSensor5.cs @@ -0,0 +1,21 @@ +namespace OBD.NET.OBDData +{ + public class OxygenSensor5 : AbstractOBDData + { + #region Properties & Fields + + public double Voltage => A / 200.0; + public double ShortTermFuelTrim => (B / 1.28) - 100; + public bool IsSensorUsed => B != 0xFF; + + #endregion + + #region Constructors + + public OxygenSensor5() + : base(0x18, 2) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/OxygenSensor6.cs b/OBD.NET/OBD.NET/OBDData/OxygenSensor6.cs new file mode 100644 index 0000000..3bc695e --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/OxygenSensor6.cs @@ -0,0 +1,21 @@ +namespace OBD.NET.OBDData +{ + public class OxygenSensor6 : AbstractOBDData + { + #region Properties & Fields + + public double Voltage => A / 200.0; + public double ShortTermFuelTrim => (B / 1.28) - 100; + public bool IsSensorUsed => B != 0xFF; + + #endregion + + #region Constructors + + public OxygenSensor6() + : base(0x19, 2) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/OxygenSensor7.cs b/OBD.NET/OBD.NET/OBDData/OxygenSensor7.cs new file mode 100644 index 0000000..fa1aba4 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/OxygenSensor7.cs @@ -0,0 +1,21 @@ +namespace OBD.NET.OBDData +{ + public class OxygenSensor7 : AbstractOBDData + { + #region Properties & Fields + + public double Voltage => A / 200.0; + public double ShortTermFuelTrim => (B / 1.28) - 100; + public bool IsSensorUsed => B != 0xFF; + + #endregion + + #region Constructors + + public OxygenSensor7() + : base(0x1A, 2) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/OxygenSensor8.cs b/OBD.NET/OBD.NET/OBDData/OxygenSensor8.cs new file mode 100644 index 0000000..ea9ea82 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/OxygenSensor8.cs @@ -0,0 +1,21 @@ +namespace OBD.NET.OBDData +{ + public class OxygenSensor8 : AbstractOBDData + { + #region Properties & Fields + + public double Voltage => A / 200.0; + public double ShortTermFuelTrim => (B / 1.28) - 100; + public bool IsSensorUsed => B != 0xFF; + + #endregion + + #region Constructors + + public OxygenSensor8() + : base(0x1B, 2) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/OxygenSensorPresent.cs b/OBD.NET/OBD.NET/OBDData/OxygenSensorPresent.cs new file mode 100644 index 0000000..24ddd51 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/OxygenSensorPresent.cs @@ -0,0 +1,26 @@ +namespace OBD.NET.OBDData +{ + public class OxygenSensorPresent : AbstractOBDData + { + #region Properties & Fields + + public bool IsSensor1Present => (A & 1 << 0) != 0; + public bool IsSensor2Present => (A & 1 << 1) != 0; + public bool IsSensor3Present => (A & 1 << 2) != 0; + public bool IsSensor4Present => (A & 1 << 3) != 0; + public bool IsSensor5Present => (A & 1 << 4) != 0; + public bool IsSensor6Present => (A & 1 << 5) != 0; + public bool IsSensor7Present => (A & 1 << 6) != 0; + public bool IsSensor8Present => (A & 1 << 7) != 0; + + #endregion + + #region Constructors + + public OxygenSensorPresent() + : base(0x13, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/OxygenSensorsPresent2.cs b/OBD.NET/OBD.NET/OBDData/OxygenSensorsPresent2.cs new file mode 100644 index 0000000..cb28605 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/OxygenSensorsPresent2.cs @@ -0,0 +1,26 @@ +namespace OBD.NET.OBDData +{ + public class OxygenSensorPresent2 : AbstractOBDData + { + #region Properties & Fields + + public bool IsSensor1Present => (A & 1 << 0) != 0; + public bool IsSensor2Present => (A & 1 << 1) != 0; + public bool IsSensor3Present => (A & 1 << 2) != 0; + public bool IsSensor4Present => (A & 1 << 3) != 0; + public bool IsSensor5Present => (A & 1 << 4) != 0; + public bool IsSensor6Present => (A & 1 << 5) != 0; + public bool IsSensor7Present => (A & 1 << 6) != 0; + public bool IsSensor8Present => (A & 1 << 7) != 0; + + #endregion + + #region Constructors + + public OxygenSensorPresent2() + : base(0x1D, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/PidsSupported01_20.cs b/OBD.NET/OBD.NET/OBDData/PidsSupported01_20.cs new file mode 100644 index 0000000..704750d --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/PidsSupported01_20.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; + +namespace OBD.NET.OBDData +{ + public class PidsSupported01_20 : AbstractOBDData + { + #region Properties & Fields + + public int[] SupportedPids + { + get + { + List supportedPids = new List(); + for (int i = 0x01; i < 0x20; i++) + switch ((int)(i / 8.0)) + { + case 0: + if ((A << (7 - i)) != 0) + supportedPids.Add(i); + break; + case 1: + if ((A << (15 - i)) != 0) + supportedPids.Add(i); + break; + case 2: + if ((A << (23 - i)) != 0) + supportedPids.Add(i); + break; + case 3: + if ((A << (31 - i)) != 0) + supportedPids.Add(i); + break; + } + return supportedPids.ToArray(); + } + } + + #endregion + + #region Constructors + + public PidsSupported01_20() + : base(0x00, 4) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/RunTimeSinceEngineStart.cs b/OBD.NET/OBD.NET/OBDData/RunTimeSinceEngineStart.cs new file mode 100644 index 0000000..14accc5 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/RunTimeSinceEngineStart.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class RunTimeSinceEngineStart : AbstractOBDData + { + #region Properties & Fields + + public int Runtime => (256 * A) + B; + + #endregion + + #region Constructors + + public RunTimeSinceEngineStart() + : base(0x1F, 2) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/ShortTermFuelTrimBank1.cs b/OBD.NET/OBD.NET/OBDData/ShortTermFuelTrimBank1.cs new file mode 100644 index 0000000..d0f8aca --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/ShortTermFuelTrimBank1.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class ShortTermFuelTrimBank1 : AbstractOBDData + { + #region Properties & Fields + + public double Trim => (A / 1.28) - 100; + + #endregion + + #region Constructors + + public ShortTermFuelTrimBank1() + : base(0x06, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/ShortTermFuelTrimBank2.cs b/OBD.NET/OBD.NET/OBDData/ShortTermFuelTrimBank2.cs new file mode 100644 index 0000000..2efc75b --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/ShortTermFuelTrimBank2.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class ShortTermFuelTrimBank2 : AbstractOBDData + { + #region Properties & Fields + + public double Trim => (A / 1.28) - 100; + + #endregion + + #region Constructors + + public ShortTermFuelTrimBank2() + : base(0x08, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/ThrottlePosition.cs b/OBD.NET/OBD.NET/OBDData/ThrottlePosition.cs new file mode 100644 index 0000000..fb330ad --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/ThrottlePosition.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class ThrottlePosition : AbstractOBDData + { + #region Properties & Fields + + public double Position => A / 2.55; + + #endregion + + #region Constructors + + public ThrottlePosition() + : base(0x11, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/TimingAdvance.cs b/OBD.NET/OBD.NET/OBDData/TimingAdvance.cs new file mode 100644 index 0000000..e9f5e66 --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/TimingAdvance.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class TimingAdvance : AbstractOBDData + { + #region Properties & Fields + + public double Timing => (A / 2.0) - 64; + + #endregion + + #region Constructors + + public TimingAdvance() + : base(0x0E, 1) + { } + + #endregion + } +} diff --git a/OBD.NET/OBD.NET/OBDData/VehicleSpeed.cs b/OBD.NET/OBD.NET/OBDData/VehicleSpeed.cs new file mode 100644 index 0000000..72129dc --- /dev/null +++ b/OBD.NET/OBD.NET/OBDData/VehicleSpeed.cs @@ -0,0 +1,19 @@ +namespace OBD.NET.OBDData +{ + public class VehicleSpeed : AbstractOBDData + { + #region Properties & Fields + + public int Speed => A; + + #endregion + + #region Constructors + + public VehicleSpeed() + : base(0x0D, 1) + { } + + #endregion + } +}