diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1e/8025d3dbc98300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1e/8025d3dbc98300131636968a6a637f39 deleted file mode 100644 index fb82f1d..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1e/8025d3dbc98300131636968a6a637f39 +++ /dev/null @@ -1,64 +0,0 @@ -package org.apparatus_templi; - -public class SimpleDriver extends Coordinator implements ControlerModule,Runnable { - private String moduleName = "SimpleDriver"; - - @Override - public String getModuleType() { - return "Controller"; - } - - @Override - public String getControlerListXML() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void tellController(String controllerName, String command) { - // TODO Auto-generated method stub - - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void run() { - // TODO Auto-generated method stub - - } - - @Override - public void receiveMessage(String message) { - // TODO Auto-generated method stub - - } - - @Override - public void terminate() { - // TODO Auto-generated method stub - - } - - @Override - public String getWidgetXML() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getFullPageXML() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getControlerStatusXML(String controllerName) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1e/d03af6cecb8300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1e/d03af6cecb8300131636968a6a637f39 deleted file mode 100644 index 8e68ce0..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1e/d03af6cecb8300131636968a6a637f39 +++ /dev/null @@ -1,156 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControllerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - /* - * I'm uncertain what the best way to impliment this is. Either - * we can return back the strings "Controller","Sensor","Combo", - * or change the interfaces to require an isSensorModule() and - * isControllerModule(). I think the latter would be best, since - * additional types might be added later. - */ - @Override - public String getModuleType() { - return "Controller"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - - /* - * Tell the thread that execution should stop. - * This does not immediately terminate the thread, but sets a flag - * so that the infinite loop in run() will exit. - */ - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControllerListXML() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * Since our simple driver does not keep track of the status of the LEDs - * it can only respond with 'Unknown' for the status. If this were a real - * driver you would want to check that the controlerName is valid, and - * return a response based of of the controller's last known status. - */ - @Override - public String getControllerStatusXML(String controllerName) { - return new String( "\n" + - "" + - "" + controllerName + "" + - "Unknown" + - ""); - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - /* - * We don't care about any response messages. - */ - @Override - public void receiveMessage(String message) {} - - /* - * The XML format for the widget needs to be standardized - */ - @Override - public String getWidgetXML() { - // TODO Auto-generated method stub - return null; - } - - /* - * The XML format for the full page control needs to be standardized - */ - @Override - public String getFullPageXML() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/30/f0e689d6c38300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/30/f0e689d6c38300131636968a6a637f39 deleted file mode 100644 index fb06fcf..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/30/f0e689d6c38300131636968a6a637f39 +++ /dev/null @@ -1,50 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash implements ControlerModule, Runnable { - private String moduleName = "LED_FLASH"; - - @Override - public String getModuleType() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getModuleName() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getControlerList() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void tellController(String controllerName, String command) { - // TODO Auto-generated method stub - - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. - * - * The startup procedure is very simple, ask the Coordinator if the - */ - @Override - public void run() { - // TODO Auto-generated method stub - - } - - @Override - public void receiveMessage(String message) { - // TODO Auto-generated method stub - - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/38/c0a0475dc88300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/38/c0a0475dc88300131636968a6a637f39 deleted file mode 100644 index 64bd97f..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/38/c0a0475dc88300131636968a6a637f39 +++ /dev/null @@ -1,122 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControlerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - @Override - public String getModuleType() { - return "Controler"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControlerListXML() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * Since our simple driver does not keep track of the status of the LEDs - * it can only respond with 'Unknown' for the status. If this were a real - * driver you would want to check that the controlerName is valid, and - * return a response based of of the controller's last known status. - */ - @Override - public String getControlerStatusXML(String controllerName) { - return new String( "\n" + - "Unknown"); - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - /* - * We don't care about any response messages. - */ - @Override - public void receiveMessage(String message) {} - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/43/e0a585deca8300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/43/e0a585deca8300131636968a6a637f39 deleted file mode 100644 index 08c6afc..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/43/e0a585deca8300131636968a6a637f39 +++ /dev/null @@ -1,143 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControllerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - @Override - public String getModuleType() { - return "Controler"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControllerListXML() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * Since our simple driver does not keep track of the status of the LEDs - * it can only respond with 'Unknown' for the status. If this were a real - * driver you would want to check that the controlerName is valid, and - * return a response based of of the controller's last known status. - */ - @Override - public String getControllerStatusXML(String controllerName) { - return new String( "\n" + - "" + - "" + controllerName + "" + - "Unknown" + - ""); - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - /* - * We don't care about any response messages. - */ - @Override - public void receiveMessage(String message) {} - - /* - * The XML format for the widget needs to be standardized - */ - @Override - public String getWidgetXML() { - // TODO Auto-generated method stub - return null; - } - - /* - * The XML format for the full page control needs to be standardized - */ - @Override - public String getFullPageXML() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/48/10bcf49185880013142d9777a99f0fe4 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/48/10bcf49185880013142d9777a99f0fe4 deleted file mode 100644 index 1f2d651..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/48/10bcf49185880013142d9777a99f0fe4 +++ /dev/null @@ -1,6 +0,0 @@ -package org.apparatus_templi; - -public interface SensorModule extends Driver { - public String getSensorList(); - public String getSensorData(String sensorName); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/53/307b4f40ca8300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/53/307b4f40ca8300131636968a6a637f39 deleted file mode 100644 index 663f216..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/53/307b4f40ca8300131636968a6a637f39 +++ /dev/null @@ -1,143 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControllerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - @Override - public String getModuleType() { - return "Controler"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControlerListXML() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * Since our simple driver does not keep track of the status of the LEDs - * it can only respond with 'Unknown' for the status. If this were a real - * driver you would want to check that the controlerName is valid, and - * return a response based of of the controller's last known status. - */ - @Override - public String getControllerStatusXML(String controllerName) { - return new String( "\n" + - "" + - "" + controllerName + "" + - "Unknown" + - ""); - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - /* - * We don't care about any response messages. - */ - @Override - public void receiveMessage(String message) {} - - /* - * The XML format for the widget needs to be standardized - */ - @Override - public String getWidgetXML() { - // TODO Auto-generated method stub - return null; - } - - /* - * The XML format for the full page control needs to be standardized - */ - @Override - public String getFullPageXML() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/57/5021d5dbc98300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/57/5021d5dbc98300131636968a6a637f39 deleted file mode 100644 index a2cd71b..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/57/5021d5dbc98300131636968a6a637f39 +++ /dev/null @@ -1,7 +0,0 @@ -package org.apparatus_templi; - -public interface ControlerModule extends Driver { - public String getControlerListXML(); - public String getControlerStatusXML(String controllerName); - public void tellController(String controllerName, String command); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5f/80e2f1eaca8300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5f/80e2f1eaca8300131636968a6a637f39 deleted file mode 100644 index f7da2c2..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5f/80e2f1eaca8300131636968a6a637f39 +++ /dev/null @@ -1,64 +0,0 @@ -package org.apparatus_templi; - -public class SimpleDriver extends Coordinator implements ControllerModule,Runnable { - private String moduleName = "SimpleDriver"; - - @Override - public String getModuleType() { - return "Controller"; - } - - @Override - public String getControlerListXML() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void tellController(String controllerName, String command) { - // TODO Auto-generated method stub - - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void run() { - // TODO Auto-generated method stub - - } - - @Override - public void receiveMessage(String message) { - // TODO Auto-generated method stub - - } - - @Override - public void terminate() { - // TODO Auto-generated method stub - - } - - @Override - public String getWidgetXML() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getFullPageXML() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getControlerStatusXML(String controllerName) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6/10ec5b0ac18300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6/10ec5b0ac18300131636968a6a637f39 deleted file mode 100644 index f406588..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6/10ec5b0ac18300131636968a6a637f39 +++ /dev/null @@ -1,6 +0,0 @@ -package org.apparatus_templi; - -public interface Driver { - public String getModuleType(); - public String getModuleName(); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/65/e03ccf1bc18300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/65/e03ccf1bc18300131636968a6a637f39 deleted file mode 100644 index 08b9390..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/65/e03ccf1bc18300131636968a6a637f39 +++ /dev/null @@ -1,34 +0,0 @@ -package org.apparatus_templi; - -public class SimpleDriver extends Coordinator implements ControlerModule,Runnable { - private String moduleName = "SimpleDriver"; - - @Override - public String getModuleType() { - return "Controller"; - } - - @Override - public String getControlerList() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void tellController(String controllerName, String command) { - // TODO Auto-generated method stub - - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void run() { - // TODO Auto-generated method stub - - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/90a5ac33c78300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/90a5ac33c78300131636968a6a637f39 deleted file mode 100644 index 945be8e..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/90a5ac33c78300131636968a6a637f39 +++ /dev/null @@ -1,6 +0,0 @@ -package org.apparatus_templi; - -public interface ControlerModule extends Driver { - public String getControlerList(); - public void tellController(String controllerName, String command); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/68/6057cf75c78300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/68/6057cf75c78300131636968a6a637f39 deleted file mode 100644 index 5cb872b..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/68/6057cf75c78300131636968a6a637f39 +++ /dev/null @@ -1,110 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControlerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - @Override - public String getModuleType() { - return "Controler"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControlerList() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - /* - * We don't care about any response messages. - */ - @Override - public void receiveMessage(String message) {} - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6b/507ed200d58500131105c897513b99eb b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6b/507ed200d58500131105c897513b99eb deleted file mode 100644 index a867a8a..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6b/507ed200d58500131105c897513b99eb +++ /dev/null @@ -1,162 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControllerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - /* - * I'm uncertain what the best way to implement this is. Either - * we can return back the strings "Controller","Sensor","Combo", - * or change the interfaces to require an isSensorModule() and - * isControllerModule(). I think the latter would be best, since - * additional types might be added later. - */ - @Override - public String getModuleType() { - return "Controller"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - - /* - * Tell the thread that execution should stop. - * This does not immediately terminate the thread, but sets a flag - * so that the infinite loop in run() will exit. - */ - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControllerListXML() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * Since our simple driver does not keep track of the status of the LEDs - * it can only respond with 'Unknown' for the status. If this were a real - * driver you would want to check that the controlerName is valid, and - * return a response based of of the controller's last known status. - */ - @Override - public String getControllerStatusXML(String controllerName) { - return new String( "\n" + - "" + - "" + controllerName + "" + - "Unknown" + - ""); - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - * - * Note that the commands being send are very simple (a single digit - * number corresponding to a pin on the arduino). A more complex - * driver might send multiple pin numbers at a time, or even a length - * of time in which to flash. The format of the command is free form - * text, but steer clear of using the line feed character for now. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - /* - * We don't care about any response messages. - */ - @Override - public void receiveMessage(String message) {} - - /* - * The XML format for the widget needs to be standardized - */ - @Override - public String getWidgetXML() { - // TODO Auto-generated method stub - return null; - } - - /* - * The XML format for the full page control needs to be standardized - */ - @Override - public String getFullPageXML() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7/9008393cca8300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7/9008393cca8300131636968a6a637f39 deleted file mode 100644 index 780ff44..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7/9008393cca8300131636968a6a637f39 +++ /dev/null @@ -1,7 +0,0 @@ -package org.apparatus_templi; - -public interface ControllerModule extends Driver { - public String getControlerListXML(); - public String getControlerStatusXML(String controllerName); - public void tellController(String controllerName, String command); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/74/e0942bd2ce8300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/74/e0942bd2ce8300131636968a6a637f39 deleted file mode 100644 index ac01543..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/74/e0942bd2ce8300131636968a6a637f39 +++ /dev/null @@ -1,162 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControllerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - /* - * I'm uncertain what the best way to impliment this is. Either - * we can return back the strings "Controller","Sensor","Combo", - * or change the interfaces to require an isSensorModule() and - * isControllerModule(). I think the latter would be best, since - * additional types might be added later. - */ - @Override - public String getModuleType() { - return "Controller"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - - /* - * Tell the thread that execution should stop. - * This does not immediately terminate the thread, but sets a flag - * so that the infinite loop in run() will exit. - */ - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControllerListXML() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * Since our simple driver does not keep track of the status of the LEDs - * it can only respond with 'Unknown' for the status. If this were a real - * driver you would want to check that the controlerName is valid, and - * return a response based of of the controller's last known status. - */ - @Override - public String getControllerStatusXML(String controllerName) { - return new String( "\n" + - "" + - "" + controllerName + "" + - "Unknown" + - ""); - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - * - * Note that the commands being send are very simple (a single digit - * number corresponding to a pin on the arduino). A more complex - * driver might send multiple pin numbers at a time, or even a length - * of time in which to flash. The format of the command is free form - * text, but steer clear of using the line feed character for now. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - /* - * We don't care about any response messages. - */ - @Override - public void receiveMessage(String message) {} - - /* - * The XML format for the widget needs to be standardized - */ - @Override - public String getWidgetXML() { - // TODO Auto-generated method stub - return null; - } - - /* - * The XML format for the full page control needs to be standardized - */ - @Override - public String getFullPageXML() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/75/60a9f1f7c68300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/75/60a9f1f7c68300131636968a6a637f39 deleted file mode 100644 index 403ba0a..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/75/60a9f1f7c68300131636968a6a637f39 +++ /dev/null @@ -1,40 +0,0 @@ -package org.apparatus_templi; - -public class SimpleDriver extends Coordinator implements ControlerModule,Runnable { - private String moduleName = "SimpleDriver"; - - @Override - public String getModuleType() { - return "Controller"; - } - - @Override - public String getControlerList() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void tellController(String controllerName, String command) { - // TODO Auto-generated method stub - - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void run() { - // TODO Auto-generated method stub - - } - - @Override - public void receiveMessage(String message) { - // TODO Auto-generated method stub - - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/77/f08ab6d8c38300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/77/f08ab6d8c38300131636968a6a637f39 deleted file mode 100644 index 1f28fe5..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/77/f08ab6d8c38300131636968a6a637f39 +++ /dev/null @@ -1,85 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControlerModule, Runnable { - private String moduleName = "LED_FLASH"; - - @Override - public String getModuleType() { - return "Controler"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControlerList() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. - * - * The startup procedure is very simple, ask the Coordinator if the - */ - @Override - public void run() { - // TODO Auto-generated method stub - - } - - @Override - public void receiveMessage(String message) { - // TODO Auto-generated method stub - - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7d/40bb251bd68500131105c897513b99eb b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7d/40bb251bd68500131105c897513b99eb deleted file mode 100644 index 02c6a0d..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7d/40bb251bd68500131105c897513b99eb +++ /dev/null @@ -1,7 +0,0 @@ -package org.apparatus_templi; - -public interface ControllerModule extends Driver { - public String getControllerListXML(); - public String getControllerStatusXML(String controllerName); - public void tellController(String controllerName, String command); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/87/30e85b0bc78300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/87/30e85b0bc78300131636968a6a637f39 deleted file mode 100644 index e450c3a..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/87/30e85b0bc78300131636968a6a637f39 +++ /dev/null @@ -1,110 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControlerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - @Override - public String getModuleType() { - return "Controler"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControlerList() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - @Override - public void receiveMessage(String message) { - // TODO Auto-generated method stub - - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/88/e08421b8bd8700131803c0e19ead1d07 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/88/e08421b8bd8700131803c0e19ead1d07 deleted file mode 100644 index 23f2b83..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/88/e08421b8bd8700131803c0e19ead1d07 +++ /dev/null @@ -1,64 +0,0 @@ -package org.apparatus_templi; - -public class SimpleDriver extends Coordinator implements ControllerModule,Runnable { - private String moduleName = "SimpleDriver"; - - @Override - public String getModuleType() { - return "Controller"; - } - - @Override - public String getControllerListXML() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void tellController(String controllerName, String command) { - // TODO Auto-generated method stub - - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void run() { - // TODO Auto-generated method stub - - } - - @Override - public void receiveMessage(String message) { - // TODO Auto-generated method stub - - } - - @Override - public void terminate() { - // TODO Auto-generated method stub - - } - - @Override - public String getWidgetXML() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getFullPageXML() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getControllerStatusXML(String controllerName) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8c/f036d4dbc98300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8c/f036d4dbc98300131636968a6a637f39 deleted file mode 100644 index a2cd71b..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8c/f036d4dbc98300131636968a6a637f39 +++ /dev/null @@ -1,7 +0,0 @@ -package org.apparatus_templi; - -public interface ControlerModule extends Driver { - public String getControlerListXML(); - public String getControlerStatusXML(String controllerName); - public void tellController(String controllerName, String command); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/96/c0982ae0c98300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/96/c0982ae0c98300131636968a6a637f39 deleted file mode 100644 index 25bec03..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/96/c0982ae0c98300131636968a6a637f39 +++ /dev/null @@ -1,140 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControlerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - @Override - public String getModuleType() { - return "Controler"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControlerListXML() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * Since our simple driver does not keep track of the status of the LEDs - * it can only respond with 'Unknown' for the status. If this were a real - * driver you would want to check that the controlerName is valid, and - * return a response based of of the controller's last known status. - */ - @Override - public String getControlerStatusXML(String controllerName) { - return new String( "\n" + - "Unknown"); - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - /* - * We don't care about any response messages. - */ - @Override - public void receiveMessage(String message) {} - - /* - * The XML format for the widget needs to be standardized - */ - @Override - public String getWidgetXML() { - // TODO Auto-generated method stub - return null; - } - - /* - * The XML format for the full page control needs to be standardized - */ - @Override - public String getFullPageXML() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9e/70b1bdf2c98300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9e/70b1bdf2c98300131636968a6a637f39 deleted file mode 100644 index eac8377..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9e/70b1bdf2c98300131636968a6a637f39 +++ /dev/null @@ -1,141 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControlerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - @Override - public String getModuleType() { - return "Controler"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControlerListXML() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * Since our simple driver does not keep track of the status of the LEDs - * it can only respond with 'Unknown' for the status. If this were a real - * driver you would want to check that the controlerName is valid, and - * return a response based of of the controller's last known status. - */ - @Override - public String getControllerStatusXML(String controllerName) { - return new String( "\n" + - "" - "Unknown"); - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - /* - * We don't care about any response messages. - */ - @Override - public void receiveMessage(String message) {} - - /* - * The XML format for the widget needs to be standardized - */ - @Override - public String getWidgetXML() { - // TODO Auto-generated method stub - return null; - } - - /* - * The XML format for the full page control needs to be standardized - */ - @Override - public String getFullPageXML() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a2/80900f23c78300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a2/80900f23c78300131636968a6a637f39 deleted file mode 100644 index c5a0d7e..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a2/80900f23c78300131636968a6a637f39 +++ /dev/null @@ -1,113 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControlerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - @Override - public String getModuleType() { - return "Controler"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControlerList() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - /* - * We don't care about any response messages. - */ - @Override - public void receiveMessage(String message) { - // TODO Auto-generated method stub - - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/af/e0496c1790870013180285bc67266d2d b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/af/e0496c1790870013180285bc67266d2d deleted file mode 100644 index b405592..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/af/e0496c1790870013180285bc67266d2d +++ /dev/null @@ -1,12 +0,0 @@ -package org.apparatus_templi; - -public interface Driver { - - public String getModuleType(); - public String getModuleName(); - public void receiveMessage(String message); - public void terminate(); - - public String getWidgetXML(); - public String getFullPageXML(); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b0/50c164a9c78300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b0/50c164a9c78300131636968a6a637f39 deleted file mode 100644 index ac4306d..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b0/50c164a9c78300131636968a6a637f39 +++ /dev/null @@ -1,46 +0,0 @@ -package org.apparatus_templi; - -public class SimpleDriver extends Coordinator implements ControlerModule,Runnable { - private String moduleName = "SimpleDriver"; - - @Override - public String getModuleType() { - return "Controller"; - } - - @Override - public String getControlerListXML() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void tellController(String controllerName, String command) { - // TODO Auto-generated method stub - - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void run() { - // TODO Auto-generated method stub - - } - - @Override - public void receiveMessage(String message) { - // TODO Auto-generated method stub - - } - - @Override - public void terminate() { - // TODO Auto-generated method stub - - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b1/006aeda4c78300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b1/006aeda4c78300131636968a6a637f39 deleted file mode 100644 index df6d5f5..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b1/006aeda4c78300131636968a6a637f39 +++ /dev/null @@ -1,7 +0,0 @@ -package org.apparatus_templi; - -public interface ControlerModule extends Driver { - public String getControlerLisXMLt(); - public String getControlerStatusXML(String controllerName); - public void tellController(String controllerName, String command); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b4/70b81eeeca8300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b4/70b81eeeca8300131636968a6a637f39 deleted file mode 100644 index 1f60943..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b4/70b81eeeca8300131636968a6a637f39 +++ /dev/null @@ -1,64 +0,0 @@ -package org.apparatus_templi; - -public class SimpleDriver extends Coordinator implements ControllerModule,Runnable { - private String moduleName = "SimpleDriver"; - - @Override - public String getModuleType() { - return "Controller"; - } - - @Override - public String getControllerListXML() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void tellController(String controllerName, String command) { - // TODO Auto-generated method stub - - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void run() { - // TODO Auto-generated method stub - - } - - @Override - public void receiveMessage(String message) { - // TODO Auto-generated method stub - - } - - @Override - public void terminate() { - // TODO Auto-generated method stub - - } - - @Override - public String getWidgetXML() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getFullPageXML() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getControlerStatusXML(String controllerName) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c4/905d0fedc58300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c4/905d0fedc58300131636968a6a637f39 deleted file mode 100644 index 4c7fbcf..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c4/905d0fedc58300131636968a6a637f39 +++ /dev/null @@ -1,8 +0,0 @@ -package org.apparatus_templi; - -public interface Driver { - - public String getModuleType(); - public String getModuleName(); - public void receiveMessage(String message); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c8/205ec798c78300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c8/205ec798c78300131636968a6a637f39 deleted file mode 100644 index 6bcd35d..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c8/205ec798c78300131636968a6a637f39 +++ /dev/null @@ -1,46 +0,0 @@ -package org.apparatus_templi; - -public class SimpleDriver extends Coordinator implements ControlerModule,Runnable { - private String moduleName = "SimpleDriver"; - - @Override - public String getModuleType() { - return "Controller"; - } - - @Override - public String getControlerList() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void tellController(String controllerName, String command) { - // TODO Auto-generated method stub - - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void run() { - // TODO Auto-generated method stub - - } - - @Override - public void receiveMessage(String message) { - // TODO Auto-generated method stub - - } - - @Override - public void terminate() { - // TODO Auto-generated method stub - - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ce/4008ed59c18300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ce/4008ed59c18300131636968a6a637f39 deleted file mode 100644 index 42d22aa..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ce/4008ed59c18300131636968a6a637f39 +++ /dev/null @@ -1,7 +0,0 @@ -package org.apparatus_templi; - -public interface Driver { - public String getModuleType(); - public String getModuleName(); - public void receiveMessage(String message); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ce/90419835ca8300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ce/90419835ca8300131636968a6a637f39 deleted file mode 100644 index 4fbb162..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ce/90419835ca8300131636968a6a637f39 +++ /dev/null @@ -1,141 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControllerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - @Override - public String getModuleType() { - return "Controler"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControlerListXML() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * Since our simple driver does not keep track of the status of the LEDs - * it can only respond with 'Unknown' for the status. If this were a real - * driver you would want to check that the controlerName is valid, and - * return a response based of of the controller's last known status. - */ - @Override - public String getControllerStatusXML(String controllerName) { - return new String( "\n" + - "" - "Unknown"); - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - /* - * We don't care about any response messages. - */ - @Override - public void receiveMessage(String message) {} - - /* - * The XML format for the widget needs to be standardized - */ - @Override - public String getWidgetXML() { - // TODO Auto-generated method stub - return null; - } - - /* - * The XML format for the full page control needs to be standardized - */ - @Override - public String getFullPageXML() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e3/b0f00cf0c68300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e3/b0f00cf0c68300131636968a6a637f39 deleted file mode 100644 index 9d93730..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e3/b0f00cf0c68300131636968a6a637f39 +++ /dev/null @@ -1,84 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControlerModule, Runnable { - private String moduleName = "LED_FLASH"; - - @Override - public String getModuleType() { - return "Controler"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControlerList() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. - * - * The startup procedure is very simple, ask the Coordinator if the - */ - @Override - public void run() { - // TODO Auto-generated method stub - - } - - @Override - public void receiveMessage(String message) { - // TODO Auto-generated method stub - - } - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e6/a0555166c18300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e6/a0555166c18300131636968a6a637f39 deleted file mode 100644 index c2de95d..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e6/a0555166c18300131636968a6a637f39 +++ /dev/null @@ -1,8 +0,0 @@ -package org.apparatus_templi; - -public interface Driver { - private String moduleName; - public String getModuleType(); - public String getModuleName(); - public void receiveMessage(String message); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ed/a0625a90c78300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ed/a0625a90c78300131636968a6a637f39 deleted file mode 100644 index 17edcde..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ed/a0625a90c78300131636968a6a637f39 +++ /dev/null @@ -1,9 +0,0 @@ -package org.apparatus_templi; - -public interface Driver { - - public String getModuleType(); - public String getModuleName(); - public void receiveMessage(String message); - public void terminate(); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f1/00cefc7cc78300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f1/00cefc7cc78300131636968a6a637f39 deleted file mode 100644 index 4dba0dd..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f1/00cefc7cc78300131636968a6a637f39 +++ /dev/null @@ -1,7 +0,0 @@ -package org.apparatus_templi; - -public interface ControlerModule extends Driver { - public String getControlerList(); - public String getControlerStatus(String controllerName); - public void tellController(String controllerName, String command); -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f1/609a7725c88300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f1/609a7725c88300131636968a6a637f39 deleted file mode 100644 index 1323a0d..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f1/609a7725c88300131636968a6a637f39 +++ /dev/null @@ -1,122 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControlerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - @Override - public String getModuleType() { - return "Controler"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControlerListXML() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - /* - * Since our simple driver does not keep track of the status of the LEDs - * it can only respond with 'Unknown' for the status. If this were a real - * driver you would want to check that the controlerName is valid, and - * return a response based of of the controlers last known status. - */ - @Override - public String getControlerStatusXML(String controllerName) { - return new String( "\n" + - "Unknown"); - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - /* - * We don't care about any response messages. - */ - @Override - public void receiveMessage(String message) {} - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/fe/e068a305c88300131636968a6a637f39 b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/fe/e068a305c88300131636968a6a637f39 deleted file mode 100644 index 07ecd36..0000000 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.history/fe/e068a305c88300131636968a6a637f39 +++ /dev/null @@ -1,117 +0,0 @@ -package org.apparatus_templi; - -public class LedFlash extends Coordinator implements ControlerModule, Runnable { - private String moduleName = "LED_FLASH"; - private volatile boolean running = true; - - @Override - public String getModuleType() { - return "Controler"; - } - - @Override - public String getModuleName() { - return moduleName; - } - - @Override - public void terminate() { - running = false; - } - - /* - * Since every driver is exited to have intimate knowledge of - * the remote module that it corresponds with this can be a hard - * coded XML response. - */ - @Override - public String getControlerListXML() { - return new String( "\n" + - "" + - "" + - "LED 1" + - "" + - "" + - "LED 2" + - "" + - "" + - "LED 1" + - "" + - ""); - - } - - @Override - public String getControlerStatusXML(String controllerName) { - return new String( "\n" + - "" + - "<" - } - - /* - * This method will be called by the Coordinator on behalf - * of the front-ends. It is up to you do validate the incoming - * controllerName and command (if desired). In this case we will - * switch based off the controllerName. Since the only thing that - * this driver does is flash the LED we do not even have to check the - * command. - */ - @Override - public void tellController(String controllerName, String command) { - switch (controllerName) { - case "LED 1": - super.sendCommand(moduleName, "4"); - break; - case "LED 2": - super.sendCommand(moduleName, "5"); - break; - case "LED 3": - super.sendCommand(moduleName, "6"); - break; - default: - super.logMessage(moduleName, "tellController() Given invalid LED name"); - break; - } - } - - /* - * Our starting point of execution for this driver. - * This simply runs a loop sending commands to flash LEDs attached to - * different pins. The driver does not care about responses from the - * remote module, so receiveMessage() is left unimplemented. If the - * Coordinator needs to shut down this thread it can do so through the - * terminate() method, which will make the while loop exit - * - * The startup procedure is very simple, ask the Coordinator if the - * remote module is active. If it isn't, then terminate, else begin sending - * commands - */ - @Override - public void run() { - if (super.isModulePresent(moduleName)) { - while (running) { - /* - * This is our main loop. All of the processing will happen here - * Our simple driver will repeatedly send three messages to the - * remote module, sleeping 5 seconds between each message. - */ - for (int i = 3; i < 6; i++) { - super.sendCommand(moduleName, String.valueOf(i)); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - /* - * We don't care about any response messages. - */ - @Override - public void receiveMessage(String message) {} - -} diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Coordinator/.indexes/4b/e4/ed/history.index b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Coordinator/.indexes/4b/e4/ed/history.index index fbcbe21..a7d049e 100644 Binary files a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Coordinator/.indexes/4b/e4/ed/history.index and b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Coordinator/.indexes/4b/e4/ed/history.index differ diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Coordinator/.indexes/e4/e4/ed/history.index b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Coordinator/.indexes/e4/e4/ed/history.index index 7a3b7f9..a691f0e 100644 Binary files a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Coordinator/.indexes/e4/e4/ed/history.index and b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Coordinator/.indexes/e4/e4/ed/history.index differ diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Coordinator/.markers b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Coordinator/.markers index d59c1ef..e469bed 100644 Binary files a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Coordinator/.markers and b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Coordinator/.markers differ diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources index cfc7364..c2e936e 100644 Binary files a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources and b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources differ diff --git a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi index 4f1ca2e..0f2738e 100644 --- a/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi +++ b/coordinator_eclipse_workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi @@ -440,18 +440,18 @@ Draggable - - - - - - - - - - - - + + + + + + + + + + + + toolbarSeparator @@ -459,72 +459,72 @@ Draggable - - - + + + Draggable - - + + Draggable - - + + Draggable - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + Draggable - - + + Draggable - - - - + + + + Draggable - - - - + + + + Draggable - - - + + + Draggable - - - - - - + + + + + + toolbarSeparator @@ -532,15 +532,15 @@ Draggable - - - - - - - - - + + + + + + + + + toolbarSeparator @@ -552,8 +552,8 @@ Draggable - - + + stretch diff --git a/coordinator_eclipse_workspace/Coordinator/drivers/org/apparatus_templi/StatefullLed.java b/coordinator_eclipse_workspace/Coordinator/drivers/org/apparatus_templi/StatefullLed.java index 73b8256..48b12a5 100644 --- a/coordinator_eclipse_workspace/Coordinator/drivers/org/apparatus_templi/StatefullLed.java +++ b/coordinator_eclipse_workspace/Coordinator/drivers/org/apparatus_templi/StatefullLed.java @@ -35,10 +35,6 @@ public String getModuleType() { return "Controller"; } - @Override - public String getModuleName() { - return moduleName; - } @Override public void receiveCommand(String message) { @@ -47,12 +43,6 @@ public void receiveCommand(String message) { } - @Override - public void terminate() { - Log.d(moduleName, "told to terminate"); - running = false; - - } @Override public String getWidgetXML() { diff --git a/coordinator_eclipse_workspace/Coordinator/src/org/apparatus_templi/Coordinator.java b/coordinator_eclipse_workspace/Coordinator/src/org/apparatus_templi/Coordinator.java index 4d6b0c9..501f5f5 100644 --- a/coordinator_eclipse_workspace/Coordinator/src/org/apparatus_templi/Coordinator.java +++ b/coordinator_eclipse_workspace/Coordinator/src/org/apparatus_templi/Coordinator.java @@ -5,6 +5,7 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import javax.xml.bind.DatatypeConverter; @@ -25,7 +26,7 @@ public class Coordinator { //TODO check that 1000 bytes enough private static ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream(); - private static ArrayList remoteModules = new ArrayList(); + private static HashSet remoteModules = new HashSet(); private static HashMap loadedDrivers = new HashMap(); private static int portNum; private static final int DEFAULT_PORT = 2024; @@ -195,7 +196,7 @@ private static synchronized void sendCommandV1(String moduleName, String command } } - private static synchronized void processMessage(byte[] byteArray) { + static synchronized void processMessage(byte[] byteArray) { //TODO check the protocol version based off the first byte //Since we only support protocol version 0 right now we only need to //+ convert this to a string using ASCII encoding @@ -214,7 +215,7 @@ private static synchronized void processMessage(byte[] byteArray) { //the local arduino will send "READY\n" after it is finished with //+ its setup. Since this can sometimes become garbled (i.e. "REAREADY\N") //+ we have to be a bit loose in how the message is matched. - if (inMessage.indexOf(";") == -1 && inMessage.trim().endsWith("READY")) { + if (inMessage.indexOf(":") == -1 && inMessage.trim().endsWith("READY")) { //TODO Log.d(TAG, "local arduino link is ready"); connectionReady = true; @@ -225,6 +226,15 @@ private static synchronized void processMessage(byte[] byteArray) { if (destination.equals("DEBUG")) { Log.d(TAG, "requested debug from remote module '" + command + "'"); + } else if (command.equals("READY")) { + //this was a response to the broadcast, add this remote module + //+ to the known list. + if (remoteModules.contains(destination)) { + Log.w(TAG, "remote module " + destination + " is already in the remote modules list"); + } else { + Log.d(TAG, "adding module " + destination + " to the list of known modules"); + remoteModules.add(destination); + } } else { //route the message to the appropriate driver if (loadedDrivers.containsKey(destination)) { @@ -241,10 +251,17 @@ private static synchronized void processMessage(byte[] byteArray) { } } } else { - //the incomming message does not match any known format + //the incoming message does not match any known format Log.w(TAG, "incomming message does not match any known formats"); } } + + /** + * Sends a query string to all remote modules "ALL:READY?" + */ + private static void queryRemoteModules() { + sendCommand("ALL", "READY?"); + } /** * Sends the given command to a specific remote module @@ -425,14 +442,7 @@ synchronized boolean passCommand(String toDriver, String fromDriver, String comm * @return true if the remote module is known to be up, false otherwise */ static synchronized boolean isModulePresent(String moduleName) { - boolean result = false; - for (String name: remoteModules) { - if (name.equals(moduleName)) { - result = true; - break; - } - } - return result; + return remoteModules.contains(moduleName); } /** @@ -513,8 +523,29 @@ public static void main(String argv[]) throws InterruptedException { System.err.println("could not connect to serial port, exiting"); System.exit(1); } + + //block until the local arduino is ready + Log.d(TAG, "waiting for local link to be ready"); + for (int i = 0; i < 100; i++) { + if (!connectionReady) { + Thread.sleep(500); + } + } + if (!connectionReady) { + Log.e(TAG, "could not find a local arduino connection, exiting"); + System.exit(1); + } + + //query for remote modules. Since the modules may be slow in responding + //+ we will wait for a few seconds to make sure we get a complete list + Log.d(TAG, "querying remote modules"); + queryRemoteModules(); + for (int i = 0; i < 60; i++) { + Thread.sleep(100); + } + Log.d(TAG, "initializing drivers"); //initialize the drivers Driver driver1 = new LedFlash(); @@ -522,13 +553,11 @@ public static void main(String argv[]) throws InterruptedException { Driver driver2 = new LedFlash(); //only drivers with valid names are added + //TODO make this generic if (driver1.getModuleName() != null) { if (!loadedDrivers.containsKey(driver1.getModuleName())) { - remoteModules.add(driver1.getModuleName()); + loadedDrivers.put(driver1.getModuleName(), driver1); Log.d(TAG, "driver " + driver1.getModuleName() + " of type " + driver1.getModuleType() + " initialized"); - - //right now just add the driver name to the remote module list - loadedDrivers.put(driver1.getModuleName(), (Driver)driver1); } else { Log.w(TAG, "error loading driver " + driver1.getClass().getName() + "a driver with the name " + driver1.getModuleName() + " already exists"); @@ -537,11 +566,8 @@ public static void main(String argv[]) throws InterruptedException { if (driver2.getModuleName() != null) { if (!loadedDrivers.containsKey(driver2.getModuleName())) { - remoteModules.add(driver2.getModuleName()); + loadedDrivers.put(driver2.getModuleName(), driver2); Log.d(TAG, "driver " + driver2.getModuleName() + " of type " + driver2.getModuleType() + " initialized"); - - //right now just add the driver name to the remote module list - loadedDrivers.put(driver2.getModuleName(), (Driver)driver2); } else { Log.e(TAG, "error loading driver " + driver2.getClass().getName() + " a driver with the name " + driver2.getModuleName() + " already exists"); diff --git a/coordinator_eclipse_workspace/Coordinator/src/org/apparatus_templi/Driver.java b/coordinator_eclipse_workspace/Coordinator/src/org/apparatus_templi/Driver.java index dc43102..6d7c520 100644 --- a/coordinator_eclipse_workspace/Coordinator/src/org/apparatus_templi/Driver.java +++ b/coordinator_eclipse_workspace/Coordinator/src/org/apparatus_templi/Driver.java @@ -11,7 +11,7 @@ public abstract class Driver implements Runnable { abstract String getFullPageXML(); - void terminate() { + final void terminate() { running = false; //call the subclass implementation } @@ -21,11 +21,11 @@ void terminate() { * name. */ - String getModuleName() { + final String getModuleName() { return this.name; } - Thread.State getState() { + final Thread.State getState() { return Thread.currentThread().getState(); } diff --git a/coordinator_eclipse_workspace/Coordinator/src/org/apparatus_templi/SerialConnection.java b/coordinator_eclipse_workspace/Coordinator/src/org/apparatus_templi/SerialConnection.java index 9e9a0aa..670052d 100644 --- a/coordinator_eclipse_workspace/Coordinator/src/org/apparatus_templi/SerialConnection.java +++ b/coordinator_eclipse_workspace/Coordinator/src/org/apparatus_templi/SerialConnection.java @@ -5,6 +5,7 @@ import gnu.io.SerialPortEventListener; import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -33,8 +34,10 @@ public class SerialConnection implements SerialPortEventListener { /** Milliseconds to block while waiting for port open */ private static final int TIME_OUT = 2000; /** Default bits per second for COM port. */ - private static final int DATA_RATE = 9600; +// private static final int DATA_RATE = 9600; + private static final int DATA_RATE = 115200; private static String preferredConnection; + private static ByteArrayOutputStream buffer = new ByteArrayOutputStream(); private boolean connected = false; @@ -127,13 +130,14 @@ synchronized void close() { public synchronized void serialEvent(SerialPortEvent oEvent) { if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) { try { -// byte[] inputByte = new byte[1]; -// input.read(inputByte); -// Log.d(TAG, "read hex value: " + DatatypeConverter.printHexBinary(inputByte)); -// Log.d(TAG, "Read char value: " + new String(inputByte)); - - //notify the coordinator that incoming data is available - Coordinator.setIoReady(true); + int readInt = input.read(); + if (readInt != -1) { + if ((byte)readInt == 0x0A) { + Coordinator.processMessage(buffer.toByteArray()); + } else { + buffer.write((byte)readInt); + } + } } catch (Exception e) { System.err.println(e.toString()); } diff --git a/skeleton/arduino-sketches/controler/basic_coordinator/basic_coordinator.ino b/skeleton/arduino-sketches/controler/basic_coordinator/basic_coordinator.ino index 0dfe871..2cda0ae 100644 --- a/skeleton/arduino-sketches/controler/basic_coordinator/basic_coordinator.ino +++ b/skeleton/arduino-sketches/controler/basic_coordinator/basic_coordinator.ino @@ -2,7 +2,7 @@ SoftwareSerial xbee(10, 11); void setup() { - Serial.begin(9600); + Serial.begin(115200); xbee.begin(9600); Serial.write("READY"); Serial.write('\n');