@signageos/front-applet 5.9.0 → 5.10.0

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.
@@ -21,7 +21,12 @@ Management API power allows you to reboot the system, restart the application an
21
21
  | ------ | ------ | ------------- |
22
22
  | `systemReboot()` | Safely reboot device | 3.0.0 |
23
23
  | `appRestart()` | Restart Core App | 3.0.0 |
24
- | `setTimer()` | Timer - when the device turns on and off based on the days in a week | 3.0.0 |
24
+ | `setTimer()` | Create/Set Timer - when the device turns on and off based on the days in a week | 3.0.0 |
25
+ | `unsetTimer()` | Remove Timer - when the device turns on and off based on the days in a week | 4.0.0 |
26
+ | `getTimers()` | List All Timers - when the device turns on and off based on the days in a week | 4.0.0 |
27
+ | `setProprietaryTimer()` | Create/Set Proprietary Timer - when the device turns on and off based on the days in a week | 5.10.0 |
28
+ | `unsetProprietaryTimer()` | Remove Proprietary Timer - when the device turns on and off based on the days in a week | 5.10.0 |
29
+ | `getProprietaryTimers()` | List All Proprietary Timers - when the device turns on and off based on the days in a week | 5.10.0 |
25
30
  :::
26
31
 
27
32
  ## systemReboot()
@@ -77,6 +82,111 @@ Method `setTimer()` will set the time of the timer.
77
82
  await sos.management.power.setTimer("TIMER_1", "09:00:00", "23:00:05", ["mon"], 10);
