static public PID GetPID(PIDCode pidCode) { foreach (var pid in _listPIDs) { if (pid.PIDCode == pidCode) { return(pid); } } return(null); }
public bool IsPidSupported(PIDCode pidCode) { int[] list = PidsSupported; if (list != null) { return(list.FirstOrDefault(n => n == (int)pidCode) != 0); } return(false); }
public PID this[PIDCode pidCode] { get { var pid = PID.GetPID(pidCode); if (pid == null) // not registered in PID.cs { Logger?.WriteLine($"{pidCode} not found in static PID list (PID.cs)"); } return(pid); } }
public object GetValue(PIDCode pidCode) { LastResponse = Connection.WriteAndRead(PID.ToPidString(pidCode) + '\r'); if (LastResponse == null) { throw new Exception("Connection to OBD adapter lost"); } LastResponse = LastResponse.ToUpper(); var pid = PID.Parse(pidCode, this, LastResponse, CurrentEcu); Logger?.WriteLine($"{pidCode}: {pid.Value}"); return(pid.Value); }
public static PID Parse(PIDCode pidCode, ObdCommand command, string response, string ecu) { var pid = _listPIDs.FirstOrDefault(p => p.PIDCode == pidCode); if (pid == null) { throw new ArgumentException($"PIDCode {pidCode} not defined in PID.CS (_listPids)"); } var rawValue = GetRawValue(pid, response, ecu); if (rawValue != null) { pid.Value = pid.Decoder(rawValue); } return(pid); }
public static string ToPidReturn(PIDCode code) { var pidCode = ((int)code).ToString("X4"); return('4' + pidCode.Substring(1)); }
public static string ToPidString(PIDCode code) { return(((int)code).ToString("X4")); }
public OBDValue(string description, PIDCode pidCode, string value = "") { Description = description; PIDCode = pidCode; Value = value; }