@@ -0,0 +1,1591 @@
+package osgi.enroute.trains.hw.provider;%0A%0Aimport org.osgi.service.component.annotations.Activate;%0Aimport org.osgi.service.component.annotations.Component;%0Aimport org.osgi.service.component.annotations.ConfigurationPolicy;%0Aimport org.osgi.service.metatype.annotations.Designate;%0Aimport org.osgi.service.metatype.annotations.ObjectClassDefinition;%0Aimport org.osgi.util.promise.Deferred;%0Aimport org.osgi.util.promise.Promise;%0A%0Aimport osgi.enroute.trains.controller.api.RFIDSegmentController;%0A%0A@Designate(ocd=RFIDSegmentImpl.Config.class, factory=true)%0A@Component(name = %22osgi.enroute.trains.hw.rfid%22, property=%22service.exported.interfaces=*%22, configurationPolicy=ConfigurationPolicy.REQUIRE)%0Apublic class RFIDSegmentImpl implements RFIDSegmentController %7B%0A%0A%09private Config config;%0A%0A%09private String lastRFID = null;%0A%09private Deferred%3CString%3E nextRFID = new Deferred%3CString%3E();%0A%09%0A%09%0A%09@ObjectClassDefinition%0A%09@interface Config %7B%0A%09%09int controller();%0A%09%09%0A%09%09// TODO also specify which hardware pins/port RFID reader to read out in config%0A%09%7D%0A%0A%09@Activate%0A%09void activate(Config config) %7B%0A%09%09this.config = config;%0A%09%09%0A%09%09// TODO initialize reading out the RFID reader - call trigger each time RFID is detected%0A%09%7D%0A%0A%09@Override%0A%09public String lastRFID() %7B%0A%09%09return lastRFID;%0A%09%7D%0A%0A%09@Override%0A%09public synchronized Promise%3CString%3E nextRFID() %7B%0A%09%09return nextRFID.getPromise();%0A%09%7D%0A%0A%09// This method is called when an RFID tag detected %0A%09private synchronized void trigger(String rfid)%7B%0A%09%09Deferred%3CString%3E toResolve = nextRFID;%0A%09%09nextRFID = new Deferred%3CString%3E();%0A%09%09toResolve.resolve(rfid);%0A%09%09this.lastRFID = rfid;%0A%09%7D%0A%7D%0A

Add placeholder for the RFID segment controller