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 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.UconnectMessage;
import com.google.protobuf.ByteString;
import com.google.protobuf.ExtensionRegistry;
import com.google.protobuf.InvalidProtocolBufferException;

/**
 * This example class demonstrates how to use the AWS IoT mqtt client to receive a Uconnect SendDestinationtoCar messages from the SDP    
 * This code is only for reference and is furnished without warranty.....
 * 
 * @author FCA Global V2C API Team
 *
 */
public class TBMExampleForSendDesttoCar {

	private String clientId; // The clientId is unique to the device and obtained from the client X.509 certificate CN.
	private ByteString 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 boolean receivedResponse = false; // flag to wait for the response as part of this example.
	private AWSIotTopic iotTopic; // The Topic object to subscribe for inbound messages.
	private ExtensionRegistry extRegistry; // Google protocol buffers extension registry instance.
	private Semaphore semaphore;//The semaphore object is used to wait for a response.
	

	
	/**
	 * Constructor - initialize protocol buffer extension registry for parsing incoming Uconnect Messages.
	 */
	public TBMExampleForSendDesttoCar() {
		extRegistry = ExtensionRegistry.newInstance();
		extRegistry.add(GlobalUconnectExtSendAndGo.destinationPush);
		this.semaphore = new Semaphore();
	}
	
