ghy
Alejandro Acuña
2025-03-12 26319e4c5bfbee722c15b8e7ccca9b6127bb1cb8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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);
        }
    }
 
}