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.ArrayList;
    import java.util.List;

    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.GlobalUconnectExtSQDF.SQDFData;
    import com.fca.uconnect.global.GlobalUconnectExtSQDF.SQDFData.ECUDataPoint;
    import com.fca.uconnect.global.GlobalUconnectExtSQDF.SQDFData.ECUDataPoint.CanType;
    import com.fca.uconnect.global.GlobalUconnectExtSQDF.SQDFData.QuickScan;
    import com.fca.uconnect.global.GlobalUconnectExtSQDF.SQDFPublish;
    import com.fca.uconnect.global.GlobalUconnectExtSQDF.SQDFResponse;
    import com.google.protobuf.ByteString;
    import com.google.protobuf.ExtensionRegistry;

    /**
     * This example class demonstrates how to use the AWS IoT mqtt client to send a Uconnect SQDF message to the SDP and wait for a response message.
     * This code is only for reference and is furnished without warranty.....
     *
     * @author FCA Global V2C API Team
     *
     */
    public class TBMExampleForSQDF {

    	private String clientId; // The clientId is unique to the device and obtained from the client X.509 certificate CN.
    	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.
    	List messages ;
    	/**
    	 * Constructor - initialize protocol buffer extension registry for parsing incoming Uconnect Messages.
    	 */
    	public TBMExampleForSQDF() {
    		extRegistry = ExtensionRegistry.newInstance();
    		extRegistry.add(GlobalUconnectExtSQDF.sqdfRequest);
    	}

    	/**
    	 * This method generates a Protocol Buffer Uconnect Message given the required inputs for SQDFPublish.
    	 *
    	 * @return UconnectMessage Protocol Buffer
    	 */
    	public UconnectMessage getSQDFPubMsg() {
    		this.messageId++;
    		ECUDataPoint dataPoint = ECUDataPoint.newBuilder()
    		.setResponseID(12345)
    		.setType(CanType.BHCAN_OR_I_CAN)
    		.setCanFrame(ByteString.copyFrom(new byte[18]))
    		.build();
    		QuickScan scan = QuickScan.newBuilder()
    				.setODO(60)
    				.setGpsLatitude(12.34)
    				.setGpsLongitude(12.34)
    				.addQuickscanDataPoints(dataPoint)
    				.setGpsAltitude(12.34)
    				.setGpsTimestamp(System.currentTimeMillis())
    				.setVIN(122)
    				.build();
    		SQDFData data = SQDFData.newBuilder()
    				.setQuickScan(scan)
    				.build();
    		SQDFPublish pubMsg = SQDFPublish.newBuilder()
    				.setData(data)
    				.build();

    		UconnectMessage msg = UconnectMessage.newBuilder()
    			.setTimestamp(System.currentTimeMillis())
    			.setMessageId(messageId)
    			.addMessages(UconnectAny.newBuilder().
    			 setExtension(GlobalUconnectExtSQDF.sqdfPublish, pubMsg))
    			.build();

    		return msg;
    	}
    	/**
    	 * This method demonstrates connecting to the AWS IoT mqtt broker and publishing an SQDF message to the SQDF topic.
    	 */
    	public List process() {

    		mqttClient = new AWSIotMqttClient("endpoint", clientId, "awsAccessKeyId", "awsSecretAccessKey");
    		try {
    			mqttClient.connect();

    		iotTopic = new AWSIotTopic(clientId+"/SQDF/", AWSIotQos.QOS1) {
    				public void onMessage(AWSIotMessage msg) {
    					try{
    					UconnectMessage msgIn;
    						msgIn = UconnectMessage.parseFrom(msg.getPayload(),extRegistry);
    					if (msgIn.getMessages(0).hasExtension(GlobalUconnectExtSQDF.sqdfRequest)) {
    						if(messages==null)
    							messages = new ArrayList();
    						messages.add(msgIn.getMessages(0));
    					}

    			} catch( Exception ex) {
    				ex.printStackTrace();
    				System.out.println("Err processing message: "+ex+", try parsing SQDF.");
    			}
    			}
    			};
    			mqttClient.subscribe(iotTopic);
    			UconnectMessage msg = getSQDFPubMsg();
    			mqttClient.publish("/SQDF/"+clientId, AWSIotQos.QOS1, msg.toByteArray());

    			if(messages!=null)
    				return messages;
    		} catch (AWSIotException ex) {
    			System.out.println("Caught AWS Exception "+ex);
    			ex.printStackTrace();
    		}  catch (Exception e) {
    			e.printStackTrace();
    		}
    		return null;
    	}

    	/**
    	 * Example main to launch example.
    	 *
    	 * @param args
    	 */
    	public static void main(String[] args) {
    		TBMExampleForSQDF example = new TBMExampleForSQDF();
    		example.process();
    	}
    }

Service 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.UconnectAny;
    import com.fca.uconnect.global.GlobalUconnectControl.UconnectMessage;
    import com.fca.uconnect.global.GlobalUconnectExtSQDF.SQDFRequest;
    import com.fca.uconnect.global.GlobalUconnectExtSQDF.SQDFRequest.PolicySubscriptionScope;
    import com.fca.uconnect.global.GlobalUconnectExtSQDF.SQDFRequest.SQDFCommand;
    import com.google.protobuf.ExtensionRegistry;

    public class SDPExampleForSQDF {
    private String clientId; // The clientId is unique to the device and obtained from the client X.509 certificate CN.
    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 SDPExampleForSQDF() {
    	extRegistry = ExtensionRegistry.newInstance();
    	extRegistry.add(GlobalUconnectExtSQDF.sqdfResponse);

    }
    public static void main(String[] args) {
    	SDPExampleForSQDF m = new SDPExampleForSQDF();
    	m.process();
    }
    public UconnectMessage getSQDFRequestMsg() {
    	messageId++;

    	SQDFRequest sreq = SQDFRequest.newBuilder()
    			.setCommand(SQDFCommand.SendData)
    			.setPolicySubscriptionScope(PolicySubscriptionScope.GenericData)
    			.build();
    	UconnectMessage msg = UconnectMessage.newBuilder()
    		.setTimestamp(System.currentTimeMillis())
    		.setMessageId(messageId)
    		.addMessages(UconnectAny.newBuilder().
    		 setExtension(GlobalUconnectExtSQDF.sqdfRequest, sreq))
    		.build();
    	return msg;
    }

    public void process() {

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

    try {
    mqttClient.connect();
     iotTopic = new AWSIotTopic("/SQDF/#",AWSIotQos.QOS1){
    	public void onMessage(AWSIotMessage msg) {
    try {

    	UconnectMessage	msgIn = UconnectMessage.parseFrom(msg.getPayload(),extRegistry);
    	GlobalUconnectExtSQDF.SQDFResponse SQDFRespMsg = msgIn.getMessages(0).getExtension(GlobalUconnectExtSQDF.sqdfResponse);
    	if (SQDFRespMsg!=null) {
    		//receive sqdfresponse.

    	}
    } catch( Exception ex) {
    	ex.printStackTrace();
    }
    }
    };

    mqttClient.subscribe(iotTopic);
    sendMessage(getSQDFRequestMsg());
    } 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+"/SQDF/", AWSIotQos.QOS1, msgOut);
    } catch (AWSIotException e) {
    	System.out.println("Caught Exception "+e);
    				e.printStackTrace();
    			}
    	    }

    	}).start();
    }
    }

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

Download Client Example Code here

Download Service Example Code here