@denevads/dnv-smo 1.0.12 → 1.0.14

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.
Binary file
package/README.md CHANGED
@@ -1,20 +1,80 @@
1
1
  #Introducción
2
- TODO: Proporcione una breve introducción del proyecto. En esta sección se deben explicar los objetivos o los motivos del proyecto.
2
+ Librería de interfaz de comunicaciones entre un objeto HTML5 y las funciones de un player de DenevaDS.
3
3
 
4
- # Tareas iniciales
5
- TODO: Guíe a los usuarios para que apliquen el código a su sistema propio sin ningún problema. En esta sección se puede hablar sobre:
6
- 1. El proceso de instalación
7
- 2. Las dependencias de software
8
- 3. Las últimas versiones
9
- 4. Las referencias de API
4
+ Aquí definiremos el uso de la librería y las funciones que la misma provee
10
5
 
11
- # Compilación y prueba
12
- TODO: Describa y muestre cómo compilar el código y ejecutar las pruebas.
13
6
 
14
- # Contribución
15
- TODO: Explique cómo pueden contribuir otros usuarios y desarrolladores a la mejora del código.
7
+ # Instalación
8
+ La librería esta pensada para ser usada junto con Angular, de manera que si no contamos con el cli de angular en el sistema conviene instalarlo para inicializar el proyecto.
9
+ ```sh
10
+ npm install -g @angular/cli
11
+ ```
12
+ Inicializamos un proyecto de prueba llamado html-deneva en la ruta en la que estemos.
13
+ ```sh
14
+ ng new html-deneva
15
+ ```
16
+ Una vez que ya tenemos la estructura básica del proyecto podemos instalar la librería en el proyecto ejecutando la siguiente liena dentro de la carpeta del mismo:
17
+ ```sh
18
+ npm install @denevads/dnv-smo
19
+ ```
16
20
 
