Inheritance: CoreSensor
Beispiel #1
0
        void init(SensorRegistry registry)
        {
            if (reader == null)
            {
                throw new Exception("Can't do double init");
            }

            reader.ReadToFollowing("parameters");

            this.Namespace   = reader.GetAttribute("namespace") ?? "Default";
            this.Description = reader.GetAttribute("description") ?? "";

            reader.ReadStartElement("parameters");

            while (reader.NodeType == XmlNodeType.Element)
            {
                if (reader.Name == "include")
                {
                    var name   = reader.ReadElementString().Trim();
                    var ecuinc = new ECUXMLSensorProvider(System.IO.Path.Combine(Path, name));
                    ecuinc.init(registry);
                    continue;
                }

                if (reader.Name != "parameter")
                {
                    reader.ReadElementString();
                    continue;
                }

                var id      = reader.GetAttribute("id");
                var display = reader.GetAttribute("display");

                reader.ReadStartElement();

                int    command     = 0;
                string clazz       = null;
                string rawcommand  = null;
                string basename    = null;
                string basenameraw = null;

                int    replyoffset = 0;
                string units       = null;

                string value   = null;
                string word    = null;
                string wordle  = null;
                string dword   = null;
                string dwordle = null;

                bool   signed  = false;
                double scale   = 1;
                double offset  = 0;
                int    bit     = -1;
                int?   cutlow  = null;
                int?   cuthigh = null;

                while (reader.NodeType == XmlNodeType.Element)
                {
                    try{
                        switch (reader.Name)
                        {
                        case "class":
                            clazz = reader.ReadElementString().Trim();
                            break;

                        case "address":
                            reader.ReadStartElement();
                            var hexval = reader.ReadElementString("byte").Trim();
                            if (hexval.StartsWith("0x"))
                            {
                                hexval = hexval.Substring(2);
                            }
                            command = int.Parse(hexval, NumberStyles.HexNumber);
                            reader.ReadEndElement();
                            break;

                        case "raw":
                            rawcommand = reader.ReadElementString().Trim().Replace(";", "\r");
                            break;

                        case "base":
                            basename = reader.ReadElementString().Trim();
                            break;

                        case "base-raw":
                            basenameraw = reader.ReadElementString().Trim();
                            break;

                        case "value":
                        case "valuea":
                            value       = reader.ReadElementString();
                            scale       = double.Parse(value, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 0;
                            break;

                        case "valueb":
                            value       = reader.ReadElementString();
                            scale       = double.Parse(value, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 1;
                            break;

                        case "valuec":
                            value       = reader.ReadElementString();
                            scale       = double.Parse(value, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 2;
                            break;

                        case "valued":
                            value       = reader.ReadElementString();
                            scale       = double.Parse(value, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 3;
                            break;

                        case "valueab":
                            word        = reader.ReadElementString();
                            scale       = double.Parse(word, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 0;
                            break;

                        case "valuebc":
                            word        = reader.ReadElementString();
                            scale       = double.Parse(word, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 1;
                            break;

                        case "valuecd":
                            word        = reader.ReadElementString();
                            scale       = double.Parse(word, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 2;
                            break;

                        case "signed":
                            signed = true;
                            reader.ReadElementString();
                            break;

                        case "offset":
                            offset = double.Parse(reader.ReadElementString(), UnitsConverter.DefaultNumberFormat);
                            break;

                        case "bit":
                            bit = int.Parse(reader.ReadElementString());
                            break;

                        case "cut-low":
                            cutlow = int.Parse(reader.ReadElementString());
                            break;

                        case "cut-high":
                            cuthigh = int.Parse(reader.ReadElementString());
                            break;

                        case "description":
                            reader.ReadStartElement();
                            while (reader.NodeType == XmlNodeType.Element)
                            {
                                switch (reader.Name)
                                {
                                case "unit":
                                    units = reader.ReadElementString().Trim();
                                    break;

                                default:
                                    reader.ReadElementString();
                                    break;
                                }
                            }
                            reader.ReadEndElement();
                            break;

                        default:
                            if (reader.Name.StartsWith("value-"))
                            {
                                replyoffset = int.Parse(reader.Name.Replace("value-", ""));
                                value       = reader.ReadElementContentAsString();
                                scale       = double.Parse(value, UnitsConverter.DefaultNumberFormat);
                            }
                            else
                            if (reader.Name.StartsWith("word-"))
                            {
                                replyoffset = int.Parse(reader.Name.Replace("word-", ""));
                                word        = reader.ReadElementContentAsString();
                                scale       = double.Parse(word, UnitsConverter.DefaultNumberFormat);
                            }
                            else
                            if (reader.Name.StartsWith("wordle-"))
                            {
                                replyoffset = int.Parse(reader.Name.Replace("wordle-", ""));
                                wordle      = reader.ReadElementContentAsString();
                                scale       = double.Parse(wordle, UnitsConverter.DefaultNumberFormat);
                            }
                            else
                            if (reader.Name.StartsWith("dword-"))
                            {
                                replyoffset = int.Parse(reader.Name.Replace("dword-", ""));
                                dword       = reader.ReadElementContentAsString();
                                scale       = double.Parse(dword, UnitsConverter.DefaultNumberFormat);
                            }
                            else
                            if (reader.Name.StartsWith("dwordle-"))
                            {
                                replyoffset = int.Parse(reader.Name.Replace("dwordle-", ""));
                                dwordle     = reader.ReadElementContentAsString();
                                scale       = double.Parse(dwordle, UnitsConverter.DefaultNumberFormat);
                            }
                            else
                            {
                                throw new Exception("unknown tag `" + reader.Name + "` while creating PID " + id);
                            }
                            break;
                        }
                    }catch (Exception e) {
                        Logger.error("ECUXMLSensorProvider", "bad sensor param: " + id, e);
                    }
                }

                Func <double, double> evaluator = (v) => {
                    if (signed)
                    {
                        if (dword != null || dwordle != null)
                        {
                            v = (double)(int)((uint)v);
                        }
                        else if (word != null || wordle != null)
                        {
                            v = (double)(short)((ushort)v);
                        }
                        else
                        {
                            v = (double)(sbyte)((byte)v);
                        }
                    }
                    var res = v * scale + offset;
                    if (bit != -1)
                    {
                        res = ((int)res >> bit) & 1;
                    }
                    if (cutlow != null)
                    {
                        res = res < cutlow ? 0 : res;
                    }
                    if (cuthigh != null)
                    {
                        res = res > cuthigh ? 0 : res;
                    }
                    return(res);
                };

                CoreSensor sensor = null;
                if (clazz != null)
                {
                    sensor = (CoreSensor)registry.CreateObject(clazz);
                }
                // OBD2 derived sensor
                else if (basename != null)
                {
                    // Custom derived sensor
                    var s = new DerivedSensor("", basename, null);
                    if (value != null)
                    {
                        s.DerivedValue = (a, b) => evaluator(a.Value);
                    }
                    sensor = s;
                }
                // RAW data from base sensor
                else if (basenameraw != null)
                {
                    // Custom derived sensor
                    var s = new DerivedSensor("", basenameraw, null);
                    if (value != null)
                    {
                        s.DerivedValue = (a, b) => evaluator((a as OBD2Sensor).getraw(replyoffset));
                    }
                    if (word != null)
                    {
                        s.DerivedValue = (a, b) => evaluator((a as OBD2Sensor).getraw_word(replyoffset));
                    }
                    if (wordle != null)
                    {
                        s.DerivedValue = (a, b) => evaluator((a as OBD2Sensor).getraw_wordle(replyoffset));
                    }
                    if (dword != null)
                    {
                        s.DerivedValue = (a, b) => evaluator((a as OBD2Sensor).getraw_dword(replyoffset));
                    }
                    if (dwordle != null)
                    {
                        s.DerivedValue = (a, b) => evaluator((a as OBD2Sensor).getraw_dwordle(replyoffset));
                    }
                    sensor = s;
                }
                // command / raw command
                else if (basename == null)
                {
                    var s = new OBD2Sensor();

                    if (value != null)
                    {
                        s.obdValue = (p) => evaluator(p.get(replyoffset));
                    }
                    if (word != null)
                    {
                        s.obdValue = (p) => evaluator(p.get_word(replyoffset));
                    }
                    sensor = s;
                }

                if (sensor != null && sensor is OBD2Sensor)
                {
                    if (rawcommand != null)
                    {
                        (sensor as OBD2Sensor).RawCommand = rawcommand;
                    }
                    else if (command != 0)
                    {
                        (sensor as OBD2Sensor).Command = command;
                    }
                }

                if (sensor != null)
                {
                    sensor.ID   = this.Namespace + "." + id;
                    sensor.Name = id;
                    //sensor.Display = display;
                    if (units != null)
                    {
                        sensor.Units = units;
                    }

                    registry.Add(sensor);
                }
                reader.ReadEndElement();
            }

            reader.ReadEndElement();
            reader.Close();
            reader = null;
        }
Beispiel #2
0
        void init(SensorRegistry registry)
        {
            if (reader == null)
            throw new Exception("Can't do double init");

            reader.ReadToFollowing("parameters");

            this.Namespace = reader.GetAttribute("namespace") ?? "Default";
            this.Description = reader.GetAttribute("description") ?? "";

            reader.ReadStartElement("parameters");

            while( reader.NodeType == XmlNodeType.Element ){

            if (reader.Name == "include")
            {
                var name = reader.ReadElementString().Trim();
                var ecuinc = new ECUXMLSensorProvider(System.IO.Path.Combine(Path, name));
                ecuinc.init(registry);
                continue;
            }

            if (reader.Name != "parameter")
            {
                reader.ReadElementString();
                continue;
            }

            var id = reader.GetAttribute("id");
            var display = reader.GetAttribute("display");

            reader.ReadStartElement();

            int command = 0;
            string clazz = null;
            string rawcommand = null;
            string basename = null;
            string basenameraw = null;

            int    replyoffset = 0;
            string units = null;

            string value = null;
            string word = null;
            string wordle = null;
            string dword = null;
            string dwordle = null;

            bool signed = false;
            double scale = 1;
            double offset = 0;
            int bit = -1;
            int? cutlow = null;
            int? cuthigh = null;

            while(reader.NodeType == XmlNodeType.Element)
            {
                try{
                    switch(reader.Name)
                    {
                        case "class":
                            clazz = reader.ReadElementString().Trim();
                            break;
                        case "address":
                            reader.ReadStartElement();
                            var hexval = reader.ReadElementString("byte").Trim();
                            if (hexval.StartsWith("0x"))
                                hexval = hexval.Substring(2);
                            command = int.Parse(hexval, NumberStyles.HexNumber);
                            reader.ReadEndElement();
                            break;
                        case "raw":
                            rawcommand = reader.ReadElementString().Trim().Replace(";", "\r");
                            break;
                        case "base":
                            basename = reader.ReadElementString().Trim();
                            break;
                        case "base-raw":
                            basenameraw = reader.ReadElementString().Trim();
                            break;

                        case "value":
                        case "valuea":
                            value = reader.ReadElementString();
                            scale = double.Parse(value, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 0;
                            break;
                        case "valueb":
                            value = reader.ReadElementString();
                            scale = double.Parse(value, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 1;
                            break;
                        case "valuec":
                            value = reader.ReadElementString();
                            scale = double.Parse(value, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 2;
                            break;
                        case "valued":
                            value = reader.ReadElementString();
                            scale = double.Parse(value, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 3;
                            break;

                        case "valueab":
                            word = reader.ReadElementString();
                            scale = double.Parse(word, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 0;
                            break;
                        case "valuebc":
                            word = reader.ReadElementString();
                            scale = double.Parse(word, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 1;
                            break;
                        case "valuecd":
                            word = reader.ReadElementString();
                            scale = double.Parse(word, UnitsConverter.DefaultNumberFormat);
                            replyoffset = 2;
                            break;

                        case "signed":
                            signed = true;
                            reader.ReadElementString();
                            break;
                        case "offset":
                            offset = double.Parse(reader.ReadElementString(), UnitsConverter.DefaultNumberFormat);
                            break;
                        case "bit":
                            bit = int.Parse(reader.ReadElementString());
                            break;
                        case "cut-low":
                            cutlow = int.Parse(reader.ReadElementString());
                            break;
                        case "cut-high":
                            cuthigh = int.Parse(reader.ReadElementString());
                            break;
                        case "description":
                            reader.ReadStartElement();
                            while(reader.NodeType == XmlNodeType.Element)
                            {
                                switch(reader.Name)
                                {
                                    case "unit":
                                        units = reader.ReadElementString().Trim();
                                        break;
                                    default:
                                        reader.ReadElementString();
                                        break;
                                }
                            }
                            reader.ReadEndElement();
                            break;
                        default:
                            if (reader.Name.StartsWith("value-"))
                            {
                                replyoffset = int.Parse(reader.Name.Replace("value-",""));
                                value = reader.ReadElementContentAsString();
                                scale = double.Parse(value, UnitsConverter.DefaultNumberFormat);
                            }else
                            if (reader.Name.StartsWith("word-"))
                            {
                                replyoffset = int.Parse(reader.Name.Replace("word-",""));
                                word = reader.ReadElementContentAsString();
                                scale = double.Parse(word, UnitsConverter.DefaultNumberFormat);
                            }else
                            if (reader.Name.StartsWith("wordle-"))
                            {
                                replyoffset = int.Parse(reader.Name.Replace("wordle-",""));
                                wordle = reader.ReadElementContentAsString();
                                scale = double.Parse(wordle, UnitsConverter.DefaultNumberFormat);
                            }else
                            if (reader.Name.StartsWith("dword-"))
                            {
                                replyoffset = int.Parse(reader.Name.Replace("dword-",""));
                                dword = reader.ReadElementContentAsString();
                                scale = double.Parse(dword, UnitsConverter.DefaultNumberFormat);
                            }else
                            if (reader.Name.StartsWith("dwordle-"))
                            {
                                replyoffset = int.Parse(reader.Name.Replace("dwordle-",""));
                                dwordle = reader.ReadElementContentAsString();
                                scale = double.Parse(dwordle, UnitsConverter.DefaultNumberFormat);
                            }else
                            {
                                throw new Exception("unknown tag `"+reader.Name+"` while creating PID "+id);
                            }
                            break;
                    }
                }catch(Exception e){
                    Logger.error("ECUXMLSensorProvider", "bad sensor param: "+id, e);
                }
            }

            Func<double, double> evaluator = (v) => {
                if (signed){
                    if (dword != null || dwordle != null)
                        v = (double)(int)((uint)v);
                    else if (word != null || wordle != null)
                        v = (double)(short)((ushort)v);
                    else
                        v = (double)(sbyte)((byte)v);
                }
                var res = v * scale + offset;
                if (bit != -1)
                    res = ((int)res >> bit)&1;
                if (cutlow != null)
                    res = res < cutlow ? 0 : res;
                if (cuthigh != null)
                    res = res > cuthigh ? 0 : res;
                return res;
            };

            CoreSensor sensor = null;
            if (clazz != null)
            {
                sensor = (CoreSensor)registry.CreateObject(clazz);
            }
            // OBD2 derived sensor
            else if (basename != null)
            {
                // Custom derived sensor
                var s = new DerivedSensor("", basename, null);
                if (value != null)
                {
                    s.DerivedValue = (a,b) => evaluator(a.Value);
                }
                sensor = s;
            }
            // RAW data from base sensor
            else if (basenameraw != null)
            {
                // Custom derived sensor
                var s = new DerivedSensor("", basenameraw, null);
                if (value != null)
                {
                    s.DerivedValue = (a,b) => evaluator((a as OBD2Sensor).getraw(replyoffset));
                }
                if (word != null)
                {
                    s.DerivedValue = (a,b) => evaluator((a as OBD2Sensor).getraw_word(replyoffset));
                }
                if (wordle != null)
                {
                    s.DerivedValue = (a,b) => evaluator((a as OBD2Sensor).getraw_wordle(replyoffset));
                }
                if (dword != null)
                {
                    s.DerivedValue = (a,b) => evaluator((a as OBD2Sensor).getraw_dword(replyoffset));
                }
                if (dwordle != null)
                {
                    s.DerivedValue = (a,b) => evaluator((a as OBD2Sensor).getraw_dwordle(replyoffset));
                }
                sensor = s;
            }
            // command / raw command
            else if (basename == null)
            {
                var s = new OBD2Sensor();

                if (value != null)
                {
                    s.obdValue = (p) => evaluator(p.get(replyoffset));
                }
                if (word != null)
                {
                    s.obdValue = (p) => evaluator(p.get_word(replyoffset));
                }
                sensor = s;
            }

            if (sensor != null && sensor is OBD2Sensor)
            {
                if (rawcommand != null)
                    (sensor as OBD2Sensor).RawCommand = rawcommand;
                else if (command != 0)
                    (sensor as OBD2Sensor).Command = command;
            }

            if (sensor != null)
            {
                sensor.ID = this.Namespace+"."+id;
                sensor.Name = id;
                //sensor.Display = display;
                if (units != null)
                    sensor.Units = units;

                registry.Add(sensor);
            }
            reader.ReadEndElement();
            }

            reader.ReadEndElement();
            reader.Close();
            reader = null;
        }
Beispiel #3
0
        public void Activate(SensorRegistry registry)
        {
            CoreSensor s;

            // ToyotaPID_A1
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_A1",
                Name = "PID_A1",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xA1,

            };

            registry.Add(s);

            // ToyotaPID_A2
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_A2",
                Name = "PID_A2",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xA2,

            };

            registry.Add(s);

            // ToyotaPID_A3
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_A3",
                Name = "PID_A3",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xA3,

            };

            registry.Add(s);

            // ToyotaPID_A8
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_A8",
                Name = "PID_A8",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xA8,

            };

            registry.Add(s);

            // ToyotaPID_A9
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_A9",
                Name = "PID_A9",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xA9,

            };

            registry.Add(s);

            // ToyotaPID_AA
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_AA",
                Name = "PID_AA",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xAA,

            };

            registry.Add(s);

            // ToyotaPID_AC
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_AC",
                Name = "PID_AC",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xAC,

            };

            registry.Add(s);

            // ToyotaPID_B1
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B1",
                Name = "PID_B1",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xB1,

            };

            registry.Add(s);

            // ToyotaPID_B2
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B2",
                Name = "PID_B2",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xB2,

            };

            registry.Add(s);

            // ToyotaPID_B2
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B2",
                Name = "PID_B2",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x01);
                      },

                Command = 0xB2,

            };

            registry.Add(s);

            // ToyotaPID_B2
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B2",
                Name = "PID_B2",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x02);
                      },

                Command = 0xB2,

            };

            registry.Add(s);

            // ToyotaPID_B2
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B2",
                Name = "PID_B2",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x03);
                      },

                Command = 0xB2,

            };

            registry.Add(s);

            // ToyotaPID_B2
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B2",
                Name = "PID_B2",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x04);
                      },

                Command = 0xB2,

            };

            registry.Add(s);

            // ToyotaPID_B2
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B2",
                Name = "PID_B2",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x05);
                      },

                Command = 0xB2,

            };

            registry.Add(s);

            // ToyotaPID_B3
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B3",
                Name = "PID_B3",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 1);
                      },

                Command = 0xB3,

            };

            registry.Add(s);

            // ToyotaPID_B3
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B3",
                Name = "PID_B3",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 2);
                      },

                Command = 0xB3,

            };

            registry.Add(s);

            // ToyotaPID_B3
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B3",
                Name = "PID_B3",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 3);
                      },

                Command = 0xB3,

            };

            registry.Add(s);

            // ToyotaPID_B3
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B3",
                Name = "PID_B3",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 4);
                      },

                Command = 0xB3,

            };

            registry.Add(s);

            // ToyotaPID_B3
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B3",
                Name = "PID_B3",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 5);
                      },

                Command = 0xB3,

            };

            registry.Add(s);

            // ToyotaPID_B3
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B3",
                Name = "PID_B3",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 6);
                      },

                Command = 0xB3,

            };

            registry.Add(s);

            // ToyotaPID_B3
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B3",
                Name = "PID_B3",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x02);
                      },

                Command = 0xB3,

            };

            registry.Add(s);

            // ToyotaPID_B3
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B3",
                Name = "PID_B3",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x03);
                      },

                Command = 0xB3,

            };

            registry.Add(s);

            // ToyotaPID_B3
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B3",
                Name = "PID_B3",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x04);
                      },

                Command = 0xB3,

            };

            registry.Add(s);

            // ToyotaPID_B3
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_B3",
                Name = "PID_B3",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x05);
                      },

                Command = 0xB3,

            };

            registry.Add(s);

            // ToyotaATFTemp
            s = new OBD2Sensor()
            {
                ID = "Toyota.ATFTemp",
                Name = "ATFTemp",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x0) - 40;
                      },

                Command = 0xB4,

            };

            registry.Add(s);

            // ToyotaPID_C3
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_C3",
                Name = "PID_C3",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xC3,

            };

            registry.Add(s);

            // ToyotaPID_D1
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_D1",
                Name = "PID_D1",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xD1,

            };

            registry.Add(s);

            // ToyotaPID_DA
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_DA",
                Name = "PID_DA",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00) * 2.5;
                      },

                Command = 0xDA,

            };

            registry.Add(s);

            // ToyotaPID_DA
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_DA",
                Name = "PID_DA",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x02) * 2.5;
                      },

                Command = 0xDA,

            };

            registry.Add(s);

            // ToyotaPID_DA
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_DA",
                Name = "PID_DA",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x04) * 2.5;
                      },

                Command = 0xDA,

            };

            registry.Add(s);

            // ToyotaPID_E1
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E1",
                Name = "PID_E1",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xE1,

            };

            registry.Add(s);

            // ToyotaPID_E2
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E2",
                Name = "PID_E2",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xE2,

            };

            registry.Add(s);

            // ToyotaFuelPressureExt
            s = new OBD2Sensor()
            {
                ID = "Toyota.FuelPressureExt",
                Name = "FuelPressureExt",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00) * 816 / 255;
                      },

                Command = 0xE3,

            };

            registry.Add(s);

            // ToyotaInjectorPulseWidth
            s = new OBD2Sensor()
            {
                ID = "Toyota.InjectorPulseWidth",
                Name = "InjectorPulseWidth",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(0x00) * (32.60/255));
                      },

                Command = 0xE4,

            };

            s.Units = "ms";

            registry.Add(s);

            // ToyotaIdleDutyCycle
            s = new OBD2Sensor()
            {
                ID = "Toyota.IdleDutyCycle",
                Name = "IdleDutyCycle",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(0x00) * (99.4/255));
                      },

                Command = 0xE6,

            };

            s.Units = "%";

            registry.Add(s);

            // ToyotaPID_E7
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E7",
                Name = "PID_E7",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xE7,

            };

            registry.Add(s);

            // ToyotaPID_E8
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E8",
                Name = "PID_E8",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 1);
                      },

                Command = 0xE8,

            };

            registry.Add(s);

            // ToyotaPID_E8
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E8",
                Name = "PID_E8",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 2);
                      },

                Command = 0xE8,

            };

            registry.Add(s);

            // ToyotaPID_E8
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E8",
                Name = "PID_E8",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 3);
                      },

                Command = 0xE8,

            };

            registry.Add(s);

            // ToyotaAT_NP
            s = new OBD2Sensor()
            {
                ID = "Toyota.AT_NP",
                Name = "AT_NP",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 4);
                      },

                Command = 0xE8,

            };

            registry.Add(s);

            // ToyotaPID_E8
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E8",
                Name = "PID_E8",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 5);
                      },

                Command = 0xE8,

            };

            registry.Add(s);

            // ToyotaPID_E8
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E8",
                Name = "PID_E8",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 6);
                      },

                Command = 0xE8,

            };

            registry.Add(s);

            // ToyotaPID_E8
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E8",
                Name = "PID_E8",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 7);
                      },

                Command = 0xE8,

            };

            registry.Add(s);

            // ToyotaPID_E8
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E8",
                Name = "PID_E8",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x01, 0);
                      },

                Command = 0xE8,

            };

            registry.Add(s);

            // ToyotaPID_E8
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E8",
                Name = "PID_E8",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x01, 1);
                      },

                Command = 0xE8,

            };

            registry.Add(s);

            // ToyotaPID_E8
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E8",
                Name = "PID_E8",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x02, 0);
                      },

                Command = 0xE8,

            };

            registry.Add(s);

            // ToyotaPID_E8
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E8",
                Name = "PID_E8",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x02, 6);
                      },

                Command = 0xE8,

            };

            registry.Add(s);

            // ToyotaPID_E8
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_E8",
                Name = "PID_E8",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x02, 7);
                      },

                Command = 0xE8,

            };

            registry.Add(s);

            // ToyotaPID_EC
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EC",
                Name = "PID_EC",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xEC,

            };

            registry.Add(s);

            // ToyotaPID_ED
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_ED",
                Name = "PID_ED",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xED,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x01);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x02);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x03);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x04);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x05);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x06);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x07);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x08);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x11);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x12);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x13);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x14);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x15);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x16);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x17);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x18);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x21);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x22);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x24);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x25);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x26);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x27);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x28);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x31);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x32);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x33);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x34);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x35);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x36);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x37);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_EF
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_EF",
                Name = "PID_EF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x38);
                      },

                Command = 0xEF,

            };

            registry.Add(s);

            // ToyotaPID_F7
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_F7",
                Name = "PID_F7",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xF7,

            };

            registry.Add(s);

            // ToyotaShiftPosition
            s = new OBD2Sensor()
            {
                ID = "Toyota.ShiftPosition",
                Name = "ShiftPosition",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0xF8,

            };

            registry.Add(s);

            // ToyotaAT_L
            s = new OBD2Sensor()
            {
                ID = "Toyota.AT_L",
                Name = "AT_L",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 1-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaAT_2
            s = new OBD2Sensor()
            {
                ID = "Toyota.AT_2",
                Name = "AT_2",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 2-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaAT_R
            s = new OBD2Sensor()
            {
                ID = "Toyota.AT_R",
                Name = "AT_R",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 3-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaPID_F9
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_F9",
                Name = "PID_F9",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 4-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaAT_OD
            s = new OBD2Sensor()
            {
                ID = "Toyota.AT_OD",
                Name = "AT_OD",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 5-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaAT_Kickdown
            s = new OBD2Sensor()
            {
                ID = "Toyota.AT_Kickdown",
                Name = "AT_Kickdown",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 6-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaStopSignals
            s = new OBD2Sensor()
            {
                ID = "Toyota.StopSignals",
                Name = "StopSignals",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 7-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaPID_F9
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_F9",
                Name = "PID_F9",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 8-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaAT_3
            s = new OBD2Sensor()
            {
                ID = "Toyota.AT_3",
                Name = "AT_3",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x01, 1-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaAT_D
            s = new OBD2Sensor()
            {
                ID = "Toyota.AT_D",
                Name = "AT_D",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x01, 3-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaPID_F9
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_F9",
                Name = "PID_F9",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x01, 4-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaPID_F9
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_F9",
                Name = "PID_F9",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x01, 5-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaPID_F9
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_F9",
                Name = "PID_F9",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x01, 6-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaPID_F9
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_F9",
                Name = "PID_F9",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x01, 7-1);
                      },

                Command = 0xF9,

            };

            registry.Add(s);

            // ToyotaPID_FB
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_FB",
                Name = "PID_FB",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 1-1);
                      },

                Command = 0xFB,

            };

            registry.Add(s);

            // ToyotaPID_FB
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_FB",
                Name = "PID_FB",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 2-1);
                      },

                Command = 0xFB,

            };

            registry.Add(s);

            // ToyotaPID_FB
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_FB",
                Name = "PID_FB",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 3-1);
                      },

                Command = 0xFB,

            };

            registry.Add(s);

            // ToyotaPID_FB
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_FB",
                Name = "PID_FB",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 4-1);
                      },

                Command = 0xFB,

            };

            registry.Add(s);

            // ToyotaPID_FB
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_FB",
                Name = "PID_FB",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 5-1);
                      },

                Command = 0xFB,

            };

            registry.Add(s);

            // ToyotaPID_FB
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_FB",
                Name = "PID_FB",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 6-1);
                      },

                Command = 0xFB,

            };

            registry.Add(s);

            // ToyotaPID_FB
            s = new OBD2Sensor()
            {
                ID = "Toyota.PID_FB",
                Name = "PID_FB",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get_bit(0x00, 7-1);
                      },

                Command = 0xFB,

            };

            registry.Add(s);
        }
