Client Example Code (HU/TBM):

    /**********************************************************************************************
     * This example code is provided for illustrative purposes only and provided 'AS IS' without
     * warranty of any kind.
     *
     * Copyright ©2014 Chrysler Group LLC.  All Rights Reserved.  All information contained herein is,
     * and remains the property of Chrysler Group LLC and its suppliers, if any.  The intellectual and
     * technical concepts contained herein are proprietary to Chrysler Group LLC and its suppliers
     * and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade
     * secret or copyright law. Dissemination of this information or reproduction of this material is
     * strictly forbidden unless prior written permission is obtained from Chrysler Group LLC.
     *
     * Chrysler, Jeep, Dodge, Ram, SRT, Mopar and the Pentastar logo are registered trademarks of
     * Chrysler Group LLC. FIAT is a registered trademark of Fiat group Marketing & Corporate
     * Communication S.p.A. used under license by Chrysler Group LLC.
     *********************************************************************************************/
    package com.fca.uconnect.global;

    import java.util.UUID;

    import com.amazonaws.services.iot.client.AWSIotException;
    import com.amazonaws.services.iot.client.AWSIotMessage;
    import com.amazonaws.services.iot.client.AWSIotMqttClient;
    import com.amazonaws.services.iot.client.AWSIotQos;
    import com.amazonaws.services.iot.client.AWSIotTopic;
    import com.fca.uconnect.global.GlobalUconnectControl.UconnectAny;
    import com.fca.uconnect.global.GlobalUconnectControl.UconnectMessage;
    import com.fca.uconnect.global.GlobalUconnectExtVehDataAcquisition.VehicleDataAcquisitionPolicyPublish.DataSetSignal;
    import com.fca.uconnect.global.GlobalUconnectExtVehDataAcquisition.VehicleDataAcquisitionPublish;
    import com.fca.uconnect.global.GlobalUconnectExtVehDataAcquisition.VehicleDataAcquisitionPublish.DataSet;
    import com.fca.uconnect.global.GlobalUconnectExtVehDataAcquisition.VehicleDataAcquisitionPublish.DataSubscription;
    import com.fca.uconnect.global.GlobalUconnectExtVehDataAcquisition.VehicleDataAcquisitionPublish.SignalValue;
    import com.google.protobuf.ExtensionRegistry;

    public class ClientExampleForADA {
    private String clientId; // The clientId is unique to the device and obtained from the client X.509 certificate CN.
    private UUID sessionId; // The sessionId is assigned by the SDP to maintain a session independent of connection protocols.
    private int messageId; // The messageId is a sequential number incremented and assigned to each message sent from the client.
    private AWSIotMqttClient mqttClient; // The mqtt client object from the AWS IoT client library.
    private AWSIotTopic iotTopic; // The Topic object to subscribe for inbound messages.
    private ExtensionRegistry extRegistry; // Google protocol buffers extension registry instance.
    private boolean messageReceived = false; // flag to wait for the message as part of this example.

    public ClientExampleForADA() {
    	extRegistry = ExtensionRegistry.newInstance();
    	extRegistry.add(GlobalUconnectExtVehDataAcquisition.vehicleDataAcquisitionPolicyPublish);
    	extRegistry.add(GlobalUconnectExtVehDataAcquisition.vehicleDataAcquisitionPublish);
    }

    private void process() {

    	mqttClient = new AWSIotMqttClient("endpoint", clientId, "awsAccessKeyId", "awsSecretAccessKey");
    try {
    mqttClient.connect();
     iotTopic = new AWSIotTopic("/ADA/#",AWSIotQos.QOS0){
    	public void onMessage(AWSIotMessage msg) {
    try {

    	UconnectMessage	msgIn = UconnectMessage.parseFrom(msg.getPayload(),extRegistry);
    	GlobalUconnectExtVehDataAcquisition.VehicleDataAcquisitionPolicyPublish vehicleDataAcquisitionPolicyPublishMsg = msgIn.getMessages(0).getExtension(GlobalUconnectExtVehDataAcquisition.vehicleDataAcquisitionPolicyPublish);
    	if (vehicleDataAcquisitionPolicyPublishMsg.getPolicySubscriptionList()!=null &&vehicleDataAcquisitionPolicyPublishMsg.getPolicySubscriptionList().size()>0) {
    		while(true){
    		 Thread.sleep(1000);//wait and send Vehicle Data
    		 sendMessage(getVehicleDataPublishMsg());
    		}
    	}

    } catch( Exception ex) {
    	ex.printStackTrace();
    	System.out.println("Err processing message: "+ex+", try parsing ADA.");

    }
    }
    };

    mqttClient.subscribe(iotTopic);

    } catch (AWSIotException e) {
    	System.out.println("Caught Exception "+e);
    	e.printStackTrace();
    }

    while(!messageReceived) {
     try {
            Thread.sleep(1000);
        } catch (InterruptedException e){
        }
     }

    }
    public UconnectMessage getVehicleDataPublishMsg() {
    	messageId++;
    	VehicleDataAcquisitionPublish.DataSet.Builder dataSetBuilder = VehicleDataAcquisitionPublish.DataSet.newBuilder();
    	dataSetBuilder.setDataSetId(1);

    	VehicleDataAcquisitionPublish.DataRow.Builder dataRowBuilder = VehicleDataAcquisitionPublish.DataRow.newBuilder();
    	dataRowBuilder.setTimestamp(System.currentTimeMillis());

    		SignalValue.Builder svb1 = VehicleDataAcquisitionPublish.SignalValue.newBuilder();
    				svb1.setStringValue("123456");	//VehicleId
    				dataRowBuilder.addSignalValue(svb1);
    		SignalValue.Builder svb2 = VehicleDataAcquisitionPublish.SignalValue.newBuilder();
    				svb2.setStringValue("4.0");	//SWRelease
    				dataRowBuilder.addSignalValue(svb2);
    		SignalValue.Builder svb3 = VehicleDataAcquisitionPublish.SignalValue.newBuilder();
    				svb3.setStringValue("12AESCXFSDSDS2344");//HU Serial nbr
    				dataRowBuilder.addSignalValue(svb3);
    				SignalValue.Builder svb4 = VehicleDataAcquisitionPublish.SignalValue.newBuilder();
    				    svb4.setDoubleValue(48.543434343434);//Latitude
    				    dataRowBuilder.addSignalValue(svb4);
    				    SignalValue.Builder svb5 = VehicleDataAcquisitionPublish.SignalValue.newBuilder();
    				    svb4.setDoubleValue(48.543434343434);//Longitude
    				    dataRowBuilder.addSignalValue(svb5);
    				    SignalValue.Builder svb6 = VehicleDataAcquisitionPublish.SignalValue.newBuilder();
    				    svb4.setFloatValue(4.434343434f);//HorizontalAccuracy
    				    dataRowBuilder.addSignalValue(svb6);
    				    SignalValue.Builder svb7 = VehicleDataAcquisitionPublish.SignalValue.newBuilder();
    				    svb4.setFloatValue(4.434343434f);//VerticalAccuracy
    				    dataRowBuilder.addSignalValue(svb7);
    				    SignalValue.Builder svb8 = VehicleDataAcquisitionPublish.SignalValue.newBuilder();
    				    svb4.setFloatValue(4.434343434f);//Course
    				    dataRowBuilder.addSignalValue(svb8);
    				    SignalValue.Builder svb9 = VehicleDataAcquisitionPublish.SignalValue.newBuilder();
    				    svb4.setFloatValue(4.434343434f);//Azimuth
    				    dataRowBuilder.addSignalValue(svb9);
    				    SignalValue.Builder svb10 = VehicleDataAcquisitionPublish.SignalValue.newBuilder();
    				    svb4.setFloatValue(65f);//Speed
    				    dataRowBuilder.addSignalValue(svb10);
    				    SignalValue.Builder svb11 = VehicleDataAcquisitionPublish.SignalValue.newBuilder();
    				    svb4.setInt64Value(System.currentTimeMillis());//Timestamp
    				    dataRowBuilder.addSignalValue(svb11);
    				    SignalValue.Builder svb12 = VehicleDataAcquisitionPublish.SignalValue.newBuilder();
    				    svb4.setFloatValue(4.434343434f);//Altitude
    				    dataRowBuilder.addSignalValue(svb12);
    	dataSetBuilder.addDataRow(dataRowBuilder);
    	DataSet ds = dataSetBuilder.build();

    	VehicleDataAcquisitionPublish.DataSubscription.Builder dataSubBuilder = VehicleDataAcquisitionPublish.DataSubscription.newBuilder();
    	UUID policyId = UUID.randomUUID();
    	dataSubBuilder.setPolicySubscriptionIdLSB(policyId.getLeastSignificantBits());
    	dataSubBuilder.setPolicySubscriptionIdMSB(policyId.getMostSignificantBits());
    	dataSubBuilder.addDataSet(ds);
    	VehicleDataAcquisitionPublish.Builder publishBuilder = VehicleDataAcquisitionPublish.newBuilder();
    	publishBuilder.addDataSubscription(dataSubBuilder);

    	UconnectMessage msg = UconnectMessage.newBuilder()
    			.setTimestamp(System.currentTimeMillis())
    			.setMessageId(messageId)

    			.addMessages(UconnectAny.newBuilder().
    			setExtension(GlobalUconnectExtVehDataAcquisition.vehicleDataAcquisitionPublish, publishBuilder.build()))
    			.build();
    	return msg;
    }

    public void sendMessage(UconnectMessage msg) {
    final byte[] msgOut = msg.toByteArray();
    new Thread(new Runnable() {

        @Override
    public void run() {
    try {
    	mqttClient.publish(clientId+"/ADA/", AWSIotQos.QOS0, msgOut);

    } catch (AWSIotException e) {
    	System.out.println("Caught Exception "+e);
    				e.printStackTrace();
    			}
    	    }

    	}).start();
    }
    public static void main(String[] args) {
    	ServiceExampleForADA service = new ServiceExampleForADA();
    	service.process();
    }

    }

