| | |
| | | |
| | | import Mocker.IDeviceMocker; |
| | | import Rtz.RtzMap; |
| | | import art.library.interop.serialization.Serialization; |
| | | import art.library.model.devices.colors.controller.RTZ32.RTZ32_Controller; |
| | | import art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation; |
| | | import art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerStatus; |
| | | import art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_Centralized; |
| | | import art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General; |
| | | import devices.mockers.LocalFileDeviceMocker; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Paths; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | import svgdevicestest.mock.*; |
| | | |
| | | public class RtzMockerMap extends DeviceMocker implements IDeviceMocker |
| | |
| | | @Override |
| | | public void updateDevice(boolean active) |
| | | { |
| | | // RTZ32_Controller.class.cast(device).getDeviceInformation().mode = RTZ32_ControllerInformation.MODE_NON_CENTRALIZED; |
| | | RTZ32_Controller.class.cast(device).getDeviceInformation().mode = RTZ32_ControllerInformation.MODE_NON_CENTRALIZED; |
| | | try |
| | | { |
| | | |
| | | RTZ32_ControllerStatus status = (RTZ32_ControllerStatus)device.getDeviceStatus(); |
| | | status.rtz32.general.control = RTZ32_Status_General.CONTROL_LOCAL; |
| | | status.rtz32.general.semiactuated = false; |
| | | status.rtz32.centralized = new RTZ32_Status_Centralized(); |
| | | status.rtz32.centralized.centralized = true; |
| | | String dv = new String(Files.readAllBytes(Paths.get("C:\\Users\\Konstantin\\Desktop\\rtz32_controller.txt"))); |
| | | |
| | | device.setAlarm("alarm_offline", true); |
| | | device.setAlarm("alarm_flashing_inputs_key", false); |
| | | RTZ32_Controller controller = Serialization.deserialize(RTZ32_Controller.class, dv); |
| | | |
| | | int i = 0; |
| | | |
| | | // Device controller = Serialization.deserialize(Device.class, "C:\\Users\\Konstantin\\Desktop\\rtz32_controller.txt"); |
| | | |
| | | device.status = controller.status; |
| | | device.alarms = controller.alarms; |
| | | device.information = controller.information; |
| | | device.configuration = controller.configuration; |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Logger.getLogger(RtzMockerMap.class.getName()).log(Level.SEVERE, null, ex); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public String getFilePath() |
| | | { |
| | | return "C:\\Users\\Konstantin\\Documents\\LocalBackup\\Obras\\Zaragoza\\rtzserver\\data\\art.servers.rtzserver\\symbols\\9\\Controller.svg"; |
| | | return "D:\\LocalBackup\\Obras\\Zaragoza\\rtzserver\\data\\art.servers.rtzserver\\symbols\\9\\Controller.svg"; |
| | | } |
| | | |
| | | @Override |