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 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.Location;
    import com.fca.uconnect.global.GlobalUconnectControl.UconnectAny;
    import com.fca.uconnect.global.GlobalUconnectControl.UconnectMessage;
    import com.fca.uconnect.global.GlobalUconnectExtECall.ECallDataUpload;
    import com.fca.uconnect.global.GlobalUconnectExtECall.ECallDataUpload.AirBagStatus;
    import com.fca.uconnect.global.GlobalUconnectExtECall.ECallDataUpload.EngineStatusEnum;
    import com.fca.uconnect.global.GlobalUconnectExtECall.ECallDataUpload.TirePressure;
    import com.fca.uconnect.global.GlobalUconnectExtECall.ECallStatusUpdate;
    import com.fca.uconnect.global.GlobalUconnectExtECall.ECallStatusUpdate.ECallStatusEnum;
    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 send a Uconnect Ecall 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 TBMExampleForECall {

    	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 AWSIotTopic iotTopic; // The Topic object to subscribe for inbound messages.
    	private ExtensionRegistry extRegistry; // Google protocol buffers extension registry instance.

    	/**
    	 * Constructor - initialize protocol buffer extension registry for parsing incoming Uconnect Messages.
    	 */
    	public TBMExampleForECall() {
    		extRegistry = ExtensionRegistry.newInstance();
    		extRegistry.add(GlobalUconnectExtECall.ecallDataUpload);
    	}

    	/**
    	 * This method generates a Protocol Buffer Uconnect Message given the required inputs for ECALLDATAUPLOAD.
    	 *
    	 * @param vehicleId
    	 * @param numberOfPassengers
    	 * @param vehicleSpeed
    	 * @param tirePressure
    	 * @param isPositionTrusted
    	 * @param carLocation
    	 * @param airBagStatus
    	 * @return
    	 */
    	public UconnectMessage getECallDataUploadReqMsg(String vehicleId,int numberOfPassengers,float vehicleSpeed,
    			TirePressure tirePressure,boolean isPositionTrusted,Location carLocation,AirBagStatus airBagStatus){

    		this.messageId++;
    		sessionId = ByteString.copyFrom(new byte[18]);
        	ECallDataUpload cardata = ECallDataUpload.newBuilder()
        			.setVehicleId(vehicleId)
        			.setNumberOfPassengers(numberOfPassengers)
        			.setVehicleSpeed(vehicleSpeed)
        			.setTimeStamp(System.currentTimeMillis())
        			.setTirePressure(tirePressure)
        			.setEngineStatusEnum(EngineStatusEnum.STOP)
        			.setIsPositionTrusted(isPositionTrusted)
        			.setVehicleLocation(carLocation)
        			.setAirBagStatus(airBagStatus)
        			.build();
    		UconnectMessage msg = UconnectMessage.newBuilder()
    			.setTimestamp(System.currentTimeMillis())
    			.setSessionId(sessionId)

    			.setMessageId(messageId)
    			.addMessages(UconnectAny.newBuilder().
    			 setExtension(GlobalUconnectExtECall.ecallDataUpload, cardata))
    			.build();

    		return msg;
    	}

    	public UconnectMessage getECallStatusUpdateMsg(){
    		ECallStatusUpdate ecallStatusUpdate = ECallStatusUpdate.newBuilder().
    				setEcallStatusEnum(ECallStatusEnum.DIAL).build();

    		UconnectMessage msg = UconnectMessage.newBuilder()
    				.setTimestamp(System.currentTimeMillis())
    				.setSessionId(sessionId)

    				.setMessageId(messageId)
    				.addMessages(UconnectAny.newBuilder().
    				 setExtension(GlobalUconnectExtECall.ecallStatusUpdate, ecallStatusUpdate))
    				.build();

    			return msg;
    	}

    	/**
    	 * This method demonstrates connecting to the AWS IoT mqtt broker and publishing an ECALL message to the ECAL topic.
    	 */
    	public void process() {

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

    		try {
    			mqttClient.connect();

    			iotTopic = new AWSIotTopic(clientId+"/ECAL/", AWSIotQos.QOS1) {
    				public void onMessage(AWSIotMessage msg) {
    					UconnectMessage msgIn = null;
    					try {
    						msgIn = UconnectMessage.parseFrom(msg.getPayload(),extRegistry);
    					} catch (InvalidProtocolBufferException e) {
    					}
    				}
    			};
    			mqttClient.subscribe(iotTopic);
    			AirBagStatus airBagStatus = AirBagStatus.newBuilder()
    					.setIsDriver(false)
    					.setIsDriverKnee(false)
    					.setIsLeftSeat(false)
    					.setIsRightSeat(false)
    					.setIsPassenger(false)
    					.setIsPassengerKnee(false)
    					.setIsLeftSideCurtain(false)
    					.build();
    			Location vehicleLocation = Location.newBuilder()
    					.setPositionLongitude(43.9999f)
    					.setPositionLatitude(-84.54635343f)
    					.build();
    				TirePressure tirePressureMsg = TirePressure.newBuilder()
    						.setFlTirePressure(35)
    						.setFrTirePressure(34)
    						.setRlTirePressure(36)
    						.setRrTirePressure(35)
    						.build();
    			UconnectMessage msg = getECallDataUploadReqMsg("1234AXFGFGHGH4566",1,75,tirePressureMsg,true,vehicleLocation,airBagStatus);
    			sendMessage(msg);
    			Thread.sleep(5000);
    			UconnectMessage eCallMsg = getECallStatusUpdateMsg();
    			sendMessage(eCallMsg);

    		} catch (AWSIotException ex) {
    			System.out.println("Caught AWS Exception "+ex);
    			ex.printStackTrace();
    		} catch (InterruptedException e) {
    		}
    	}
    	/**
    	 * This method publishes the message to ECAL topic
    	 */
    	public void sendMessage(UconnectMessage msg) {
    		final byte[] msgOut = msg.toByteArray();
    		new Thread(new Runnable() {

    		    @Override
    		public void run() {
    		try {
    			AWSIotMessage message = new
    					MessagePublisherListener("/ECAL/"+clientId,AWSIotQos.QOS1,msgOut);
    			mqttClient.publish(message);
    		} catch (AWSIotException e) {
    			System.out.println("Caught Exception "+e);
    						e.printStackTrace();
    					}
    			    }
    			}).start();
    		}

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

Here's an example of how Service Connects to AWS IOT MQTT for Activation topics and process ECALL Request .

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.GlobalUconnectExtECall.ECallCarDataRequest;
    import com.fca.uconnect.global.GlobalUconnectExtECall.ECallStatusUpdate.ECallStatusEnum;
    import com.google.protobuf.ByteString;
    import com.google.protobuf.ExtensionRegistry;

    public class SDPExampleForECall {
    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 AWSIotTopic iotTopic; // The Topic object to subscribe for inbound messages.
    private ExtensionRegistry extRegistry; // Google protocol buffers extension registry instance.
    private int correlationId = 0;// The correlationId is a sender messageId so that Sender can recognize the message once its received response.
    private Semaphore semaphore;//The semaphore object is used to wait for a response.

    public SDPExampleForECall() {
    	extRegistry = ExtensionRegistry.newInstance();
    	extRegistry.add(GlobalUconnectExtECall.ecallDataUpload);
    	extRegistry.add(GlobalUconnectExtECall.ecallStatusUpdate);
    	extRegistry.add(GlobalUconnectExtECall.ecallCarDataResponse);
    	this.semaphore = new Semaphore();
    }
    public static void main(String[] args) {
    	SDPExampleForECall m = new SDPExampleForECall();
    	m.process();
    }
    public UconnectMessage getECallCarDataRequestMsg() {
    	messageId++;

    	ECallCarDataRequest carDataReq = ECallCarDataRequest.newBuilder()
    			.build();
    	sessionId = ByteString.copyFrom(new byte[18]);
    	UconnectMessage msg = UconnectMessage.newBuilder()
    		.setTimestamp(System.currentTimeMillis())
    		.setSessionId(sessionId)

    		.setMessageId(messageId)
    		.setCorrelationId(correlationId)
    		.addMessages(UconnectAny.newBuilder().
    		 setExtension(GlobalUconnectExtECall.ecallCarDataRequest, carDataReq))
    		.build();

    	return msg;
    }

    public void process() {
    	mqttClient = new AWSIotMqttClient("endpoint", clientId, "awsAccessKeyId", "awsSecretAccessKey");

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

    	UconnectMessage	msgIn = UconnectMessage.parseFrom(msg.getPayload(),extRegistry);
    	if(msgIn.getMessages(0).hasExtension(GlobalUconnectExtECall.ecallDataUpload)){
    	//receive Vehicle Data
    	GlobalUconnectExtECall.ECallDataUpload ecallDataUploadMsg = msgIn.getMessages(0).getExtension(GlobalUconnectExtECall.ecallDataUpload);
    	}else{
    	//Wait for Call
    	GlobalUconnectExtECall.ECallStatusUpdate ecallStatusUpdateMsg = msgIn.getMessages(0).getExtension(GlobalUconnectExtECall.ecallStatusUpdate);
    	if(!ecallStatusUpdateMsg.getEcallStatusEnum().equals(ECallStatusEnum.CANCEL)){//User did not cancel call
    		//if needed query for Vehicle data continuously
    	 int counter = 0;
    	 while(counter<5){
    		sendMessage(getECallCarDataRequestMsg());
    		try {
    			Thread.sleep(1000);//wait and Request vehicle data
    		} catch (InterruptedException e) {
    		}
    		counter++;
    	 }
        }
    	semaphore.unlock();// Releasing the lock
       }

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

    }
    }
    };
    mqttClient.subscribe(iotTopic);

    } catch (AWSIotException e) {
    	System.out.println("Caught Exception "+e);
    	e.printStackTrace();
    }
    try {
    	this.semaphore.lock();
    } catch (InterruptedException e) {

    }
    }

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

        @Override
    public void run() {
    try {
    	AWSIotMessage message = new
    			MessagePublisherListener(clientId+"/ECAL/",AWSIotQos.QOS1,msgOut);
    	mqttClient.publish(message);

    } 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 ECall topic.

Download Client Example Code here

Download Service Example Code here