/** * Construct a Docking Station object with touch screen, card reader and key issuer interface * devices and a connection to a number of docking points. * * <p>If the instance name is <foo>, then the Docking Points are named <foo>.1 ... * <foo>.<numPoints> . * * @param instanceName */ public DStation(String instanceName, int eastPos, int northPos, int numPoints) { // Construct and make connections with interface devices this.instanceName = instanceName; this.eastPos = eastPos; this.northPos = northPos; touchScreen = new DSTouchScreen(instanceName + ".ts"); touchScreen.setObserver(this); // Set observers to recognise "view activity" and "find free points" options touchScreen.setViewActivityObserver(this); touchScreen.setFindFreePointsObserver(this); cardReader = new CardReader(instanceName + ".cr"); keyIssuer = new KeyIssuer(instanceName + ".ki"); keyReader = new KeyReader(instanceName + ".kr"); dockingPoints = new ArrayList<DPoint>(); for (int i = 1; i <= numPoints; i++) { DPoint dp = new DPoint(instanceName + "." + i, i - 1); dockingPoints.add(dp); } }
/** * Implementation of docking station functionality for "view activity" use case. * * <p>Method called on docking station receiving a "view activity" triggering input event at the * touch screen. */ @Override public void viewActivityReceived() { logger.fine(getInstanceName()); touchScreen.showPrompt("PLEASE INSERT YOUR KEY."); String keyID = keyReader.waitForKeyInsertion(); ArrayList<String> userInfoData; userInfoData = hub.userActivity(keyID); touchScreen.showUserActivity(userInfoData); ; }
void setCollector(EventCollector c) { touchScreen.setCollector(c); cardReader.setCollector(c); keyIssuer.setCollector(c); for (DPoint dp : dockingPoints) { dp.setCollector(c); } }
void setDistributor(EventDistributor d) { touchScreen.addDistributorLinks(d); cardReader.addDistributorLinks(d); keyReader.addDistributorLinks(d); for (DPoint dp : dockingPoints) { dp.setDistributor(d); } }
/** * Implementation of docking station functionality for "find free points" use case. * * <p>Method called on docking station receiving a "find free points" triggering input event at * the touch screen. * * <p>It asks the */ @Override public void findFreePointsReceived() { logger.fine(getInstanceName()); ArrayList<String> occupancyList; occupancyList = hub.findFreePoints(this); touchScreen.showFreePoints(occupancyList); }