Document command queries and responses.
[apps/agl-service-can-low-level.git] / README.md
index dcfee28..0fe4b8d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -40,7 +40,9 @@ is sent as a JSON object, separated by newlines. The format of each object is:
 
 **data** - up to 8 bytes of data from the CAN message's payload, represented as
   a hexidecimal number in a string. Many JSON parser cannot handle 64-bit
-  integers, which is why we are not using a numerical data type.
+  integers, which is why we are not using a numerical data type. Each byte in
+  the string *must* be represented with 2 characters, e.g. `0x1` is `0x01` - the
+  complete string must have an even number of characters.
 
 ## Diagnostic Messages
 
@@ -79,6 +81,8 @@ with this command format:
 **payload** - (optional) up to 7 bytes of data for the request's payload
     represented as a hexidecimal number in a string. Many JSON parser cannot
     handle 64-bit integers, which is why we are not using a numerical data type.
+    Each byte in the string *must* be represented with 2 characters, e.g. `0x1`
+    is `0x01` - the complete string must have an even number of characters.
 
 **parse_payload** - (optional, false by default) if true, the complete payload in the
     response message will be parsed as a number and returned in the 'value' field of
@@ -114,9 +118,6 @@ key twice, it'll overwrite the existing one (i.e. it will change the frequency,
 the only other parameter). To cancel a recurring request, send this command with
 the frequency set to 0.
 
-TODO it'd be nice to have the OBD-II PIDs built in, with the proper conversion
-functions - that may need a different output format
-
 If you're just requesting a PID, you can use this minimal field set for the
 `request` object:
 
@@ -164,9 +165,33 @@ The response to a simple PID request would look like this:
 
     {"bus": 1, "id": 1234, "mode": 1, "pid": 5, "payload": "0x2"}
 
-TODO again, it'd be nice to have the OBD-II PIDs built in, with the proper
-conversion functions so the response here included the actual transformed value
-of the pid and a human readable name
+## Commands
+
+### Version Query
+
+The `version` command triggers the VI to inject a firmware version identifier
+response into the outgoing data stream.
+
+**Request**
+
+    { "command": "version"}
+
+**Response**
+
+    { "command_response": "version", "message": "v6.0-dev (default)"}
+
+### Device ID Query
+
+The `device_id` command triggers the VI to inject a unique device ID (e.g. the
+MAC address of an included Bluetooth module) into into the outgoing data stream.
+
+**Request**
+
+    { "command": "device_id"}
+
+**Response**
+
+    { "command_response": "device_id", "message": "0012345678"}
 
 ## Trace File Format