Alejandro Acuña
2024-09-16 adba74e107bcda9e1cb510bc14364b02e781baef
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
package svgdevicestest.mock;
 
import art.library.model.devices.vms.rotapanel.VmsRotapanel;
import art.library.model.devices.vms.rotapanel.VmsRotapanelAlarms;
import art.library.model.devices.vms.rotapanel.VmsRotapanelStatus;
 
public class VmsRotaPanelStatusMocker extends DeviceMocker
{
    int face = 0;
    
    public VmsRotaPanelStatusMocker()
    {
        super(new VmsRotapanel("rotapanel"));
    }
 
    public VmsRotaPanelStatusMocker getMocker()
    {
        return this;
    }
 
    @Override
    public void updateDevice(boolean active)
    {
        VmsRotapanel vmsRotapanel = (VmsRotapanel) device;
        vmsRotapanel.status = new VmsRotapanelStatus();
        vmsRotapanel.alarms = new VmsRotapanelAlarms();
        
        face++;
        if (face > 3) face = 0;
        vmsRotapanel.getDeviceStatus().face = face;
        
        if (active)
        {
            vmsRotapanel.setAlarm("alarm_offline", true);
            vmsRotapanel.getDeviceStatus().lightActive = true;
            vmsRotapanel.getDeviceStatus().manualControlActive = true;
            vmsRotapanel.getDeviceStatus().turnTestActive = true;
            vmsRotapanel.getDeviceStatus().rotationInterval = 15;
        } else
        {
            vmsRotapanel.getDeviceStatus().lightActive = false;
            vmsRotapanel.getDeviceStatus().manualControlActive = false;
            vmsRotapanel.getDeviceStatus().turnTestActive = false;
            vmsRotapanel.getDeviceStatus().rotationInterval = 0;
        }
        active = !active;
    }
}