Alejandro Acuña
2024-10-22 9214c4e5cec380dc263034f9a0e5a10f0dc1ebac
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
package ParkingEquinsa.mockers;
 
import Mocker.IDeviceMocker;
import ParkingUrbiotica.ParkingUrbioticaMap;
import art.library.interop.serialization.Serialization;
import art.library.interop.serialization.SerializationException;
import art.library.model.devices.Device;
import art.library.model.devices.parking.Parking;
import svgdevicestest.mock.*;
 
public class ParkingEquinsaMockerMap extends DeviceMocker implements IDeviceMocker
{
 
    private static final String parking = "{\n" +
"  \"Parking\" : {\n" +
"    \"Last timestamp update\" : \"2024-02-14T08:22:59.179Z\",\n" +
"    \"Last timestamp information update\" : \"2024-02-07T09:17:27.613Z\",\n" +
"    \"Last timestamp status update\" : \"2024-02-14T08:22:59.179Z\",\n" +
"    \"Last timestamp alarms update\" : \"2024-02-12T23:33:51.320Z\",\n" +
"    \"Last timestamp configuration update\" : \"2024-02-07T09:17:27.613Z\",\n" +
"    \"Device information\" : {\n" +
"      \"Parking information\" : {\n" +
"        \"Type\" : 4,\n" +
"        \"Polling\" : 60,\n" +
"        \"Alarms\" : [ ],\n" +
"        \"Creation date\" : \"2024-02-07T09:17:27.613Z\",\n" +
"        \"Description\" : \"\",\n" +
"        \"Equinsa\" : {\n" +
"          \"Message name\" : \"P. Ajedrez\",\n" +
"          \"Percentage almost full\" : 80,\n" +
"          \"Percentage full\" : 95,\n" +
"          \"Connection\" : {\n" +
"            \"Installation code\" : 1291,\n" +
"            \"User\" : \"estepona\",\n" +
"            \"Password\" : \"Estepona2023\",\n" +
"            \"Connection timeout\" : 15000,\n" +
"            \"Read timeout\" : 15000\n" +
"          }\n" +
"        },\n" +
"        \"Identifier\" : \"equinsa-1291\",\n" +
"        \"Latitude\" : 41.6675,\n" +
"        \"Latitude offset\" : 0.0,\n" +
"        \"Location\" : \"Estepona\",\n" +
"        \"Longitude\" : -0.889,\n" +
"        \"Longitude offset\" : 0.0,\n" +
"        \"Municipality\" : \"Málaga\",\n" +
"        \"Name\" : \"P. Ajedrez\",\n" +
"        \"Number\" : 0,\n" +
"        \"Server address\" : \"172.16.12.25\",\n" +
"        \"Server port\" : 5023,\n" +
"        \"Server port external\" : 0,\n" +
"        \"Server service name\" : \"parking\",\n" +
"        \"Symbol\" : \"Parking\"\n" +
"      }\n" +
"    },\n" +
"    \"Device configuration\" : {\n" +
"      \"Parking configuration\" : { }\n" +
"    },\n" +
"    \"Device status\" : {\n" +
"      \"Parking status\" : {\n" +
"        \"Etd customs lpr\" : {\n" +
"          \"State\" : 0,\n" +
"          \"Signal state\" : 0,\n" +
"          \"Car spaces\" : 0,\n" +
"          \"Truck spaces\" : 0,\n" +
"          \"Occupied car spaces\" : 0,\n" +
"          \"Occupied truck spaces\" : 0,\n" +
"          \"Input lprs\" : [ ],\n" +
"          \"Output lprs\" : [ ],\n" +
"          \"Input etds\" : [ ],\n" +
"          \"Output etds\" : [ ]\n" +
"        },\n" +
"        \"Equinsa\" : {\n" +
"          \"zones\" : [\n" +
"            {\n" +
"              \"id\" : 1,\n" +
"              \"description\" : \"Rotación\",\n" +
"              \"total_spaces\" : 220,\n" +
"              \"available_spaces\" : 162,\n" +
"              \"occupied_spaces\" : 58\n" +
"            },\n" +
"            {\n" +
"              \"id\" : 2,\n" +
"              \"description\" : \"Propietarios\",\n" +
"              \"total_spaces\" : 265,\n" +
"              \"available_spaces\" : 97,\n" +
"              \"occupied_spaces\" : 168\n" +
"            }\n" +
"          ],\n" +
"          \"counters\" : [\n" +
"            {\n" +
"              \"id\" : 1,\n" +
"              \"description\" : \"Propietarios\",\n" +
"              \"value_expression\" : \"POZ2\",\n" +
"              \"value\" : 168\n" +
"            },\n" +
"            {\n" +
"              \"id\" : 2,\n" +
"              \"description\" : \"Rotación Ocupadas\",\n" +
"              \"value_expression\" : \"POZ1\",\n" +
"              \"value\" : 58\n" +
"            },\n" +
"            {\n" +
"              \"id\" : 3,\n" +
"              \"description\" : \"Rotación Libres\",\n" +
"              \"value_expression\" : \"PLZ1\",\n" +
"              \"value\" : 162\n" +
"            }\n" +
"          ],\n" +
"          \"signs\" : [\n" +
"            {\n" +
"              \"id\" : 1,\n" +
"              \"description\" : \"Cartel 1\",\n" +
"              \"activation_expression\" : \"PLZ1 <= 1\",\n" +
"              \"activated\" : 0,\n" +
"              \"forced\" : 0\n" +
"            },\n" +
"            {\n" +
"              \"id\" : 2,\n" +
"              \"description\" : \"Cartel 2\",\n" +
"              \"activation_expression\" : \"PLZ1 <= 1\",\n" +
"              \"activated\" : 0,\n" +
"              \"forced\" : 0\n" +
"            }\n" +
"          ]\n" +
"        },\n" +
"        \"Measurements timestamp\" : \"1970-01-01T00:00:00.000Z\",\n" +
"        \"Status\" : 1\n" +
"      }\n" +
"    },\n" +
"    \"Device alarms\" : {\n" +
"      \"Parking alarms\" : {\n" +
"        \"Alarm complete\" : 0,\n" +
"        \"Alarm almost complete\" : 0,\n" +
"        \"Alarm expiration time\" : 0,\n" +
"        \"Alarm signal\" : 0,\n" +
"        \"Alarm disabled\" : 0,\n" +
"        \"Alarm invalid\" : 0,\n" +
"        \"Alarm offline\" : 0,\n" +
"        \"Alarm simulated\" : 0,\n" +
"        \"Alarms configuration\" : [ ],\n" +
"        \"Alarms implemented\" : [\n" +
"          {\n" +
"            \"Name\" : \"alarm_offline\",\n" +
"            \"Severity\" : 0,\n" +
"            \"Timestamp\" : 0\n" +
"          },\n" +
"          {\n" +
"            \"Name\" : \"alarm_invalid\",\n" +
"            \"Severity\" : 0,\n" +
"            \"Timestamp\" : 0\n" +
"          },\n" +
"          {\n" +
"            \"Name\" : \"alarm_disabled\",\n" +
"            \"Severity\" : 0,\n" +
"            \"Timestamp\" : 0\n" +
"          },\n" +
"          {\n" +
"            \"Name\" : \"alarm_simulated\",\n" +
"            \"Severity\" : 0,\n" +
"            \"Timestamp\" : 0\n" +
"          },\n" +
"          {\n" +
"            \"Name\" : \"alarm_complete\",\n" +
"            \"Severity\" : 0,\n" +
"            \"Timestamp\" : 0\n" +
"          },\n" +
"          {\n" +
"            \"Name\" : \"alarm_almost_complete\",\n" +
"            \"Severity\" : 0,\n" +
"            \"Timestamp\" : 0\n" +
"          },\n" +
"          {\n" +
"            \"Name\" : \"alarm_expiration_time\",\n" +
"            \"Severity\" : 0,\n" +
"            \"Timestamp\" : 0\n" +
"          },\n" +
"          {\n" +
"            \"Name\" : \"alarm_signal\",\n" +
"            \"Severity\" : 0,\n" +
"            \"Timestamp\" : 0\n" +
"          }\n" +
"        ],\n" +
"        \"Severity\" : 0\n" +
"      }\n" +
"    }\n" +
"  }\n" +
"}";
    
    public ParkingEquinsaMockerMap() 
    {
        super(getParking());
    }
 
    public ParkingEquinsaMockerMap getMocker() 
    {
        return this;
    }
    
     @Override
    public void updateDevice(boolean active)
    {
        Parking parking = (Parking) device;
 
    }
    
    private static Parking getParking()
    {
        Parking parkingMock;
        try
        {
            parkingMock = (Parking)Serialization.deserialize(Device.class, parking);
        
            return parkingMock;
        } 
        catch (SerializationException ex)
        {
        }
        
        return null;
    }
 
    @Override
    public String getFilePath()
    {
        return "C:\\Users\\Konstantin\\Documents\\ARTIC3\\Applications\\parkingServer\\data\\art.servers.parkingserver\\symbols\\18\\Parking.svg";
    }
 
    @Override
    public boolean isStatusMode()
    {
        return true;
    }
 
    @Override
    public Class getScriptClass()
    {
        return ParkingUrbioticaMap.class;
    }
}