Added OBDII header file describing predefined PIDs
[apps/low-level-can-service.git] / obdII.h
1 /*
2  * Copyright (C) 2015, 2016 "IoT.bzh"
3  * Author "Romain Forlot" <romain.forlot@iot.bzh>
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *   http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 /*
19  *  A representation of an OBD-II PID.
20  *
21  * pid - The 1 byte PID.
22  * name - A human readable name to use for this PID when published.
23  * frequency - The frequency to request this PID if supported by the vehicle
24  *      when automatic, recurring OBD-II requests are enabled.
25  */
26 typedef struct _Obd2Pid {
27     uint8_t pid;
28     const char* name;
29     float frequency;
30 } Obd2Pid;
31
32 /*
33  * Pre-defined OBD-II PIDs to query for if supported by the vehicle.
34  */
35 const Obd2Pid OBD2_PIDS[] = {
36     { pid: 0xc, name: "engine_speed", frequency: 5 },
37     { pid: 0xd, name: "vehicle_speed", frequency: 5 },
38     { pid: 0x4, name: "engine_load", frequency: 5 },
39     { pid: 0x5, name: "engine_coolant_temperature", frequency: 1 },
40     { pid: 0x33, name: "barometric_pressure", frequency: 1 },
41     { pid: 0x4c, name: "commanded_throttle_position", frequency: 1 },
42     { pid: 0x27, name: "fuel_level", frequency: 1 },
43     { pid: 0xf, name: "intake_air_temperature", frequency: 1 },
44     { pid: 0xb, name: "intake_manifold_pressure", frequency: 1 },
45     { pid: 0x1f, name: "running_time", frequency: 1 },
46     { pid: 0x11, name: "throttle_position", frequency: 5 },
47     { pid: 0xa, name: "fuel_pressure", frequency: 1 },
48     { pid: 0x10, name: "mass_airflow", frequency: 5 },
49     { pid: 0x5a, name: "accelerator_pedal_position", frequency: 5 },
50     { pid: 0x52, name: "ethanol_fuel_percentage", frequency: 1 },
51     { pid: 0x5c, name: "engine_oil_temperature", frequency: 1 },
52     { pid: 0x63, name: "engine_torque", frequency: 1 },
53 };