78
83
  ```
79
84
 
85
+ ## unsetTimer()
86
+ Method `unsetTimer()` will remove the timer.
87
+
88
+ ::: table-responsive
89
+ | Param | Type | Required |Description |
90
+ | -------------- | ----------------------| :-------: | ---------------------------- |
91
+ | `type` | TimerType | <div class="red">Yes</div> | 7 slots for your timers |
92
+ |^^|^^|^^| `TIMER_1`, `TIMER_2`, `TIMER_3`, `TIMER_4`, `TIMER_5`, `TIMER_6`, `TIMER_7` |
93
+ :::
94
+
95
+ ### Javascript example
96
+ ```javascript
97
+ await sos.management.power.unsetTimer("TIMER_1");
98
+ ```
99
+
100
+ ## getTimers()
101
+ Method `getTimer()` will return all currently set timers.
102
+
103
+ ### Javascript example
104
+ ```javascript
105
+ const timers = await sos.management.power.getTimers();
106
+ ```
107
+
108
+ ### Example of response
109
+ ```json
110
+ [
111
+ {
112
+ "type": "TIMER_1",
113
+ "timeOn": "05:00:00",
114
+ "timeOff": "15:00:00",
115
+ "weekdays": ["mon", "sun"],
116
+ "volume": 29
117
+ },
118
+ {
119
+ "type": "TIMER_3",
120
+ "timeOn": "08:00:00",
121
+ "timeOff": "19:00:00",
122
+ "weekdays": ["fri", "sat"],
123
+ "volume": 85
124
+ },
125
+ ]
126
+ ```
127
+
128
+ ## setProprietaryTimer()
129
+ Method `setProprietaryTimer()` will set the time of the proprietary timer.
130
+
131
+ ::: table-responsive
132
+ | Param | Type | Required |Description |
133
+ | -------------- | ----------------------| :-------: | ---------------------------- |
134
+ | `type` | TimerType | <div class="red">Yes</div> | Slots for your timers in format `TIMER_${number}` |
135
+ |^^|^^|^^| `TIMER_1`, `TIMER_2`, `TIMER_3`, `TIMER_4`, `TIMER_5`, `TIMER_6`, `TIMER_XX` |
136
+ | `timeOn` | String or null | <div class="red">Yes</div> | When the display/screen should be turned on |
137
+ |^^|^^|^^| `00:00:00` - `23:59:00` |
138
+ | `timeOff` | String or null | <div class="red">Yes</div> | When the display/screen should be turned off |
139
+ |^^|^^|^^| `00:00:00` - `23:59:00` |
140
+ | `weekdays` | TimerWeekday[] | <div class="red">Yes</div> | Weekdays when timer is applied |
141
+ |^^|^^|^^| `sun`, `mon`, `tue`, `wed`, `thu`, `fri`, `sat` |
142
+ :::
143
+
144
+ ### Javascript example
145
+ ```javascript
146
+ await sos.management.power.setProprietaryTimer("TIMER_105", "09:00:00", "23:00:05", ["mon"]);
147
+ ```
148
+
149
+ ## unsetProprietaryTimer()
150
+ Method `unsetProprietaryTimer()` will remove the proprietary timer.
151
+
152
+ ::: table-responsive
153
+ | Param | Type | Required |Description |
154
+ | -------------- | ----------------------| :-------: | ---------------------------- |
155
+ | `type` | TimerType | <div class="red">Yes</div> | Slots for your timers in format `TIMER_${number}` |
156
+ |^^|^^|^^| `TIMER_1`, `TIMER_2`, `TIMER_3`, `TIMER_4`, `TIMER_5`, `TIMER_6`, `TIMER_XX` |
157
+ :::
158
+
159
+ ### Javascript example
160
+ ```javascript
161
+ await sos.management.power.unsetProprietaryTimer("TIMER_105");
162
+ ```
163
+
164
+ ## getProprietaryTimers()
165
+ Method `getProprietaryTimers()` will return all currently set proprietary timers.
166
+
167
+ ### Javascript example
168
+ ```javascript
169
+ const timers = await sos.management.power.getProprietaryTimers();
170
+ ```
171
+
172
+ ### Example of response
173
+ ```json
174
+ [
175
+ {
176
+ "type": "TIMER_1",
177
+ "timeOn": "05:00:00",
178
+ "timeOff": "15:00:00",
179
+ "weekdays": ["mon", "sun"]
180
+ },
181
+ {
182
+ "type": "TIMER_105",
183
+ "timeOn": "08:00:00",
184
+ "timeOff": "19:00:00",
185
+ "weekdays": ["fri", "sat"]
186
+ },
187
+ ]
188
+ ```
189
+
80
190
  <div class="row d-flex align-content-stretch force-padding-20">
81
191
  <div class="col-12 d-flex">
82
192
  <a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" target="_blank" href="https://github.com/signageos/applet-examples/blob/master/examples/management-js-api/timer/">
@@ -1,5 +1,6 @@
1
1
  import IPostMessage from '../IPostMessage';
2
2
  import { TimerType, ITimer } from './helpers/TimerHelper';
3
+ import { IProprietaryTimer, ProprietaryTimerType } from './helpers/ProprietaryTimerHelper';
3
4
  export default class Power {
4
5
  private messagePrefix;
5
6
  private postMessage;
@@ -9,5 +10,8 @@ export default class Power {
9
10
  getTimers(): Promise<ITimer[]>;
10
11
  setTimer(type: keyof typeof TimerType, timeOn: string | null, timeOff: string | null, weekdays: string[], volume: number): Promise<void>;
11
12
  unsetTimer(type: keyof typeof TimerType): Promise<void>;
13
+ getProprietaryTimers(): Promise<IProprietaryTimer[]>;
14
+ setProprietaryTimer(type: ProprietaryTimerType, timeOn: string | null, timeOff: string | null, weekdays: string[]): Promise<void>;
15
+ unsetProprietaryTimer(type: ProprietaryTimerType): Promise<void>;
12
16
  private getMessage;
13
17
  }
@@ -70,6 +70,39 @@ class Power {
70
70
  yield this.setTimer(type, null, null, [], 0);
71
71
  });
72
72
  }
73
+ getProprietaryTimers() {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ const { timers } = yield this.postMessage({
76
+ type: this.getMessage('get_proprietary_timers'),
77
+ });
78
+ return timers;
79
+ });
80
+ }
81
+ setProprietaryTimer(type, timeOn, timeOff, weekdays) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ Validate_1.default({ type }).required().array('string').matchRegExp(/^TIMER_\d+$/);
84
+ Validate_1.default({ timeOn }).canBeNull().required().string().matchRegExp(/\d{2}:\d{2}:\d{2}/).timerTime();
85
+ Validate_1.default({ timeOff }).canBeNull().required().string().matchRegExp(/\d{2}:\d{2}:\d{2}/).timerTime();
86
+ Validate_1.default({ weekdays }).required().array('string');
87
+ for (const weekday of weekdays) {
88
+ if (typeof TimerHelper_1.TimerWeekday[weekday] === 'undefined') {
89
+ throw new Error('Invalid timer weekday');
90
+ }
91
+ }
92
+ yield this.postMessage({
93
+ type: this.getMessage('set_proprietary_timer'),
94
+ timerType: type,
95
+ timeOn,
96
+ timeOff,
97
+ weekdays,
98
+ });
99
+ });
100
+ }
101
+ unsetProprietaryTimer(type) {
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ yield this.setProprietaryTimer(type, null, null, []);
104
+ });
105
+ }
73
106
  getMessage(name) {
74
107
  return this.messagePrefix + '.' + name;
75
108
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Power.js","sourceRoot":"","sources":["../../../src/FrontApplet/Management/Power.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,uDAAwE;AACxE,mDAA6C;AAE7C,MAAqB,KAAK;IACzB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAQ;QACrB,gBAAW,GAAX,WAAW,CAAmB;IACvC,CAAC;IAEY,YAAY;;YACxB,MAAM,IAAI,CAAC,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AI,QAAQ,EAAE;gBAC/B,IAAI,OAAO,0BAAY,CAAC,OAAoC,CAAC,KAAK,WAAW,EAAE;oBAC9E,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;iBACzC;aACD;YAED,MAAM,IAAI,CAAC,WAAW,CAAC;gBACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC;gBAC9C,SAAS,EAAE,IAAI;gBACf,MAAM;gBACN,OAAO;gBACP,QAAQ;aACR,CAAC,CAAC;QACJ,CAAC;KAAA;IAEY,qBAAqB,CAAC,IAA0B;;YAC5D,MAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACtD,CAAC;KAAA;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC;IACxC,CAAC;CACD;AArGD,wBAqGC"}
@@ -0,0 +1,7 @@
1
+ export declare type ProprietaryTimerType = `TIMER_${number}`;
2
+ export interface IProprietaryTimer {
3
+ type: ProprietaryTimerType;
4
+ timeOn: string | null;
5
+ timeOff: string | null;
6
+ weekdays: string[];
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ProprietaryTimerHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProprietaryTimerHelper.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/helpers/ProprietaryTimerHelper.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signageos/front-applet",
3
- "version": "5.9.0",
3
+ "version": "5.10.0",
4
4
  "main": "dist/bundle.js",
5
5
  "types": "es6/bundle.d.ts",
6
6
  "files": [
@@ -31,7 +31,7 @@
31
31
  "@babel/polyfill": "7.6.0",
32
32
  "@babel/preset-env": "7.6.0",
33
33
  "@signageos/codestyle": "0.0.23",
34
- "@signageos/lib": "10.0.0",
34
+ "@signageos/lib": "10.14.2",
35
35
  "@types/faker": "4.1.5",
36
36
  "@types/lodash": "4.14.137",
37
37
  "@types/mocha": "5.2.7",