Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using CAN_BUS_IO;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OBD_API {
- static class EOBD {
- public static readonly Dictionary<BaseParser.PacketInfo, IParser> ParameterTable = new Dictionary<BaseParser.PacketInfo, IParser> {
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0x0C }), new EOBD_EngineSpeed()},
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0x0D }), new EOBD_VehicleSpeed()},
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0x05 }), new EOBD_EngineTemp()},
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0x46 }), new EOBD_AmbientAirTemp()},
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0xA6 }), new EOBD_Odometer()},
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0x2F }), new EOBD_FuelTankLevelInput()},
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0x51 }), new EOBD_TypeofFuel()},
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0x5E }), new EOBD_FuelRate()},
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0x04 }), new EOBD_EngineLoad()},
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0x64 }), new EOBD_EngineTorque()},
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0x21 }), new EOBD_DistanceMIL()},
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0x5A }), new EOBD_AcceleratorPos()},
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0x10 }), new EOBD_MAFAirFlow()},
- {new BaseParser.PacketInfo(0x7DF, 0x01, new byte[]{ 0x1F }), new EOBD_TimeSinceEngineStart()}
- };
- }
- public class EOBD_EngineSpeed : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[2] { 0x1F, 0x40 };
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- public class EOBD_VehicleSpeed : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[1] { 0x64 };
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- public class EOBD_EngineTemp : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[1] { 0x3C };
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- public class EOBD_AmbientAirTemp : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[1] { 0x3C };
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- public class EOBD_Odometer : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[4] { 0x01, 0x86, 0xA0, 0x00 };
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- public class EOBD_FuelTankLevelInput : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[1] { 0x32};
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- public class EOBD_TypeofFuel : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[1] { 0x01 };
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- public class EOBD_FuelRate : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[2] { 0x01, 0x20 };
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- public class EOBD_EngineLoad : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[1] { 0x32 };
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- public class EOBD_EngineTorque : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[5] { 0x01, 0x02, 0x03, 0x04, 0x05 };
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- public class EOBD_DistanceMIL : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[2] { 0x64, 0x01 };
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- public class EOBD_AcceleratorPos : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[1] { 0x32 };
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- public class EOBD_MAFAirFlow : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[2] { 0x32, 0x01 };
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- public class EOBD_TimeSinceEngineStart : IParser {
- public void ParsePacket(BaseParser.PacketInfo input) {
- uint ID = 0x7E8;
- byte SID = (byte)(input.SID + 0x40);
- byte[] PID = input.PID;
- byte[] data = new byte[2] { 0x32, 0x01 };
- Sender.AddToQueue(BaseParser.FormResponse(ID, SID, PID, data, MessageFormat.Standard));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement