package art.servers.sosserver.controller;
|
|
import art.library.interop.InteropParameters;
|
import art.library.interop.InteropResponse;
|
import art.library.interop.serialization.SerializationException;
|
import art.library.model.devices.DeviceAction;
|
import art.library.model.devices.sos.Sos;
|
import art.servers.ServerException;
|
import art.servers.sosserver.Shared;
|
|
|
public class ListenerImplementation extends art.servers.controller.ListenerImplementation
|
{
|
public InteropResponse sendCommands(InteropParameters parameters) throws SerializationException
|
{
|
String language = (String)parameters.getParameterValue("language");
|
|
try
|
{
|
Shared.println("Listener", "SendCommands language=" + language);
|
String identifier = (parameters.hasParameter("device") == true) ? (String)parameters.getParameterValue("device") : null;
|
Shared.println("Listener", "SendCommands identifier=" + identifier);
|
ControllerSos controller = (ControllerSos)Shared.getDeviceController(identifier);
|
Sos device = controller.getDevice();
|
|
Shared.println("Listener", "SendCommands Device=" + device.getIdentifier());
|
DeviceAction[] laction = controller.sendCommands(parameters);
|
Shared.println("Listener", "SendCommands Result=" + laction.length);
|
return(new InteropResponse(laction));
|
}
|
catch (ServerException exception)
|
{
|
Shared.printstack("Listener", exception);
|
throw new SerializationException(Shared.getMessage(language, exception.getMessage()));
|
}
|
catch (Exception exception)
|
{
|
Shared.printstack("Listener", exception);
|
throw new SerializationException(Shared.getMessage(language, exception.getMessage()), exception);
|
}
|
}
|
|
}
|