loupedeck-commander 1.2.3 → 1.2.4
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/LICENSE +201 -0
- package/README.md +131 -131
- package/VERSION.md +32 -32
- package/common/ApplicationConfig.mjs +219 -84
- package/common/BaseLoupeDeckHandler.mjs +333 -326
- package/common/cmd-executer.mjs +16 -16
- package/common/index.mjs +5 -5
- package/common/touchbuttons.mjs +534 -534
- package/common/utils.mjs +30 -29
- package/config.json +8 -8
- package/eslint.config.mjs +8 -8
- package/example/ExampleDeviceHandler.mjs +44 -44
- package/example/example.mjs +21 -21
- package/index.mjs +3 -3
- package/interfaces/baseif.mjs +69 -69
- package/interfaces/httpif.mjs +90 -81
- package/interfaces/opcuaif.mjs +296 -291
- package/interfaces/shellif.mjs +53 -47
- package/package.json +29 -29
- package/profile-1.json +373 -280
- package/test.mjs +26 -22
|
@@ -1,326 +1,333 @@
|
|
|
1
|
-
import {discover, HAPTIC,LoupedeckDevice } from 'loupedeck'
|
|
2
|
-
import { ApplicationConfig } from './ApplicationConfig.mjs'
|
|
3
|
-
import { ButtonField, StopInterfaces, InitializeInterfaces,opcuainterface,profileEmitter} from './touchbuttons.mjs'
|
|
4
|
-
|
|
5
|
-
export class BaseLoupeDeckHandler {
|
|
6
|
-
device = undefined
|
|
7
|
-
appConfig = undefined
|
|
8
|
-
profileConfigs = []
|
|
9
|
-
currentProfile = 0
|
|
10
|
-
screens = {}
|
|
11
|
-
buttons = {}
|
|
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
|
-
this.device.on('
|
|
58
|
-
this.device.on('
|
|
59
|
-
this.device.on('
|
|
60
|
-
this.device.on('
|
|
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
|
-
if (this.device){
|
|
87
|
-
this.device.
|
|
88
|
-
await new Promise(resolve => setTimeout(resolve, 250))
|
|
89
|
-
}
|
|
90
|
-
if (this.device){
|
|
91
|
-
this.device.
|
|
92
|
-
await
|
|
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
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
await this.buttons.load()
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
this.buttons.
|
|
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
|
-
this.screenUpdate["
|
|
198
|
-
this.
|
|
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
|
-
ok =
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
this.
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
1
|
+
import {discover, HAPTIC,LoupedeckDevice } from 'loupedeck'
|
|
2
|
+
import { ApplicationConfig } from './ApplicationConfig.mjs'
|
|
3
|
+
import { ButtonField, StopInterfaces, InitializeInterfaces,opcuainterface,profileEmitter} from './touchbuttons.mjs'
|
|
4
|
+
|
|
5
|
+
export class BaseLoupeDeckHandler {
|
|
6
|
+
device = undefined
|
|
7
|
+
appConfig = undefined
|
|
8
|
+
profileConfigs = []
|
|
9
|
+
currentProfile = 0
|
|
10
|
+
screens = {}
|
|
11
|
+
buttons = {}
|
|
12
|
+
knobs = {}
|
|
13
|
+
screenUpdate = {}
|
|
14
|
+
stopping = false
|
|
15
|
+
|
|
16
|
+
constructor (config) {
|
|
17
|
+
console.log(`INIT with config ${config}`)
|
|
18
|
+
let result = this.loadConfig(config)
|
|
19
|
+
if (!result){
|
|
20
|
+
process.exit(-1)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* event handler - start
|
|
26
|
+
*/
|
|
27
|
+
async start () {
|
|
28
|
+
console.info('Start')
|
|
29
|
+
while (!this.device && !this.stopping) {
|
|
30
|
+
try {
|
|
31
|
+
var list = await LoupedeckDevice.list()
|
|
32
|
+
if (list.length>0){
|
|
33
|
+
var element = list[0]
|
|
34
|
+
console.log("Connecting to device")
|
|
35
|
+
console.log("Path: ", element.path)
|
|
36
|
+
console.log("vendorId: ", element.vendorId, element.productId)
|
|
37
|
+
console.log("serialNumber: ", element.serialNumber)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
this.device = await discover()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
} catch (e) {
|
|
45
|
+
console.error(`${e}. Reattempting in 3 seconds...`)
|
|
46
|
+
await new Promise(resolve => setTimeout(resolve, 3000))
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (this.stopping){
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
console.info(`✅ Discovered Device ${this.device.type}`)
|
|
54
|
+
|
|
55
|
+
const self = this
|
|
56
|
+
|
|
57
|
+
this.device.on('connect', (address) => { self.onConnected(address) })
|
|
58
|
+
this.device.on('down', (event) => { self.onButtonDown(event) })
|
|
59
|
+
this.device.on('up', (event) => { self.onButtonUp(event) })
|
|
60
|
+
this.device.on('rotate', (event) => { self.onRotate(event) })
|
|
61
|
+
this.device.on('touchstart', (event) => { self.onTouchStart(event) })
|
|
62
|
+
this.device.on('touchmove', (event) => { self.onTouchMove(event) })
|
|
63
|
+
this.device.on('touchend', (event) => { self.onTouchEnd(event) })
|
|
64
|
+
this.device.on('disconnect', (event) => { self.disconnectDevice(event) })
|
|
65
|
+
|
|
66
|
+
console.info(`✅ Registered callbacks`)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* event handler - loupedeck device disconnected
|
|
71
|
+
*/
|
|
72
|
+
async disconnectDevice (event) {
|
|
73
|
+
console.info("Device Disconnected")
|
|
74
|
+
this.device=undefined
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* stop handler - close the dipslay-connection and also stop all interface handlers
|
|
79
|
+
*/
|
|
80
|
+
async stop () {
|
|
81
|
+
console.info('Stopping Handler')
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
console.info(`Closing Device`)
|
|
85
|
+
this.stopping = true
|
|
86
|
+
if (this.device){
|
|
87
|
+
this.device.vibrate(HAPTIC.DESCEND_MED)
|
|
88
|
+
await new Promise(resolve => setTimeout(resolve, 250))
|
|
89
|
+
}
|
|
90
|
+
if (this.device){
|
|
91
|
+
this.device.setBrightness(0)
|
|
92
|
+
await new Promise(resolve => setTimeout(resolve, 250))
|
|
93
|
+
}
|
|
94
|
+
if (this.device){
|
|
95
|
+
this.device.reconnectInterval = 0
|
|
96
|
+
await this.device.close()
|
|
97
|
+
await new Promise(resolve => setTimeout(resolve, 2000))
|
|
98
|
+
console.info(`Device Closed`)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
console.info(`Stopping interfaces`)
|
|
102
|
+
await StopInterfaces()
|
|
103
|
+
await new Promise(resolve => setTimeout(resolve, 500))
|
|
104
|
+
} catch (e) {}
|
|
105
|
+
|
|
106
|
+
process.exit()
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* load Application config file from JSON
|
|
112
|
+
* @param filename
|
|
113
|
+
*/
|
|
114
|
+
loadConfig (fileName) {
|
|
115
|
+
console.info(`Loading Config File ${fileName}`)
|
|
116
|
+
this.appConfig = new ApplicationConfig()
|
|
117
|
+
return this.appConfig.loadFromFile(fileName)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* activate the profile with the givven ID
|
|
122
|
+
*/
|
|
123
|
+
async activateProfile (id) {
|
|
124
|
+
// todo Profile-change implementation
|
|
125
|
+
id = Number(id)
|
|
126
|
+
var oldProfile = this.currentProfile
|
|
127
|
+
if (this.appConfig.profiles.length > id) {
|
|
128
|
+
this.currentProfile = id
|
|
129
|
+
}else{
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
const profile = this.getCurrentProfile()
|
|
133
|
+
console.info("ACTIVATE PROFILE",id,profile.name)
|
|
134
|
+
const dLeft = this.device.displays.left
|
|
135
|
+
const dRight = this.device.displays.right
|
|
136
|
+
const dCenter = this.device.displays.center
|
|
137
|
+
|
|
138
|
+
this.screens.center = new ButtonField('center', this.device.rows, this.device.columns, dCenter.width, dCenter.height, profile.touch.center,profile)
|
|
139
|
+
this.screens.left = new ButtonField('left', 1, 1, dLeft.width, dLeft.height, profile.touch.left,profile)
|
|
140
|
+
this.screens.right = new ButtonField('right', 1, 1, dRight.width, dRight.height, profile.touch.right,profile)
|
|
141
|
+
// knobs are only available in the CT-version:
|
|
142
|
+
if (this.device.knobs) {
|
|
143
|
+
this.knobs = new ButtonField('knob', 1, 1, 0, 0, profile.knobs,profile)
|
|
144
|
+
}
|
|
145
|
+
if (this.device.buttons) {
|
|
146
|
+
this.buttons = new ButtonField('buttons', 1, 1, 0, 0, profile.buttons,profile)
|
|
147
|
+
}
|
|
148
|
+
await this.screens.center.load()
|
|
149
|
+
await this.screens.right.load()
|
|
150
|
+
await this.screens.left.load()
|
|
151
|
+
await this.buttons.load()
|
|
152
|
+
await this.knobs.load()
|
|
153
|
+
|
|
154
|
+
await this.screens.center.draw(this.device)
|
|
155
|
+
|
|
156
|
+
//this.buttons.setState(this.currentProfile+1,1)
|
|
157
|
+
//this.buttons.setState(oldProfile+1,1)
|
|
158
|
+
|
|
159
|
+
await this.buttons.draw(this.device)
|
|
160
|
+
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* get the dictionary iwth the current profile settings
|
|
165
|
+
*/
|
|
166
|
+
getCurrentProfile () {
|
|
167
|
+
return this.appConfig.profiles[this.currentProfile]
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Triggered, when LoupeDeck Device is connected
|
|
172
|
+
* - Initialize the profile from config-file and
|
|
173
|
+
* - start the interface handlers accordingly
|
|
174
|
+
*/
|
|
175
|
+
async onConnected (address) {
|
|
176
|
+
console.info(`✅ Connected to ${this.device.type}, ${address}`)
|
|
177
|
+
|
|
178
|
+
await this.activateProfile(0)
|
|
179
|
+
|
|
180
|
+
var profile = this.getCurrentProfile()
|
|
181
|
+
await InitializeInterfaces(profile,this.buttons.setState)
|
|
182
|
+
|
|
183
|
+
const self = this
|
|
184
|
+
|
|
185
|
+
// Register callback on monitored item change:
|
|
186
|
+
opcuainterface.on("monitored item changed",(buttonID,nodeid,val) => { self.buttonStateChanged(buttonID,nodeid,val) })
|
|
187
|
+
profileEmitter.on("profileChanged",(profileID) => { self.activateProfile(profileID) })
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
this.device.setBrightness(1)
|
|
191
|
+
this.device.vibrate(HAPTIC.ASCEND_MED)
|
|
192
|
+
|
|
193
|
+
// Fore update of all screens
|
|
194
|
+
console.info('✅ Force Screen update')
|
|
195
|
+
this.screenUpdate["center"] = true
|
|
196
|
+
this.screenUpdate["left"] = true
|
|
197
|
+
this.screenUpdate["right"] = true
|
|
198
|
+
await this.updateScreens()
|
|
199
|
+
|
|
200
|
+
console.info('✅ Done initializing')
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Fore an update of all screens
|
|
205
|
+
*/
|
|
206
|
+
async updateScreens () {
|
|
207
|
+
const keys = Object.keys(this.screenUpdate)
|
|
208
|
+
for (let i = 0; i < keys.length; i++) {
|
|
209
|
+
const screen = keys[i]
|
|
210
|
+
await this.screens[screen].draw(this.device)
|
|
211
|
+
}
|
|
212
|
+
this.screenUpdate = {}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Button Down Handler - triggered through Event Button Down - connected to LoupeDeck Event
|
|
217
|
+
*/
|
|
218
|
+
async onButtonDown (event) {
|
|
219
|
+
let ok = false
|
|
220
|
+
const id = event.id
|
|
221
|
+
if (Number.isInteger(id)){
|
|
222
|
+
ok = await this.buttons.pressed(id)
|
|
223
|
+
await this.buttons.draw(this.device)
|
|
224
|
+
}else{
|
|
225
|
+
ok = await this.knobs.pressed(id)
|
|
226
|
+
}
|
|
227
|
+
return ok
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Button Up Handler - triggered through Event Button Up - connected to LoupeDeck Event
|
|
232
|
+
*/
|
|
233
|
+
async onButtonUp (event) {
|
|
234
|
+
let ok = false
|
|
235
|
+
const id = event.id
|
|
236
|
+
if (Number.isInteger(id) && this.buttons){
|
|
237
|
+
ok = await this.buttons.released(id)
|
|
238
|
+
await this.buttons.draw(this.device)
|
|
239
|
+
}else{
|
|
240
|
+
if(this.knobs)
|
|
241
|
+
ok = await this.knobs.released(id)
|
|
242
|
+
}
|
|
243
|
+
return ok
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Button Rotate Handler - triggered through Event Rotate available with knob-Buttons - connected to LoupeDeck Event
|
|
248
|
+
*/
|
|
249
|
+
async onRotate (event) {
|
|
250
|
+
const id = event.id
|
|
251
|
+
const delta = event.delta
|
|
252
|
+
if (this.knobs)
|
|
253
|
+
return await this.knobs.rotated(id, delta)
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* TouchStart Handler - triggered through Event touch available on all touchbuttons on the loupedeck display - connected to LoupeDeck Event
|
|
258
|
+
*/
|
|
259
|
+
async onTouchStart (event) {
|
|
260
|
+
let ok = false
|
|
261
|
+
const changedTouches = event.changedTouches
|
|
262
|
+
for (let i = 0; i < changedTouches.length; i++) {
|
|
263
|
+
const screen = changedTouches[i].target.screen
|
|
264
|
+
let id = changedTouches[i].target.key
|
|
265
|
+
this.screenUpdate[screen] = true
|
|
266
|
+
if (id === undefined) {
|
|
267
|
+
id = 0
|
|
268
|
+
}
|
|
269
|
+
if (this.screens[screen])
|
|
270
|
+
ok = await this.screens[screen].pressed(id)
|
|
271
|
+
}
|
|
272
|
+
await this.updateScreens()
|
|
273
|
+
return ok
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* TouchMove Handler - triggered through Event touch available on all touchbuttons on the loupedeck display - connected to LoupeDeck Event
|
|
278
|
+
*/
|
|
279
|
+
async onTouchMove (event) {
|
|
280
|
+
let ok = false
|
|
281
|
+
const changedTouches = event.changedTouches
|
|
282
|
+
for (let i = 0; i < changedTouches.length; i++) {
|
|
283
|
+
const x = changedTouches[i].x
|
|
284
|
+
const y = changedTouches[i].y
|
|
285
|
+
const screen = changedTouches[i].target.screen
|
|
286
|
+
let id = changedTouches[i].target.key
|
|
287
|
+
if (id === undefined) {
|
|
288
|
+
id = 0 // for left/right
|
|
289
|
+
}
|
|
290
|
+
if (this.screens[screen])
|
|
291
|
+
ok = await this.screens[screen].touchmove(id, x, y)
|
|
292
|
+
}
|
|
293
|
+
return ok
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* TouchEnd Handler - triggered through Event touch available on all touchbuttons on the loupedeck display - connected to LoupeDeck Event
|
|
298
|
+
*/
|
|
299
|
+
async onTouchEnd (event) {
|
|
300
|
+
let ok = false
|
|
301
|
+
const changedTouches = event.changedTouches
|
|
302
|
+
for (let i = 0; i < changedTouches.length; i++) {
|
|
303
|
+
const elem = changedTouches[i].target
|
|
304
|
+
let id = changedTouches[i].target.key
|
|
305
|
+
if (id === undefined) {
|
|
306
|
+
id = 0
|
|
307
|
+
}
|
|
308
|
+
this.screenUpdate[elem.screen] = true
|
|
309
|
+
|
|
310
|
+
if (this.screens[elem.screen])
|
|
311
|
+
ok = await this.screens[elem.screen].released(id)
|
|
312
|
+
}
|
|
313
|
+
await this.updateScreens()
|
|
314
|
+
return ok
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Handler for StateChanged through OPC/UA Interface - only connected with touch-buttons on center field (yet)
|
|
319
|
+
*/
|
|
320
|
+
async buttonStateChanged(buttonID,nodeid,val) {
|
|
321
|
+
let ok = false
|
|
322
|
+
this.screenUpdate["center"] = true
|
|
323
|
+
this.screenUpdate["left"] = true
|
|
324
|
+
this.screenUpdate["right"] = true
|
|
325
|
+
|
|
326
|
+
ok = await this.screens.center.changed(buttonID,nodeid,val)
|
|
327
|
+
|
|
328
|
+
await this.updateScreens()
|
|
329
|
+
return ok
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
}
|