Example #1
0
        public Dictionary <int, List <int> > GetSupportedPids()
        {
            var supportedPids = new Dictionary <int, List <int> >();

            var result = ObdPort.GetPidData(0x01, 0x00);

            foreach (var payload in result)
            {
                supportedPids[payload.Key] = DecodeSupportedPids(payload.Value, 0x00);
            }

            result = ObdPort.GetPidData(0x01, 0x20);
            foreach (var payload in result)
            {
                supportedPids[payload.Key].AddRange(DecodeSupportedPids(payload.Value, 0x20));
            }

            result = ObdPort.GetPidData(0x01, 0x40);
            foreach (var payload in result)
            {
                supportedPids[payload.Key].AddRange(DecodeSupportedPids(payload.Value, 0x40));
            }

            return(supportedPids);
        }
Example #2
0
        private void Connect()
        {
            //shoudl be implemented in async likely
            ObdPort.Connect();

            if (Convert.ToInt32(ObdPort.Protocol) > 9 || ObdPort.Protocol != Protocol.Unknown)
            {
                throw new ArgumentOutOfRangeException(ObdPort.Protocol.ToString(), "Protocol must be a value between of known type Int(1 and 9), inclusive.");
            }
            if (ObdPort == null)
            {
                throw new ObdException("OBDPort not speficied.");
            }
            if (ObdPort.Connected)
            {
                InitializeDevice();
                this.Connected = true;
            }
            else
            {
                if (ObdPort == null)
                {
                    throw new ObdException("OBDPort connect failed.");
                }
            }

            FireConnectionChangedEvent(ObdPort.Connected);
        }
Example #3
0
 public void Disconnect()
 {
     ObdPort.Disconnect();
     FireConnectionChangedEvent(ObdPort.Connected);
 }
Example #4
0
 public void Connect(ObdPort obdport)
 {
     ObdPort = obdport;
     Connect();
 }
Example #5
0
 public ObdResponse GetPidData(ObdRequest req)
 {
     return(ObdPort.GetPidData(req));
 }