bck
Alejandro Acuña
2024-11-11 f1cb4443aede6d4657bdc3396c8914d3a9f4fa93
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
 
import art.library.model.devices.Device;
import art.library.model.devices.DeviceCommands;
import com.kitfox.svg.SVGDiagram;
 
 
public class DeviceGraphicsRuntime_Sos_musatel_command_aspect extends DeviceGraphicsRuntime
{
 
    public DeviceGraphicsRuntime_Sos_musatel_command_aspect(art.library.model.devices.Device device, SVGDiagram diagram)
    {
        super(device, diagram);
    }
 
    public void status()
    {
        try
        {
            Device device = getDevice();
            art.library.model.devices.sos.SosStatus status = (art.library.model.devices.sos.SosStatus) device.getDeviceStatus();
            art.library.model.devices.sos.SosInformation information = (art.library.model.devices.sos.SosInformation) device.getDeviceInformation();
            art.library.model.devices.sos.SosAlarms alarms = (art.library.model.devices.sos.SosAlarms) device.getDeviceAlarms();
            setAttribute("phone_call", "display", "none", 999);
            setAttribute("phone_waiting", "display", "none", 999);
            setAttribute("pending_call_noarrow", "display", "none", 999);
            setAttribute("lock_on", "display", "none", 999);
            setAttribute("light-on", "display", "none", 999);
            for (int i = 0; i <= 5; i++)
            {
                setAttribute("alarm-" + i, "display", (alarms.getServerityAlarm() == i) ? "inline" : "none", 999);
            }
            if (status.musatel != null)
            {
                switch (status.musatel.state)
                {
                    case art.library.model.devices.sos.musatel.status.SosStatusMusatel.STATE_ACTIVE_CALL:
                        setAttribute("phone_call", "display", "inline", 999);
                        break;
                    case art.library.model.devices.sos.musatel.status.SosStatusMusatel.STATE_PENDING_USER_CALL:
                    case art.library.model.devices.sos.musatel.status.SosStatusMusatel.STATE_PENDING_SERVICE_CALL:
                        setAttribute(show ? "phone_call" : "pending_call_noarrow", "display", "inline", 999);
                        break;
                    case art.library.model.devices.sos.musatel.status.SosStatusMusatel.STATE_IDLE:
                        setAttribute("phone_waiting", "display", "inline", 999);
                        break;
                }
                setText(getElement("txt_vol"), String.valueOf(status.musatel.audio.volume));
            }
        } catch (Exception ex)
        {
        }
    }
    private boolean show = false;
 
    public void timer()
    {
        show = !show;
        commands();
    }
 
    public void commands()
    {
        art.library.model.devices.sos.SosCommands deviceCommands = (art.library.model.devices.sos.SosCommands) getDeviceCommands();
        setAttribute("phone_disable", "display", "inline");
        setAttribute("phone_start", "display", (deviceCommands.musatel.call != null) ? "display" : "none", 999);
        setAttribute("speech", "display", (deviceCommands.musatel.speech != null) ? "display" : "none", 999);
        setAttribute("phone_pause", "display", (deviceCommands.musatel.pauseCall == deviceCommands.CONDITION_YES) ? "display" : "none", 999);
        setAttribute("phone_resume", "display", (deviceCommands.musatel.resumeCall == deviceCommands.CONDITION_YES) ? "display" : "none", 999);
        setAttribute("phone_end", "display", (deviceCommands.musatel.endCall == deviceCommands.CONDITION_YES) ? "display" : "none", 999);
        setAttribute("restart", "display", (deviceCommands.musatel.reset == deviceCommands.CONDITION_YES) ? "display" : "none", 999);
        setAttribute("sound", "display", "none", 999);
        setAttribute("tool", "display", "none", 999);
        setAttribute("message", "display", "none", 999);
        setAttribute("beep", "display", "none", 999);
        setAttribute("icon-test-on", "display", "none", 999);
        setAttribute("light-on", "display", "none", 999);
        setAttribute("light-off", "display", "inline", 999);
        setAttribute("lock_on", "display", "none", 9999);
        setAttribute("gr_spk", "display", "none", 999);
        if (deviceCommands.musatel.call != null || deviceCommands.musatel.pauseCall == deviceCommands.CONDITION_YES || deviceCommands.musatel.resumeCall == deviceCommands.CONDITION_YES || deviceCommands.musatel.endCall == deviceCommands.CONDITION_YES)
        {
            setAttribute("phone_disable", "display", "none");
        }
        if (deviceCommands.musatel.call != null)
        {
            setAttribute("gr_mic", "display", "inline", 999);
            setAttribute("gr_spk", "display", "inline", 999);
            setAttribute("lock_on", "display", (deviceCommands.musatel.call.priority >= 256) ? "inline" : "none", 999);
            setText(getElement("txt_vol"), String.valueOf(deviceCommands.musatel.call.speakerVolume));
        } else if (deviceCommands.musatel.speech != null)
        {
            setAttribute("gr_spk", "display", "inline", 999);
            setAttribute("lock_on", "display", (deviceCommands.musatel.speech.priority >= 256) ? "inline" : "none", 999);
            setText(getElement("txt_vol"), String.valueOf(deviceCommands.musatel.speech.volume));
        }
        if (deviceCommands.musatel.speakerVolume >= 0)
        {
            setAttribute("gr_spk", "display", "inline", 999);
            setText(getElement("txt_vol"), String.valueOf(deviceCommands.musatel.speakerVolume));
        }
        if (deviceCommands.musatel.maintenanceTest != art.library.model.devices.DeviceCommands.CONDITION_NOTHING)
        {
            setAttribute("icon-test-on", "display", "inline", 999);
            setAttribute("tool", "display", "inline", 999);
        }
        if (deviceCommands.musatel.audioTest != null)
        {
            setAttribute("icon-test-on", "display", "inline", 999);
            setAttribute("sound", "display", "inline", 999);
        }
        if (deviceCommands.musatel.toneTest != null)
        {
            setAttribute("icon-test-on", "display", "inline", 999);
            setAttribute("beep", "display", "inline", 999);
        }
        if (deviceCommands.musatel.messagesTest != null)
        {
            setAttribute("icon-test-on", "display", "inline", 999);
            setAttribute("message", "display", "inline", 999);
        }
    }
//    java.io.StringWriter sw = new java.io.StringWriter();
//    art.library.gui.flat.FlatDialog.showDialog(null, "Error", e.getMessage() + "\n\n" + sw.toString(), true, art.library.gui.flat.FlatDialog.DIALOG_ERROR);                        
//    
}