Skip to content
Merged

Next #50

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# OpenXC Message Format Changelog

## v0.8.0

* Feature: Support for GET_VIN command
* Improvements: Diagnostic Request structure enhanced to handle stitch frames
* Removed: MessagePack encoding removed

## v0.7.0-dev

* Improvement: Increase diagnostic response payload size to accommodate
Expand Down
19 changes: 2 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OpenXC Message Format Specification

Version: v0.7.0-dev
Version: v0.8.0

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

Expand Down Expand Up @@ -30,21 +30,6 @@ 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 Expand Up @@ -176,7 +161,7 @@ found in the [OBD-II standard](http://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_01)
License
=======

Copyright (c) 2012-2014 Ford Motor Company
Copyright (c) 2012-2021 Ford Motor Company

Licensed under the BSD license.

Expand Down
Binary file modified gen/cpp/openxc.pb
Binary file not shown.
3 changes: 0 additions & 3 deletions gen/cpp/openxc.pb.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ PB_BIND(openxc_DiagnosticRequest, openxc_DiagnosticRequest, AUTO)
PB_BIND(openxc_DiagnosticResponse, openxc_DiagnosticResponse, 2)


PB_BIND(openxc_DiagnosticStitchResponse, openxc_DiagnosticStitchResponse, AUTO)


PB_BIND(openxc_DynamicField, openxc_DynamicField, AUTO)


Expand Down
95 changes: 25 additions & 70 deletions gen/cpp/openxc.pb.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ typedef enum _openxc_VehicleMessage_Type {
openxc_VehicleMessage_Type_SIMPLE = 2,
openxc_VehicleMessage_Type_DIAGNOSTIC = 3,
openxc_VehicleMessage_Type_CONTROL_COMMAND = 4,
openxc_VehicleMessage_Type_COMMAND_RESPONSE = 5,
openxc_VehicleMessage_Type_DIAGNOSTIC_STITCH = 6
openxc_VehicleMessage_Type_COMMAND_RESPONSE = 5
} openxc_VehicleMessage_Type;
#define _openxc_VehicleMessage_Type_MIN openxc_VehicleMessage_Type_UNUSED
#define _openxc_VehicleMessage_Type_MAX openxc_VehicleMessage_Type_DIAGNOSTIC_STITCH
#define _openxc_VehicleMessage_Type_ARRAYSIZE ((openxc_VehicleMessage_Type)(openxc_VehicleMessage_Type_DIAGNOSTIC_STITCH+1))
#define _openxc_VehicleMessage_Type_MAX openxc_VehicleMessage_Type_COMMAND_RESPONSE
#define _openxc_VehicleMessage_Type_ARRAYSIZE ((openxc_VehicleMessage_Type)(openxc_VehicleMessage_Type_COMMAND_RESPONSE+1))

typedef enum _openxc_CanMessage_FrameFormat {
openxc_CanMessage_FrameFormat_UNUSED = 0,
Expand All @@ -49,11 +48,12 @@ typedef enum _openxc_ControlCommand_Type {
openxc_ControlCommand_Type_MODEM_CONFIGURATION = 8,
openxc_ControlCommand_Type_RTC_CONFIGURATION = 9,
openxc_ControlCommand_Type_SD_MOUNT_STATUS = 10,
openxc_ControlCommand_Type_PLATFORM = 11
openxc_ControlCommand_Type_PLATFORM = 11,
openxc_ControlCommand_Type_GET_VIN = 12
} openxc_ControlCommand_Type;
#define _openxc_ControlCommand_Type_MIN openxc_ControlCommand_Type_UNUSED
#define _openxc_ControlCommand_Type_MAX openxc_ControlCommand_Type_PLATFORM
#define _openxc_ControlCommand_Type_ARRAYSIZE ((openxc_ControlCommand_Type)(openxc_ControlCommand_Type_PLATFORM+1))
#define _openxc_ControlCommand_Type_MAX openxc_ControlCommand_Type_GET_VIN
#define _openxc_ControlCommand_Type_ARRAYSIZE ((openxc_ControlCommand_Type)(openxc_ControlCommand_Type_GET_VIN+1))

typedef enum _openxc_DiagnosticControlCommand_Action {
openxc_DiagnosticControlCommand_Action_UNUSED = 0,
Expand All @@ -67,12 +67,11 @@ typedef enum _openxc_DiagnosticControlCommand_Action {
typedef enum _openxc_PayloadFormatCommand_PayloadFormat {
openxc_PayloadFormatCommand_PayloadFormat_UNUSED = 0,
openxc_PayloadFormatCommand_PayloadFormat_JSON = 1,
openxc_PayloadFormatCommand_PayloadFormat_PROTOBUF = 2,
openxc_PayloadFormatCommand_PayloadFormat_MESSAGEPACK = 3
openxc_PayloadFormatCommand_PayloadFormat_PROTOBUF = 2
} openxc_PayloadFormatCommand_PayloadFormat;
#define _openxc_PayloadFormatCommand_PayloadFormat_MIN openxc_PayloadFormatCommand_PayloadFormat_UNUSED
#define _openxc_PayloadFormatCommand_PayloadFormat_MAX openxc_PayloadFormatCommand_PayloadFormat_MESSAGEPACK
#define _openxc_PayloadFormatCommand_PayloadFormat_ARRAYSIZE ((openxc_PayloadFormatCommand_PayloadFormat)(openxc_PayloadFormatCommand_PayloadFormat_MESSAGEPACK+1))
#define _openxc_PayloadFormatCommand_PayloadFormat_MAX openxc_PayloadFormatCommand_PayloadFormat_PROTOBUF
#define _openxc_PayloadFormatCommand_PayloadFormat_ARRAYSIZE ((openxc_PayloadFormatCommand_PayloadFormat)(openxc_PayloadFormatCommand_PayloadFormat_PROTOBUF+1))

typedef enum _openxc_NetworkOperatorSettings_OperatorSelectMode {
openxc_NetworkOperatorSettings_OperatorSelectMode_AUTOMATIC = 0,
Expand Down Expand Up @@ -224,24 +223,10 @@ typedef struct _openxc_DiagnosticResponse {
uint32_t negative_response_code;
openxc_DiagnosticResponse_payload_t payload;
openxc_DynamicField value;
/* @@protoc_insertion_point(struct:openxc_DiagnosticResponse) */
} openxc_DiagnosticResponse;


typedef PB_BYTES_ARRAY_T(14) openxc_DiagnosticStitchResponse_payload_t;
typedef struct _openxc_DiagnosticStitchResponse {
int32_t bus;
uint32_t message_id;
uint32_t mode;
uint32_t pid;
bool success;
uint32_t negative_response_code;
openxc_DiagnosticStitchResponse_payload_t payload;
openxc_DynamicField value;
int32_t frame;
uint32_t total_size;
/* @@protoc_insertion_point(struct:openxc_DiagnosticStitchResponse) */
} openxc_DiagnosticStitchResponse;
/* @@protoc_insertion_point(struct:openxc_DiagnosticResponse) */
} openxc_DiagnosticResponse;


typedef struct _openxc_NetworkOperatorSettings {
Expand Down Expand Up @@ -288,14 +273,13 @@ typedef struct _openxc_VehicleMessage {
openxc_DiagnosticResponse diagnostic_response;
openxc_ControlCommand control_command;
openxc_CommandResponse command_response;
openxc_DiagnosticStitchResponse diagnostic_stitch_response;
uint64_t timestamp;
/* @@protoc_insertion_point(struct:openxc_VehicleMessage) */
} openxc_VehicleMessage;


/* Initializer values for message structs */
#define openxc_VehicleMessage_init_default {_openxc_VehicleMessage_Type_MIN, openxc_CanMessage_init_default, openxc_SimpleMessage_init_default, openxc_DiagnosticResponse_init_default, openxc_ControlCommand_init_default, openxc_CommandResponse_init_default, openxc_DiagnosticStitchResponse_init_default, 0}
#define openxc_VehicleMessage_init_default {_openxc_VehicleMessage_Type_MIN, openxc_CanMessage_init_default, openxc_SimpleMessage_init_default, openxc_DiagnosticResponse_init_default, openxc_ControlCommand_init_default, openxc_CommandResponse_init_default, 0}
#define openxc_CanMessage_init_default {0, 0, {0, {0}}, _openxc_CanMessage_FrameFormat_MIN}
#define openxc_ControlCommand_init_default {_openxc_ControlCommand_Type_MIN, openxc_DiagnosticControlCommand_init_default, openxc_PassthroughModeControlCommand_init_default, openxc_AcceptanceFilterBypassCommand_init_default, openxc_PayloadFormatCommand_init_default, openxc_PredefinedObd2RequestsCommand_init_default, openxc_ModemConfigurationCommand_init_default, openxc_RTCConfigurationCommand_init_default}
#define openxc_DiagnosticControlCommand_init_default {openxc_DiagnosticRequest_init_default, _openxc_DiagnosticControlCommand_Action_MIN}
Expand All @@ -311,11 +295,10 @@ typedef struct _openxc_VehicleMessage {
#define openxc_RTCConfigurationCommand_init_default {0}
#define openxc_CommandResponse_init_default {_openxc_ControlCommand_Type_MIN, "", 0}
#define openxc_DiagnosticRequest_init_default {0, 0, 0, 0, {0, {0}}, 0, 0, "", _openxc_DiagnosticRequest_DecodedType_MIN}
#define openxc_DiagnosticResponse_init_default {0, 0, 0, 0, 0, 0, {0, {0}}, openxc_DynamicField_init_default}
#define openxc_DiagnosticStitchResponse_init_default {0, 0, 0, 0, 0, 0, {0, {0}}, openxc_DynamicField_init_default, 0, 0}
#define openxc_DiagnosticResponse_init_default {0, 0, 0, 0, 0, 0, {0, {0}}, openxc_DynamicField_init_default, 0, 0}
#define openxc_DynamicField_init_default {_openxc_DynamicField_Type_MIN, "", 0, 0}
#define openxc_SimpleMessage_init_default {"", openxc_DynamicField_init_default, openxc_DynamicField_init_default}
#define openxc_VehicleMessage_init_zero {_openxc_VehicleMessage_Type_MIN, openxc_CanMessage_init_zero, openxc_SimpleMessage_init_zero, openxc_DiagnosticResponse_init_zero, openxc_ControlCommand_init_zero, openxc_CommandResponse_init_zero, openxc_DiagnosticStitchResponse_init_zero, 0}
#define openxc_VehicleMessage_init_zero {_openxc_VehicleMessage_Type_MIN, openxc_CanMessage_init_zero, openxc_SimpleMessage_init_zero, openxc_DiagnosticResponse_init_zero, openxc_ControlCommand_init_zero, openxc_CommandResponse_init_zero, 0}
#define openxc_CanMessage_init_zero {0, 0, {0, {0}}, _openxc_CanMessage_FrameFormat_MIN}
#define openxc_ControlCommand_init_zero {_openxc_ControlCommand_Type_MIN, openxc_DiagnosticControlCommand_init_zero, openxc_PassthroughModeControlCommand_init_zero, openxc_AcceptanceFilterBypassCommand_init_zero, openxc_PayloadFormatCommand_init_zero, openxc_PredefinedObd2RequestsCommand_init_zero, openxc_ModemConfigurationCommand_init_zero, openxc_RTCConfigurationCommand_init_zero}
#define openxc_DiagnosticControlCommand_init_zero {openxc_DiagnosticRequest_init_zero, _openxc_DiagnosticControlCommand_Action_MIN}
Expand All @@ -331,8 +314,7 @@ typedef struct _openxc_VehicleMessage {
#define openxc_RTCConfigurationCommand_init_zero {0}
#define openxc_CommandResponse_init_zero {_openxc_ControlCommand_Type_MIN, "", 0}
#define openxc_DiagnosticRequest_init_zero {0, 0, 0, 0, {0, {0}}, 0, 0, "", _openxc_DiagnosticRequest_DecodedType_MIN}
#define openxc_DiagnosticResponse_init_zero {0, 0, 0, 0, 0, 0, {0, {0}}, openxc_DynamicField_init_zero}
#define openxc_DiagnosticStitchResponse_init_zero {0, 0, 0, 0, 0, 0, {0, {0}}, openxc_DynamicField_init_zero, 0, 0}
#define openxc_DiagnosticResponse_init_zero {0, 0, 0, 0, 0, 0, {0, {0}}, openxc_DynamicField_init_zero, 0, 0}
#define openxc_DynamicField_init_zero {_openxc_DynamicField_Type_MIN, "", 0, 0}
#define openxc_SimpleMessage_init_zero {"", openxc_DynamicField_init_zero, openxc_DynamicField_init_zero}

Expand Down Expand Up @@ -379,16 +361,8 @@ typedef struct _openxc_VehicleMessage {
#define openxc_DiagnosticResponse_negative_response_code_tag 6
#define openxc_DiagnosticResponse_payload_tag 7
#define openxc_DiagnosticResponse_value_tag 8
#define openxc_DiagnosticStitchResponse_bus_tag 1
#define openxc_DiagnosticStitchResponse_message_id_tag 2
#define openxc_DiagnosticStitchResponse_mode_tag 3
#define openxc_DiagnosticStitchResponse_pid_tag 4
#define openxc_DiagnosticStitchResponse_success_tag 5
#define openxc_DiagnosticStitchResponse_negative_response_code_tag 6
#define openxc_DiagnosticStitchResponse_payload_tag 7
#define openxc_DiagnosticStitchResponse_value_tag 8
#define openxc_DiagnosticStitchResponse_frame_tag 9
#define openxc_DiagnosticStitchResponse_total_size_tag 10
#define openxc_DiagnosticResponse_frame_tag 9
#define openxc_DiagnosticResponse_total_size_tag 10
#define openxc_NetworkOperatorSettings_allowDataRoaming_tag 1
#define openxc_NetworkOperatorSettings_operatorSelectMode_tag 2
#define openxc_NetworkOperatorSettings_networkDescriptor_tag 3
Expand All @@ -412,8 +386,7 @@ typedef struct _openxc_VehicleMessage {
#define openxc_VehicleMessage_diagnostic_response_tag 4
#define openxc_VehicleMessage_control_command_tag 5
#define openxc_VehicleMessage_command_response_tag 6
#define openxc_VehicleMessage_diagnostic_stitch_response_tag 7
#define openxc_VehicleMessage_timestamp_tag 8
#define openxc_VehicleMessage_timestamp_tag 7

/* Struct field encoding specification for nanopb */
#define openxc_VehicleMessage_FIELDLIST(X, a) \
Expand All @@ -423,16 +396,14 @@ X(a, STATIC, SINGULAR, MESSAGE, simple_message, 3) \
X(a, STATIC, SINGULAR, MESSAGE, diagnostic_response, 4) \
X(a, STATIC, SINGULAR, MESSAGE, control_command, 5) \
X(a, STATIC, SINGULAR, MESSAGE, command_response, 6) \
X(a, STATIC, SINGULAR, MESSAGE, diagnostic_stitch_response, 7) \
X(a, STATIC, SINGULAR, UINT64, timestamp, 8)
X(a, STATIC, SINGULAR, UINT64, timestamp, 7)
#define openxc_VehicleMessage_CALLBACK NULL
#define openxc_VehicleMessage_DEFAULT NULL
#define openxc_VehicleMessage_can_message_MSGTYPE openxc_CanMessage
#define openxc_VehicleMessage_simple_message_MSGTYPE openxc_SimpleMessage
#define openxc_VehicleMessage_diagnostic_response_MSGTYPE openxc_DiagnosticResponse
#define openxc_VehicleMessage_control_command_MSGTYPE openxc_ControlCommand
#define openxc_VehicleMessage_command_response_MSGTYPE openxc_CommandResponse
#define openxc_VehicleMessage_diagnostic_stitch_response_MSGTYPE openxc_DiagnosticStitchResponse

#define openxc_CanMessage_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, INT32, bus, 1) \
Expand Down Expand Up @@ -558,25 +529,12 @@ X(a, STATIC, SINGULAR, UINT32, pid, 4) \
X(a, STATIC, SINGULAR, BOOL, success, 5) \
X(a, STATIC, SINGULAR, UINT32, negative_response_code, 6) \
X(a, STATIC, SINGULAR, BYTES, payload, 7) \
X(a, STATIC, SINGULAR, MESSAGE, value, 8)
#define openxc_DiagnosticResponse_CALLBACK NULL
#define openxc_DiagnosticResponse_DEFAULT NULL
#define openxc_DiagnosticResponse_value_MSGTYPE openxc_DynamicField

#define openxc_DiagnosticStitchResponse_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, INT32, bus, 1) \
X(a, STATIC, SINGULAR, UINT32, message_id, 2) \
X(a, STATIC, SINGULAR, UINT32, mode, 3) \
X(a, STATIC, SINGULAR, UINT32, pid, 4) \
X(a, STATIC, SINGULAR, BOOL, success, 5) \
X(a, STATIC, SINGULAR, UINT32, negative_response_code, 6) \
X(a, STATIC, SINGULAR, BYTES, payload, 7) \
X(a, STATIC, SINGULAR, MESSAGE, value, 8) \
X(a, STATIC, SINGULAR, INT32, frame, 9) \
X(a, STATIC, SINGULAR, UINT32, total_size, 10)
#define openxc_DiagnosticStitchResponse_CALLBACK NULL
#define openxc_DiagnosticStitchResponse_DEFAULT NULL
#define openxc_DiagnosticStitchResponse_value_MSGTYPE openxc_DynamicField
#define openxc_DiagnosticResponse_CALLBACK NULL
#define openxc_DiagnosticResponse_DEFAULT NULL
#define openxc_DiagnosticResponse_value_MSGTYPE openxc_DynamicField

#define openxc_DynamicField_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UENUM, type, 1) \
Expand Down Expand Up @@ -612,7 +570,6 @@ extern const pb_msgdesc_t openxc_RTCConfigurationCommand_msg;
extern const pb_msgdesc_t openxc_CommandResponse_msg;
extern const pb_msgdesc_t openxc_DiagnosticRequest_msg;
extern const pb_msgdesc_t openxc_DiagnosticResponse_msg;
extern const pb_msgdesc_t openxc_DiagnosticStitchResponse_msg;
extern const pb_msgdesc_t openxc_DynamicField_msg;
extern const pb_msgdesc_t openxc_SimpleMessage_msg;

Expand All @@ -634,12 +591,11 @@ extern const pb_msgdesc_t openxc_SimpleMessage_msg;
#define openxc_CommandResponse_fields &openxc_CommandResponse_msg
#define openxc_DiagnosticRequest_fields &openxc_DiagnosticRequest_msg
#define openxc_DiagnosticResponse_fields &openxc_DiagnosticResponse_msg
#define openxc_DiagnosticStitchResponse_fields &openxc_DiagnosticStitchResponse_msg
#define openxc_DynamicField_fields &openxc_DynamicField_msg
#define openxc_SimpleMessage_fields &openxc_SimpleMessage_msg

/* Maximum encoded size of messages (where known) */
#define openxc_VehicleMessage_size 1585
#define openxc_VehicleMessage_size 1383
#define openxc_CanMessage_size 29
#define openxc_ControlCommand_size 342
#define openxc_DiagnosticControlCommand_size 67
Expand All @@ -655,8 +611,7 @@ extern const pb_msgdesc_t openxc_SimpleMessage_msg;
#define openxc_RTCConfigurationCommand_size 6
#define openxc_CommandResponse_size 134
#define openxc_DiagnosticRequest_size 63
#define openxc_DiagnosticResponse_size 441
#define openxc_DiagnosticStitchResponse_size 216
#define openxc_DiagnosticResponse_size 458
#define openxc_DynamicField_size 143
#define openxc_SimpleMessage_size 393

Expand Down
3 changes: 0 additions & 3 deletions gen/go/openxc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading