Document the RAW message format, including the bus attribute.
[apps/low-level-can-service.git] / README.md
1 # OpenXC Message Format Specification
2
3 This specification is a part of the [OpenXC platform][OpenXC].
4
5 An OpenXC vehicle interface sends generic vehicle data over one or more output
6 interfaces (e.g. USB or Bluetooth) as JSON objects, separated by newlines.
7
8 There are two valid message types - single valued and evented.
9
10 There may not be a 1:1 relationship between input and output signals - i.e. raw
11 engine timing CAN signals may be summarized in an "engine performance" metric on
12 the abstract side of the interface.
13
14 ## Single Valued
15
16 The expected format of a single valued message is:
17
18     {"name": "steering_wheel_angle", "value": 45}
19
20 ## Evented
21
22 The expected format of an event message is:
23
24     {"name": "button_event", "value": "up", "event": "pressed"}
25
26 This format is good for something like a button event, where there are two
27 discrete pieces of information in the measurement.
28
29 ## Official Signals
30
31 These signal names are a part of the OpenXC specification, although some
32 manufacturers may support custom message names.
33
34 * steering_wheel_angle
35     * numerical, degrees
36 * torque_at_transmission
37     * numerical, Nm
38 * engine_speed
39     * numerical, RPM
40 * vehicle_speed, numerical, Kph
41 * accelerator_pedal_position
42     * percentage
43 * parking_brake_status
44     * boolean, (true == brake engaged)
45 * brake_pedal_status
46     * boolean (True == pedal pressed)
47 * transmission_gear_position
48     * states: first, second, third, fourth, fifth, sixth, seventh, eighth,
49       reverse, neutral
50 * gear_lever_position
51     * states: neutral, park, reverse, drive, sport, low, first, second, third,
52       fourth, fifth, sixth
53 * odometer
54     * Numerical, km
55 * ignition_status
56     * states: off, accessory, run, start
57 * fuel_level
58     * percentage
59 * fuel_consumed_since_restart
60     * numerical, liters (goes to 0 every time the
61   vehicle interfaces power cycles)
62 * door_status
63     * Value is State: driver, passenger, rear_left, rear_right.
64     * Event is boolean: true == ajar
65 * headlamp_status
66     * boolean, true is on
67 * high_beam_status
68     * boolean, true is on
69 * windshield_wiper_status
70     * boolean, true is on
71 * latitude
72     * numerical
73 * longitude
74     * numerical
75
76 ## Raw CAN Message format
77
78 An OpenXC vehicle interface may also output raw CAN messages. Each CAN message
79 is sent as a JSON object, separated by newlines. The format of each object is:
80
81     {"bus": 1, "id": 1234, "value": "0x12345678"}
82
83 **bus** - the numerical identifier of the CAN bus where this message originated,
84   most likely 1 or 2 (for a vehicle interface with 2 CAN controllers).
85
86 **id** - the CAN message ID
87
88 **data** - up to 8 bytes of data from the CAN message's payload, represented as
89   a hexidecimal number in a string. Many JSON parser cannot handle 64-bit
90   integers, which is why we are not using a numerical data type.
91
92 License
93 =======
94
95 Copyright (c) 2012-2013 Ford Motor Company
96
97 Licensed under the BSD license.
98
99 [OpenXC]: http://openxcplatform.com