Skip to content
Snippets Groups Projects
Commit 156f44aa authored by jkerdreu's avatar jkerdreu
Browse files

Added some method for device



git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Java/branches/0.7@2623 b32b6428-25c9-4566-ad07-03861ab6144f
parent 94621bc0
No related branches found
No related tags found
No related merge requests found
......@@ -59,7 +59,7 @@ public class Engine extends Thread {
}
/**
* As the Engine to stop monitoring devices.
* Ask the Engine to stop monitoring devices.
*
* @param devices the list of devices
*/
......@@ -70,6 +70,27 @@ public class Engine extends Thread {
}
}
/**
* Ask the Engine to monitor a device.
*
* @param device
*/
public void registerDevice(Device device) {
this.devices.add(device);
device.setEngine(this);
}
/**
* Ask the Engine to stop monitoring device.
*
* @param device
*/
public void unregisterDevice(Device device) {
this.devices.remove(device);
device.setEngine(null);
}
/**
* Get the monitored devices.
*
......@@ -144,8 +165,7 @@ public class Engine extends Thread {
}
/**
* Queue Alive message for devices.
* @throws Exception
* Queue Alive message for devices
*/
public void processAlives() {
long now = System.currentTimeMillis()/1000;
......@@ -166,7 +186,6 @@ public class Engine extends Thread {
*
* @param dev the device (that should answer)
* @param msg the incoming request
* @throws Exception
*/
public void handleGetDescription(Device dev, Message msg) {
HashMap<String,Object> body = new HashMap<String,Object>();
......@@ -193,7 +212,6 @@ public class Engine extends Thread {
*
* @param dev the device (that should answer)
* @param msg the incoming request
* @throws Exception
*/
public void handleGetAttributes(Device dev, Message msg) {
HashMap<String,Object> body = new HashMap<String,Object>();
......@@ -210,7 +228,6 @@ public class Engine extends Thread {
*
* @param dev the device (that should answer)
* @param msg the incoming request
* @throws Exception
*/
public void handleIsAlive(Device dev, Message msg) {
Message reply = factory.buildAlive(dev, Arrays.asList(msg.getSource()), dev.getTimeOutPeriod());
......@@ -222,7 +239,6 @@ public class Engine extends Thread {
*
* @param dev the device (that should answer)
* @param msg the incoming request
* @throws Exception
*/
public void handleTDB(Device dev, Message msg) {
Message error = factory.buildError(dev, Arrays.asList(msg.getSource()), 500, "Not implemented yet");
......@@ -234,7 +250,6 @@ public class Engine extends Thread {
*
* @param targets list of device that should handle an incoming message
* @param msg the message to handle.
* @throws Exception
*/
public void handleRequest(List<Device> targets, Message msg) {
......@@ -272,7 +287,6 @@ public class Engine extends Thread {
* Push a message in the output queue.
*
* @param msg the message to queue.
* @throws Exception
*/
public void queueMessage(Message msg) {
try {
......@@ -300,7 +314,6 @@ public class Engine extends Thread {
* message for example
*
* @param msg the message to process
* @throws Exception
*/
public void processRxMSG(Message msg) {
if (msg.getMsgType() == MessageType.REQUEST) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment