// Path: be.iminds.iot.things.api/src/be/iminds/iot/things/api/event/ChangeEvent.java
// public class ChangeEvent {
// 	
// 	public UUID thingId; /* id of the thing */
// 	public UUID gatewayId; /* gateway that published the event */
// 	public String stateVariable; /* state variable that changed */
// 	public Object stateValue; /* new value of the state variable */
// 	public long timestamp; /* timestamp the event was generated */
// 	
// }
// 
// Path: be.iminds.iot.things.api/src/be/iminds/iot/things/api/event/OfflineEvent.java
// public class OfflineEvent {
// 	
// 	public UUID thingId; /* id of the thing */
// 	public UUID gatewayId; /* gateway that published the event */
// 	public long timestamp; /* timestamp the event was generated */
// 	
// }
// 
// Path: be.iminds.iot.things.api/src/be/iminds/iot/things/api/event/OnlineEvent.java
// public class OnlineEvent {
// 	
// 	public UUID thingId; /* id of the thing */
// 	public UUID gatewayId; /* gateway that published the event */
// 	public String service; /* service of the thing */
// 	public String device; /* device name of the thing */
// 	public String type; /* thing type */
// 	public long timestamp; /* timestamp the event was generated */
// 	
// }


import java.util.UUID;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.event.EventAdmin;
import osgi.enroute.dto.api.DTOs;
import osgi.enroute.scheduler.api.Scheduler;
import be.iminds.iot.things.api.event.ChangeEvent;
import be.iminds.iot.things.api.event.OfflineEvent;
import be.iminds.iot.things.api.event.OnlineEvent;
import java.util.Random;
		e.thingId = id;
		e.gatewayId = gatewayId;
		e.device = device;
		e.service = service;
		e.type = type;
		e.timestamp = System.currentTimeMillis();
		
		try {
			final String topic = "be/iminds/iot/thing/online/"+id;
			ea.sendEvent(new org.osgi.service.event.Event(topic, dtos.asMap(e)));
		} catch(Exception ex){
			System.err.println("Failed to send event "+e);
		}
	}
	
	void publishOffline(){
		OfflineEvent e = new OfflineEvent();
		e.thingId = id;
		e.gatewayId = gatewayId;
		e.timestamp = System.currentTimeMillis();
		
		try {
			final String topic = "be/iminds/iot/thing/offline/"+id;
			ea.sendEvent(new org.osgi.service.event.Event(topic, dtos.asMap(e)));
		} catch(Exception ex){
			System.err.println("Failed to send event "+e);
		}
	}
	
	void publishChange(String variable, Object value){
// Path: be.iminds.iot.things.api/src/be/iminds/iot/things/api/event/ChangeEvent.java
// public class ChangeEvent {
// 	
// 	public UUID thingId; /* id of the thing */
// 	public UUID gatewayId; /* gateway that published the event */
// 	public String stateVariable; /* state variable that changed */
// 	public Object stateValue; /* new value of the state variable */
// 	public long timestamp; /* timestamp the event was generated */
// 	
// }
// 
// Path: be.iminds.iot.things.api/src/be/iminds/iot/things/api/event/OfflineEvent.java
// public class OfflineEvent {
// 	
// 	public UUID thingId; /* id of the thing */
// 	public UUID gatewayId; /* gateway that published the event */
// 	public long timestamp; /* timestamp the event was generated */
// 	
// }
// 
// Path: be.iminds.iot.things.api/src/be/iminds/iot/things/api/event/OnlineEvent.java
// public class OnlineEvent {
// 	
// 	public UUID thingId; /* id of the thing */
// 	public UUID gatewayId; /* gateway that published the event */
// 	public String service; /* service of the thing */
// 	public String device; /* device name of the thing */
// 	public String type; /* thing type */
// 	public long timestamp; /* timestamp the event was generated */
// 	
// }


// Path: be.iminds.iot.things.dummy.adapter/src/be/iminds/iot/things/dummy/DummyThing.java
import java.util.UUID;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.event.EventAdmin;
import osgi.enroute.dto.api.DTOs;
import osgi.enroute.scheduler.api.Scheduler;
import be.iminds.iot.things.api.event.ChangeEvent;
import be.iminds.iot.things.api.event.OfflineEvent;
import be.iminds.iot.things.api.event.OnlineEvent;
import java.util.Random;

		e.thingId = id;
		e.gatewayId = gatewayId;
		e.device = device;
		e.service = service;
		e.type = type;
		e.timestamp = System.currentTimeMillis();
		
		try {
			final String topic = "be/iminds/iot/thing/online/"+id;
			ea.sendEvent(new org.osgi.service.event.Event(topic, dtos.asMap(e)));
		} catch(Exception ex){
			System.err.println("Failed to send event "+e);
		}
	}
	
	void publishOffline(){
		OfflineEvent e = new OfflineEvent();
		e.thingId = id;
		e.gatewayId = gatewayId;
		e.timestamp = System.currentTimeMillis();
		
		try {
			final String topic = "be/iminds/iot/thing/offline/"+id;
			ea.sendEvent(new org.osgi.service.event.Event(topic, dtos.asMap(e)));
		} catch(Exception ex){
			System.err.println("Failed to send event "+e);
		}
	}
	
	void publishChange(String variable, Object value){
		ChangeEvent e = new ChangeEvent();