package art.servers.sosserver.controller;
|
|
import art.servers.sosserver.controller.musatel.ControllerSos_Musatel;
|
import art.library.model.devices.Device;
|
import art.library.model.devices.sos.Sos;
|
import art.library.model.devices.sos.SosInformation;
|
import art.servers.sosserver.Shared;
|
import art.servers.controller.ControllerDevice;
|
import art.servers.sosserver.controller.musatel.ListenerSos_Musatel;
|
|
|
|
public class FactoryController extends art.servers.controller.FactoryController
|
{
|
|
public FactoryController()
|
{
|
super();
|
}
|
|
|
public ControllerDevice addController(Device device)
|
{
|
ControllerDevice controller = null;
|
|
try
|
{
|
Sos sos = (Sos)device;
|
|
if (sos.getDeviceInformation().type.equalsIgnoreCase(SosInformation.TYPE_MUSATEL))
|
{
|
if (sos.getDeviceInformation().musatel.connection != null)
|
{
|
controller = new ControllerSos_Musatel(sos);
|
Shared.lcontroller.add(controller);
|
controller.start();
|
|
|
for (ListenerSos_Musatel listener : Shared.listenersMusatel)
|
{
|
if (listener.getPort() == sos.getDeviceInformation().musatel.connection.portControlCenter)
|
{
|
return controller;
|
}
|
}
|
|
ListenerSos_Musatel listener = new ListenerSos_Musatel(sos.getDeviceInformation().musatel.connection.portControlCenter);
|
Shared.listenersMusatel.add(listener);
|
listener.start();
|
}
|
}
|
}
|
catch (Exception e)
|
{
|
}
|
|
return controller;
|
}
|
|
|
|
|
public void removeController(ControllerDevice controller)
|
{
|
|
}
|
|
}
|