package com.fca.uconnect.global;

import com.amazonaws.services.iot.client.AWSIotMessage;
import com.amazonaws.services.iot.client.AWSIotQos;
import com.amazonaws.services.iot.client.AWSIotTopic;

public class IoTReceiveTopic extends AWSIotTopic {
	
	private MqttMessageCallbackInterface callback;
	
	public IoTReceiveTopic(String topic, AWSIotQos qos) {
		super(topic, qos);
	}

	public void setMqttMessageCallbackInterface(MqttMessageCallbackInterface c) {
		this.callback = c;
	}
	
	public void onMessage(AWSIotMessage msg) {
		if (this.callback != null) {
			this.callback.onMessage(msg);			
		} else {
			System.out.println("Err: Callback not set to handle msg: "+msg.toString());
		}
	}

}
