Alejandro Acuña
2024-07-30 65a64a81d30f00f1fffd5da6866850e1308e1135
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package art.servers.asfserver.controller;
 
import art.library.model.devices.Device;
import art.library.model.devices.vms.asf.Asf;
import art.library.model.devices.vms.asf.AsfInformation;
import art.servers.Shared;
import art.servers.controller.ControllerDevice;
 
public class FactoryController extends art.servers.controller.FactoryController
{
 
    public FactoryController()
    {
        super();
    }
 
    public ControllerDevice addController(Device device)
    {
      
        ControllerDevice controller = null;
 
        try
        {
            try
            {
                ControllerAsf controllerAsf = (ControllerAsf) Shared.getDeviceController(device.getIdentifier());
                return (controllerAsf);
            } catch (Exception e)
            {
                Shared.printerr("Exception on device " + device.getIdentifier(), e.getMessage());
            }
 
            Asf asf = (Asf) device;
 
            AsfInformation information = asf.getDeviceInformation();
 
            if (asf.getDeviceInformation().type == AsfInformation.TYPE_DGT)
            {
                if (asf.getDeviceInformation().connectionEru != null)
                {
                    controller = new ControllerAsfDGTEru(asf);
                    Shared.lcontroller.add(controller);
                    controller.start();
                }
 
                if (asf.getDeviceInformation().connectionTcp != null)
                {
                    controller = new ControllerAsfDGTTcp(asf);
                    Shared.lcontroller.add(controller);
                    controller.start();
                }
            } else
            {
                Shared.printerr("Unexpected asf with identifier", asf.getIdentifier());
            }
        } catch (Exception e)
        {
            Shared.printerr("Exception on asf " + device.getIdentifier(), e.getMessage());
        }
 
        return controller;
    }
 
    public void removeController(ControllerDevice controller)
    {
 
    }
 
}