mirror of
https://github.com/DarthAffe/OBD.NET.git
synced 2025-12-12 16:58:30 +00:00
Added first set of PIDs
This commit is contained in:
parent
9607c7efa4
commit
732d50ad8f
19
OBD.NET/OBD.NET/Enums/Mode.cs
Normal file
19
OBD.NET/OBD.NET/Enums/Mode.cs
Normal file
@ -0,0 +1,19 @@
|
||||
namespace OBD.NET.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// https://en.wikipedia.org/wiki/OBD-II_PIDs#Modes
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
}
|
||||
@ -45,6 +45,39 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Enums\Mode.cs" />
|
||||
<Compile Include="OBDData\AbstractOBDData.cs" />
|
||||
<Compile Include="OBDData\AuxiliaryInputStatus.cs" />
|
||||
<Compile Include="OBDData\CommandedSecondaryAirStatus.cs" />
|
||||
<Compile Include="OBDData\EngineCoolantTemperature.cs" />
|
||||
<Compile Include="OBDData\CalculatedEngineLoad.cs" />
|
||||
<Compile Include="OBDData\EngineRPM.cs" />
|
||||
<Compile Include="OBDData\FuelPressure.cs" />
|
||||
<Compile Include="OBDData\FuelSystemStatus.cs" />
|
||||
<Compile Include="OBDData\IntakeAirTemperature.cs" />
|
||||
<Compile Include="OBDData\IntakeManifoldAbsolutePressure.cs" />
|
||||
<Compile Include="OBDData\IOBDData.cs" />
|
||||
<Compile Include="OBDData\LongTermFuelTrimBank1.cs" />
|
||||
<Compile Include="OBDData\LongTermFuelTrimBank2.cs" />
|
||||
<Compile Include="OBDData\MAFAirFlowRate.cs" />
|
||||
<Compile Include="OBDData\OBDStandards.cs" />
|
||||
<Compile Include="OBDData\OxygenSensor8.cs" />
|
||||
<Compile Include="OBDData\OxygenSensor7.cs" />
|
||||
<Compile Include="OBDData\OxygenSensor6.cs" />
|
||||
<Compile Include="OBDData\OxygenSensor5.cs" />
|
||||
<Compile Include="OBDData\OxygenSensor4.cs" />
|
||||
<Compile Include="OBDData\OxygenSensor3.cs" />
|
||||
<Compile Include="OBDData\OxygenSensor2.cs" />
|
||||
<Compile Include="OBDData\OxygenSensor1.cs" />
|
||||
<Compile Include="OBDData\OxygenSensorPresent.cs" />
|
||||
<Compile Include="OBDData\OxygenSensorsPresent2.cs" />
|
||||
<Compile Include="OBDData\PidsSupported01_20.cs" />
|
||||
<Compile Include="OBDData\RunTimeSinceEngineStart.cs" />
|
||||
<Compile Include="OBDData\ShortTermFuelTrimBank1.cs" />
|
||||
<Compile Include="OBDData\ShortTermFuelTrimBank2.cs" />
|
||||
<Compile Include="OBDData\ThrottlePosition.cs" />
|
||||
<Compile Include="OBDData\TimingAdvance.cs" />
|
||||
<Compile Include="OBDData\VehicleSpeed.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
73
OBD.NET/OBD.NET/OBDData/AbstractOBDData.cs
Normal file
73
OBD.NET/OBD.NET/OBDData/AbstractOBDData.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/AuxiliaryInputStatus.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/AuxiliaryInputStatus.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/CalculatedEngineLoad.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/CalculatedEngineLoad.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
38
OBD.NET/OBD.NET/OBDData/CommandedSecondaryAirStatus.cs
Normal file
38
OBD.NET/OBD.NET/OBDData/CommandedSecondaryAirStatus.cs
Normal file
@ -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
|
||||
|
||||
/// <summary>
|
||||
/// https://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_1_PID_12
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum CommandedSecondaryAirStatusValue
|
||||
{
|
||||
Missing = 0,
|
||||
Upstream = 1 << 0,
|
||||
DownstreamOfCatalyticConverter = 1 << 1,
|
||||
FromTheOutsideAtmosphereOrOff = 1 << 2,
|
||||
PumpCommandedOnForDiagnostics = 1 << 3
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/EngineCoolantTemperature.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/EngineCoolantTemperature.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/EngineRPM.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/EngineRPM.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/FuelPressure.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/FuelPressure.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
40
OBD.NET/OBD.NET/OBDData/FuelSystemStatus.cs
Normal file
40
OBD.NET/OBD.NET/OBDData/FuelSystemStatus.cs
Normal file
@ -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
|
||||
|
||||
/// <summary>
|
||||
/// https://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_1_PID_03
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum FuelSystemStatusValue
|
||||
{
|
||||
Missing = 0,
|
||||
OpenLoopDueToInsufficientEngineTemperature = 1 << 0,
|
||||
ClosedLoopUsingOxygenSensorFeedbackToDetermineFuelMix = 1 << 1,
|
||||
OpenLoopDueToEngineLoadOrFuelCutDueToDeceleration = 1 << 2,
|
||||
OpenLoopDueToSystemFailure = 1 << 3,
|
||||
ClosedLoopUsingAtLeastOneOxygenSensorButThereIsAFaultInTheFeedbackSystem = 1 << 4
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
11
OBD.NET/OBD.NET/OBDData/IOBDData.cs
Normal file
11
OBD.NET/OBD.NET/OBDData/IOBDData.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System.IO;
|
||||
|
||||
namespace OBD.NET.OBDData
|
||||
{
|
||||
public interface IOBDData
|
||||
{
|
||||
int PID { get; }
|
||||
|
||||
void Read(Stream stream);
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/IntakeAirTemperature.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/IntakeAirTemperature.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/IntakeManifoldAbsolutePressure.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/IntakeManifoldAbsolutePressure.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/LongTermFuelTrimBank1.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/LongTermFuelTrimBank1.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/LongTermFuelTrimBank2.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/LongTermFuelTrimBank2.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/MAFAirFlowRate.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/MAFAirFlowRate.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
56
OBD.NET/OBD.NET/OBDData/OBDStandards.cs
Normal file
56
OBD.NET/OBD.NET/OBDData/OBDStandards.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
21
OBD.NET/OBD.NET/OBDData/OxygenSensor1.cs
Normal file
21
OBD.NET/OBD.NET/OBDData/OxygenSensor1.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
21
OBD.NET/OBD.NET/OBDData/OxygenSensor2.cs
Normal file
21
OBD.NET/OBD.NET/OBDData/OxygenSensor2.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
21
OBD.NET/OBD.NET/OBDData/OxygenSensor3.cs
Normal file
21
OBD.NET/OBD.NET/OBDData/OxygenSensor3.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
21
OBD.NET/OBD.NET/OBDData/OxygenSensor4.cs
Normal file
21
OBD.NET/OBD.NET/OBDData/OxygenSensor4.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
21
OBD.NET/OBD.NET/OBDData/OxygenSensor5.cs
Normal file
21
OBD.NET/OBD.NET/OBDData/OxygenSensor5.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
21
OBD.NET/OBD.NET/OBDData/OxygenSensor6.cs
Normal file
21
OBD.NET/OBD.NET/OBDData/OxygenSensor6.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
21
OBD.NET/OBD.NET/OBDData/OxygenSensor7.cs
Normal file
21
OBD.NET/OBD.NET/OBDData/OxygenSensor7.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
21
OBD.NET/OBD.NET/OBDData/OxygenSensor8.cs
Normal file
21
OBD.NET/OBD.NET/OBDData/OxygenSensor8.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
26
OBD.NET/OBD.NET/OBDData/OxygenSensorPresent.cs
Normal file
26
OBD.NET/OBD.NET/OBDData/OxygenSensorPresent.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
26
OBD.NET/OBD.NET/OBDData/OxygenSensorsPresent2.cs
Normal file
26
OBD.NET/OBD.NET/OBDData/OxygenSensorsPresent2.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
48
OBD.NET/OBD.NET/OBDData/PidsSupported01_20.cs
Normal file
48
OBD.NET/OBD.NET/OBDData/PidsSupported01_20.cs
Normal file
@ -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<int> supportedPids = new List<int>();
|
||||
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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/RunTimeSinceEngineStart.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/RunTimeSinceEngineStart.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/ShortTermFuelTrimBank1.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/ShortTermFuelTrimBank1.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/ShortTermFuelTrimBank2.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/ShortTermFuelTrimBank2.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/ThrottlePosition.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/ThrottlePosition.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/TimingAdvance.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/TimingAdvance.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
19
OBD.NET/OBD.NET/OBDData/VehicleSpeed.cs
Normal file
19
OBD.NET/OBD.NET/OBDData/VehicleSpeed.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user