17
- Si quiere obtener más información sobre cómo crear archivos Léame descriptivos, consulte las siguientes [directrices](https://docs.microsoft.com/en-us/azure/devops/repos/git/create-a-readme?view=azure-devops). También puede inspirarse en los archivos Léame siguientes:
18
- - [ASP.NET Core](https://github.com/aspnet/Home)
19
- - [Visual Studio Code](https://github.com/Microsoft/vscode)
20
- - [Chakra Core](https://github.com/Microsoft/ChakraCore)
21
+ # Inicialización
22
+
23
+ Una vez que tengamos el proyecto de angular inicializado, procedemos importar el módulo.
24
+
25
+ Dentro de la definición del app.module en la carpeta app, importamos la librería.
26
+ ```ts
27
+ import { SMO } from '@denevads/dnv-smo/dist/smo';
28
+ ```
29
+ y lo añadimos como provider en @NgModule
30
+ ```ts
31
+ providers: [SMO]
32
+ ```
33
+
34
+ Ahora ya solo bastaría con añadirlo al componente del angular y empezar a usarlo.
35
+
36
+ De nuevo en app.component importamos la librería
37
+ ```js
38
+ import { LogLevel, SMO } from '@denevads/dnv-smo/dist/smo'
39
+ ```
40
+ Y en la exportación de la clase AppComponent añadimos el constructor
41
+ ```js
42
+ constructor(private smo:SMO){ }
43
+ ```
44
+ De esta manera ya tendríamos disponible para su uso todas las llamadas que aporta la librería usando
45
+ ```js
46
+ this.smo.
47
+ ```
48
+ También en la importacion hemos traído la enumeración de los niveles de log, que sirven para loggear en el disco del equipo.
49
+ El uso sería de la siguiente forma.
50
+ ```js
51
+ this.smo.smoCallBacks.smoLog('Mensaje de prueba',LogLevel.Info);
52
+ ```
53
+
54
+ # Compilación y empaquetado.
55
+
56
+ Para que el proyecto pueda funcionar en un equipo sin problemas hay que hacer un par de cambios en el código del proyecto por defecto.
57
+
58
+ El primero de ellos es modificar el tsconfig.json para que el "target" sea "ES5" en lugar de "ES2022"
59
+
60
+
61
+ Y el segundo cambio es en archivo de index. Aquí haremos dos cosas.
62
+ -Borraremos la importación del favicon (además de borrarlo de la carpeta de archivos).
63
+ -Y cambiamos la línea
64
+ ```html
65
+ <base href="/">
66
+ ```
67
+ por
68
+ ```html
69
+ <script>document.write('<base href="' + document.location + '" />');</script>
70
+ ```
71
+ Con estos cambios hechos, podemos compilar el proyecto ejecutando la línea
72
+ ```sh
73
+ ng b
74
+ ```
75
+ Esto nos generara una carpeta dist, con el contenido de nuestro HTML5 compilado.
76
+
77
+ Para poder subirlo al player de deneva, simplemente tenemos que crear un zip con el contenido en la raíz, y le cambiaremos la extensión por
78
+ ```sh
79
+ .wgt
80
+ ```
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./";
1
+ export * from "./";
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./"), exports);
@@ -1,56 +1,56 @@
1
- export interface setDatasource {
2
- xml: string;
3
- }
4
- export interface start {
5
- }
6
- export interface variable {
7
- variable: string;
8
- valor: string;
9
- }
10
- export interface location {
11
- top: string;
12
- left: string;
13
- width: string;
14
- height: string;
15
- }
16
- export interface Slide {
17
- codigo: string;
18
- idioma: string;
19
- denominacion: string;
20
- hash: string;
21
- }
22
- export interface DataSalida {
23
- dataKey: string;
24
- data: Slide[];
25
- }
26
- export interface ExecFunction {
27
- funcion: string;
28
- params: string;
29
- }
30
- export interface Notify {
31
- destion: string;
32
- value: any;
33
- }
34
- export interface GetRecursos {
35
- codigo: number;
36
- fechaInicio: string;
37
- fechaFin: string;
38
- recursos: Recurso[];
39
- }
40
- export interface GetRecursosRelleno {
41
- codigo: number;
42
- recursos: Recurso[];
43
- }
44
- export interface Recurso {
45
- codigo: number;
46
- url: string;
47
- duracion: number;
48
- tipo: number;
49
- disponible: boolean;
50
- vigencia_inicio: string;
51
- vigencia_fin: string;
52
- hora_inicio: string;
53
- hora_fin: string;
54
- dias: string;
55
- nombre: string;
56
- }
1
+ export interface setDatasource {
2
+ xml: string;
3
+ }
4
+ export interface start {
5
+ }
6
+ export interface variable {
7
+ variable: string;
8
+ valor: string;
9
+ }
10
+ export interface location {
11
+ top: string;
12
+ left: string;
13
+ width: string;
14
+ height: string;
15
+ }
16
+ export interface Slide {
17
+ codigo: string;
18
+ idioma: string;
19
+ denominacion: string;
20
+ hash: string;
21
+ }
22
+ export interface DataSalida {
23
+ dataKey: string;
24
+ data: Slide[];
25
+ }
26
+ export interface ExecFunction {
27
+ funcion: string;
28
+ params: string;
29
+ }
30
+ export interface Notify {
31
+ destion: string;
32
+ value: any;
33
+ }
34
+ export interface GetRecursos {
35
+ codigo: number;
36
+ fechaInicio: string;
37
+ fechaFin: string;
38
+ recursos: Recurso[];
39
+ }
40
+ export interface GetRecursosRelleno {
41
+ codigo: number;
42
+ recursos: Recurso[];
43
+ }
44
+ export interface Recurso {
45
+ codigo: number;
46
+ url: string;
47
+ duracion: number;
48
+ tipo: number;
49
+ disponible: boolean;
50
+ vigencia_inicio: string;
51
+ vigencia_fin: string;
52
+ hora_inicio: string;
53
+ hora_fin: string;
54
+ dias: string;
55
+ nombre: string;
56
+ }
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/smo.d.ts CHANGED
@@ -1,117 +1,125 @@
1
- import { setDatasource, variable, location, DataSalida, ExecFunction, Notify, start, GetRecursos, GetRecursosRelleno } from "./interfaces/callbacks";
2
- import { Subject } from 'rxjs';
3
- export declare class SMO {
4
- vars: any;
5
- id: string;
6
- private intervalsubscriptionDataSource;
7
- intervalDataSource$: import("rxjs").Observable<number>;
8
- smoCallBacks: smoCallBacks;
9
- utils: Utils;
10
- events: SmoEvents;
11
- constructor();
12
- init(): void;
13
- initOnMessage(): void;
14
- start(): void;
15
- setDatasource(datasource: setDatasource): void;
16
- getVariable(variable: variable): void;
17
- setCurrentStream(stream: string): void;
18
- infoCurrentLocation(location: location): void;
19
- setSalidaData(data: DataSalida): void;
20
- updatefromsalida(data: any): void;
21
- getRecursos(data: GetRecursos): void;
22
- getRecursosDefault(data: GetRecursos): void;
23
- getRecursosRelleno(data: GetRecursosRelleno): void;
24
- getVariableStorage(variable: variable): void;
25
- }
26
- declare class SmoEvents {
27
- start: Subject<start>;
28
- setDatasource: Subject<setDatasource>;
29
- setDatasourceJson: Subject<any>;
30
- getVariable: Subject<variable>;
31
- setCurrentStream: Subject<string>;
32
- infoCurrentLocation: Subject<location>;
33
- setSalidaData: Subject<DataSalida>;
34
- updatefromsalida: Subject<any>;
35
- getRecursos: Subject<GetRecursos>;
36
- getRecursosDefault: Subject<GetRecursos>;
37
- getRecursosRelleno: Subject<GetRecursosRelleno>;
38
- getVariableStorage: Subject<variable>;
39
- constructor(smo: SMO);
40
- }
41
- declare class smoCallBacks {
42
- smo: SMO;
43
- constructor(_smo: SMO);
44
- onSmoLoad(): void;
45
- onSmoReady(): void;
46
- smoLog(msn: string, level: LogLevel): void;
47
- smoAlarma(msn: string, level: AlarmaLevel): void;
48
- smoLogStash(msn: string): void;
49
- smoLogNowShowing(msn: any): void;
50
- reiniciarDispositivo(msn: string): void;
51
- urlNext(): void;
52
- exitInteractivity(): void;
53
- showBrowser(): void;
54
- closeBrowser(): void;
55
- urlNextDirectamente(): void;
56
- setVariable(variable: string, valor: string): void;
57
- getVariable(variable: string): void;
58
- getFile(file: string): void;
59
- setLocalData(variable: string, valor: string): void;
60
- getLocalData(variable: string): void;
61
- getCurrentStream(): void;
62
- finAviso(id: string): void;
63
- refreshDatasource(codigo: string): void;
64
- getLocation(): void;
65
- getSalidaData(data: string): void;
66
- ejecutaFuncion(data: ExecFunction): void;
67
- addObserver(data: string): void;
68
- notify(data: Notify): void;
69
- playOnceChannelByTrigger(trigger: string): void;
70
- stopPlayOnceChannelByTrigger(): void;
71
- playOnceChannel(codigoCanal: string): void;
72
- stopPlayChannel(): void;
73
- editWrapperStyle(obj: any): void;
74
- getRecursos(): void;
75
- getRecursosDefault(): void;
76
- getRecursosRelleno(): void;
77
- setVariableStorage(variable: string, valor: string): void;
78
- getVariableStorage(variable: string): void;
79
- }
80
- declare class Utils {
81
- smo: SMO;
82
- smoCallBacks: smoCallBacks;
83
- constructor(_smo: SMO, _smoCallBacks: smoCallBacks);
84
- xmlToJSON(xml: string): string;
85
- jsonToStr(js_obj: any): string;
86
- setJsonObj(xml: any): any;
87
- dataToJSON(data: setDatasource): any;
88
- }
89
- export declare enum SMO_EVENT_TYPE {
90
- start = "start",
91
- setDatasource = "setDatasource",
92
- getVariable = "getVariable",
93
- setCurrentStream = "setCurrentStream",
94
- infoCurrentLocation = "infoCurrentLocation",
95
- setSalidaData = "setSalidaData",
96
- updatefromsalida = "updatefromsalida",
97
- setDatasourceJson = "setDatasourceJson",
98
- getRecursos = "getRecursos",
99
- getRecursosDefault = "getRecursosDefault",
100
- getRecursosRelleno = "getRecursosRelleno",
101
- getVariableStorage = "getVariableStorage"
102
- }
103
- export declare enum LogLevel {
104
- Debug = 0,
105
- Info = 1,
106
- Warning = 2,
107
- Error = 3
108
- }
109
- export declare enum AlarmaLevel {
110
- Ok_off = 0,
111
- Ok = 1,
112
- Scanning = 2,
113
- Timeout = 3,
114
- Warning = 4,
115
- Error = 5
116
- }
117
- export {};
1
+ import { setDatasource, variable, location, DataSalida, ExecFunction, Notify, start, GetRecursos, GetRecursosRelleno } from "./interfaces/callbacks";
2
+ import { Subject } from 'rxjs';
3
+ export declare class SMO {
4
+ vars: any;
5
+ id: string;
6
+ private intervalsubscriptionDataSource;
7
+ intervalDataSource$: import("rxjs").Observable<number>;
8
+ smoCallBacks: smoCallBacks;
9
+ utils: Utils;
10
+ events: SmoEvents;
11
+ constructor();
12
+ init(): void;
13
+ initOnMessage(): void;
14
+ start(): void;
15
+ setDatasource(datasource: setDatasource): void;
16
+ getVariable(variable: variable): void;
17
+ setCurrentStream(stream: string): void;
18
+ infoCurrentLocation(location: location): void;
19
+ setSalidaData(data: DataSalida): void;
20
+ updatefromsalida(data: any): void;
21
+ getRecursos(data: GetRecursos): void;
22
+ getRecursosDefault(data: GetRecursos): void;
23
+ getRecursosRelleno(data: GetRecursosRelleno): void;
24
+ getVariableStorage(variable: variable): void;
25
+ checkHealth(variable: string): void;
26
+ }
27
+ declare class SmoEvents {
28
+ start: Subject<start>;
29
+ setDatasource: Subject<setDatasource>;
30
+ setDatasourceJson: Subject<any>;
31
+ getVariable: Subject<variable>;
32
+ setCurrentStream: Subject<string>;
33
+ infoCurrentLocation: Subject<location>;
34
+ setSalidaData: Subject<DataSalida>;
35
+ updatefromsalida: Subject<any>;
36
+ getRecursos: Subject<GetRecursos>;
37
+ getRecursosDefault: Subject<GetRecursos>;
38
+ getRecursosRelleno: Subject<GetRecursosRelleno>;
39
+ getVariableStorage: Subject<variable>;
40
+ checkHealth: Subject<string>;
41
+ constructor(smo: SMO);
42
+ }
43
+ declare class smoCallBacks {
44
+ smo: SMO;
45
+ constructor(_smo: SMO);
46
+ onSmoLoad(): void;
47
+ onSmoReady(): void;
48
+ smoLog(msn: string, level: LogLevel): void;
49
+ smoAlarma(msn: string, level: AlarmaLevel): void;
50
+ smoLogStash(msn: string): void;
51
+ smoLogNowShowing(msn: any): void;
52
+ reiniciarDispositivo(msn: string): void;
53
+ urlNext(): void;
54
+ exitInteractivity(): void;
55
+ showBrowser(): void;
56
+ closeBrowser(): void;
57
+ urlNextDirectamente(): void;
58
+ setVariable(variable: string, valor: string): void;
59
+ getVariable(variable: string): void;
60
+ getFile(file: string): void;
61
+ setLocalData(variable: string, valor: string): void;
62
+ getLocalData(variable: string): void;
63
+ getCurrentStream(): void;
64
+ finAviso(id: string): void;
65
+ refreshDatasource(codigo: string): void;
66
+ getLocation(): void;
67
+ getSalidaData(data: string): void;
68
+ ejecutaFuncion(data: ExecFunction): void;
69
+ addObserver(data: string): void;
70
+ notify(data: Notify): void;
71
+ playOnceChannelByTrigger(trigger: string): void;
72
+ stopPlayOnceChannelByTrigger(): void;
73
+ playOnceChannel(codigoCanal: string): void;
74
+ stopPlayChannel(): void;
75
+ editWrapperStyle(obj: any): void;
76
+ getRecursos(): void;
77
+ getRecursosDefault(): void;
78
+ getRecursosRelleno(): void;
79
+ setVariableStorage(variable: string, valor: string): void;
80
+ getVariableStorage(variable: string): void;
81
+ printTextLine(txt: string): void;
82
+ printBarcode(code: string, width: number, height: number): void;
83
+ cutPaper(percent: number): void;
84
+ checkHealth(): void;
85
+ printImage(image: string): void;
86
+ }
87
+ declare class Utils {
88
+ smo: SMO;
89
+ smoCallBacks: smoCallBacks;
90
+ constructor(_smo: SMO, _smoCallBacks: smoCallBacks);
91
+ xmlToJSON(xml: string): string;
92
+ jsonToStr(js_obj: any): string;
93
+ setJsonObj(xml: any): any;
94
+ dataToJSON(data: setDatasource): any;
95
+ }
96
+ export declare enum SMO_EVENT_TYPE {
97
+ start = "start",
98
+ setDatasource = "setDatasource",
99
+ getVariable = "getVariable",
100
+ setCurrentStream = "setCurrentStream",
101
+ infoCurrentLocation = "infoCurrentLocation",
102
+ setSalidaData = "setSalidaData",
103
+ updatefromsalida = "updatefromsalida",
104
+ setDatasourceJson = "setDatasourceJson",
105
+ getRecursos = "getRecursos",
106
+ getRecursosDefault = "getRecursosDefault",
107
+ getRecursosRelleno = "getRecursosRelleno",
108
+ getVariableStorage = "getVariableStorage",
109
+ checkHealth = "checkHealth"
110
+ }
111
+ export declare enum LogLevel {
112
+ Debug = 0,
113
+ Info = 1,
114
+ Warning = 2,
115
+ Error = 3
116
+ }
117
+ export declare enum AlarmaLevel {
118
+ Ok_off = 0,
119
+ Ok = 1,
120
+ Scanning = 2,
121
+ Timeout = 3,
122
+ Warning = 4,
123
+ Error = 5
124
+ }
125
+ export {};