Here's an example of how Service Connects to AWS IOT MQTT for ADA topics and process Vehicle Data policy, send vehicle Data.

Service Example Code (SDP):

    package com.fca.uconnect.global;

    import java.util.UUID;

    import com.amazonaws.services.iot.client.AWSIotException;
    import com.amazonaws.services.iot.client.AWSIotMessage;
    import com.amazonaws.services.iot.client.AWSIotMqttClient;
    import com.amazonaws.services.iot.client.AWSIotQos;
    import com.amazonaws.services.iot.client.AWSIotTopic;
    import com.fca.uconnect.global.GlobalUconnectControl.UconnectAny;
    import com.fca.uconnect.global.GlobalUconnectControl.UconnectMessage;
    import com.fca.uconnect.global.GlobalUconnectExtVehDataAcquisition.VehicleDataAcquisitionPolicyPublish;
    import com.fca.uconnect.global.GlobalUconnectExtVehDataAcquisition.VehicleDataAcquisitionPolicyPublish.PolicySubscription;
    import com.google.protobuf.ExtensionRegistry;

    public class ServiceExampleForADA {
    	public ServiceExampleForADA() {
    		extRegistry = ExtensionRegistry.newInstance();
    		extRegistry.add(GlobalUconnectExtVehDataAcquisition.vehicleDataAcquisitionPolicyPublish);
    	}

    	private String clientId; // The clientId is unique to the device and obtained from the client X.509 certificate CN.
    	private UUID sessionId; // The sessionId is assigned by the SDP to maintain a session independent of connection protocols.
    	private int messageId; // The messageId is a sequential number incremented and assigned to each message sent from the client.
    	private AWSIotMqttClient mqttClient; // The mqtt client object from the AWS IoT client library.
    	private AWSIotTopic iotTopic; // The Topic object to subscribe for inbound messages.
    	private ExtensionRegistry extRegistry; // Google protocol buffers extension registry instance.

    	public void process(){

    		mqttClient = new AWSIotMqttClient("endpoint", clientId, "awsAccessKeyId", "awsSecretAccessKey");
    		try {
    		mqttClient.connect();
    		 iotTopic = new AWSIotTopic("/ADA/#",AWSIotQos.QOS0){
    			public void onMessage(AWSIotMessage msg) {
    		try {
    				sendMessage(getADAPolicyMsg());
    		} catch( Exception ex) {
    			ex.printStackTrace();
    			System.out.println("Err processing message: "+ex+", try parsing ADA.");
    		}
    		}
    		};

    		mqttClient.subscribe(iotTopic);

    		} catch (AWSIotException e) {
    			System.out.println("Caught Exception "+e);
    			e.printStackTrace();
    		}
    	}
    	public void sendMessage(UconnectMessage msg) {
    		final byte[] msgOut = msg.toByteArray();
    		new Thread(new Runnable() {

    		    @Override
    		public void run() {
    		try {
    			mqttClient.publish(clientId+"/ADA/", AWSIotQos.QOS0, msgOut);
    		} catch (AWSIotException e) {
    			System.out.println("Caught Exception "+e);
    						e.printStackTrace();
    					}
    			    }
    			}).start();
    		}

    	public UconnectMessage getADAPolicyMsg() {
    		messageId++;
    		UUID policySubId = UUID.randomUUID();
    		PolicySubscription policySub = PolicySubscription.newBuilder()
    				.setExpirationDate(policySubId.getLeastSignificantBits())
    				.setPolicySubscriptionIdLSB(policySubId.getMostSignificantBits())
    				.build();
    		VehicleDataAcquisitionPolicyPublish vehiclePolicy = VehicleDataAcquisitionPolicyPublish.newBuilder()
    				.setPolicySubscription(0, policySub).build();
    		UconnectMessage msg = UconnectMessage.newBuilder()
    			.setTimestamp(System.currentTimeMillis())

    			.setMessageId(messageId)
    			.addMessages(UconnectAny.newBuilder().
    			 setExtension(GlobalUconnectExtVehDataAcquisition.vehicleDataAcquisitionPolicyPublish, vehiclePolicy))
    			.build();

    		return msg;
    	}

    	public static void main(String[] args){
    		ServiceExampleForADA serviceExampleForADA = new ServiceExampleForADA();
    		serviceExampleForADA.process();
    	}

    }

The example code demonstrates how to connect with AWS IoT for publishing and subscribing to the ADA topic.

Download Client Example Code here

Download Service Example Code here