@denevads/dnv-smo 1.0.33 → 1.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/smo.js CHANGED
@@ -1,808 +1,829 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AlarmaLevel = exports.LogLevel = exports.SMO_EVENT_TYPE = exports.SMO = void 0;
4
- var rxjs_1 = require("rxjs");
5
- // @ts-ignore
6
- var SMO = /** @class */ (function () {
7
- function SMO() {
8
- this.vars = {};
9
- this.id = "";
10
- this.intervalDataSource$ = (0, rxjs_1.interval)(5 * 60 * 1000);
11
- this.initOnMessage();
12
- this.smoCallBacks = new smoCallBacks(this);
13
- this.utils = new Utils(this, this.smoCallBacks);
14
- this.events = new SmoEvents(this);
15
- this.init();
16
- }
17
- SMO.prototype.init = function () {
18
- var _this = this;
19
- var match, pl = /\+/g, search = /([^&=]+)=?([^&]*)/g, decode = function (s) {
20
- return decodeURIComponent(s.replace(pl, " "));
21
- }, query = window.location.search.substring(1);
22
- while (match = search.exec(query)) {
23
- this.vars[decode(match[1])] = decode(match[2]);
24
- }
25
- console.log("vars->", JSON.stringify(this.vars));
26
- // @ts-ignore
27
- console.log("resultados " + window.objJS != undefined + " " + window !== window.parent + " " + this.vars.ontop != undefined + " " + this.vars.ontop != "");
28
- // @ts-ignore
29
- if (window.objJS != undefined && this.vars.ontop !== undefined && this.vars.ontop !== "") {
30
- // @ts-ignore
31
- console.log("Existe objJS en window -->" + JSON.stringify(window.objJS));
32
- // @ts-ignore
33
- window.sendToIframefromNet = function (target, iframeID, objData) {
34
- console.log("sendToIframefromNet->", JSON.stringify(target));
35
- switch (target) {
36
- case "SMO.setDatasource":
37
- _this.events.setDatasource.next(objData);
38
- break;
39
- case "SMO.checkHealthPrinter":
40
- _this.events.checkHealthPrinter.next(objData);
41
- break;
42
- }
43
- };
44
- // @ts-ignore
45
- window.external = {
46
- // @ts-ignore
47
- URLNext: window.objJS.urlNext,
48
- // @ts-ignore
49
- LimpiaCapa: window.objJS.limpiaCapa,
50
- // @ts-ignore
51
- LogFlash: window.objJS.logFlash,
52
- // @ts-ignore
53
- PageInit: window.objJS.pageInit,
54
- // @ts-ignore
55
- FinAviso: window.objJS.finAviso,
56
- // @ts-ignore
57
- ExitInteractivity: window.objJS.exitInteractivity,
58
- // @ts-ignore
59
- LogWeb: window.objJS.logWeb,
60
- // @ts-ignore
61
- RefreshPage: window.objJS.refreshPage,
62
- // @ts-ignore
63
- RefreshPageByError: window.objJS.refreshPageByError,
64
- // @ts-ignore
65
- RefreshPageByVideoEvent: window.objJS.refreshPageByVideoEvent,
66
- // @ts-ignore
67
- AuditarRecurso: window.objJS.auditarRecurso,
68
- // @ts-ignore
69
- InitSMO: window.objJS.initSMO,
70
- // @ts-ignore
71
- GetFile: window.objJS.getFile,
72
- // @ts-ignore
73
- ShowBrowser: window.objJS.showBrowser,
74
- // @ts-ignore
75
- closeBrowser: window.objJS.closeBrowser,
76
- // @ts-ignore
77
- RefreshDataSource: window.objJS.refreshDataSource,
78
- // @ts-ignore
79
- SetVariable: window.objJS.setVariable,
80
- // @ts-ignore
81
- GetVariable: window.objJS.getVariable,
82
- // @ts-ignore
83
- GetLocation: window.objJS.getLocation,
84
- // @ts-ignore
85
- SalirApp: window.objJS.salirApp,
86
- // @ts-ignore
87
- SetLocalData: window.objJS.setLocalData,
88
- // @ts-ignore
89
- GetLocalData: window.objJS.getLocalData,
90
- // @ts-ignore
91
- GetSalidaData: window.objJS.getSalidaData,
92
- // @ts-ignore
93
- EjecutaFuncion: window.objJS.ejecutaFuncion,
94
- // @ts-ignore
95
- AddObserver: window.objJS.addObserver,
96
- // @ts-ignore
97
- NotifyToObservers: window.objJS.notifyToObservers,
98
- // @ts-ignore
99
- PrintTextLine: window.objJS.printTextLine,
100
- // @ts-ignore
101
- PrintBarcode: window.objJS.printBarcode,
102
- // @ts-ignore
103
- CutPaper: window.objJS.cutPaper,
104
- // @ts-ignore
105
- PrintImage: window.objJS.printImage,
106
- // @ts-ignore
107
- CheckHealthPrinter: window.objJS.checkHealthPrinter,
108
- // @ts-ignore
109
- CheckHealth: window.objJS.checkHealth
110
- };
111
- }
112
- else {
113
- console.log("No existe objJS en window");
114
- if (this.vars.idSmo) {
115
- this.id = this.vars.idSmo;
116
- if (this.vars["LowPower"] == "true" && (this.vars["url"] != undefined || this.vars["LocalData"] != undefined)) {
117
- this.smoCallBacks.onSmoLoad();
118
- return;
119
- }
120
- if (this.vars["url"] != undefined) {
121
- this.smoCallBacks.getFile(this.vars["url"]);
122
- this.intervalsubscriptionDataSource = this.intervalDataSource$.subscribe(function () {
123
- _this.smoCallBacks.getFile(_this.vars["url"]);
124
- });
125
- return;
126
- }
127
- if (this.vars["LocalData"] != undefined) {
128
- this.smoCallBacks.getLocalData(this.vars["LocalData"]);
129
- this.intervalsubscriptionDataSource = this.intervalDataSource$.subscribe(function () {
130
- _this.smoCallBacks.getLocalData(_this.vars["LocalData"]);
131
- });
132
- return;
133
- }
134
- return;
135
- }
136
- console.warn("No idSmo found in URL");
137
- return;
138
- }
139
- if (this.vars.idSmo) {
140
- this.id = this.vars.idSmo;
141
- return;
142
- }
143
- console.warn("No idSmo found in URL");
144
- };
145
- SMO.prototype.initOnMessage = function () {
146
- var selft = this;
147
- window.onmessage = function (e) {
148
- if (e.data.target) {
149
- var targets = e.data.target.split('.');
150
- var func = targets[targets.length - 1];
151
- if (func == SMO_EVENT_TYPE.start) {
152
- selft.start();
153
- return;
154
- }
155
- if (func == SMO_EVENT_TYPE.setDatasource) {
156
- selft.setDatasource(e.data.objData);
157
- return;
158
- }
159
- if (func == SMO_EVENT_TYPE.getVariable) {
160
- selft.getVariable(e.data.objData);
161
- return;
162
- }
163
- if (func == SMO_EVENT_TYPE.setCurrentStream) {
164
- selft.setCurrentStream(e.data.objData);
165
- return;
166
- }
167
- if (func == SMO_EVENT_TYPE.infoCurrentLocation) {
168
- selft.infoCurrentLocation(e.data.objData);
169
- return;
170
- }
171
- if (func == SMO_EVENT_TYPE.setSalidaData) {
172
- selft.setSalidaData(e.data.objData);
173
- return;
174
- }
175
- if (func == SMO_EVENT_TYPE.updatefromsalida) {
176
- selft.updatefromsalida(e.data.objData);
177
- return;
178
- }
179
- if (func == SMO_EVENT_TYPE.getRecursosByCodigo) {
180
- selft.getRecursosByCodigo(e.data.objData);
181
- return;
182
- }
183
- if (func == SMO_EVENT_TYPE.getRecursos) {
184
- selft.getRecursos(e.data.objData);
185
- }
186
- if (func == SMO_EVENT_TYPE.getRecursosDefault) {
187
- selft.getRecursosDefault(e.data.objData);
188
- }
189
- if (func == SMO_EVENT_TYPE.getRecursosRelleno) {
190
- selft.getRecursosRelleno(e.data.objData);
191
- return;
192
- }
193
- if (func == SMO_EVENT_TYPE.getVariableStorage) {
194
- selft.getVariableStorage(e.data.objData);
195
- return;
196
- }
197
- if (func == SMO_EVENT_TYPE.checkHealth) {
198
- selft.checkHealth(e.data.objData);
199
- return;
200
- }
201
- if (func == SMO_EVENT_TYPE.checkHealthPrinter) {
202
- selft.checkHealthPrinter(e.data.objData);
203
- return;
204
- }
205
- console.warn("message not implemented!!" + func);
206
- }
207
- };
208
- };
209
- SMO.prototype.start = function () {
210
- this.events.start.next({});
211
- };
212
- SMO.prototype.setDatasource = function (datasource) {
213
- this.events.setDatasource.next(datasource);
214
- this.events.setDatasourceJson.next(this.utils.xmlToJSON(datasource.xml));
215
- };
216
- SMO.prototype.getVariable = function (variable) {
217
- this.events.getVariable.next(variable);
218
- };
219
- SMO.prototype.setCurrentStream = function (stream) {
220
- this.events.setCurrentStream.next(stream);
221
- };
222
- SMO.prototype.infoCurrentLocation = function (location) {
223
- this.events.infoCurrentLocation.next(location);
224
- };
225
- SMO.prototype.setSalidaData = function (data) {
226
- this.events.setSalidaData.next(data);
227
- };
228
- SMO.prototype.updatefromsalida = function (data) {
229
- this.events.updatefromsalida.next(data);
230
- };
231
- SMO.prototype.getRecursosByCodigo = function (data) {
232
- this.events.getRecursosByCodigo.next(data);
233
- };
234
- SMO.prototype.getRecursos = function (data) {
235
- this.events.getRecursos.next(data);
236
- };
237
- SMO.prototype.getRecursosDefault = function (data) {
238
- this.events.getRecursosDefault.next(data);
239
- };
240
- SMO.prototype.getRecursosRelleno = function (data) {
241
- this.events.getRecursosRelleno.next(data);
242
- };
243
- SMO.prototype.getVariableStorage = function (variable) {
244
- this.events.getVariableStorage.next(variable);
245
- };
246
- SMO.prototype.checkHealth = function (json) {
247
- this.events.checkHealth.next(json);
248
- };
249
- SMO.prototype.checkHealthPrinter = function (json) {
250
- this.events.checkHealthPrinter.next(json);
251
- };
252
- return SMO;
253
- }());
254
- exports.SMO = SMO;
255
- var SmoEvents = /** @class */ (function () {
256
- function SmoEvents(smo) {
257
- this.start = new rxjs_1.Subject();
258
- this.setDatasource = new rxjs_1.Subject();
259
- this.setDatasourceJson = new rxjs_1.Subject();
260
- this.getVariable = new rxjs_1.Subject();
261
- this.setCurrentStream = new rxjs_1.Subject();
262
- this.infoCurrentLocation = new rxjs_1.Subject();
263
- this.setSalidaData = new rxjs_1.Subject();
264
- this.updatefromsalida = new rxjs_1.Subject();
265
- this.getRecursosByCodigo = new rxjs_1.Subject();
266
- this.getRecursos = new rxjs_1.Subject();
267
- this.getRecursosDefault = new rxjs_1.Subject();
268
- this.getRecursosRelleno = new rxjs_1.Subject();
269
- this.getVariableStorage = new rxjs_1.Subject();
270
- this.checkHealth = new rxjs_1.Subject();
271
- this.checkHealthPrinter = new rxjs_1.Subject();
272
- }
273
- return SmoEvents;
274
- }());
275
- var smoCallBacks = /** @class */ (function () {
276
- function smoCallBacks(_smo) {
277
- this.smo = _smo;
278
- }
279
- smoCallBacks.prototype.onSmoLoad = function () {
280
- this.smo.utils.sendToParent({
281
- target: "Dnv.smoCallbacks.onSmoLoad",
282
- objData: undefined,
283
- idSmo: this.smo.id
284
- }, this.smo.vars.idSmo);
285
- };
286
- smoCallBacks.prototype.onSmoReady = function () {
287
- this.smo.utils.sendToParent({
288
- target: "Dnv.smoCallbacks.onSmoReady",
289
- objData: undefined,
290
- idSmo: this.smo.id
291
- }, this.smo.vars.idSmo);
292
- };
293
- smoCallBacks.prototype.smoLog = function (msn, level) {
294
- if (level == undefined) {
295
- level = LogLevel.Info;
296
- }
297
- //level = Dnv.LogLevel.Debug...
298
- if (level == LogLevel.Debug) {
299
- console.debug(msn);
300
- }
301
- if (level == LogLevel.Info) {
302
- console.log(msn);
303
- }
304
- if (level == LogLevel.Warning) {
305
- console.warn(msn);
306
- }
307
- if (level == LogLevel.Error) {
308
- console.error(msn);
309
- }
310
- if (window.parent != window) {
311
- this.smo.utils.sendToParent({
312
- target: "Dnv.smoCallbacks.smoLog",
313
- objData: {
314
- level: level,
315
- txt: msn
316
- },
317
- idSmo: this.smo.id
318
- }, this.smo.vars.idSmo);
319
- }
320
- };
321
- smoCallBacks.prototype.smoAlarma = function (msn, level) {
322
- this.smo.utils.sendToParent({
323
- target: "Dnv.smoCallbacks.smoAlarma",
324
- objData: {
325
- level: level,
326
- txt: msn
327
- },
328
- idSmo: this.smo.id
329
- }, this.smo.vars.idSmo);
330
- };
331
- smoCallBacks.prototype.smoLogStash = function (msn) {
332
- this.smo.utils.sendToParent({
333
- target: "Dnv.smoCallbacks.smoLogStash",
334
- objData: {
335
- txt: msn
336
- },
337
- idSmo: this.smo.id
338
- }, this.smo.vars.idSmo);
339
- };
340
- smoCallBacks.prototype.smoLogNowShowing = function (msn) {
341
- this.smo.utils.sendToParent({
342
- target: "Dnv.smoCallbacks.smoNowShowing",
343
- objData: msn,
344
- idSmo: this.smo.id
345
- }, this.smo.vars.idSmo);
346
- };
347
- smoCallBacks.prototype.reiniciarDispositivo = function (msn) {
348
- //Permite reiniciar el player, proporcionando una razón para el reinicio. Solo Player HTML5
349
- this.smo.utils.sendToParent({
350
- target: "Dnv.smoCallbacks.reiniciarDispositivo",
351
- objData: {
352
- txt: msn // Razón del reinicio
353
- },
354
- idSmo: this.smo.id
355
- }, this.smo.vars.idSmo);
356
- };
357
- smoCallBacks.prototype.urlNext = function () {
358
- //Permite avanzar plantilla. Solo si Reloj Maestro activado.
359
- this.smo.utils.sendToParent({
360
- target: "Dnv.smoCallbacks.urlNext",
361
- objData: undefined,
362
- idSmo: this.smo.id
363
- }, this.smo.vars.idSmo);
364
- };
365
- smoCallBacks.prototype.exitInteractivity = function () {
366
- //Para canales interactivos, vuelve al canal de reposo. Solo Android y Player PC.
367
- this.smo.utils.sendToParent({
368
- target: "Dnv.smoCallbacks.exitInteractivity",
369
- objData: undefined,
370
- idSmo: this.smo.id
371
- }, this.smo.vars.idSmo);
372
- };
373
- smoCallBacks.prototype.showBrowser = function () {
374
- /* DEPRECATED NOT IMPLEMENTED */
375
- };
376
- smoCallBacks.prototype.closeBrowser = function () {
377
- /* DEPRECATED NOT IMPLEMENTED */
378
- };
379
- smoCallBacks.prototype.urlNextDirectamente = function () {
380
- /* NOT IMPLEMENTED */
381
- };
382
- smoCallBacks.prototype.setVariable = function (variable, valor) {
383
- this.smo.utils.sendToParent({
384
- target: "Dnv.smoCallbacks.setVariable",
385
- objData: {
386
- variable: variable,
387
- valor: valor
388
- },
389
- idSmo: this.smo.id
390
- }, this.smo.vars.idSmo);
391
- };
392
- smoCallBacks.prototype.getVariable = function (variable) {
393
- this.smo.utils.sendToParent({
394
- target: "Dnv.smoCallbacks.getVariable",
395
- objData: {
396
- variable: variable
397
- },
398
- idSmo: this.smo.id
399
- }, this.smo.vars.idSmo);
400
- /* MIRAR SMO.getVariable */
401
- };
402
- smoCallBacks.prototype.getFile = function (file) {
403
- this.smo.utils.sendToParent({
404
- target: "Dnv.smoCallbacks.getFile",
405
- objData: file,
406
- idSmo: this.smo.id
407
- }, this.smo.vars.idSmo);
408
- };
409
- smoCallBacks.prototype.setLocalData = function (variable, valor) {
410
- this.smo.utils.sendToParent({
411
- target: "Dnv.smoCallbacks.setLocalData",
412
- objData: {
413
- nameData: variable,
414
- data: valor
415
- },
416
- idSmo: this.smo.id
417
- }, this.smo.vars.idSmo);
418
- };
419
- smoCallBacks.prototype.getLocalData = function (variable) {
420
- this.smo.utils.sendToParent({
421
- target: "Dnv.smoCallbacks.getLocalData",
422
- objData: variable,
423
- idSmo: this.smo.id
424
- }, this.smo.vars.idSmo);
425
- /* MIRAR SMO.setDatasource */
426
- };
427
- smoCallBacks.prototype.getCurrentStream = function () {
428
- this.smo.utils.sendToParent({
429
- target: "Dnv.smoCallbacks.getCurrentStream",
430
- objData: undefined,
431
- idSmo: this.smo.id
432
- }, this.smo.vars.idSmo);
433
- /* MIRAR SMO.setCurrentStream' */
434
- };
435
- smoCallBacks.prototype.finAviso = function (id) {
436
- this.smo.utils.sendToParent({
437
- target: "Dnv.smoCallbacks.finAviso",
438
- objData: id,
439
- idSmo: this.smo.id
440
- }, this.smo.vars.idSmo);
441
- };
442
- smoCallBacks.prototype.refreshDatasource = function (codigo) {
443
- this.smo.utils.sendToParent({
444
- target: "Dnv.smoCallbacks.refreshDatasource",
445
- objData: codigo,
446
- idSmo: this.smo.id
447
- }, this.smo.vars.idSmo);
448
- };
449
- smoCallBacks.prototype.getLocation = function () {
450
- this.smo.utils.sendToParent({
451
- target: "Dnv.smoCallbacks.getLocation",
452
- objData: undefined,
453
- idSmo: this.smo.id
454
- }, this.smo.vars.idSmo);
455
- /* MIRAR SMO.infoCurrentLocation */
456
- };
457
- smoCallBacks.prototype.getSalidaData = function (data) {
458
- this.smo.utils.sendToParent({
459
- target: "Dnv.smoCallbacks.getSalidaData",
460
- objData: data,
461
- idSmo: this.smo.id
462
- }, this.smo.vars.idSmo);
463
- /* MIRAR SMO.setSalidaData */
464
- };
465
- smoCallBacks.prototype.ejecutaFuncion = function (data) {
466
- /*data ={
467
- funcion: "", // Nombre de la función que se debe ejecutar
468
- params: "" // Parámetros que debemos enviarle a la funcion. sin separadores ni nada, un string y se usa como tal. Solo esta implementada en un caso y se usa como tal sin parsear ni nada
469
- } */
470
- this.smo.utils.sendToParent({
471
- target: "Dnv.smoCallbacks.ejecutaFuncion",
472
- objData: data,
473
- idSmo: this.smo.id
474
- }, this.smo.vars.idSmo);
475
- };
476
- smoCallBacks.prototype.addObserver = function (data) {
477
- /*data ="fruta"
478
- */
479
- this.smo.utils.sendToParent({
480
- target: "Dnv.smoCallbacks.addObserver",
481
- objData: data,
482
- idSmo: this.smo.id
483
- }, this.smo.vars.idSmo);
484
- };
485
- smoCallBacks.prototype.notify = function (data) {
486
- /*data ={
487
- destino: "fruta",
488
- value: "{'fruta':'manzana', 'color':'roja'}"
489
- } */
490
- this.smo.utils.sendToParent({
491
- target: "Dnv.smoCallbacks.notify",
492
- objData: data,
493
- idSmo: this.smo.id
494
- }, this.smo.vars.idSmo);
495
- };
496
- smoCallBacks.prototype.playOnceChannelByTrigger = function (trigger) {
497
- this.smo.utils.sendToParent({
498
- target: "Dnv.smoCallbacks.playOnceChannelByTrigger",
499
- objData: { triggerCanal: trigger },
500
- idSmo: this.smo.id
501
- }, this.smo.vars.idSmo);
502
- };
503
- smoCallBacks.prototype.stopPlayOnceChannelByTrigger = function () {
504
- this.smo.utils.sendToParent({ target: "Dnv.smoCallbacks.stopPlayOnceChannelByTrigger", objData: {}, idSmo: this.smo.id }, this.smo.vars.idSmo);
505
- };
506
- smoCallBacks.prototype.playOnceChannel = function (codigoCanal) {
507
- this.smo.utils.sendToParent({ target: "Dnv.smoCallbacks.playOnceChannel", objData: { codigoCanal: codigoCanal, params: "PLAYONCE_CHANNEL|" + codigoCanal }, idSmo: this.smo.id }, this.smo.vars.idSmo);
508
- };
509
- smoCallBacks.prototype.stopPlayChannel = function () {
510
- this.smo.utils.sendToParent({ target: "Dnv.smoCallbacks.stopPlayOnceChannel", objData: {}, idSmo: this.smo.id }, this.smo.vars.idSmo);
511
- };
512
- smoCallBacks.prototype.editWrapperStyle = function (obj) {
513
- /*{"posX": "0px","posY": "0px","alto": "0px","ancho": "0px","overflow": "hidden","scale": 0.1,"zindex": 0.1,"opacidad": 0.1,"isMaestro": true,duracionTransition: "1s", transitionTiming: "lineal", css: string} */
514
- this.smo.utils.sendToParent({
515
- target: "Dnv.smoCallbacks.editWrapperStyle",
516
- objData: obj,
517
- idSmo: this.smo.id
518
- }, this.smo.vars.idSmo);
519
- };
520
- smoCallBacks.prototype.getRecursosByCodigo = function (codigos) {
521
- /** ["123456","654321"] */
522
- this.smo.utils.sendToParent({
523
- target: "Dnv.smoCallbacks.getRecursosByCodigo",
524
- objData: {
525
- recursos: codigos
526
- },
527
- idSmo: this.smo.id
528
- }, this.smo.vars.idSmo);
529
- };
530
- smoCallBacks.prototype.getRecursos = function () {
531
- this.smo.utils.sendToParent({
532
- target: "Dnv.smoCallbacks.getRecursos",
533
- idSmo: this.smo.id
534
- }, this.smo.vars.idSmo);
535
- };
536
- smoCallBacks.prototype.getRecursosDefault = function () {
537
- this.smo.utils.sendToParent({
538
- target: "Dnv.smoCallbacks.getRecursosDefault",
539
- idSmo: this.smo.id
540
- }, this.smo.vars.idSmo);
541
- };
542
- smoCallBacks.prototype.getRecursosRelleno = function () {
543
- this.smo.utils.sendToParent({
544
- target: "Dnv.smoCallbacks.getRecursosRelleno",
545
- idSmo: this.smo.id
546
- }, this.smo.vars.idSmo);
547
- };
548
- smoCallBacks.prototype.setVariableStorage = function (variable, valor) {
549
- this.smo.utils.sendToParent({
550
- target: "Dnv.smoCallbacks.setVariableStorage",
551
- objData: {
552
- variable: variable,
553
- valor: valor
554
- },
555
- idSmo: this.smo.id
556
- }, this.smo.vars.idSmo);
557
- };
558
- smoCallBacks.prototype.getVariableStorage = function (variable) {
559
- this.smo.utils.sendToParent({
560
- target: "Dnv.smoCallbacks.getVariableStorage",
561
- objData: {
562
- variable: variable
563
- },
564
- idSmo: this.smo.id
565
- }, this.smo.vars.idSmo);
566
- /* MIRAR SMO.getVariable */
567
- };
568
- smoCallBacks.prototype.printTextLine = function (txt) {
569
- this.smo.utils.sendToParent({
570
- target: "Dnv.smoCallbacks.printTextLine",
571
- objData: {
572
- txt: txt
573
- },
574
- idSmo: this.smo.id
575
- }, this.smo.vars.idSmo);
576
- };
577
- smoCallBacks.prototype.printBarcode = function (code, width, height) {
578
- this.smo.utils.sendToParent({
579
- target: "Dnv.smoCallbacks.printBarcode",
580
- objData: {
581
- code: code,
582
- width: width,
583
- height: height
584
- },
585
- idSmo: this.smo.id
586
- }, this.smo.vars.idSmo);
587
- };
588
- smoCallBacks.prototype.cutPaper = function (percent) {
589
- this.smo.utils.sendToParent({
590
- target: "Dnv.smoCallbacks.cutPaper",
591
- objData: {
592
- percent: percent
593
- },
594
- idSmo: this.smo.id
595
- }, this.smo.vars.idSmo);
596
- };
597
- smoCallBacks.prototype.checkHealth = function () {
598
- this.smo.utils.sendToParent({
599
- target: "Dnv.smoCallbacks.checkHealth",
600
- idSmo: this.smo.id
601
- }, this.smo.vars.idSmo);
602
- };
603
- smoCallBacks.prototype.checkHealthPrinter = function () {
604
- this.smo.utils.sendToParent({
605
- target: "Dnv.smoCallbacks.checkHealthPrinter",
606
- idSmo: this.smo.id
607
- }, this.smo.vars.idSmo);
608
- };
609
- smoCallBacks.prototype.printImage = function (image) {
610
- this.smo.utils.sendToParent({
611
- target: "Dnv.smoCallbacks.printImage",
612
- objData: {
613
- image: image
614
- },
615
- idSmo: this.smo.id
616
- }, this.smo.vars.idSmo);
617
- };
618
- return smoCallBacks;
619
- }());
620
- var Utils = /** @class */ (function () {
621
- function Utils(_smo, _smoCallBacks) {
622
- this.smo = _smo;
623
- this.smoCallBacks = _smoCallBacks;
624
- }
625
- // Funciones para XML to JSON
626
- Utils.prototype.xmlToJSON = function (xml) {
627
- var getxml = new DOMParser();
628
- var sinSaltosYTabulaciones = xml.replace(/[\n\r\t]/g, '');
629
- var sinEspaciosEntreTags = sinSaltosYTabulaciones.replace(/>\s*</g, '><');
630
- var xmlDoc = getxml.parseFromString(sinEspaciosEntreTags, "text/xml");
631
- // gets the JSON string
632
- var json_str = this.jsonToStr(this.setJsonObj(xmlDoc));
633
- // sets and returns the JSON object, if "rstr" undefined (not passed), else, returns JSON string
634
- return json_str;
635
- };
636
- Utils.prototype.jsonToStr = function (js_obj) {
637
- var rejsn = JSON.stringify(js_obj, undefined, 2).replace(/(\\t|\\r|\\n)/g, '').replace(/"",[\n\t\r\s]+""[,]*/g, '').replace(/(\n[\t\s\r]*\n)/g, '').replace(/[\s\t]{2,}""[,]{0,1}/g, '').replace(/"[\s\t]{1,}"[,]{0,1}/g, '').replace(/\[[\t\s]*\]/g, '""');
638
- return (rejsn.indexOf('"parsererror": {') == -1) ? rejsn : 'Invalid XML format';
639
- };
640
- Utils.prototype.sendToParent = function (obj, dest) {
641
- console.log('sendToParent->', JSON.stringify(obj));
642
- //@ts-ignore
643
- if (window.objJS != undefined && this.smo.vars.ontop != undefined && this.smo.vars.ontop != "") {
644
- switch (obj.target) {
645
- case "Dnv.smoCallbacks.onSmoLoad":
646
- // @ts-ignore
647
- window.objJS.onSmoLoad();
648
- break;
649
- case "Dnv.smoCallbacks.printTextLine":
650
- // @ts-ignore
651
- window.objJS.printTextLine(obj.objData.txt);
652
- break;
653
- case "Dnv.smoCallbacks.printBarcode":
654
- // @ts-ignore
655
- window.objJS.printBarcode(obj.objData.code, obj.objData.width, obj.objData.height);
656
- break;
657
- case "Dnv.smoCallbacks.cutPaper":
658
- // @ts-ignore
659
- window.objJS.cutPaper(obj.objData.percent);
660
- break;
661
- case "Dnv.smoCallbacks.printImage":
662
- // @ts-ignore
663
- window.objJS.printImage(obj.idSmo, obj.objData.image);
664
- break;
665
- case "Dnv.smoCallbacks.checkHealthPrinter":
666
- console.log('llamo a checkhealthprinter');
667
- // @ts-ignore
668
- window.objJS.checkHealthPrinter(obj.idSmo);
669
- break;
670
- case "Dnv.smoCallbacks.checkHealth":
671
- // @ts-ignore
672
- window.objJS.checkHealth();
673
- break;
674
- case "Dnv.smoCallbacks.getFile":
675
- // @ts-ignore
676
- window.objJS.getFile(dest, obj.objData);
677
- break;
678
- }
679
- return;
680
- }
681
- /* // @ts-ignore
682
- window.parent.postMessage = (target,objData,idSmo)=> {
683
- switch (target.target) {
684
- case "Dnv.smoCallbacks.onSmoLoad":
685
- // @ts-ignore
686
- window.objJS.onSmoLoad();
687
- break;
688
-
689
- case "Dnv.smoCallbacks.printTextLine":
690
- // @ts-ignore
691
- window.objJS.printTextLine(objData.txt);
692
- break;
693
- case "Dnv.smoCallbacks.printBarcode":
694
- // @ts-ignore
695
- window.objJS.printBarcode(objData.code, objData.width, objData.height);
696
- break;
697
- case "Dnv.smoCallbacks.cutPaper":
698
- // @ts-ignore
699
- window.objJS.cutPaper(objData.percent);
700
- break;
701
- case "Dnv.smoCallbacks.printImage":
702
- // @ts-ignore
703
- window.objJS.printImage(idSmo, objData.image);
704
- break;
705
- case "Dnv.smoCallbacks.checkHealthPrinter":
706
- console.log('llamo a checkhealthprinter');
707
- // @ts-ignore
708
-
709
- window.objJS.checkHealthPrinter(idSmo);
710
- break;
711
- case "Dnv.smoCallbacks.checkHealth":
712
- // @ts-ignore
713
- window.objJS.checkHealth();
714
- break;
715
-
716
-
717
- }
718
- }*/
719
- window.parent.postMessage(obj, "*");
720
- };
721
- Utils.prototype.setJsonObj = function (xml) {
722
- var jsonObj = {};
723
- if (xml.nodeType == 1) { // Element
724
- if (xml.attributes.length > 0) {
725
- jsonObj["ATTRIBUTES"] = {};
726
- for (var j = 0; j < xml.attributes.length; j++) {
727
- var attribute = xml.attributes.item(j);
728
- jsonObj["ATTRIBUTES"][attribute.nodeName] = attribute.nodeValue;
729
- }
730
- }
731
- }
732
- else if (xml.nodeType == 3) { // Text
733
- jsonObj = xml.nodeValue.trim();
734
- }
735
- else if (xml.nodeType == 4) { // CDATA
736
- jsonObj = xml.nodeValue.trim();
737
- }
738
- if (xml.hasChildNodes()) {
739
- for (var i = 0; i < xml.childNodes.length; i++) {
740
- var item = xml.childNodes[i];
741
- var nodeName = item.nodeName;
742
- if (nodeName == "#text" && item.nodeType == 3) {
743
- jsonObj = item.nodeValue.trim();
744
- }
745
- else if (nodeName == "#cdata-section" && (item.nodeType == 4 || item.nodeType == 3)) { //Para que quede bonito
746
- jsonObj["CDATA"] = this.setJsonObj(item);
747
- }
748
- else if (typeof jsonObj[nodeName] === "undefined") {
749
- jsonObj[nodeName] = this.setJsonObj(item);
750
- }
751
- else {
752
- if (!Array.isArray(jsonObj[nodeName])) {
753
- jsonObj[nodeName] = [jsonObj[nodeName]];
754
- }
755
- jsonObj[nodeName].push(this.setJsonObj(item));
756
- }
757
- }
758
- }
759
- return jsonObj;
760
- };
761
- Utils.prototype.dataToJSON = function (data) {
762
- try {
763
- var parser = new DOMParser();
764
- var xmlDoc = parser.parseFromString(data.xml, "text/xml");
765
- var dataForJSON = xmlDoc.getElementsByTagName("item")[0].innerHTML;
766
- dataForJSON = dataForJSON.replace(/{'/g, '{"').replace(/'}/g, '"}').replace(/:'/g, ':"').replace(/':/g, '":').replace(/,'/g, ',"').replace(/',/g, '",').replace(/\['/g, '["').replace(/'\]/g, '"]').replace(/(\r\n|\n|\r)/gm, "");
767
- return JSON.parse(dataForJSON);
768
- }
769
- catch (error) {
770
- return {};
771
- }
772
- };
773
- return Utils;
774
- }());
775
- var SMO_EVENT_TYPE;
776
- (function (SMO_EVENT_TYPE) {
777
- SMO_EVENT_TYPE["start"] = "start";
778
- SMO_EVENT_TYPE["setDatasource"] = "setDatasource";
779
- SMO_EVENT_TYPE["getVariable"] = "getVariable";
780
- SMO_EVENT_TYPE["setCurrentStream"] = "setCurrentStream";
781
- SMO_EVENT_TYPE["infoCurrentLocation"] = "infoCurrentLocation";
782
- SMO_EVENT_TYPE["setSalidaData"] = "setSalidaData";
783
- SMO_EVENT_TYPE["updatefromsalida"] = "updatefromsalida";
784
- SMO_EVENT_TYPE["setDatasourceJson"] = "setDatasourceJson";
785
- SMO_EVENT_TYPE["getRecursosByCodigo"] = "getRecursosByCodigo";
786
- SMO_EVENT_TYPE["getRecursos"] = "getRecursos";
787
- SMO_EVENT_TYPE["getRecursosDefault"] = "getRecursosDefault";
788
- SMO_EVENT_TYPE["getRecursosRelleno"] = "getRecursosRelleno";
789
- SMO_EVENT_TYPE["getVariableStorage"] = "getVariableStorage";
790
- SMO_EVENT_TYPE["checkHealth"] = "checkHealth";
791
- SMO_EVENT_TYPE["checkHealthPrinter"] = "checkHealthPrinter";
792
- })(SMO_EVENT_TYPE = exports.SMO_EVENT_TYPE || (exports.SMO_EVENT_TYPE = {}));
793
- var LogLevel;
794
- (function (LogLevel) {
795
- LogLevel[LogLevel["Debug"] = 0] = "Debug";
796
- LogLevel[LogLevel["Info"] = 1] = "Info";
797
- LogLevel[LogLevel["Warning"] = 2] = "Warning";
798
- LogLevel[LogLevel["Error"] = 3] = "Error";
799
- })(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
800
- var AlarmaLevel;
801
- (function (AlarmaLevel) {
802
- AlarmaLevel[AlarmaLevel["Ok_off"] = 0] = "Ok_off";
803
- AlarmaLevel[AlarmaLevel["Ok"] = 1] = "Ok";
804
- AlarmaLevel[AlarmaLevel["Scanning"] = 2] = "Scanning";
805
- AlarmaLevel[AlarmaLevel["Timeout"] = 3] = "Timeout";
806
- AlarmaLevel[AlarmaLevel["Warning"] = 4] = "Warning";
807
- AlarmaLevel[AlarmaLevel["Error"] = 5] = "Error";
808
- })(AlarmaLevel = exports.AlarmaLevel || (exports.AlarmaLevel = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlarmaLevel = exports.LogLevel = exports.SMO_EVENT_TYPE = exports.SMO = void 0;
4
+ var rxjs_1 = require("rxjs");
5
+ // @ts-ignore
6
+ var SMO = /** @class */ (function () {
7
+ function SMO() {
8
+ this.vars = {};
9
+ this.id = "";
10
+ this.intervalDataSource$ = (0, rxjs_1.interval)(5 * 60 * 1000);
11
+ this.initOnMessage();
12
+ this.smoCallBacks = new smoCallBacks(this);
13
+ this.utils = new Utils(this, this.smoCallBacks);
14
+ this.events = new SmoEvents(this);
15
+ this.init();
16
+ }
17
+ SMO.prototype.init = function () {
18
+ var _this = this;
19
+ var match, pl = /\+/g, search = /([^&=]+)=?([^&]*)/g, decode = function (s) {
20
+ return decodeURIComponent(s.replace(pl, " "));
21
+ }, query = window.location.search.substring(1);
22
+ while (match = search.exec(query)) {
23
+ this.vars[decode(match[1])] = decode(match[2]);
24
+ }
25
+ //console.log("vars->",JSON.stringify(this.vars));
26
+ // @ts-ignore
27
+ //console.log( "resultados " +window.objJS != undefined + " " + window !== window.parent + " " + this.vars.ontop != undefined + " " + this.vars.ontop != "");
28
+ // @ts-ignore
29
+ if (window.objJS != undefined && this.vars != undefined && this.vars.ontop !== undefined && this.vars.ontop !== "") {
30
+ // @ts-ignore
31
+ console.log("Existe objJS en window -->" + JSON.stringify(window.objJS));
32
+ // @ts-ignore
33
+ window.sendToIframefromNet = function (target, iframeID, objData) {
34
+ console.log("sendToIframefromNet->", JSON.stringify(target));
35
+ switch (target) {
36
+ case "SMO.setDatasource":
37
+ _this.events.setDatasource.next(objData);
38
+ break;
39
+ case "SMO.checkHealthPrinter":
40
+ _this.events.checkHealthPrinter.next(objData);
41
+ break;
42
+ }
43
+ };
44
+ // @ts-ignore
45
+ window.external = {
46
+ // @ts-ignore
47
+ URLNext: window.objJS.urlNext,
48
+ // @ts-ignore
49
+ LimpiaCapa: window.objJS.limpiaCapa,
50
+ // @ts-ignore
51
+ LogFlash: window.objJS.logFlash,
52
+ // @ts-ignore
53
+ PageInit: window.objJS.pageInit,
54
+ // @ts-ignore
55
+ FinAviso: window.objJS.finAviso,
56
+ // @ts-ignore
57
+ ExitInteractivity: window.objJS.exitInteractivity,
58
+ // @ts-ignore
59
+ LogWeb: window.objJS.logWeb,
60
+ // @ts-ignore
61
+ RefreshPage: window.objJS.refreshPage,
62
+ // @ts-ignore
63
+ RefreshPageByError: window.objJS.refreshPageByError,
64
+ // @ts-ignore
65
+ RefreshPageByVideoEvent: window.objJS.refreshPageByVideoEvent,
66
+ // @ts-ignore
67
+ AuditarRecurso: window.objJS.auditarRecurso,
68
+ // @ts-ignore
69
+ InitSMO: window.objJS.initSMO,
70
+ // @ts-ignore
71
+ GetFile: window.objJS.getFile,
72
+ // @ts-ignore
73
+ ShowBrowser: window.objJS.showBrowser,
74
+ // @ts-ignore
75
+ closeBrowser: window.objJS.closeBrowser,
76
+ // @ts-ignore
77
+ RefreshDataSource: window.objJS.refreshDataSource,
78
+ // @ts-ignore
79
+ SetVariable: window.objJS.setVariable,
80
+ // @ts-ignore
81
+ GetVariable: window.objJS.getVariable,
82
+ // @ts-ignore
83
+ GetLocation: window.objJS.getLocation,
84
+ // @ts-ignore
85
+ SalirApp: window.objJS.salirApp,
86
+ // @ts-ignore
87
+ SetLocalData: window.objJS.setLocalData,
88
+ // @ts-ignore
89
+ GetLocalData: window.objJS.getLocalData,
90
+ // @ts-ignore
91
+ GetSalidaData: window.objJS.getSalidaData,
92
+ // @ts-ignore
93
+ EjecutaFuncion: window.objJS.ejecutaFuncion,
94
+ // @ts-ignore
95
+ AddObserver: window.objJS.addObserver,
96
+ // @ts-ignore
97
+ NotifyToObservers: window.objJS.notifyToObservers,
98
+ // @ts-ignore
99
+ PrintTextLine: window.objJS.printTextLine,
100
+ // @ts-ignore
101
+ PrintBarcode: window.objJS.printBarcode,
102
+ // @ts-ignore
103
+ CutPaper: window.objJS.cutPaper,
104
+ // @ts-ignore
105
+ PrintImage: window.objJS.printImage,
106
+ // @ts-ignore
107
+ CheckHealthPrinter: window.objJS.checkHealthPrinter,
108
+ // @ts-ignore
109
+ CheckHealth: window.objJS.checkHealth,
110
+ // @ts-ignore
111
+ getValorCalendario: window.objJS.getValorCalendario
112
+ };
113
+ }
114
+ else {
115
+ console.log("No existe objJS en window");
116
+ if (this.vars.idSmo) {
117
+ this.id = this.vars.idSmo;
118
+ if (this.vars["LowPower"] == "true" && (this.vars["url"] != undefined || this.vars["LocalData"] != undefined)) {
119
+ this.smoCallBacks.onSmoLoad();
120
+ return;
121
+ }
122
+ if (this.vars["url"] != undefined) {
123
+ this.smoCallBacks.getFile(this.vars["url"]);
124
+ this.intervalsubscriptionDataSource = this.intervalDataSource$.subscribe(function () {
125
+ _this.smoCallBacks.getFile(_this.vars["url"]);
126
+ });
127
+ return;
128
+ }
129
+ if (this.vars["LocalData"] != undefined) {
130
+ this.smoCallBacks.getLocalData(this.vars["LocalData"]);
131
+ this.intervalsubscriptionDataSource = this.intervalDataSource$.subscribe(function () {
132
+ _this.smoCallBacks.getLocalData(_this.vars["LocalData"]);
133
+ });
134
+ return;
135
+ }
136
+ return;
137
+ }
138
+ console.warn("No idSmo found in URL");
139
+ return;
140
+ }
141
+ if (this.vars.idSmo) {
142
+ this.id = this.vars.idSmo;
143
+ return;
144
+ }
145
+ console.warn("No idSmo found in URL");
146
+ };
147
+ SMO.prototype.initOnMessage = function () {
148
+ var selft = this;
149
+ window.onmessage = function (e) {
150
+ if (e.data.target) {
151
+ var targets = e.data.target.split('.');
152
+ var func = targets[targets.length - 1];
153
+ if (func == SMO_EVENT_TYPE.start) {
154
+ selft.start();
155
+ return;
156
+ }
157
+ if (func == SMO_EVENT_TYPE.setDatasource) {
158
+ selft.setDatasource(e.data.objData);
159
+ return;
160
+ }
161
+ if (func == SMO_EVENT_TYPE.getVariable) {
162
+ selft.getVariable(e.data.objData);
163
+ return;
164
+ }
165
+ if (func == SMO_EVENT_TYPE.setCurrentStream) {
166
+ selft.setCurrentStream(e.data.objData);
167
+ return;
168
+ }
169
+ if (func == SMO_EVENT_TYPE.infoCurrentLocation) {
170
+ selft.infoCurrentLocation(e.data.objData);
171
+ return;
172
+ }
173
+ if (func == SMO_EVENT_TYPE.setSalidaData) {
174
+ selft.setSalidaData(e.data.objData);
175
+ return;
176
+ }
177
+ if (func == SMO_EVENT_TYPE.updatefromsalida) {
178
+ selft.updatefromsalida(e.data.objData);
179
+ return;
180
+ }
181
+ if (func == SMO_EVENT_TYPE.getRecursosByCodigo) {
182
+ selft.getRecursosByCodigo(e.data.objData);
183
+ return;
184
+ }
185
+ if (func == SMO_EVENT_TYPE.getRecursos) {
186
+ selft.getRecursos(e.data.objData);
187
+ }
188
+ if (func == SMO_EVENT_TYPE.getRecursosDefault) {
189
+ selft.getRecursosDefault(e.data.objData);
190
+ }
191
+ if (func == SMO_EVENT_TYPE.getRecursosRelleno) {
192
+ selft.getRecursosRelleno(e.data.objData);
193
+ return;
194
+ }
195
+ if (func == SMO_EVENT_TYPE.getVariableStorage) {
196
+ selft.getVariableStorage(e.data.objData);
197
+ return;
198
+ }
199
+ if (func == SMO_EVENT_TYPE.checkHealth) {
200
+ selft.checkHealth(e.data.objData);
201
+ return;
202
+ }
203
+ if (func == SMO_EVENT_TYPE.checkHealthPrinter) {
204
+ selft.checkHealthPrinter(e.data.objData);
205
+ return;
206
+ }
207
+ if (func == SMO_EVENT_TYPE.getValorCalendario) {
208
+ selft.getValorCalendario(e.data.objData);
209
+ return;
210
+ }
211
+ console.warn("message not implemented!!" + func);
212
+ }
213
+ };
214
+ };
215
+ SMO.prototype.start = function () {
216
+ this.events.start.next({});
217
+ };
218
+ SMO.prototype.setDatasource = function (datasource) {
219
+ this.events.setDatasource.next(datasource);
220
+ this.events.setDatasourceJson.next(this.utils.xmlToJSON(datasource.xml));
221
+ };
222
+ SMO.prototype.getVariable = function (variable) {
223
+ this.events.getVariable.next(variable);
224
+ };
225
+ SMO.prototype.setCurrentStream = function (stream) {
226
+ this.events.setCurrentStream.next(stream);
227
+ };
228
+ SMO.prototype.infoCurrentLocation = function (location) {
229
+ this.events.infoCurrentLocation.next(location);
230
+ };
231
+ SMO.prototype.setSalidaData = function (data) {
232
+ this.events.setSalidaData.next(data);
233
+ };
234
+ SMO.prototype.updatefromsalida = function (data) {
235
+ this.events.updatefromsalida.next(data);
236
+ };
237
+ SMO.prototype.getRecursosByCodigo = function (data) {
238
+ this.events.getRecursosByCodigo.next(data);
239
+ };
240
+ SMO.prototype.getRecursos = function (data) {
241
+ this.events.getRecursos.next(data);
242
+ };
243
+ SMO.prototype.getRecursosDefault = function (data) {
244
+ this.events.getRecursosDefault.next(data);
245
+ };
246
+ SMO.prototype.getRecursosRelleno = function (data) {
247
+ this.events.getRecursosRelleno.next(data);
248
+ };
249
+ SMO.prototype.getVariableStorage = function (variable) {
250
+ this.events.getVariableStorage.next(variable);
251
+ };
252
+ SMO.prototype.checkHealth = function (json) {
253
+ this.events.checkHealth.next(json);
254
+ };
255
+ SMO.prototype.checkHealthPrinter = function (json) {
256
+ this.events.checkHealthPrinter.next(json);
257
+ };
258
+ SMO.prototype.getValorCalendario = function (estado) {
259
+ this.events.getValorCalendario.next(estado);
260
+ };
261
+ return SMO;
262
+ }());
263
+ exports.SMO = SMO;
264
+ var SmoEvents = /** @class */ (function () {
265
+ function SmoEvents(smo) {
266
+ this.start = new rxjs_1.Subject();
267
+ this.setDatasource = new rxjs_1.Subject();
268
+ this.setDatasourceJson = new rxjs_1.Subject();
269
+ this.getVariable = new rxjs_1.Subject();
270
+ this.setCurrentStream = new rxjs_1.Subject();
271
+ this.infoCurrentLocation = new rxjs_1.Subject();
272
+ this.setSalidaData = new rxjs_1.Subject();
273
+ this.updatefromsalida = new rxjs_1.Subject();
274
+ this.getRecursosByCodigo = new rxjs_1.Subject();
275
+ this.getRecursos = new rxjs_1.Subject();
276
+ this.getRecursosDefault = new rxjs_1.Subject();
277
+ this.getRecursosRelleno = new rxjs_1.Subject();
278
+ this.getVariableStorage = new rxjs_1.Subject();
279
+ this.checkHealth = new rxjs_1.Subject();
280
+ this.checkHealthPrinter = new rxjs_1.Subject();
281
+ this.getValorCalendario = new rxjs_1.Subject();
282
+ }
283
+ return SmoEvents;
284
+ }());
285
+ var smoCallBacks = /** @class */ (function () {
286
+ function smoCallBacks(_smo) {
287
+ this.smo = _smo;
288
+ }
289
+ smoCallBacks.prototype.onSmoLoad = function () {
290
+ this.smo.utils.sendToParent({
291
+ target: "Dnv.smoCallbacks.onSmoLoad",
292
+ objData: undefined,
293
+ idSmo: this.smo.id
294
+ }, this.smo.vars.idSmo);
295
+ };
296
+ smoCallBacks.prototype.onSmoReady = function () {
297
+ this.smo.utils.sendToParent({
298
+ target: "Dnv.smoCallbacks.onSmoReady",
299
+ objData: undefined,
300
+ idSmo: this.smo.id
301
+ }, this.smo.vars.idSmo);
302
+ };
303
+ smoCallBacks.prototype.smoLog = function (msn, level) {
304
+ if (level == undefined) {
305
+ level = LogLevel.Info;
306
+ }
307
+ //level = Dnv.LogLevel.Debug...
308
+ if (level == LogLevel.Debug) {
309
+ console.debug(msn);
310
+ }
311
+ if (level == LogLevel.Info) {
312
+ console.log(msn);
313
+ }
314
+ if (level == LogLevel.Warning) {
315
+ console.warn(msn);
316
+ }
317
+ if (level == LogLevel.Error) {
318
+ console.error(msn);
319
+ }
320
+ if (window.parent != window) {
321
+ this.smo.utils.sendToParent({
322
+ target: "Dnv.smoCallbacks.smoLog",
323
+ objData: {
324
+ level: level,
325
+ txt: msn
326
+ },
327
+ idSmo: this.smo.id
328
+ }, this.smo.vars.idSmo);
329
+ }
330
+ };
331
+ smoCallBacks.prototype.smoAlarma = function (msn, level) {
332
+ this.smo.utils.sendToParent({
333
+ target: "Dnv.smoCallbacks.smoAlarma",
334
+ objData: {
335
+ level: level,
336
+ txt: msn
337
+ },
338
+ idSmo: this.smo.id
339
+ }, this.smo.vars.idSmo);
340
+ };
341
+ smoCallBacks.prototype.smoLogStash = function (msn) {
342
+ this.smo.utils.sendToParent({
343
+ target: "Dnv.smoCallbacks.smoLogStash",
344
+ objData: {
345
+ txt: msn
346
+ },
347
+ idSmo: this.smo.id
348
+ }, this.smo.vars.idSmo);
349
+ };
350
+ smoCallBacks.prototype.smoLogNowShowing = function (msn) {
351
+ this.smo.utils.sendToParent({
352
+ target: "Dnv.smoCallbacks.smoNowShowing",
353
+ objData: msn,
354
+ idSmo: this.smo.id
355
+ }, this.smo.vars.idSmo);
356
+ };
357
+ smoCallBacks.prototype.reiniciarDispositivo = function (msn) {
358
+ //Permite reiniciar el player, proporcionando una razón para el reinicio. Solo Player HTML5
359
+ this.smo.utils.sendToParent({
360
+ target: "Dnv.smoCallbacks.reiniciarDispositivo",
361
+ objData: {
362
+ txt: msn // Razón del reinicio
363
+ },
364
+ idSmo: this.smo.id
365
+ }, this.smo.vars.idSmo);
366
+ };
367
+ smoCallBacks.prototype.urlNext = function () {
368
+ //Permite avanzar plantilla. Solo si Reloj Maestro activado.
369
+ this.smo.utils.sendToParent({
370
+ target: "Dnv.smoCallbacks.urlNext",
371
+ objData: undefined,
372
+ idSmo: this.smo.id
373
+ }, this.smo.vars.idSmo);
374
+ };
375
+ smoCallBacks.prototype.exitInteractivity = function () {
376
+ //Para canales interactivos, vuelve al canal de reposo. Solo Android y Player PC.
377
+ this.smo.utils.sendToParent({
378
+ target: "Dnv.smoCallbacks.exitInteractivity",
379
+ objData: undefined,
380
+ idSmo: this.smo.id
381
+ }, this.smo.vars.idSmo);
382
+ };
383
+ smoCallBacks.prototype.showBrowser = function () {
384
+ /* DEPRECATED NOT IMPLEMENTED */
385
+ };
386
+ smoCallBacks.prototype.closeBrowser = function () {
387
+ /* DEPRECATED NOT IMPLEMENTED */
388
+ };
389
+ smoCallBacks.prototype.urlNextDirectamente = function () {
390
+ /* NOT IMPLEMENTED */
391
+ };
392
+ smoCallBacks.prototype.setVariable = function (variable, valor) {
393
+ this.smo.utils.sendToParent({
394
+ target: "Dnv.smoCallbacks.setVariable",
395
+ objData: {
396
+ variable: variable,
397
+ valor: valor
398
+ },
399
+ idSmo: this.smo.id
400
+ }, this.smo.vars.idSmo);
401
+ };
402
+ smoCallBacks.prototype.getVariable = function (variable) {
403
+ this.smo.utils.sendToParent({
404
+ target: "Dnv.smoCallbacks.getVariable",
405
+ objData: {
406
+ variable: variable
407
+ },
408
+ idSmo: this.smo.id
409
+ }, this.smo.vars.idSmo);
410
+ /* MIRAR SMO.getVariable */
411
+ };
412
+ smoCallBacks.prototype.getFile = function (file) {
413
+ this.smo.utils.sendToParent({
414
+ target: "Dnv.smoCallbacks.getFile",
415
+ objData: file,
416
+ idSmo: this.smo.id
417
+ }, this.smo.vars.idSmo);
418
+ };
419
+ smoCallBacks.prototype.setLocalData = function (variable, valor) {
420
+ this.smo.utils.sendToParent({
421
+ target: "Dnv.smoCallbacks.setLocalData",
422
+ objData: {
423
+ nameData: variable,
424
+ data: valor
425
+ },
426
+ idSmo: this.smo.id
427
+ }, this.smo.vars.idSmo);
428
+ };
429
+ smoCallBacks.prototype.getLocalData = function (variable) {
430
+ this.smo.utils.sendToParent({
431
+ target: "Dnv.smoCallbacks.getLocalData",
432
+ objData: variable,
433
+ idSmo: this.smo.id
434
+ }, this.smo.vars.idSmo);
435
+ /* MIRAR SMO.setDatasource */
436
+ };
437
+ smoCallBacks.prototype.getCurrentStream = function () {
438
+ this.smo.utils.sendToParent({
439
+ target: "Dnv.smoCallbacks.getCurrentStream",
440
+ objData: undefined,
441
+ idSmo: this.smo.id
442
+ }, this.smo.vars.idSmo);
443
+ /* MIRAR SMO.setCurrentStream' */
444
+ };
445
+ smoCallBacks.prototype.finAviso = function (id) {
446
+ this.smo.utils.sendToParent({
447
+ target: "Dnv.smoCallbacks.finAviso",
448
+ objData: id,
449
+ idSmo: this.smo.id
450
+ }, this.smo.vars.idSmo);
451
+ };
452
+ smoCallBacks.prototype.refreshDatasource = function (codigo) {
453
+ this.smo.utils.sendToParent({
454
+ target: "Dnv.smoCallbacks.refreshDatasource",
455
+ objData: codigo,
456
+ idSmo: this.smo.id
457
+ }, this.smo.vars.idSmo);
458
+ };
459
+ smoCallBacks.prototype.getLocation = function () {
460
+ this.smo.utils.sendToParent({
461
+ target: "Dnv.smoCallbacks.getLocation",
462
+ objData: undefined,
463
+ idSmo: this.smo.id
464
+ }, this.smo.vars.idSmo);
465
+ /* MIRAR SMO.infoCurrentLocation */
466
+ };
467
+ smoCallBacks.prototype.getSalidaData = function (data) {
468
+ this.smo.utils.sendToParent({
469
+ target: "Dnv.smoCallbacks.getSalidaData",
470
+ objData: data,
471
+ idSmo: this.smo.id
472
+ }, this.smo.vars.idSmo);
473
+ /* MIRAR SMO.setSalidaData */
474
+ };
475
+ smoCallBacks.prototype.ejecutaFuncion = function (data) {
476
+ /*data ={
477
+ funcion: "", // Nombre de la función que se debe ejecutar
478
+ params: "" // Parámetros que debemos enviarle a la funcion. sin separadores ni nada, un string y se usa como tal. Solo esta implementada en un caso y se usa como tal sin parsear ni nada
479
+ } */
480
+ this.smo.utils.sendToParent({
481
+ target: "Dnv.smoCallbacks.ejecutaFuncion",
482
+ objData: data,
483
+ idSmo: this.smo.id
484
+ }, this.smo.vars.idSmo);
485
+ };
486
+ smoCallBacks.prototype.addObserver = function (data) {
487
+ /*data ="fruta"
488
+ */
489
+ this.smo.utils.sendToParent({
490
+ target: "Dnv.smoCallbacks.addObserver",
491
+ objData: data,
492
+ idSmo: this.smo.id
493
+ }, this.smo.vars.idSmo);
494
+ };
495
+ smoCallBacks.prototype.notify = function (data) {
496
+ /*data ={
497
+ destino: "fruta",
498
+ value: "{'fruta':'manzana', 'color':'roja'}"
499
+ } */
500
+ this.smo.utils.sendToParent({
501
+ target: "Dnv.smoCallbacks.notify",
502
+ objData: data,
503
+ idSmo: this.smo.id
504
+ }, this.smo.vars.idSmo);
505
+ };
506
+ smoCallBacks.prototype.playOnceChannelByTrigger = function (trigger) {
507
+ this.smo.utils.sendToParent({
508
+ target: "Dnv.smoCallbacks.playOnceChannelByTrigger",
509
+ objData: { triggerCanal: trigger },
510
+ idSmo: this.smo.id
511
+ }, this.smo.vars.idSmo);
512
+ };
513
+ smoCallBacks.prototype.stopPlayOnceChannelByTrigger = function () {
514
+ this.smo.utils.sendToParent({ target: "Dnv.smoCallbacks.stopPlayOnceChannelByTrigger", objData: {}, idSmo: this.smo.id }, this.smo.vars.idSmo);
515
+ };
516
+ smoCallBacks.prototype.playOnceChannel = function (codigoCanal) {
517
+ this.smo.utils.sendToParent({ target: "Dnv.smoCallbacks.playOnceChannel", objData: { codigoCanal: codigoCanal, params: "PLAYONCE_CHANNEL|" + codigoCanal }, idSmo: this.smo.id }, this.smo.vars.idSmo);
518
+ };
519
+ smoCallBacks.prototype.stopPlayChannel = function () {
520
+ this.smo.utils.sendToParent({ target: "Dnv.smoCallbacks.stopPlayOnceChannel", objData: {}, idSmo: this.smo.id }, this.smo.vars.idSmo);
521
+ };
522
+ smoCallBacks.prototype.editWrapperStyle = function (obj) {
523
+ /*{"posX": "0px","posY": "0px","alto": "0px","ancho": "0px","overflow": "hidden","scale": 0.1,"zindex": 0.1,"opacidad": 0.1,"isMaestro": true,duracionTransition: "1s", transitionTiming: "lineal", css: string} */
524
+ this.smo.utils.sendToParent({
525
+ target: "Dnv.smoCallbacks.editWrapperStyle",
526
+ objData: obj,
527
+ idSmo: this.smo.id
528
+ }, this.smo.vars.idSmo);
529
+ };
530
+ smoCallBacks.prototype.getRecursosByCodigo = function (codigos) {
531
+ /** ["123456","654321"] */
532
+ this.smo.utils.sendToParent({
533
+ target: "Dnv.smoCallbacks.getRecursosByCodigo",
534
+ objData: {
535
+ recursos: codigos
536
+ },
537
+ idSmo: this.smo.id
538
+ }, this.smo.vars.idSmo);
539
+ };
540
+ smoCallBacks.prototype.getRecursos = function () {
541
+ this.smo.utils.sendToParent({
542
+ target: "Dnv.smoCallbacks.getRecursos",
543
+ idSmo: this.smo.id
544
+ }, this.smo.vars.idSmo);
545
+ };
546
+ smoCallBacks.prototype.getRecursosDefault = function () {
547
+ this.smo.utils.sendToParent({
548
+ target: "Dnv.smoCallbacks.getRecursosDefault",
549
+ idSmo: this.smo.id
550
+ }, this.smo.vars.idSmo);
551
+ };
552
+ smoCallBacks.prototype.getRecursosRelleno = function () {
553
+ this.smo.utils.sendToParent({
554
+ target: "Dnv.smoCallbacks.getRecursosRelleno",
555
+ idSmo: this.smo.id
556
+ }, this.smo.vars.idSmo);
557
+ };
558
+ smoCallBacks.prototype.setVariableStorage = function (variable, valor) {
559
+ this.smo.utils.sendToParent({
560
+ target: "Dnv.smoCallbacks.setVariableStorage",
561
+ objData: {
562
+ variable: variable,
563
+ valor: valor
564
+ },
565
+ idSmo: this.smo.id
566
+ }, this.smo.vars.idSmo);
567
+ };
568
+ smoCallBacks.prototype.getVariableStorage = function (variable) {
569
+ this.smo.utils.sendToParent({
570
+ target: "Dnv.smoCallbacks.getVariableStorage",
571
+ objData: {
572
+ variable: variable
573
+ },
574
+ idSmo: this.smo.id
575
+ }, this.smo.vars.idSmo);
576
+ /* MIRAR SMO.getVariable */
577
+ };
578
+ smoCallBacks.prototype.printTextLine = function (txt) {
579
+ this.smo.utils.sendToParent({
580
+ target: "Dnv.smoCallbacks.printTextLine",
581
+ objData: {
582
+ txt: txt
583
+ },
584
+ idSmo: this.smo.id
585
+ }, this.smo.vars.idSmo);
586
+ };
587
+ smoCallBacks.prototype.printBarcode = function (code, width, height) {
588
+ this.smo.utils.sendToParent({
589
+ target: "Dnv.smoCallbacks.printBarcode",
590
+ objData: {
591
+ code: code,
592
+ width: width,
593
+ height: height
594
+ },
595
+ idSmo: this.smo.id
596
+ }, this.smo.vars.idSmo);
597
+ };
598
+ smoCallBacks.prototype.cutPaper = function (percent) {
599
+ this.smo.utils.sendToParent({
600
+ target: "Dnv.smoCallbacks.cutPaper",
601
+ objData: {
602
+ percent: percent
603
+ },
604
+ idSmo: this.smo.id
605
+ }, this.smo.vars.idSmo);
606
+ };
607
+ smoCallBacks.prototype.checkHealth = function () {
608
+ this.smo.utils.sendToParent({
609
+ target: "Dnv.smoCallbacks.checkHealth",
610
+ idSmo: this.smo.id
611
+ }, this.smo.vars.idSmo);
612
+ };
613
+ smoCallBacks.prototype.checkHealthPrinter = function () {
614
+ this.smo.utils.sendToParent({
615
+ target: "Dnv.smoCallbacks.checkHealthPrinter",
616
+ idSmo: this.smo.id
617
+ }, this.smo.vars.idSmo);
618
+ };
619
+ smoCallBacks.prototype.printImage = function (image) {
620
+ this.smo.utils.sendToParent({
621
+ target: "Dnv.smoCallbacks.printImage",
622
+ objData: {
623
+ image: image
624
+ },
625
+ idSmo: this.smo.id
626
+ }, this.smo.vars.idSmo);
627
+ };
628
+ smoCallBacks.prototype.getValorCalendario = function (codigo, tipoObjeto) {
629
+ this.smo.utils.sendToParent({
630
+ target: "Dnv.smoCallbacks.getValorCalendario",
631
+ objData: {
632
+ codigo: codigo,
633
+ tipoObjeto: tipoObjeto
634
+ },
635
+ idSmo: this.smo.id
636
+ }, this.smo.vars.idSmo);
637
+ };
638
+ return smoCallBacks;
639
+ }());
640
+ var Utils = /** @class */ (function () {
641
+ function Utils(_smo, _smoCallBacks) {
642
+ this.smo = _smo;
643
+ this.smoCallBacks = _smoCallBacks;
644
+ }
645
+ // Funciones para XML to JSON
646
+ Utils.prototype.xmlToJSON = function (xml) {
647
+ var getxml = new DOMParser();
648
+ var sinSaltosYTabulaciones = xml.replace(/[\n\r\t]/g, '');
649
+ var sinEspaciosEntreTags = sinSaltosYTabulaciones.replace(/>\s*</g, '><');
650
+ var xmlDoc = getxml.parseFromString(sinEspaciosEntreTags, "text/xml");
651
+ // gets the JSON string
652
+ var json_str = this.jsonToStr(this.setJsonObj(xmlDoc));
653
+ // sets and returns the JSON object, if "rstr" undefined (not passed), else, returns JSON string
654
+ return json_str;
655
+ };
656
+ Utils.prototype.jsonToStr = function (js_obj) {
657
+ var rejsn = JSON.stringify(js_obj, undefined, 2).replace(/(\\t|\\r|\\n)/g, '').replace(/"",[\n\t\r\s]+""[,]*/g, '').replace(/(\n[\t\s\r]*\n)/g, '').replace(/[\s\t]{2,}""[,]{0,1}/g, '').replace(/"[\s\t]{1,}"[,]{0,1}/g, '').replace(/\[[\t\s]*\]/g, '""');
658
+ return (rejsn.indexOf('"parsererror": {') == -1) ? rejsn : 'Invalid XML format';
659
+ };
660
+ Utils.prototype.sendToParent = function (obj, dest) {
661
+ console.log('sendToParent->', JSON.stringify(obj));
662
+ //@ts-ignore
663
+ if (window.objJS != undefined && this.smo.vars != undefined && this.smo.vars.ontop != undefined && this.smo.vars.ontop != "") {
664
+ switch (obj.target) {
665
+ case "Dnv.smoCallbacks.onSmoLoad":
666
+ // @ts-ignore
667
+ window.objJS.onSmoLoad();
668
+ break;
669
+ case "Dnv.smoCallbacks.printTextLine":
670
+ // @ts-ignore
671
+ window.objJS.printTextLine(obj.objData.txt);
672
+ break;
673
+ case "Dnv.smoCallbacks.printBarcode":
674
+ // @ts-ignore
675
+ window.objJS.printBarcode(obj.objData.code, obj.objData.width, obj.objData.height);
676
+ break;
677
+ case "Dnv.smoCallbacks.cutPaper":
678
+ // @ts-ignore
679
+ window.objJS.cutPaper(obj.objData.percent);
680
+ break;
681
+ case "Dnv.smoCallbacks.printImage":
682
+ // @ts-ignore
683
+ window.objJS.printImage(obj.idSmo, obj.objData.image);
684
+ break;
685
+ case "Dnv.smoCallbacks.checkHealthPrinter":
686
+ console.log('llamo a checkhealthprinter');
687
+ // @ts-ignore
688
+ window.objJS.checkHealthPrinter(obj.idSmo);
689
+ break;
690
+ case "Dnv.smoCallbacks.checkHealth":
691
+ // @ts-ignore
692
+ window.objJS.checkHealth();
693
+ break;
694
+ case "Dnv.smoCallbacks.getFile":
695
+ // @ts-ignore
696
+ window.objJS.getFile(dest, obj.objData);
697
+ break;
698
+ }
699
+ return;
700
+ }
701
+ /* // @ts-ignore
702
+ window.parent.postMessage = (target,objData,idSmo)=> {
703
+ switch (target.target) {
704
+ case "Dnv.smoCallbacks.onSmoLoad":
705
+ // @ts-ignore
706
+ window.objJS.onSmoLoad();
707
+ break;
708
+
709
+ case "Dnv.smoCallbacks.printTextLine":
710
+ // @ts-ignore
711
+ window.objJS.printTextLine(objData.txt);
712
+ break;
713
+ case "Dnv.smoCallbacks.printBarcode":
714
+ // @ts-ignore
715
+ window.objJS.printBarcode(objData.code, objData.width, objData.height);
716
+ break;
717
+ case "Dnv.smoCallbacks.cutPaper":
718
+ // @ts-ignore
719
+ window.objJS.cutPaper(objData.percent);
720
+ break;
721
+ case "Dnv.smoCallbacks.printImage":
722
+ // @ts-ignore
723
+ window.objJS.printImage(idSmo, objData.image);
724
+ break;
725
+ case "Dnv.smoCallbacks.checkHealthPrinter":
726
+ console.log('llamo a checkhealthprinter');
727
+ // @ts-ignore
728
+
729
+ window.objJS.checkHealthPrinter(idSmo);
730
+ break;
731
+ case "Dnv.smoCallbacks.checkHealth":
732
+ // @ts-ignore
733
+ window.objJS.checkHealth();
734
+ break;
735
+
736
+
737
+ }
738
+ }*/
739
+ window.parent.postMessage(obj, "*");
740
+ };
741
+ Utils.prototype.setJsonObj = function (xml) {
742
+ var jsonObj = {};
743
+ if (xml.nodeType == 1) { // Element
744
+ if (xml.attributes.length > 0) {
745
+ jsonObj["ATTRIBUTES"] = {};
746
+ for (var j = 0; j < xml.attributes.length; j++) {
747
+ var attribute = xml.attributes.item(j);
748
+ jsonObj["ATTRIBUTES"][attribute.nodeName] = attribute.nodeValue;
749
+ }
750
+ }
751
+ }
752
+ else if (xml.nodeType == 3) { // Text
753
+ jsonObj = xml.nodeValue.trim();
754
+ }
755
+ else if (xml.nodeType == 4) { // CDATA
756
+ jsonObj = xml.nodeValue.trim();
757
+ }
758
+ if (xml.hasChildNodes()) {
759
+ for (var i = 0; i < xml.childNodes.length; i++) {
760
+ var item = xml.childNodes[i];
761
+ var nodeName = item.nodeName;
762
+ if (nodeName == "#text" && item.nodeType == 3) {
763
+ jsonObj = item.nodeValue.trim();
764
+ }
765
+ else if (nodeName == "#cdata-section" && (item.nodeType == 4 || item.nodeType == 3)) { //Para que quede bonito
766
+ jsonObj["CDATA"] = this.setJsonObj(item);
767
+ }
768
+ else if (typeof jsonObj[nodeName] === "undefined") {
769
+ jsonObj[nodeName] = this.setJsonObj(item);
770
+ }
771
+ else {
772
+ if (!Array.isArray(jsonObj[nodeName])) {
773
+ jsonObj[nodeName] = [jsonObj[nodeName]];
774
+ }
775
+ jsonObj[nodeName].push(this.setJsonObj(item));
776
+ }
777
+ }
778
+ }
779
+ return jsonObj;
780
+ };
781
+ Utils.prototype.dataToJSON = function (data) {
782
+ try {
783
+ var parser = new DOMParser();
784
+ var xmlDoc = parser.parseFromString(data.xml, "text/xml");
785
+ var dataForJSON = xmlDoc.getElementsByTagName("item")[0].innerHTML;
786
+ dataForJSON = dataForJSON.replace(/{'/g, '{"').replace(/'}/g, '"}').replace(/:'/g, ':"').replace(/':/g, '":').replace(/,'/g, ',"').replace(/',/g, '",').replace(/\['/g, '["').replace(/'\]/g, '"]').replace(/(\r\n|\n|\r)/gm, "");
787
+ return JSON.parse(dataForJSON);
788
+ }
789
+ catch (error) {
790
+ return {};
791
+ }
792
+ };
793
+ return Utils;
794
+ }());
795
+ var SMO_EVENT_TYPE;
796
+ (function (SMO_EVENT_TYPE) {
797
+ SMO_EVENT_TYPE["start"] = "start";
798
+ SMO_EVENT_TYPE["setDatasource"] = "setDatasource";
799
+ SMO_EVENT_TYPE["getVariable"] = "getVariable";
800
+ SMO_EVENT_TYPE["setCurrentStream"] = "setCurrentStream";
801
+ SMO_EVENT_TYPE["infoCurrentLocation"] = "infoCurrentLocation";
802
+ SMO_EVENT_TYPE["setSalidaData"] = "setSalidaData";
803
+ SMO_EVENT_TYPE["updatefromsalida"] = "updatefromsalida";
804
+ SMO_EVENT_TYPE["setDatasourceJson"] = "setDatasourceJson";
805
+ SMO_EVENT_TYPE["getRecursosByCodigo"] = "getRecursosByCodigo";
806
+ SMO_EVENT_TYPE["getRecursos"] = "getRecursos";
807
+ SMO_EVENT_TYPE["getRecursosDefault"] = "getRecursosDefault";
808
+ SMO_EVENT_TYPE["getRecursosRelleno"] = "getRecursosRelleno";
809
+ SMO_EVENT_TYPE["getVariableStorage"] = "getVariableStorage";
810
+ SMO_EVENT_TYPE["checkHealth"] = "checkHealth";
811
+ SMO_EVENT_TYPE["checkHealthPrinter"] = "checkHealthPrinter";
812
+ SMO_EVENT_TYPE["getValorCalendario"] = "getValorCalendario";
813
+ })(SMO_EVENT_TYPE = exports.SMO_EVENT_TYPE || (exports.SMO_EVENT_TYPE = {}));
814
+ var LogLevel;
815
+ (function (LogLevel) {
816
+ LogLevel[LogLevel["Debug"] = 0] = "Debug";
817
+ LogLevel[LogLevel["Info"] = 1] = "Info";
818
+ LogLevel[LogLevel["Warning"] = 2] = "Warning";
819
+ LogLevel[LogLevel["Error"] = 3] = "Error";
820
+ })(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
821
+ var AlarmaLevel;
822
+ (function (AlarmaLevel) {
823
+ AlarmaLevel[AlarmaLevel["Ok_off"] = 0] = "Ok_off";
824
+ AlarmaLevel[AlarmaLevel["Ok"] = 1] = "Ok";
825
+ AlarmaLevel[AlarmaLevel["Scanning"] = 2] = "Scanning";
826
+ AlarmaLevel[AlarmaLevel["Timeout"] = 3] = "Timeout";
827
+ AlarmaLevel[AlarmaLevel["Warning"] = 4] = "Warning";
828
+ AlarmaLevel[AlarmaLevel["Error"] = 5] = "Error";
829
+ })(AlarmaLevel = exports.AlarmaLevel || (exports.AlarmaLevel = {}));