	/**
	 * This method demonstrates connecting to the AWS IoT mqtt broker and publishing and subscribing  SendDestoVehicle messages to the SDTC topic.
	 */
	public void process() {
		
		mqttClient = new AWSIotMqttClient("endpoint", clientId, "awsAccessKeyId", "awsSecretAccessKey");
		try {			
			mqttClient.connect();						
			iotTopic = new AWSIotTopic(clientId+"/SDTC/", AWSIotQos.QOS1) {
			 public void onMessage(AWSIotMessage msg) {
				 try {
			 UconnectMessage msgIn;
				msgIn = UconnectMessage.parseFrom(msg.getPayload(),extRegistry);
				if (msgIn.getMessages(0).hasExtension(GlobalUconnectExtSendAndGo.destinationPush)) {
					semaphore.unlock();// Releasing the lock 
				} 

			} catch (InvalidProtocolBufferException e) {
			}
			 }};
				
			mqttClient.subscribe(iotTopic);
			this.semaphore.lock();	//Wait for response, lock thread
		} catch (AWSIotException ex) {
			System.out.println("Caught AWS Exception "+ex);
			ex.printStackTrace();
		}  catch (Exception e) {
			e.printStackTrace();
		}
	}	
	/**
	 * Example main to launch example.
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		TBMExampleForSendDesttoCar example = new TBMExampleForSendDesttoCar();
		example.process();
	}
}
   
      

Here's an example of how Service Connects to AWS IOT MQTT for SDTC topics and process Send Destination to Car messages.

Example Code (SDP):

      
package com.fca.uconnect.global;


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.Address;
import com.fca.uconnect.global.GlobalUconnectControl.Destination;
import com.fca.uconnect.global.GlobalUconnectControl.Destination.OriginalSource;
import com.fca.uconnect.global.GlobalUconnectControl.Destination.RoutePreference;
import com.fca.uconnect.global.GlobalUconnectControl.Location;
import com.fca.uconnect.global.GlobalUconnectControl.PointOfInterest;
import com.fca.uconnect.global.GlobalUconnectControl.UconnectAny;
import com.fca.uconnect.global.GlobalUconnectControl.UconnectMessage;
import com.fca.uconnect.global.GlobalUconnectExtSendAndGo.DestinationPush;
import com.fca.uconnect.global.GlobalUconnectExtSendAndGo.DestinationPush.MapDataBaseVariant;
import com.fca.uconnect.global.GlobalUconnectExtSendAndGo.DestinationPush.MapDataBaseVariant.NavTypeEnum;
import com.google.protobuf.ByteString;
import com.google.protobuf.ExtensionRegistry;

public class SDPExampleForSendDesttoCar {
private String clientId; // The clientId is unique to the device and obtained from the client X.509 certificate CN.
private ByteString sessionId; // The sessionId is assigned by the SDP to maintain a session independent of connection protocols.
private int messageId=10; // 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 SDPExampleForSendDesttoCar() {
	extRegistry = ExtensionRegistry.newInstance();
	extRegistry.add(GlobalUconnectExtSendAndGo.destinationPush);
}
/**
 * This method generates a Protocol Buffer Uconnect Message given the required inputs for DestinationPush.
 * @param mapDBVariant
 * @param dest
 * @param isImmediateNavigation
 * @return
 */
public UconnectMessage getDestinationPushMsg(MapDataBaseVariant mapDBVariant,Destination dest,boolean isImmediateNavigation) {
	this.messageId++;
	sessionId = ByteString.copyFrom(new byte[18]);
	
	DestinationPush destPushMsg = DestinationPush.newBuilder()
			.setIsImmediateNavigation(false)
			.setMapDataBaseVariant(mapDBVariant)
			.addDestinationList(dest)
			.build();
		
	UconnectMessage msg = UconnectMessage.newBuilder()
		.setTimestamp(System.currentTimeMillis())
		.setSessionId(sessionId)
		
		.setMessageId(messageId)
		.addMessages(UconnectAny.newBuilder().
		 setExtension(GlobalUconnectExtSendAndGo.destinationPush,destPushMsg))
		.build();
	return msg;		
}

/**
 * This method demonstrates connecting to the AWS IoT mqtt broker and publishing an SendDestinationToCar messages to the SDTC topic.
 */
public void process() {

	mqttClient = new AWSIotMqttClient("endpoint", clientId, "awsAccessKeyId", "awsSecretAccessKey");

try {			
mqttClient.connect();						
 iotTopic = new AWSIotTopic("/SDTC/#",AWSIotQos.QOS1){
	public void onMessage(AWSIotMessage msg) {
}
};
mqttClient.subscribe(iotTopic);
MapDataBaseVariant mapDBVariant =MapDataBaseVariant.newBuilder()
.setNavTypeEnum(NavTypeEnum.AUTO)
.setVersion("1.0")
.build();
Location destLocation = Location.newBuilder()
.setPositionLatitude(42.480201)
.setPositionLongitude(-83.671875F)
.build();
Address address = Address.newBuilder()
.setHouseNumber("1000")
.setStreetName("Chrystler Drive")
.setCityName("Auburn Hills")
.setProvinceName("Michigan")
.setCountryName("USA")
.build();
Address poiAddress = Address.newBuilder()
.setHouseNumber("2000")
.setStreetName("abc drive")
.setCityName("Auburn Hills")
.setProvinceName("Michigan")
.setCountryName("USA")
.build();
PointOfInterest poi  = PointOfInterest.newBuilder()
.setCategory("Restaurant")
.setDescription("favorite")
.setName("ABCD Restaurant")
.setId(123)
.setPhoneNumber("123 456 7890")
.setLocation(destLocation)
.setUrl("www.abcrestaurant.com")
.setAddress(poiAddress)
.build();
Destination dest = Destination.newBuilder()
.setDestinationDescription("fav restaurant")
.setRoutePreference(RoutePreference.Fast)
.setOrignalSource(OriginalSource.SDP)
.setCreateTimestamp(System.currentTimeMillis())
.setLocation(destLocation)
.setDestinationPoi(poi)
.setDestinationAddress(address)
.build();
sendMessage(getDestinationPushMsg(mapDBVariant,dest,true));
} 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 {	
	AWSIotMessage message = new 
			MessagePublisherListener(clientId+"/SDTC/",AWSIotQos.QOS1,msgOut);
	mqttClient.publish(message);

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

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

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

Download Client Example Code here

Download Service Example Code here