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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package Rtz.mockers;
 
import Mocker.IDeviceMocker;
import Rtz.RtzMapMiddle;
import art.library.model.devices.colors.controller.RTZ32.RTZ32_Controller;
import art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerCommands;
import art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerStatus;
import art.library.model.devices.colors.controller.RTZ32.commands.RTZ32_Commands_Centralized;
import art.library.model.devices.colors.controller.RTZ32.commands.RTZ32_Commands_Computer;
import art.library.model.devices.colors.controller.RTZ32.commands.RTZ32_Commands_Online;
import art.library.model.devices.colors.controller.RTZ32.commands.RTZ32_Commands_Plan;
import art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General;
import devices.mockers.LocalFileDeviceMocker;
import svgdevicestest.mock.*;
 
public class RtzMockerMapMiddle extends DeviceMocker implements IDeviceMocker
{
 
    public RtzMockerMapMiddle() 
    {
        super(new LocalFileDeviceMocker<RTZ32_Controller>(RTZ32_Controller.class).getDevice(),new LocalFileDeviceMocker<RTZ32_Controller>(RTZ32_Controller.class).getDevice().getDeviceCommandsEmpty());
    }
 
    public RtzMockerMapMiddle getMocker() 
    {
        return this;
    }
 
    @Override
    public void updateDevice(boolean active) 
    {
        RTZ32_ControllerStatus status =  (RTZ32_ControllerStatus)device.getDeviceStatus();
        status.rtz32.general.state = RTZ32_Status_General.STATE_FLASHING;
        status.rtz32.general.control = RTZ32_Status_General.CONTROL_LOCAL;
        
         RTZ32_ControllerCommands commands = RTZ32_ControllerCommands.class.cast(this.commands);
        {
            if ((System.currentTimeMillis() / 1000) % 2 == 0)
            {
                commands.online = new RTZ32_Commands_Online();
                commands.online.colorsMode = RTZ32_ControllerCommands.COLORS_MODE_COLORS;
                commands.online.plan = new RTZ32_Commands_Plan();
                
                commands.online.computerMode = new RTZ32_Commands_Computer();
                {
                    commands.online.computerMode.semiactuated = !commands.online.computerMode.actuated;
                    commands.online.control = RTZ32_ControllerCommands.CONTROL_COMPUTER;
                }
            }
            else
            {
                 commands.online = new RTZ32_Commands_Online();
                 commands.online.colorsMode = RTZ32_ControllerCommands.COLORS_MODE_FLASHING;
                 commands.online.plan = new RTZ32_Commands_Plan();
 
                 commands.online.computerMode = new RTZ32_Commands_Computer();
                {
                    commands.online.computerMode.semiactuated = !commands.online.computerMode.actuated;
                    commands.online.control = RTZ32_ControllerCommands.CONTROL_LOCAL;
                }
            }
            
            commands.online.centralized = new RTZ32_Commands_Centralized();
            {
            } 
            
            commands.online.centralized = new RTZ32_Commands_Centralized();
            {
//              commands.online.centralized.centralized = true;
            }
        }
    }
 
    @Override
    public String getFilePath()
    {
        return "C:\\Users\\Konstantin\\Documents\\LocalBackup\\Obras\\Zaragoza\\rtzserver\\data\\art.servers.rtzserver\\symbols\\16\\Controller.svg";
    }
 
    @Override
    public boolean isStatusMode()
    {
        return false;
    }
 
    @Override
    public Class getScriptClass()
    {
        return RtzMapMiddle.class;
    }
}