Skip to content

Commit

Permalink
Merge pull request #28 from openxc/next
Browse files Browse the repository at this point in the history
Ready to release updates for C5 devices
  • Loading branch information
emarsman committed May 9, 2016
2 parents 77718cf + 94c09b2 commit 15cd698
Show file tree
Hide file tree
Showing 10 changed files with 856 additions and 204 deletions.
3 changes: 1 addition & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[submodule "libs/nanopb"]
path = libs/nanopb
url = https://code.google.com/p/nanopb/
ignore = dirty
url = https://github.com/nanopb/nanopb
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# OpenXC Message Format Changelog

## v0.6.0

* Feature: Added MessagePack support for BTLE connections.
* Feature: Support for vehicle message timestamps (changed previous uptime).
* Feature: Support for C5 SD Card.
* Feature: Support for C5 RTC.
* Fix: Update submodule from code.google to github.

## v0.5.0

* Feature: Support for C5 Cellular device. New uptime message.
Expand Down
72 changes: 55 additions & 17 deletions JSON.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@

Each JSON message published by a VI is delimited with a `\0 ` character.

## Extra Values
## Table of Contents
1. [Vehicle Messages](#vehicle-messages)
2. [CAN Message](#can-message)
3. [Diagnostic Message](#diagnostic-message)
4. [Commands](#commands)
5. [Extra Values](#extra-values)

Any of the following JSON objects may optionally include an `extras`
field. The value may be any valid JSON object or array. The client libraries
will do their best to parse this information into a generic format and pass it
to your application. For example:
## Vehicle Messages

{"name": "steering_wheel_angle",
"value": 45,
"extras": {
"calibrated": false
}
}

## Simple Vehicle Message
### Simple Vehicle Message

There may not be a 1:1 relationship between input and output signals - i.e.
engine timing CAN signals may be summarized in an "engine performance" metric on
Expand All @@ -26,7 +21,7 @@ The expected format of a single valued message is:

{"name": "steering_wheel_angle", "value": 45}

## Evented Simple Vehicle Message
### Evented Simple Vehicle Message

The expected format of an event message is:

Expand Down Expand Up @@ -57,7 +52,7 @@ The format for a plain CAN message:
of `standard` or `extended`. If the `id` is greater than `0x7ff`, the extended
frame format will be selected automatically.

## Diagnostic Messages
## Diagnostic Message

### Requests

Expand Down Expand Up @@ -377,7 +372,7 @@ the response will be `true`.

The ModemConfigurationCommand message allows users to change certain aspects of modem operation on-the-fly (at runtime). The modem configuration settings are stored in flash memory and are untouched by the bootloader during a software update (assuming the correct cellular_c5 linker file is used during compilation of vi-firmware). Thus, new modem settings persistent across power cycles.

The ModemConfigurationCommand message provides three sub-messages for particular groups of modem settings. These are NetworkOperatorSettings, NetworkDataSettings, and ServerConnectSettings. These configuration messages are described in great detail within the [c5_cellular_config](https://github.com/openxc/vi-firmware/docs/advanced/c5_cell_config.mkd) documentation.
The ModemConfigurationCommand message provides three sub-messages for particular groups of modem settings. These are NetworkOperatorSettings, NetworkDataSettings, and ServerConnectSettings. These configuration messages are described in great detail within the [c5_cellular_config](https://github.com/openxc/vi-firmware/docs/advanced/c5_cell_config.html) documentation.

Currently, only the ServerConnectSettings sub-message is supported in the vi-firmware's command interpreter. All other settings are currently compile-time only.

Expand All @@ -394,4 +389,47 @@ The ServerConnectSettings part of ModemConfigurationCommand allows the user to s

**Response**

{ "command_response": "modem_configuration", "status": true}
{ "command_response": "modem_configuration", "status": true}

## C5 SD Card Status

In order to check the status of the SD card, the following command is available:

{ "command": "sd_mount_status"}

Command response if the SD card is mounted correctly:

{ "command_response": "sd_mount_status", "status": true}

If the SD card is full, not enabled, or connected as a MSD, the device will respond with:

{ "command_response": "sd_mount_status", "status": false}

For more info see [c5_msd](https://github.com/openxc/vi-firmware/docs/advanced/msd.html).

## C5 RTC Configuration

To set the current time of the RTC, the following

{ "command": "rtc_configuration", "unix_time": "1448551563"}

The response is

{ "command_response": "rtc_configuration", "status": true}

For more info see [c5_rtc](https://github.com/openxc/vi-firmware/docs/advanced/rtc.html).

## Extra Values

Any of the following JSON objects may optionally include an `extras`
field. The value may be any valid JSON object or array. The client libraries
will do their best to parse this information into a generic format and pass it
to your application. For example:

{"name": "steering_wheel_angle",
"value": 45,
"extras": {
"calibrated": false
}
}

17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OpenXC Message Format Specification

Version: v0.5.0
Version: v0.6.0

This specification is a part of the [OpenXC platform][OpenXC].

Expand Down Expand Up @@ -30,6 +30,21 @@ method (any protobuf library should support this).
The binary format is best if you need to maximize the amount of data that can be
sent from the VI, trading off flexibility for efficiency.

## Message Pack
MessagePack is an efficient binary serialization format. It lets you exchange data
among multiple languages like JSON, but it's faster and smaller. Small integers are
encoded into a single byte, and typical short strings require only one extra byte
in addition to the strings themselves

For protocol specification visit:
https://github.com/msgpack/msgpack/blob/master/spec.md

We are using the following lib:
https://github.com/camgunz/cmp

MessagePack provides a binary alternative to ProtoBuf. There are pros & cons to each
so you can decide what works best for your project.

## Trace File Format

An OpenXC vehicle trace file is a plaintext file that contains JSON objects,
Expand Down
Binary file modified gen/cpp/openxc.pb
Binary file not shown.
16 changes: 11 additions & 5 deletions gen/cpp/openxc.pb.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.3.1 at Tue Dec 2 03:06:57 2014. */
/* Generated by nanopb-0.3.1 at Mon Feb 29 19:42:01 2016. */

#include "openxc.pb.h"

Expand All @@ -16,7 +16,7 @@ const pb_field_t openxc_VehicleMessage_fields[8] = {
PB_FIELD( 4, MESSAGE , OPTIONAL, STATIC , OTHER, openxc_VehicleMessage, diagnostic_response, simple_message, &openxc_DiagnosticResponse_fields),
PB_FIELD( 5, MESSAGE , OPTIONAL, STATIC , OTHER, openxc_VehicleMessage, control_command, diagnostic_response, &openxc_ControlCommand_fields),
PB_FIELD( 6, MESSAGE , OPTIONAL, STATIC , OTHER, openxc_VehicleMessage, command_response, control_command, &openxc_CommandResponse_fields),
PB_FIELD( 7, UINT32 , OPTIONAL, STATIC , OTHER, openxc_VehicleMessage, uptime, command_response, 0),
PB_FIELD( 7, UINT64 , OPTIONAL, STATIC , OTHER, openxc_VehicleMessage, timestamp, command_response, 0),
PB_LAST_FIELD
};

Expand All @@ -28,14 +28,15 @@ const pb_field_t openxc_CanMessage_fields[5] = {
PB_LAST_FIELD
};

const pb_field_t openxc_ControlCommand_fields[8] = {
const pb_field_t openxc_ControlCommand_fields[9] = {
PB_FIELD( 1, ENUM , OPTIONAL, STATIC , FIRST, openxc_ControlCommand, type, type, 0),
PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, openxc_ControlCommand, diagnostic_request, type, &openxc_DiagnosticControlCommand_fields),
PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, openxc_ControlCommand, passthrough_mode_request, diagnostic_request, &openxc_PassthroughModeControlCommand_fields),
PB_FIELD( 4, MESSAGE , OPTIONAL, STATIC , OTHER, openxc_ControlCommand, acceptance_filter_bypass_command, passthrough_mode_request, &openxc_AcceptanceFilterBypassCommand_fields),
PB_FIELD( 5, MESSAGE , OPTIONAL, STATIC , OTHER, openxc_ControlCommand, payload_format_command, acceptance_filter_bypass_command, &openxc_PayloadFormatCommand_fields),
PB_FIELD( 6, MESSAGE , OPTIONAL, STATIC , OTHER, openxc_ControlCommand, predefined_obd2_requests_command, payload_format_command, &openxc_PredefinedObd2RequestsCommand_fields),
PB_FIELD( 7, MESSAGE , OPTIONAL, STATIC , OTHER, openxc_ControlCommand, modem_configuration_command, predefined_obd2_requests_command, &openxc_ModemConfigurationCommand_fields),
PB_FIELD( 8, MESSAGE , OPTIONAL, STATIC , OTHER, openxc_ControlCommand, rtc_configuration_command, modem_configuration_command, &openxc_RTCConfigurationCommand_fields),
PB_LAST_FIELD
};

Expand Down Expand Up @@ -98,6 +99,11 @@ const pb_field_t openxc_ModemConfigurationCommand_fields[4] = {
PB_LAST_FIELD
};

const pb_field_t openxc_RTCConfigurationCommand_fields[2] = {
PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, openxc_RTCConfigurationCommand, unix_time, unix_time, 0),
PB_LAST_FIELD
};

const pb_field_t openxc_CommandResponse_fields[4] = {
PB_FIELD( 1, ENUM , OPTIONAL, STATIC , FIRST, openxc_CommandResponse, type, type, 0),
PB_FIELD( 2, STRING , OPTIONAL, STATIC , OTHER, openxc_CommandResponse, message, type, 0),
Expand Down Expand Up @@ -155,7 +161,7 @@ const pb_field_t openxc_SimpleMessage_fields[4] = {
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
* field descriptors.
*/
PB_STATIC_ASSERT((pb_membersize(openxc_VehicleMessage, can_message) < 65536 && pb_membersize(openxc_VehicleMessage, simple_message) < 65536 && pb_membersize(openxc_VehicleMessage, diagnostic_response) < 65536 && pb_membersize(openxc_VehicleMessage, control_command) < 65536 && pb_membersize(openxc_VehicleMessage, command_response) < 65536 && pb_membersize(openxc_ControlCommand, diagnostic_request) < 65536 && pb_membersize(openxc_ControlCommand, passthrough_mode_request) < 65536 && pb_membersize(openxc_ControlCommand, acceptance_filter_bypass_command) < 65536 && pb_membersize(openxc_ControlCommand, payload_format_command) < 65536 && pb_membersize(openxc_ControlCommand, predefined_obd2_requests_command) < 65536 && pb_membersize(openxc_ControlCommand, modem_configuration_command) < 65536 && pb_membersize(openxc_DiagnosticControlCommand, request) < 65536 && pb_membersize(openxc_NetworkOperatorSettings, networkDescriptor) < 65536 && pb_membersize(openxc_ModemConfigurationCommand, networkOperatorSettings) < 65536 && pb_membersize(openxc_ModemConfigurationCommand, networkDataSettings) < 65536 && pb_membersize(openxc_ModemConfigurationCommand, serverConnectSettings) < 65536 && pb_membersize(openxc_SimpleMessage, value) < 65536 && pb_membersize(openxc_SimpleMessage, event) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_openxc_VehicleMessage_openxc_CanMessage_openxc_ControlCommand_openxc_DiagnosticControlCommand_openxc_PassthroughModeControlCommand_openxc_AcceptanceFilterBypassCommand_openxc_PayloadFormatCommand_openxc_PredefinedObd2RequestsCommand_openxc_NetworkOperatorSettings_openxc_NetworkOperatorSettings_NetworkDescriptor_openxc_NetworkDataSettings_openxc_ServerConnectSettings_openxc_ModemConfigurationCommand_openxc_CommandResponse_openxc_DiagnosticRequest_openxc_DiagnosticResponse_openxc_DynamicField_openxc_SimpleMessage)
PB_STATIC_ASSERT((pb_membersize(openxc_VehicleMessage, can_message) < 65536 && pb_membersize(openxc_VehicleMessage, simple_message) < 65536 && pb_membersize(openxc_VehicleMessage, diagnostic_response) < 65536 && pb_membersize(openxc_VehicleMessage, control_command) < 65536 && pb_membersize(openxc_VehicleMessage, command_response) < 65536 && pb_membersize(openxc_ControlCommand, diagnostic_request) < 65536 && pb_membersize(openxc_ControlCommand, passthrough_mode_request) < 65536 && pb_membersize(openxc_ControlCommand, acceptance_filter_bypass_command) < 65536 && pb_membersize(openxc_ControlCommand, payload_format_command) < 65536 && pb_membersize(openxc_ControlCommand, predefined_obd2_requests_command) < 65536 && pb_membersize(openxc_ControlCommand, modem_configuration_command) < 65536 && pb_membersize(openxc_ControlCommand, rtc_configuration_command) < 65536 && pb_membersize(openxc_DiagnosticControlCommand, request) < 65536 && pb_membersize(openxc_NetworkOperatorSettings, networkDescriptor) < 65536 && pb_membersize(openxc_ModemConfigurationCommand, networkOperatorSettings) < 65536 && pb_membersize(openxc_ModemConfigurationCommand, networkDataSettings) < 65536 && pb_membersize(openxc_ModemConfigurationCommand, serverConnectSettings) < 65536 && pb_membersize(openxc_SimpleMessage, value) < 65536 && pb_membersize(openxc_SimpleMessage, event) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_openxc_VehicleMessage_openxc_CanMessage_openxc_ControlCommand_openxc_DiagnosticControlCommand_openxc_PassthroughModeControlCommand_openxc_AcceptanceFilterBypassCommand_openxc_PayloadFormatCommand_openxc_PredefinedObd2RequestsCommand_openxc_NetworkOperatorSettings_openxc_NetworkOperatorSettings_NetworkDescriptor_openxc_NetworkDataSettings_openxc_ServerConnectSettings_openxc_ModemConfigurationCommand_openxc_RTCConfigurationCommand_openxc_CommandResponse_openxc_DiagnosticRequest_openxc_DiagnosticResponse_openxc_DynamicField_openxc_SimpleMessage)
#endif

#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
Expand All @@ -166,7 +172,7 @@ PB_STATIC_ASSERT((pb_membersize(openxc_VehicleMessage, can_message) < 65536 && p
* numbers or field sizes that are larger than what can fit in the default
* 8 bit descriptors.
*/
PB_STATIC_ASSERT((pb_membersize(openxc_VehicleMessage, can_message) < 256 && pb_membersize(openxc_VehicleMessage, simple_message) < 256 && pb_membersize(openxc_VehicleMessage, diagnostic_response) < 256 && pb_membersize(openxc_VehicleMessage, control_command) < 256 && pb_membersize(openxc_VehicleMessage, command_response) < 256 && pb_membersize(openxc_ControlCommand, diagnostic_request) < 256 && pb_membersize(openxc_ControlCommand, passthrough_mode_request) < 256 && pb_membersize(openxc_ControlCommand, acceptance_filter_bypass_command) < 256 && pb_membersize(openxc_ControlCommand, payload_format_command) < 256 && pb_membersize(openxc_ControlCommand, predefined_obd2_requests_command) < 256 && pb_membersize(openxc_ControlCommand, modem_configuration_command) < 256 && pb_membersize(openxc_DiagnosticControlCommand, request) < 256 && pb_membersize(openxc_NetworkOperatorSettings, networkDescriptor) < 256 && pb_membersize(openxc_ModemConfigurationCommand, networkOperatorSettings) < 256 && pb_membersize(openxc_ModemConfigurationCommand, networkDataSettings) < 256 && pb_membersize(openxc_ModemConfigurationCommand, serverConnectSettings) < 256 && pb_membersize(openxc_SimpleMessage, value) < 256 && pb_membersize(openxc_SimpleMessage, event) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_openxc_VehicleMessage_openxc_CanMessage_openxc_ControlCommand_openxc_DiagnosticControlCommand_openxc_PassthroughModeControlCommand_openxc_AcceptanceFilterBypassCommand_openxc_PayloadFormatCommand_openxc_PredefinedObd2RequestsCommand_openxc_NetworkOperatorSettings_openxc_NetworkOperatorSettings_NetworkDescriptor_openxc_NetworkDataSettings_openxc_ServerConnectSettings_openxc_ModemConfigurationCommand_openxc_CommandResponse_openxc_DiagnosticRequest_openxc_DiagnosticResponse_openxc_DynamicField_openxc_SimpleMessage)
PB_STATIC_ASSERT((pb_membersize(openxc_VehicleMessage, can_message) < 256 && pb_membersize(openxc_VehicleMessage, simple_message) < 256 && pb_membersize(openxc_VehicleMessage, diagnostic_response) < 256 && pb_membersize(openxc_VehicleMessage, control_command) < 256 && pb_membersize(openxc_VehicleMessage, command_response) < 256 && pb_membersize(openxc_ControlCommand, diagnostic_request) < 256 && pb_membersize(openxc_ControlCommand, passthrough_mode_request) < 256 && pb_membersize(openxc_ControlCommand, acceptance_filter_bypass_command) < 256 && pb_membersize(openxc_ControlCommand, payload_format_command) < 256 && pb_membersize(openxc_ControlCommand, predefined_obd2_requests_command) < 256 && pb_membersize(openxc_ControlCommand, modem_configuration_command) < 256 && pb_membersize(openxc_ControlCommand, rtc_configuration_command) < 256 && pb_membersize(openxc_DiagnosticControlCommand, request) < 256 && pb_membersize(openxc_NetworkOperatorSettings, networkDescriptor) < 256 && pb_membersize(openxc_ModemConfigurationCommand, networkOperatorSettings) < 256 && pb_membersize(openxc_ModemConfigurationCommand, networkDataSettings) < 256 && pb_membersize(openxc_ModemConfigurationCommand, serverConnectSettings) < 256 && pb_membersize(openxc_SimpleMessage, value) < 256 && pb_membersize(openxc_SimpleMessage, event) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_openxc_VehicleMessage_openxc_CanMessage_openxc_ControlCommand_openxc_DiagnosticControlCommand_openxc_PassthroughModeControlCommand_openxc_AcceptanceFilterBypassCommand_openxc_PayloadFormatCommand_openxc_PredefinedObd2RequestsCommand_openxc_NetworkOperatorSettings_openxc_NetworkOperatorSettings_NetworkDescriptor_openxc_NetworkDataSettings_openxc_ServerConnectSettings_openxc_ModemConfigurationCommand_openxc_RTCConfigurationCommand_openxc_CommandResponse_openxc_DiagnosticRequest_openxc_DiagnosticResponse_openxc_DynamicField_openxc_SimpleMessage)
#endif


Expand Down
Loading

0 comments on commit 15cd698

Please sign in to comment.