Beispiel #4
0
        public void Activate(SensorRegistry registry)
        {
            CoreSensor s;

            // OBD2DTCFRZF
            s = new OBD2Sensor()
            {
                ID = "OBD2.DTCFRZF",
                Name = "DTCFRZF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0x02,

            };

            registry.Add(s);

            // OBD2FuelSystemStatus
            s = new OBD2Sensor()
            {
                ID = "OBD2.FuelSystemStatus",
                Name = "FuelSystemStatus",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return ((int)get(0)<<8) + (p.len() > 1 ? get(1) : 0);
                      },

                Command = 0x03,

            };

            registry.Add(s);

            // OBD2EngineLoad
            s = new OBD2Sensor()
            {
                ID = "OBD2.EngineLoad",
                Name = "EngineLoad",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0) * 100 / 255;
                      },

                Command = 0x04,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2CoolantTemp
            s = new OBD2Sensor()
            {
                ID = "OBD2.CoolantTemp",
                Name = "CoolantTemp",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0)-40;
                      },

                Command = 0x05,

            };

            s.Units = "celsius";

            registry.Add(s);

            // OBD2STFT1
            s = new OBD2Sensor()
            {
                ID = "OBD2.STFT1",
                Name = "STFT1",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(0)-128) * 100/128;
                      },

                Command = 0x06,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2LTFT1
            s = new OBD2Sensor()
            {
                ID = "OBD2.LTFT1",
                Name = "LTFT1",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(0)-128) * 100/128;
                      },

                Command = 0x07,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2STFT2
            s = new OBD2Sensor()
            {
                ID = "OBD2.STFT2",
                Name = "STFT2",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(0)-128) * 100/128;
                      },

                Command = 0x08,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2LTFT2
            s = new OBD2Sensor()
            {
                ID = "OBD2.LTFT2",
                Name = "LTFT2",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(0)-128) * 100/128;
                      },

                Command = 0x09,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2FuelPressure
            s = new OBD2Sensor()
            {
                ID = "OBD2.FuelPressure",
                Name = "FuelPressure",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0)*3;
                      },

                Command = 0x0A,

            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2IntakeManifoldPressure
            s = new OBD2Sensor()
            {
                ID = "OBD2.IntakeManifoldPressure",
                Name = "IntakeManifoldPressure",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0);
                      },

                Command = 0x0B,

            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2RPM
            s = new OBD2Sensor()
            {
                ID = "OBD2.RPM",
                Name = "RPM",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(0)*256 + get(1)) / 4;
                      },

                Command = 0x0C,

            };

            s.Units = "rpm";

            registry.Add(s);

            // OBD2Speed
            s = new OBD2Sensor()
            {
                ID = "OBD2.Speed",
                Name = "Speed",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00);
                      },

                Command = 0x0D,

            };

            s.Units = "kph";

            registry.Add(s);

            // OBD2TimingAdvance
            s = new OBD2Sensor()
            {
                ID = "OBD2.TimingAdvance",
                Name = "TimingAdvance",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00)/2 - 64;
                      },

                Command = 0x0E,

            };

            s.Units = "°";

            registry.Add(s);

            // OBD2IntakeAirTemp
            s = new OBD2Sensor()
            {
                ID = "OBD2.IntakeAirTemp",
                Name = "IntakeAirTemp",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0x00) - 40;
                      },

                Command = 0x0F,

            };

            s.Units = "celsius";

            registry.Add(s);

            // OBD2MAF
            s = new OBD2Sensor()
            {
                ID = "OBD2.MAF",
                Name = "MAF",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return ((get(0)*256)+get(1)) / 100;
                      },

                Command = 0x10,

            };

            s.Units = "gr/sec";

            registry.Add(s);

            // OBD2ThrottlePosition
            s = new OBD2Sensor()
            {
                ID = "OBD2.ThrottlePosition",
                Name = "ThrottlePosition",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0)*100 / 255;
                      },

                Command = 0x11,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b1s1
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b1s1",
                Name = "Oxygen_b1s1",

                      obdValue = (p) => { return p.get(0)*0.005; },

                Command = 0x14,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b1s1_stft
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b1s1_stft",
                Name = "Oxygen_b1s1_stft",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(1)-128)*100/128;
                      },

                Command = 0x14,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b1s2
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b1s2",
                Name = "Oxygen_b1s2",

                      obdValue = (p) => { return p.get(0)*0.005; },

                Command = 0x15,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b1s2_stft
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b1s2_stft",
                Name = "Oxygen_b1s2_stft",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(1)-128)*100/128;
                      },

                Command = 0x15,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b1s3
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b1s3",
                Name = "Oxygen_b1s3",

                      obdValue = (p) => { return p.get(0)*0.005; },

                Command = 0x16,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b1s3_stft
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b1s3_stft",
                Name = "Oxygen_b1s3_stft",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(1)-128)*100/128;
                      },

                Command = 0x16,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b1s4
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b1s4",
                Name = "Oxygen_b1s4",

                      obdValue = (p) => { return p.get(0)*0.005; },

                Command = 0x17,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b1s4_stft
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b1s4_stft",
                Name = "Oxygen_b1s4_stft",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(1)-128)*100/128;
                      },

                Command = 0x17,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b2s1
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b2s1",
                Name = "Oxygen_b2s1",

                      obdValue = (p) => { return p.get(0)*0.005; },

                Command = 0x18,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b2s1_stft
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b2s1_stft",
                Name = "Oxygen_b2s1_stft",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(1)-128)*100/128;
                      },

                Command = 0x18,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b2s2
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b2s2",
                Name = "Oxygen_b2s2",

                      obdValue = (p) => { return p.get(0)*0.005; },

                Command = 0x19,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b2s2_stft
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b2s2_stft",
                Name = "Oxygen_b2s2_stft",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(1)-128)*100/128;
                      },

                Command = 0x19,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b2s3
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b2s3",
                Name = "Oxygen_b2s3",

                      obdValue = (p) => { return p.get(0)*0.005; },

                Command = 0x1a,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b2s3_stft
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b2s3_stft",
                Name = "Oxygen_b2s3_stft",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(1)-128)*100/128;
                      },

                Command = 0x1a,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b2s4
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b2s4",
                Name = "Oxygen_b2s4",

                      obdValue = (p) => { return p.get(0)*0.005; },

                Command = 0x1b,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b2s4_stft
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen_b2s4_stft",
                Name = "Oxygen_b2s4_stft",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(1)-128)*100/128;
                      },

                Command = 0x1b,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Lambda_b1s1
            s = new OBD2Sensor()
            {
                ID = "OBD2.Lambda_b1s1",
                Name = "Lambda_b1s1",

                      obdValue = (p) => { return p.getab()*2 / 65535; },

                Command = 0x24,

            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b1s1
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen2_b1s1",
                Name = "Oxygen2_b1s1",

                      obdValue = (p) => { return p.getcd()*8 / 65535; },

                Command = 0x24,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b1s2
            s = new OBD2Sensor()
            {
                ID = "OBD2.Lambda_b1s2",
                Name = "Lambda_b1s2",

                      obdValue = (p) => { return p.getab()*2 / 65535; },

                Command = 0x25,

            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b1s2
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen2_b1s2",
                Name = "Oxygen2_b1s2",

                      obdValue = (p) => { return p.getcd()*8 / 65535; },

                Command = 0x25,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b2s1
            s = new OBD2Sensor()
            {
                ID = "OBD2.Lambda_b2s1",
                Name = "Lambda_b2s1",

                      obdValue = (p) => { return p.getab()*2 / 65535; },

                Command = 0x26,

            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b2s1
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen2_b2s1",
                Name = "Oxygen2_b2s1",

                      obdValue = (p) => { return p.getcd()*8 / 65535; },

                Command = 0x26,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b2s2
            s = new OBD2Sensor()
            {
                ID = "OBD2.Lambda_b2s2",
                Name = "Lambda_b2s2",

                      obdValue = (p) => { return p.getab()*2 / 65535; },

                Command = 0x27,

            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b2s2
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen2_b2s2",
                Name = "Oxygen2_b2s2",

                      obdValue = (p) => { return p.getcd()*8 / 65535; },

                Command = 0x27,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b3s1
            s = new OBD2Sensor()
            {
                ID = "OBD2.Lambda_b3s1",
                Name = "Lambda_b3s1",

                      obdValue = (p) => { return p.getab()*2 / 65535; },

                Command = 0x28,

            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b3s1
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen2_b3s1",
                Name = "Oxygen2_b3s1",

                      obdValue = (p) => { return p.getcd()*8 / 65535; },

                Command = 0x28,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b3s2
            s = new OBD2Sensor()
            {
                ID = "OBD2.Lambda_b3s2",
                Name = "Lambda_b3s2",

                      obdValue = (p) => { return p.getab()*2 / 65535; },

                Command = 0x29,

            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b3s2
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen2_b3s2",
                Name = "Oxygen2_b3s2",

                      obdValue = (p) => { return p.getcd()*8 / 65535; },

                Command = 0x29,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b4s1
            s = new OBD2Sensor()
            {
                ID = "OBD2.Lambda_b4s1",
                Name = "Lambda_b4s1",

                      obdValue = (p) => { return p.getab()*2 / 65535; },

                Command = 0x2a,

            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b4s1
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen2_b4s1",
                Name = "Oxygen2_b4s1",

                      obdValue = (p) => { return p.getcd()*8 / 65535; },

                Command = 0x2a,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b4s2
            s = new OBD2Sensor()
            {
                ID = "OBD2.Lambda_b4s2",
                Name = "Lambda_b4s2",

                      obdValue = (p) => { return p.getab()*2 / 65535; },

                Command = 0x2b,

            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b4s2
            s = new OBD2Sensor()
            {
                ID = "OBD2.Oxygen2_b4s2",
                Name = "Oxygen2_b4s2",

                      obdValue = (p) => { return p.getcd()*8 / 65535; },

                Command = 0x2b,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2OBDSupport
            s = new OBD2Sensor()
            {
                ID = "OBD2.OBDSupport",
                Name = "OBDSupport",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0);
                      },

                Command = 0x1C,

            };

            registry.Add(s);

            // OBD2RunTime
            s = new OBD2Sensor()
            {
                ID = "OBD2.RunTime",
                Name = "RunTime",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0)*256 + get(1);
                      },

                Command = 0x1F,

            };

            s.Units = "sec";

            registry.Add(s);

            // OBD2DistanceMIL
            s = new OBD2Sensor()
            {
                ID = "OBD2.DistanceMIL",
                Name = "DistanceMIL",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0)*256 + get(1);
                      },

                Command = 0x21,

            };

            s.Units = "km";

            registry.Add(s);

            // OBD2FuelRailPressure_rel
            s = new OBD2Sensor()
            {
                ID = "OBD2.FuelRailPressure_rel",
                Name = "FuelRailPressure_rel",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (((get(0)*256)+get(1)) * 10) / 128;
                      },

                Command = 0x22,

            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2FuelRailPressure_diesel
            s = new OBD2Sensor()
            {
                ID = "OBD2.FuelRailPressure_diesel",
                Name = "FuelRailPressure_diesel",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (((get(0)*256)+get(1)) * 10);
                      },

                Command = 0x23,

            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2CommandedEGR
            s = new OBD2Sensor()
            {
                ID = "OBD2.CommandedEGR",
                Name = "CommandedEGR",

                      obdValue = (p) => { return p.get(0)*100/255; },

                Command = 0x2C,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2EGRError
            s = new OBD2Sensor()
            {
                ID = "OBD2.EGRError",
                Name = "EGRError",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(0)-128)*100/128;
                      },

                Command = 0x2D,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Commanded_EVAP
            s = new OBD2Sensor()
            {
                ID = "OBD2.Commanded_EVAP",
                Name = "Commanded_EVAP",

                      obdValue = (p) => { return p.get(0)*100/255; },

                Command = 0x2E,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2FuelLevel
            s = new OBD2Sensor()
            {
                ID = "OBD2.FuelLevel",
                Name = "FuelLevel",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return 100*get(0)/255;
                      },

                Command = 0x2F,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2DistanceMILCleared
            s = new OBD2Sensor()
            {
                ID = "OBD2.DistanceMILCleared",
                Name = "DistanceMILCleared",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0)*256 + get(1);
                      },

                Command = 0x31,

            };

            s.Units = "km";

            registry.Add(s);

            // OBD2VaporPressure
            s = new OBD2Sensor()
            {
                ID = "OBD2.VaporPressure",
                Name = "VaporPressure",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (((get(0)*256)+get(1)) / 4);
                      },

                Command = 0x32,

            };

            s.Units = "Pa";

            registry.Add(s);

            // OBD2BaroPressure
            s = new OBD2Sensor()
            {
                ID = "OBD2.BaroPressure",
                Name = "BaroPressure",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0);
                      },

                Command = 0x33,

            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2ControlModuleVoltage
            s = new OBD2Sensor()
            {
                ID = "OBD2.ControlModuleVoltage",
                Name = "ControlModuleVoltage",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (((get(0)*256)+get(1)) / 1000);
                      },

                Command = 0x42,

            };

            s.Units = "V";

            registry.Add(s);

            // OBD2AbsoluteLoadValue
            s = new OBD2Sensor()
            {
                ID = "OBD2.AbsoluteLoadValue",
                Name = "AbsoluteLoadValue",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (((get(0)*256)+get(1)) * 100 / 255);
                      },

                Command = 0x43,

            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Lambda
            s = new OBD2Sensor()
            {
                ID = "OBD2.Lambda",
                Name = "Lambda",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(0)*256 + get(1)) * 2.0 / 65535;
                      },

                Command = 0x44,

            };

            registry.Add(s);

            // OBD2AirTemp
            s = new OBD2Sensor()
            {
                ID = "OBD2.AirTemp",
                Name = "AirTemp",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return get(0) - 40;
                      },

                Command = 0x46,

            };

            s.Units = "celsius";

            registry.Add(s);

            // OBD2EngineOilTemp
            s = new OBD2Sensor()
            {
                ID = "OBD2.EngineOilTemp",
                Name = "EngineOilTemp",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (get(0)-40 );
                      },

                Command = 0x5C,

            };

            s.Units = "celsius";

            registry.Add(s);

            // OBD2FuelInjectionTiming
            s = new OBD2Sensor()
            {
                ID = "OBD2.FuelInjectionTiming",
                Name = "FuelInjectionTiming",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (((get(0)*256)+get(1) - 26880) / 128);
                      },

                Command = 0x5D,

            };

            s.Units = "degree";

            registry.Add(s);

            // OBD2LitersPerHour
            s = new OBD2Sensor()
            {
                ID = "OBD2.LitersPerHour",
                Name = "LitersPerHour",

                      obdValue = (p) => { Func<int, double> get = p.get; Func<int, int, double> get_bit = p.get_bit;
                        return (((get(0)*256)+get(1)) * 0.05);
                      },

                Command = 0x5E,

            };

            s.Units = "lphour";

            registry.Add(s);

            // OBD2TCA_CINP
            s = new OBD2Sensor()
            {
                ID = "OBD2.TCA_CINP",
                Name = "TCA_CINP",

                      obdValue = (p) => { return p.get(1)*1; },

                Command = 0x6F,

            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2TCB_CINP
            s = new OBD2Sensor()
            {
                ID = "OBD2.TCB_CINP",
                Name = "TCB_CINP",

                      obdValue = (p) => { return p.get(2)*1; },

                Command = 0x6F,

            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2EP_1
            s = new OBD2Sensor()
            {
                ID = "OBD2.EP_1",
                Name = "EP_1",

                      obdValue = (p) => { return p.getbc()*0.01; },

                Command = 0x73,

            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2EP_2
            s = new OBD2Sensor()
            {
                ID = "OBD2.EP_2",
                Name = "EP_2",

                      obdValue = (p) => { return p.getde()*0.01; },

                Command = 0x73,

            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2TCA_RPM
            s = new OBD2Sensor()
            {
                ID = "OBD2.TCA_RPM",
                Name = "TCA_RPM",

                      obdValue = (p) => { return p.getbc()*1; },

                Command = 0x74,

            };

            s.Units = "rpm";

            registry.Add(s);

            // OBD2TCB_RPM
            s = new OBD2Sensor()
            {
                ID = "OBD2.TCB_RPM",
                Name = "TCB_RPM",

                      obdValue = (p) => { return p.getde()*1; },

                Command = 0x74,

            };

            s.Units = "rpm";

            registry.Add(s);

            // OBD2MIL
            s = new hobd.MILSensor()
            {
                ID = "OBD2.MIL",
                Name = "MIL",

            };

            registry.Add(s);

            // OBD2PMIL
            s = new hobd.PMILSensor()
            {
                ID = "OBD2.PMIL",
                Name = "PMIL",

            };

            registry.Add(s);

            // OBD2ClearDTC
            s = new hobd.ClearDTCSensor()
            {
                ID = "OBD2.ClearDTC",
                Name = "ClearDTC",

            };

            registry.Add(s);
        }
Beispiel #5
0
        public void Activate(SensorRegistry registry)
        {
            CoreSensor s;

            // OBD2DTCFRZF
            s = new OBD2Sensor()
            {
                ID   = "OBD2.DTCFRZF",
                Name = "DTCFRZF",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0x00)); },

                Command = 0x02,
            };

            registry.Add(s);

            // OBD2FuelSystemStatus
            s = new OBD2Sensor()
            {
                ID   = "OBD2.FuelSystemStatus",
                Name = "FuelSystemStatus",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(((int)get(0) << 8) + (p.len() > 1 ? get(1) : 0)); },

                Command = 0x03,
            };

            registry.Add(s);

            // OBD2EngineLoad
            s = new OBD2Sensor()
            {
                ID   = "OBD2.EngineLoad",
                Name = "EngineLoad",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0) * 100 / 255); },

                Command = 0x04,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2CoolantTemp
            s = new OBD2Sensor()
            {
                ID   = "OBD2.CoolantTemp",
                Name = "CoolantTemp",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0) - 40); },

                Command = 0x05,
            };

            s.Units = "celsius";

            registry.Add(s);

            // OBD2STFT1
            s = new OBD2Sensor()
            {
                ID   = "OBD2.STFT1",
                Name = "STFT1",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(0) - 128) * 100 / 128); },

                Command = 0x06,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2LTFT1
            s = new OBD2Sensor()
            {
                ID   = "OBD2.LTFT1",
                Name = "LTFT1",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(0) - 128) * 100 / 128); },

                Command = 0x07,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2STFT2
            s = new OBD2Sensor()
            {
                ID   = "OBD2.STFT2",
                Name = "STFT2",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(0) - 128) * 100 / 128); },

                Command = 0x08,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2LTFT2
            s = new OBD2Sensor()
            {
                ID   = "OBD2.LTFT2",
                Name = "LTFT2",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(0) - 128) * 100 / 128); },

                Command = 0x09,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2FuelPressure
            s = new OBD2Sensor()
            {
                ID   = "OBD2.FuelPressure",
                Name = "FuelPressure",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0) * 3); },

                Command = 0x0A,
            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2IntakeManifoldPressure
            s = new OBD2Sensor()
            {
                ID   = "OBD2.IntakeManifoldPressure",
                Name = "IntakeManifoldPressure",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0)); },

                Command = 0x0B,
            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2RPM
            s = new OBD2Sensor()
            {
                ID   = "OBD2.RPM",
                Name = "RPM",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(0) * 256 + get(1)) / 4); },

                Command = 0x0C,
            };

            s.Units = "rpm";

            registry.Add(s);

            // OBD2Speed
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Speed",
                Name = "Speed",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0x00)); },

                Command = 0x0D,
            };

            s.Units = "kph";

            registry.Add(s);

            // OBD2TimingAdvance
            s = new OBD2Sensor()
            {
                ID   = "OBD2.TimingAdvance",
                Name = "TimingAdvance",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0x00) / 2 - 64); },

                Command = 0x0E,
            };

            s.Units = "°";

            registry.Add(s);

            // OBD2IntakeAirTemp
            s = new OBD2Sensor()
            {
                ID   = "OBD2.IntakeAirTemp",
                Name = "IntakeAirTemp",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0x00) - 40); },

                Command = 0x0F,
            };

            s.Units = "celsius";

            registry.Add(s);

            // OBD2MAF
            s = new OBD2Sensor()
            {
                ID   = "OBD2.MAF",
                Name = "MAF",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(((get(0) * 256) + get(1)) / 100); },

                Command = 0x10,
            };

            s.Units = "gr/sec";

            registry.Add(s);

            // OBD2ThrottlePosition
            s = new OBD2Sensor()
            {
                ID   = "OBD2.ThrottlePosition",
                Name = "ThrottlePosition",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0) * 100 / 255); },

                Command = 0x11,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b1s1
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b1s1",
                Name = "Oxygen_b1s1",

                obdValue = (p) => { return(p.get(0) * 0.005); },

                Command = 0x14,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b1s1_stft
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b1s1_stft",
                Name = "Oxygen_b1s1_stft",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(1) - 128) * 100 / 128); },

                Command = 0x14,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b1s2
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b1s2",
                Name = "Oxygen_b1s2",

                obdValue = (p) => { return(p.get(0) * 0.005); },

                Command = 0x15,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b1s2_stft
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b1s2_stft",
                Name = "Oxygen_b1s2_stft",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(1) - 128) * 100 / 128); },

                Command = 0x15,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b1s3
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b1s3",
                Name = "Oxygen_b1s3",

                obdValue = (p) => { return(p.get(0) * 0.005); },

                Command = 0x16,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b1s3_stft
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b1s3_stft",
                Name = "Oxygen_b1s3_stft",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(1) - 128) * 100 / 128); },

                Command = 0x16,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b1s4
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b1s4",
                Name = "Oxygen_b1s4",

                obdValue = (p) => { return(p.get(0) * 0.005); },

                Command = 0x17,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b1s4_stft
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b1s4_stft",
                Name = "Oxygen_b1s4_stft",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(1) - 128) * 100 / 128); },

                Command = 0x17,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b2s1
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b2s1",
                Name = "Oxygen_b2s1",

                obdValue = (p) => { return(p.get(0) * 0.005); },

                Command = 0x18,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b2s1_stft
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b2s1_stft",
                Name = "Oxygen_b2s1_stft",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(1) - 128) * 100 / 128); },

                Command = 0x18,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b2s2
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b2s2",
                Name = "Oxygen_b2s2",

                obdValue = (p) => { return(p.get(0) * 0.005); },

                Command = 0x19,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b2s2_stft
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b2s2_stft",
                Name = "Oxygen_b2s2_stft",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(1) - 128) * 100 / 128); },

                Command = 0x19,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b2s3
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b2s3",
                Name = "Oxygen_b2s3",

                obdValue = (p) => { return(p.get(0) * 0.005); },

                Command = 0x1a,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b2s3_stft
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b2s3_stft",
                Name = "Oxygen_b2s3_stft",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(1) - 128) * 100 / 128); },

                Command = 0x1a,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Oxygen_b2s4
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b2s4",
                Name = "Oxygen_b2s4",

                obdValue = (p) => { return(p.get(0) * 0.005); },

                Command = 0x1b,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Oxygen_b2s4_stft
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen_b2s4_stft",
                Name = "Oxygen_b2s4_stft",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(1) - 128) * 100 / 128); },

                Command = 0x1b,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Lambda_b1s1
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Lambda_b1s1",
                Name = "Lambda_b1s1",

                obdValue = (p) => { return(p.getab() * 2 / 65535); },

                Command = 0x24,
            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b1s1
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen2_b1s1",
                Name = "Oxygen2_b1s1",

                obdValue = (p) => { return(p.getcd() * 8 / 65535); },

                Command = 0x24,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b1s2
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Lambda_b1s2",
                Name = "Lambda_b1s2",

                obdValue = (p) => { return(p.getab() * 2 / 65535); },

                Command = 0x25,
            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b1s2
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen2_b1s2",
                Name = "Oxygen2_b1s2",

                obdValue = (p) => { return(p.getcd() * 8 / 65535); },

                Command = 0x25,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b2s1
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Lambda_b2s1",
                Name = "Lambda_b2s1",

                obdValue = (p) => { return(p.getab() * 2 / 65535); },

                Command = 0x26,
            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b2s1
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen2_b2s1",
                Name = "Oxygen2_b2s1",

                obdValue = (p) => { return(p.getcd() * 8 / 65535); },

                Command = 0x26,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b2s2
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Lambda_b2s2",
                Name = "Lambda_b2s2",

                obdValue = (p) => { return(p.getab() * 2 / 65535); },

                Command = 0x27,
            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b2s2
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen2_b2s2",
                Name = "Oxygen2_b2s2",

                obdValue = (p) => { return(p.getcd() * 8 / 65535); },

                Command = 0x27,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b3s1
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Lambda_b3s1",
                Name = "Lambda_b3s1",

                obdValue = (p) => { return(p.getab() * 2 / 65535); },

                Command = 0x28,
            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b3s1
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen2_b3s1",
                Name = "Oxygen2_b3s1",

                obdValue = (p) => { return(p.getcd() * 8 / 65535); },

                Command = 0x28,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b3s2
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Lambda_b3s2",
                Name = "Lambda_b3s2",

                obdValue = (p) => { return(p.getab() * 2 / 65535); },

                Command = 0x29,
            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b3s2
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen2_b3s2",
                Name = "Oxygen2_b3s2",

                obdValue = (p) => { return(p.getcd() * 8 / 65535); },

                Command = 0x29,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b4s1
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Lambda_b4s1",
                Name = "Lambda_b4s1",

                obdValue = (p) => { return(p.getab() * 2 / 65535); },

                Command = 0x2a,
            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b4s1
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen2_b4s1",
                Name = "Oxygen2_b4s1",

                obdValue = (p) => { return(p.getcd() * 8 / 65535); },

                Command = 0x2a,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2Lambda_b4s2
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Lambda_b4s2",
                Name = "Lambda_b4s2",

                obdValue = (p) => { return(p.getab() * 2 / 65535); },

                Command = 0x2b,
            };

            s.Units = "";

            registry.Add(s);

            // OBD2Oxygen2_b4s2
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Oxygen2_b4s2",
                Name = "Oxygen2_b4s2",

                obdValue = (p) => { return(p.getcd() * 8 / 65535); },

                Command = 0x2b,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2OBDSupport
            s = new OBD2Sensor()
            {
                ID   = "OBD2.OBDSupport",
                Name = "OBDSupport",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0)); },

                Command = 0x1C,
            };

            registry.Add(s);

            // OBD2RunTime
            s = new OBD2Sensor()
            {
                ID   = "OBD2.RunTime",
                Name = "RunTime",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0) * 256 + get(1)); },

                Command = 0x1F,
            };

            s.Units = "sec";

            registry.Add(s);

            // OBD2DistanceMIL
            s = new OBD2Sensor()
            {
                ID   = "OBD2.DistanceMIL",
                Name = "DistanceMIL",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0) * 256 + get(1)); },

                Command = 0x21,
            };

            s.Units = "km";

            registry.Add(s);

            // OBD2FuelRailPressure_rel
            s = new OBD2Sensor()
            {
                ID   = "OBD2.FuelRailPressure_rel",
                Name = "FuelRailPressure_rel",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((((get(0) * 256) + get(1)) * 10) / 128); },

                Command = 0x22,
            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2FuelRailPressure_diesel
            s = new OBD2Sensor()
            {
                ID   = "OBD2.FuelRailPressure_diesel",
                Name = "FuelRailPressure_diesel",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(((get(0) * 256) + get(1)) * 10); },

                Command = 0x23,
            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2CommandedEGR
            s = new OBD2Sensor()
            {
                ID   = "OBD2.CommandedEGR",
                Name = "CommandedEGR",

                obdValue = (p) => { return(p.get(0) * 100 / 255); },

                Command = 0x2C,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2EGRError
            s = new OBD2Sensor()
            {
                ID   = "OBD2.EGRError",
                Name = "EGRError",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(0) - 128) * 100 / 128); },

                Command = 0x2D,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Commanded_EVAP
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Commanded_EVAP",
                Name = "Commanded_EVAP",

                obdValue = (p) => { return(p.get(0) * 100 / 255); },

                Command = 0x2E,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2FuelLevel
            s = new OBD2Sensor()
            {
                ID   = "OBD2.FuelLevel",
                Name = "FuelLevel",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(100 * get(0) / 255); },

                Command = 0x2F,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2DistanceMILCleared
            s = new OBD2Sensor()
            {
                ID   = "OBD2.DistanceMILCleared",
                Name = "DistanceMILCleared",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0) * 256 + get(1)); },

                Command = 0x31,
            };

            s.Units = "km";

            registry.Add(s);

            // OBD2VaporPressure
            s = new OBD2Sensor()
            {
                ID   = "OBD2.VaporPressure",
                Name = "VaporPressure",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(((get(0) * 256) + get(1)) / 4); },

                Command = 0x32,
            };

            s.Units = "Pa";

            registry.Add(s);

            // OBD2BaroPressure
            s = new OBD2Sensor()
            {
                ID   = "OBD2.BaroPressure",
                Name = "BaroPressure",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0)); },

                Command = 0x33,
            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2ControlModuleVoltage
            s = new OBD2Sensor()
            {
                ID   = "OBD2.ControlModuleVoltage",
                Name = "ControlModuleVoltage",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(((get(0) * 256) + get(1)) / 1000); },

                Command = 0x42,
            };

            s.Units = "V";

            registry.Add(s);

            // OBD2AbsoluteLoadValue
            s = new OBD2Sensor()
            {
                ID   = "OBD2.AbsoluteLoadValue",
                Name = "AbsoluteLoadValue",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(((get(0) * 256) + get(1)) * 100 / 255); },

                Command = 0x43,
            };

            s.Units = "%";

            registry.Add(s);

            // OBD2Lambda
            s = new OBD2Sensor()
            {
                ID   = "OBD2.Lambda",
                Name = "Lambda",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return((get(0) * 256 + get(1)) * 2.0 / 65535); },

                Command = 0x44,
            };

            registry.Add(s);

            // OBD2AirTemp
            s = new OBD2Sensor()
            {
                ID   = "OBD2.AirTemp",
                Name = "AirTemp",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0) - 40); },

                Command = 0x46,
            };

            s.Units = "celsius";

            registry.Add(s);

            // OBD2EngineOilTemp
            s = new OBD2Sensor()
            {
                ID   = "OBD2.EngineOilTemp",
                Name = "EngineOilTemp",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(get(0) - 40); },

                Command = 0x5C,
            };

            s.Units = "celsius";

            registry.Add(s);

            // OBD2FuelInjectionTiming
            s = new OBD2Sensor()
            {
                ID   = "OBD2.FuelInjectionTiming",
                Name = "FuelInjectionTiming",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(((get(0) * 256) + get(1) - 26880) / 128); },

                Command = 0x5D,
            };

            s.Units = "degree";

            registry.Add(s);

            // OBD2LitersPerHour
            s = new OBD2Sensor()
            {
                ID   = "OBD2.LitersPerHour",
                Name = "LitersPerHour",

                obdValue = (p) => { Func <int, double> get = p.get; Func <int, int, double> get_bit = p.get_bit;
                                    return(((get(0) * 256) + get(1)) * 0.05); },

                Command = 0x5E,
            };

            s.Units = "lphour";

            registry.Add(s);

            // OBD2TCA_CINP
            s = new OBD2Sensor()
            {
                ID   = "OBD2.TCA_CINP",
                Name = "TCA_CINP",

                obdValue = (p) => { return(p.get(1) * 1); },

                Command = 0x6F,
            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2TCB_CINP
            s = new OBD2Sensor()
            {
                ID   = "OBD2.TCB_CINP",
                Name = "TCB_CINP",

                obdValue = (p) => { return(p.get(2) * 1); },

                Command = 0x6F,
            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2EP_1
            s = new OBD2Sensor()
            {
                ID   = "OBD2.EP_1",
                Name = "EP_1",

                obdValue = (p) => { return(p.getbc() * 0.01); },

                Command = 0x73,
            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2EP_2
            s = new OBD2Sensor()
            {
                ID   = "OBD2.EP_2",
                Name = "EP_2",

                obdValue = (p) => { return(p.getde() * 0.01); },

                Command = 0x73,
            };

            s.Units = "kPa";

            registry.Add(s);

            // OBD2TCA_RPM
            s = new OBD2Sensor()
            {
                ID   = "OBD2.TCA_RPM",
                Name = "TCA_RPM",

                obdValue = (p) => { return(p.getbc() * 1); },

                Command = 0x74,
            };

            s.Units = "rpm";

            registry.Add(s);

            // OBD2TCB_RPM
            s = new OBD2Sensor()
            {
                ID   = "OBD2.TCB_RPM",
                Name = "TCB_RPM",

                obdValue = (p) => { return(p.getde() * 1); },

                Command = 0x74,
            };

            s.Units = "rpm";

            registry.Add(s);

            // OBD2MIL
            s = new hobd.MILSensor()
            {
                ID   = "OBD2.MIL",
                Name = "MIL",
            };

            registry.Add(s);

            // OBD2PMIL
            s = new hobd.PMILSensor()
            {
                ID   = "OBD2.PMIL",
                Name = "PMIL",
            };

            registry.Add(s);

            // OBD2ClearDTC
            s = new hobd.ClearDTCSensor()
            {
                ID   = "OBD2.ClearDTC",
                Name = "ClearDTC",
            };

            registry.Add(s);
        }