/**
 * <p class=proto-main>The common proto is utilized to wrap one or more messages in an extensible manner for delivery between the client
 * and services.  This proto also includes common header elements necessary to implement required messaging patterns.</p>
 *
 * <div class=proto-hier>
 * <a href="#com.fca.uconnect.global.UconnectMessage">UconnectMessageV2M </a>
 *
 * <a href="#com.fca.uconnect.global.KeepAliveMessage">KeepAliveMessage </a>
 *
 * <a href="#com.fca.uconnect.global.KeepAliveAckMessage">KeepAliveAckMessage </a>
 *
 * <a href="#com.fca.uconnect.global.UconnectAny">UconnectAny </a>
 *
 * </div>
 *
 *  <h3 class=change-log-hdr> Change Log</h3>
 *  <table id="change-log" class="change-log"><thead><tr>
 *	<th>Version</th><th>Date</th><th>Notes</th></tr></thead>
 *   <tbody>
 *	<tr><td>1.1</td><td>2017-08-07</td><td>Update KeepAlive</td></tr>
 *	<tr><td>1.0</td><td>2017-06-01</td><td>Release of initial Proto</td></tr>
 *	</tbody></table>
 *
 */
 syntax="proto2";
package com.fca.uconnect.global;

// .proto file to define the global communication protocol for Uconnect 
//
// Proto Version: 2.6.1
//
// Command Line: protoc --java_out=. Global_Uconnect_V2M_Common_V1.0.proto
//
// Date		Version		Descrption		
// ----		-------		----------
// 2017-06-01	1.0		Initial version - Add Command and Control Messages for V2M
//
// Author: Steven Malson (steven.malson@external.fcagroup.com)
// 
// The Uconnect Message V2M is the common message with extensions for transfer over the Control and Data Channel between the Uconnect Vehicle and Mobile Devices.
//
// UconnectMessageV2M
//       |
//       |-- Extensions...
//
// The extensions technique has been used to allow adding future messages independent of the common message.
//
// The UconnectMessageV2M is the basis for all the ProtocolBuffer messages.  Messages for evey service/feature shall essentially extend this message using extensions.
// The message contains common attributes instead of a header for compactness.

// extensions - placeholder to allow extensions decoupled from the UconnectMessage.

message UconnectMessageV2M {

	optional int64 timestamp = 1;///The current system time on the platform when the message is generated.  NOTE: The SDP/TSP will provide a network time service based on NTP to augment the GPS time captured in the vehicle.
	optional bytes sessionId = 2;/// may contain any arbitrary sequence of bytes. Intended for implementations where parties to a session need to share a session identifier. Implementations that do so will be able to use sessionId and messageId to correlate logged messages for diagnostic/debug purposes.
	optional int32 messageId = 3;///Unique message id also utilized as a correlation id for responses.
	optional int32 correlationId = 4;/// Must only be set from the messageId of a received message. If there is not a received message being responded to, do not set any value other than the default. Initiators of interactions should never set correlationId, it is for point to point request/response only.
}

/**
 * The KeepAliveMessage provides a lightweight keep alive message to support monitoring the connection between the Vehicle and Mobile Device.  
 * The vehicle software component supporting BIMD connectivity shall periodically send a KeepAliveMessage and monitor for a response.
 */
message KeepAliveMessage {
    optional int32 messageId = 1;///Unique message id also utilized as a correlation id for responses.
    optional int64 timestamp = 2;///The milliseconds since (Jan 1, 1970 00:00:00 UTC) when the message is created. Should come from the system clock of the sender.
}

/**
 * The KeepAliveAckMessage provides a lightweight response to a keep alive message originating from the vehicle.
 * The Mobile Device software component shall return an Ack message in reponse to every received KeepAliveMessage.
 */
message KeepAliveAckMessage {
    optional int32 correlationId = 1;///Must be set from the messageId of the received message.
    optional int64 timestamp = 2;///The milliseconds since (Jan 1, 1970 00:00:00 UTC) when the message is created. Should come from the system clock of the sender.
}

/**
 * The UconnectAny message allows for protocol buffer extensions so feature specific messages are decoupled from the top level message.  It is a placeholder to allow a repeated set of extensions.
 */
message UconnectAnyV2M {
    extensions 10 to 10000;
}
