@zaber/motion 4.7.1 → 4.8.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.
- package/dist/binding/wasm/zaber-motion-lib.wasm +0 -0
- package/dist/lib/ascii/device.d.ts +7 -0
- package/dist/lib/ascii/device.js +9 -0
- package/dist/lib/ascii/device.js.map +1 -1
- package/dist/lib/ascii/index.d.ts +7 -0
- package/dist/lib/ascii/index.js +15 -1
- package/dist/lib/ascii/index.js.map +1 -1
- package/dist/lib/ascii/trigger.d.ts +134 -0
- package/dist/lib/ascii/trigger.js +302 -0
- package/dist/lib/ascii/trigger.js.map +1 -0
- package/dist/lib/ascii/trigger_action.d.ts +8 -0
- package/dist/lib/ascii/trigger_action.js +15 -0
- package/dist/lib/ascii/trigger_action.js.map +1 -0
- package/dist/lib/ascii/trigger_condition.d.ts +11 -0
- package/dist/lib/ascii/trigger_condition.js +18 -0
- package/dist/lib/ascii/trigger_condition.js.map +1 -0
- package/dist/lib/ascii/trigger_enabled_state.d.ts +19 -0
- package/dist/lib/ascii/trigger_enabled_state.js +18 -0
- package/dist/lib/ascii/trigger_enabled_state.js.map +1 -0
- package/dist/lib/ascii/trigger_operation.d.ts +8 -0
- package/dist/lib/ascii/trigger_operation.js +15 -0
- package/dist/lib/ascii/trigger_operation.js.map +1 -0
- package/dist/lib/ascii/trigger_state.d.ts +28 -0
- package/dist/lib/ascii/trigger_state.js +21 -0
- package/dist/lib/ascii/trigger_state.js.map +1 -0
- package/dist/lib/ascii/triggers.d.ts +43 -0
- package/dist/lib/ascii/triggers.js +107 -0
- package/dist/lib/ascii/triggers.js.map +1 -0
- package/dist/lib/ascii_ns.d.ts +14 -0
- package/dist/lib/ascii_ns.js +7 -0
- package/dist/lib/ascii_ns.js.map +1 -1
- package/dist/lib/protobufs/main_pb.d.ts +542 -0
- package/dist/lib/protobufs/main_pb.js +4136 -0
- package/dist/lib/protobufs/main_pb.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
|
|
3
|
+
// ============= DO NOT EDIT DIRECTLY ============= //
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
21
|
+
if (mod && mod.__esModule) return mod;
|
|
22
|
+
var result = {};
|
|
23
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
24
|
+
__setModuleDefault(result, mod);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.Trigger = void 0;
|
|
29
|
+
const gateway = __importStar(require("../gateway"));
|
|
30
|
+
const units_1 = require("../units");
|
|
31
|
+
const trigger_state_1 = require("./trigger_state");
|
|
32
|
+
const trigger_enabled_state_1 = require("./trigger_enabled_state");
|
|
33
|
+
const trigger_action_1 = require("./trigger_action");
|
|
34
|
+
/**
|
|
35
|
+
* A handle for a trigger with this number on the device.
|
|
36
|
+
* Triggers allow setting up actions that occur when a certain condition has been met or an event has occurred.
|
|
37
|
+
* Please note that the Triggers API is currently an experimental feature.
|
|
38
|
+
* Requires at least Firmware 7.06.
|
|
39
|
+
*/
|
|
40
|
+
class Trigger {
|
|
41
|
+
/**
|
|
42
|
+
* Device that this trigger belongs to.
|
|
43
|
+
*/
|
|
44
|
+
get device() {
|
|
45
|
+
return this._device;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Number of this trigger.
|
|
49
|
+
*/
|
|
50
|
+
get triggerNumber() {
|
|
51
|
+
return this._triggerNumber;
|
|
52
|
+
}
|
|
53
|
+
constructor(device, triggerNumber) {
|
|
54
|
+
this._device = device;
|
|
55
|
+
this._triggerNumber = triggerNumber;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Enables the trigger.
|
|
59
|
+
* Once a trigger is enabled, it will fire whenever its condition transitions from false to true.
|
|
60
|
+
* If a trigger condition is true when a disabled trigger is enabled, the trigger will fire immediately.
|
|
61
|
+
* @param [count=0] Number of times the trigger will fire before disabling itself.
|
|
62
|
+
* If count is not specified, or 0, the trigger will fire indefinitely.
|
|
63
|
+
*/
|
|
64
|
+
async enable(count = 0) {
|
|
65
|
+
if (count < 0) {
|
|
66
|
+
throw new TypeError('Invalid value; count must be 0 or positive.');
|
|
67
|
+
}
|
|
68
|
+
const request = new gateway.TriggerEnableRequest();
|
|
69
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
70
|
+
request.setDevice(this.device.deviceAddress);
|
|
71
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
72
|
+
request.setCount(count);
|
|
73
|
+
await gateway.callAsync('trigger/enable', request);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Disables the trigger.
|
|
77
|
+
* Once disabled, the trigger will not fire and trigger actions will not run, even if trigger conditions are met.
|
|
78
|
+
*/
|
|
79
|
+
async disable() {
|
|
80
|
+
const request = new gateway.TriggerEmptyRequest();
|
|
81
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
82
|
+
request.setDevice(this.device.deviceAddress);
|
|
83
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
84
|
+
await gateway.callAsync('trigger/disable', request);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Gets the state of the trigger.
|
|
88
|
+
* @returns Complete state of the trigger.
|
|
89
|
+
*/
|
|
90
|
+
async getState() {
|
|
91
|
+
const request = new gateway.TriggerEmptyRequest();
|
|
92
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
93
|
+
request.setDevice(this.device.deviceAddress);
|
|
94
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
95
|
+
const response = await gateway.callAsync('trigger/get_state', request, gateway.TriggerState);
|
|
96
|
+
return trigger_state_1.TriggerState.fromProtobuf(response.toObject());
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Gets the enabled state of the trigger.
|
|
100
|
+
* @returns Whether the trigger is enabled and the number of times it will fire.
|
|
101
|
+
*/
|
|
102
|
+
async getEnabledState() {
|
|
103
|
+
const request = new gateway.TriggerEmptyRequest();
|
|
104
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
105
|
+
request.setDevice(this.device.deviceAddress);
|
|
106
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
107
|
+
const response = await gateway.callAsync('trigger/get_enabled_state', request, gateway.TriggerEnabledState);
|
|
108
|
+
return trigger_enabled_state_1.TriggerEnabledState.fromProtobuf(response.toObject());
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Set a generic trigger condition.
|
|
112
|
+
* @param condition The condition to set for this trigger.
|
|
113
|
+
*/
|
|
114
|
+
async fireWhen(condition) {
|
|
115
|
+
const request = new gateway.TriggerFireWhenRequest();
|
|
116
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
117
|
+
request.setDevice(this.device.deviceAddress);
|
|
118
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
119
|
+
request.setCondition(condition);
|
|
120
|
+
await gateway.callAsync('trigger/fire_when', request);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Set a trigger condition for when an encoder position has changed by a specific distance.
|
|
124
|
+
* @param axis The axis to monitor for this condition.
|
|
125
|
+
* May be set to 0 on single-axis devices only.
|
|
126
|
+
* @param dist The measured distance between trigger fires.
|
|
127
|
+
* @param [unit=Units.NATIVE] Units of dist.
|
|
128
|
+
*/
|
|
129
|
+
async fireWhenEncoderDist(axis, dist, unit = units_1.Units.NATIVE) {
|
|
130
|
+
if (dist <= 0) {
|
|
131
|
+
throw new TypeError('Invalid value; dist must be a positive value.');
|
|
132
|
+
}
|
|
133
|
+
const request = new gateway.TriggerFireWhenDistRequest();
|
|
134
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
135
|
+
request.setDevice(this.device.deviceAddress);
|
|
136
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
137
|
+
request.setAxis(axis);
|
|
138
|
+
request.setDist(dist);
|
|
139
|
+
request.setUnit(unit);
|
|
140
|
+
await gateway.callAsync('trigger/fire_when_encoder_dist', request);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Set a trigger condition for when an axis position has changed by a specific distance.
|
|
144
|
+
* @param axis The axis to monitor for this condition.
|
|
145
|
+
* May be set to 0 on single-axis devices only.
|
|
146
|
+
* @param dist The measured distance between trigger fires.
|
|
147
|
+
* @param [unit=Units.NATIVE] Units of dist.
|
|
148
|
+
*/
|
|
149
|
+
async fireWhenDist(axis, dist, unit = units_1.Units.NATIVE) {
|
|
150
|
+
if (dist <= 0) {
|
|
151
|
+
throw new TypeError('Invalid value; dist must be a positive value.');
|
|
152
|
+
}
|
|
153
|
+
const request = new gateway.TriggerFireWhenDistRequest();
|
|
154
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
155
|
+
request.setDevice(this.device.deviceAddress);
|
|
156
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
157
|
+
request.setAxis(axis);
|
|
158
|
+
request.setDist(dist);
|
|
159
|
+
request.setUnit(unit);
|
|
160
|
+
await gateway.callAsync('trigger/fire_when_dist', request);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Set a trigger condition based on an IO channel value.
|
|
164
|
+
* @param portType The type of IO channel to monitor.
|
|
165
|
+
* @param channel The IO channel to monitor.
|
|
166
|
+
* @param triggerCondition Comparison operator.
|
|
167
|
+
* @param value Comparison value.
|
|
168
|
+
*/
|
|
169
|
+
async fireWhenIo(portType, channel, triggerCondition, value) {
|
|
170
|
+
if (channel <= 0) {
|
|
171
|
+
throw new TypeError('Invalid value; channel must be a positive value.');
|
|
172
|
+
}
|
|
173
|
+
const request = new gateway.TriggerFireWhenIoRequest();
|
|
174
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
175
|
+
request.setDevice(this.device.deviceAddress);
|
|
176
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
177
|
+
request.setPortType(portType);
|
|
178
|
+
request.setChannel(channel);
|
|
179
|
+
request.setTriggerCondition(triggerCondition);
|
|
180
|
+
request.setValue(value);
|
|
181
|
+
await gateway.callAsync('trigger/fire_when_io', request);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Set a trigger condition based on a setting value.
|
|
185
|
+
* @param axis The axis to monitor for this condition.
|
|
186
|
+
* Set to 0 for device-scope settings.
|
|
187
|
+
* @param setting The setting to monitor.
|
|
188
|
+
* @param triggerCondition Comparison operator.
|
|
189
|
+
* @param value Comparison value.
|
|
190
|
+
* @param [unit=Units.NATIVE] Units of value.
|
|
191
|
+
*/
|
|
192
|
+
async fireWhenSetting(axis, setting, triggerCondition, value, unit = units_1.Units.NATIVE) {
|
|
193
|
+
const request = new gateway.TriggerFireWhenSettingRequest();
|
|
194
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
195
|
+
request.setDevice(this.device.deviceAddress);
|
|
196
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
197
|
+
request.setAxis(axis);
|
|
198
|
+
request.setSetting(setting);
|
|
199
|
+
request.setTriggerCondition(triggerCondition);
|
|
200
|
+
request.setValue(value);
|
|
201
|
+
request.setUnit(unit);
|
|
202
|
+
await gateway.callAsync('trigger/fire_when_setting', request);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Set a trigger condition based on a time interval.
|
|
206
|
+
* @param interval The time interval between trigger fires.
|
|
207
|
+
* @param [unit=Units.NATIVE] Units of time.
|
|
208
|
+
*/
|
|
209
|
+
async fireAtInterval(interval, unit = units_1.Units.NATIVE) {
|
|
210
|
+
if (interval <= 0) {
|
|
211
|
+
throw new TypeError('Invalid value; interval must be a positive value.');
|
|
212
|
+
}
|
|
213
|
+
const request = new gateway.TriggerFireAtIntervalRequest();
|
|
214
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
215
|
+
request.setDevice(this.device.deviceAddress);
|
|
216
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
217
|
+
request.setInterval(interval);
|
|
218
|
+
request.setUnit(unit);
|
|
219
|
+
await gateway.callAsync('trigger/fire_at_interval', request);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Set a command to be a trigger action.
|
|
223
|
+
* @param action The action number to assign the command to.
|
|
224
|
+
* @param axis The axis to on which to run this command.
|
|
225
|
+
* Set to 0 for device-scope settings or to run command on all axes.
|
|
226
|
+
* @param command The command to run when the action is triggered.
|
|
227
|
+
*/
|
|
228
|
+
async onFire(action, axis, command) {
|
|
229
|
+
const request = new gateway.TriggerOnFireRequest();
|
|
230
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
231
|
+
request.setDevice(this.device.deviceAddress);
|
|
232
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
233
|
+
request.setAction(action);
|
|
234
|
+
request.setAxis(axis);
|
|
235
|
+
request.setCommand(command);
|
|
236
|
+
await gateway.callAsync('trigger/on_fire', request);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Set a trigger action to update a setting.
|
|
240
|
+
* @param action The action number to assign the command to.
|
|
241
|
+
* @param axis The axis on which to change the setting.
|
|
242
|
+
* Set to 0 to change the setting for the device.
|
|
243
|
+
* @param setting The name of the setting to change.
|
|
244
|
+
* @param operation The operation to apply to the setting.
|
|
245
|
+
* @param value Operation value.
|
|
246
|
+
* @param [unit=Units.NATIVE] Units of value.
|
|
247
|
+
*/
|
|
248
|
+
async onFireSet(action, axis, setting, operation, value, unit = units_1.Units.NATIVE) {
|
|
249
|
+
const request = new gateway.TriggerOnFireSetRequest();
|
|
250
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
251
|
+
request.setDevice(this.device.deviceAddress);
|
|
252
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
253
|
+
request.setAction(action);
|
|
254
|
+
request.setAxis(axis);
|
|
255
|
+
request.setSetting(setting);
|
|
256
|
+
request.setOperation(operation);
|
|
257
|
+
request.setValue(value);
|
|
258
|
+
request.setUnit(unit);
|
|
259
|
+
await gateway.callAsync('trigger/on_fire_set', request);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Set a trigger action to update a setting with the value of another setting.
|
|
263
|
+
* @param action The action number to assign the command to.
|
|
264
|
+
* @param axis The axis on which to change the setting.
|
|
265
|
+
* Set to 0 to change the setting for the device.
|
|
266
|
+
* @param setting The name of the setting to change.
|
|
267
|
+
* Must have either integer or boolean type.
|
|
268
|
+
* @param operation The operation to apply to the setting.
|
|
269
|
+
* @param fromAxis The axis from which to read the setting.
|
|
270
|
+
* Set to 0 to read the setting for the device.
|
|
271
|
+
* @param fromSetting The name of the setting to read.
|
|
272
|
+
* Must have either integer or boolean type.
|
|
273
|
+
*/
|
|
274
|
+
async onFireSetToSetting(action, axis, setting, operation, fromAxis, fromSetting) {
|
|
275
|
+
const request = new gateway.TriggerOnFireSetToSettingRequest();
|
|
276
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
277
|
+
request.setDevice(this.device.deviceAddress);
|
|
278
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
279
|
+
request.setAction(action);
|
|
280
|
+
request.setAxis(axis);
|
|
281
|
+
request.setSetting(setting);
|
|
282
|
+
request.setOperation(operation);
|
|
283
|
+
request.setFromAxis(fromAxis);
|
|
284
|
+
request.setFromSetting(fromSetting);
|
|
285
|
+
await gateway.callAsync('trigger/on_fire_set_to_setting', request);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Clear a trigger action.
|
|
289
|
+
* @param [action=TriggerAction.ALL] The action number to clear.
|
|
290
|
+
* The default option is to clear all actions.
|
|
291
|
+
*/
|
|
292
|
+
async clearAction(action = trigger_action_1.TriggerAction.ALL) {
|
|
293
|
+
const request = new gateway.TriggerClearActionRequest();
|
|
294
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
295
|
+
request.setDevice(this.device.deviceAddress);
|
|
296
|
+
request.setTriggerNumber(this.triggerNumber);
|
|
297
|
+
request.setAction(action);
|
|
298
|
+
await gateway.callAsync('trigger/clear_action', request);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
exports.Trigger = Trigger;
|
|
302
|
+
//# sourceMappingURL=trigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger.js","sourceRoot":"","sources":["../../../src/ascii/trigger.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,oDAAsC;AACtC,oCAA8D;AAE9D,mDAA+C;AAC/C,mEAA8D;AAG9D,qDAAiD;AAGjD;;;;;GAKG;AACH,MAAa,OAAO;IAClB;;OAEG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAGD;;OAEG;IACH,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAGD,YAAY,MAAc,EAAE,aAAqB;QAC/C,IAAI,CAAC,OAAO,GAAG,MAA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,SAAS,CAAC,MAAa,CAAC,CAAC;QAEjC,MAAM,OAAO,CAAC,SAAS,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF;AAxVD,0BAwVC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\nimport { Native, Units, Length, Angle, Time } from '../units';\nimport { Device } from './device';\nimport { TriggerState } from './trigger_state';\nimport { TriggerEnabledState } from './trigger_enabled_state';\nimport { IoPortType } from './io_port_type';\nimport { TriggerCondition } from './trigger_condition';\nimport { TriggerAction } from './trigger_action';\nimport { TriggerOperation } from './trigger_operation';\n\n/**\n * A handle for a trigger with this number on the device.\n * Triggers allow setting up actions that occur when a certain condition has been met or an event has occurred.\n * Please note that the Triggers API is currently an experimental feature.\n * Requires at least Firmware 7.06.\n */\nexport class Trigger {\n /**\n * Device that this trigger belongs to.\n */\n public get device(): Device {\n return this._device;\n }\n private _device: Device;\n\n /**\n * Number of this trigger.\n */\n public get triggerNumber(): number {\n return this._triggerNumber;\n }\n private _triggerNumber: number;\n\n constructor(device: Device, triggerNumber: number) {\n this._device = device;\n this._triggerNumber = triggerNumber;\n }\n\n /**\n * Enables the trigger.\n * Once a trigger is enabled, it will fire whenever its condition transitions from false to true.\n * If a trigger condition is true when a disabled trigger is enabled, the trigger will fire immediately.\n * @param [count=0] Number of times the trigger will fire before disabling itself.\n * If count is not specified, or 0, the trigger will fire indefinitely.\n */\n public async enable(\n count: number = 0\n ): Promise<void> {\n if (count < 0) {\n throw new TypeError('Invalid value; count must be 0 or positive.');\n }\n const request = new gateway.TriggerEnableRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n request.setCount(count);\n\n await gateway.callAsync('trigger/enable', request);\n }\n\n /**\n * Disables the trigger.\n * Once disabled, the trigger will not fire and trigger actions will not run, even if trigger conditions are met.\n */\n public async disable(): Promise<void> {\n const request = new gateway.TriggerEmptyRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n\n await gateway.callAsync('trigger/disable', request);\n }\n\n /**\n * Gets the state of the trigger.\n * @returns Complete state of the trigger.\n */\n public async getState(): Promise<TriggerState> {\n const request = new gateway.TriggerEmptyRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n\n const response = await gateway.callAsync<gateway.TriggerState>(\n 'trigger/get_state',\n request,\n gateway.TriggerState);\n return TriggerState.fromProtobuf(response.toObject());\n }\n\n /**\n * Gets the enabled state of the trigger.\n * @returns Whether the trigger is enabled and the number of times it will fire.\n */\n public async getEnabledState(): Promise<TriggerEnabledState> {\n const request = new gateway.TriggerEmptyRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n\n const response = await gateway.callAsync<gateway.TriggerEnabledState>(\n 'trigger/get_enabled_state',\n request,\n gateway.TriggerEnabledState);\n return TriggerEnabledState.fromProtobuf(response.toObject());\n }\n\n /**\n * Set a generic trigger condition.\n * @param condition The condition to set for this trigger.\n */\n public async fireWhen(\n condition: string\n ): Promise<void> {\n const request = new gateway.TriggerFireWhenRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n request.setCondition(condition);\n\n await gateway.callAsync('trigger/fire_when', request);\n }\n\n /**\n * Set a trigger condition for when an encoder position has changed by a specific distance.\n * @param axis The axis to monitor for this condition.\n * May be set to 0 on single-axis devices only.\n * @param dist The measured distance between trigger fires.\n * @param [unit=Units.NATIVE] Units of dist.\n */\n public async fireWhenEncoderDist(\n axis: number,\n dist: number,\n unit: Length | Angle | Native = Units.NATIVE\n ): Promise<void> {\n if (dist <= 0) {\n throw new TypeError('Invalid value; dist must be a positive value.');\n }\n const request = new gateway.TriggerFireWhenDistRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n request.setAxis(axis);\n request.setDist(dist);\n request.setUnit(unit);\n\n await gateway.callAsync('trigger/fire_when_encoder_dist', request);\n }\n\n /**\n * Set a trigger condition for when an axis position has changed by a specific distance.\n * @param axis The axis to monitor for this condition.\n * May be set to 0 on single-axis devices only.\n * @param dist The measured distance between trigger fires.\n * @param [unit=Units.NATIVE] Units of dist.\n */\n public async fireWhenDist(\n axis: number,\n dist: number,\n unit: Length | Angle | Native = Units.NATIVE\n ): Promise<void> {\n if (dist <= 0) {\n throw new TypeError('Invalid value; dist must be a positive value.');\n }\n const request = new gateway.TriggerFireWhenDistRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n request.setAxis(axis);\n request.setDist(dist);\n request.setUnit(unit);\n\n await gateway.callAsync('trigger/fire_when_dist', request);\n }\n\n /**\n * Set a trigger condition based on an IO channel value.\n * @param portType The type of IO channel to monitor.\n * @param channel The IO channel to monitor.\n * @param triggerCondition Comparison operator.\n * @param value Comparison value.\n */\n public async fireWhenIo(\n portType: IoPortType,\n channel: number,\n triggerCondition: TriggerCondition,\n value: number\n ): Promise<void> {\n if (channel <= 0) {\n throw new TypeError('Invalid value; channel must be a positive value.');\n }\n const request = new gateway.TriggerFireWhenIoRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n request.setPortType(portType as any);\n request.setChannel(channel);\n request.setTriggerCondition(triggerCondition as any);\n request.setValue(value);\n\n await gateway.callAsync('trigger/fire_when_io', request);\n }\n\n /**\n * Set a trigger condition based on a setting value.\n * @param axis The axis to monitor for this condition.\n * Set to 0 for device-scope settings.\n * @param setting The setting to monitor.\n * @param triggerCondition Comparison operator.\n * @param value Comparison value.\n * @param [unit=Units.NATIVE] Units of value.\n */\n public async fireWhenSetting(\n axis: number,\n setting: string,\n triggerCondition: TriggerCondition,\n value: number,\n unit: Units = Units.NATIVE\n ): Promise<void> {\n const request = new gateway.TriggerFireWhenSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n request.setAxis(axis);\n request.setSetting(setting);\n request.setTriggerCondition(triggerCondition as any);\n request.setValue(value);\n request.setUnit(unit);\n\n await gateway.callAsync('trigger/fire_when_setting', request);\n }\n\n /**\n * Set a trigger condition based on a time interval.\n * @param interval The time interval between trigger fires.\n * @param [unit=Units.NATIVE] Units of time.\n */\n public async fireAtInterval(\n interval: number,\n unit: Time | Native = Units.NATIVE\n ): Promise<void> {\n if (interval <= 0) {\n throw new TypeError('Invalid value; interval must be a positive value.');\n }\n const request = new gateway.TriggerFireAtIntervalRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n request.setInterval(interval);\n request.setUnit(unit);\n\n await gateway.callAsync('trigger/fire_at_interval', request);\n }\n\n /**\n * Set a command to be a trigger action.\n * @param action The action number to assign the command to.\n * @param axis The axis to on which to run this command.\n * Set to 0 for device-scope settings or to run command on all axes.\n * @param command The command to run when the action is triggered.\n */\n public async onFire(\n action: TriggerAction,\n axis: number,\n command: string\n ): Promise<void> {\n const request = new gateway.TriggerOnFireRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n request.setAction(action as any);\n request.setAxis(axis);\n request.setCommand(command);\n\n await gateway.callAsync('trigger/on_fire', request);\n }\n\n /**\n * Set a trigger action to update a setting.\n * @param action The action number to assign the command to.\n * @param axis The axis on which to change the setting.\n * Set to 0 to change the setting for the device.\n * @param setting The name of the setting to change.\n * @param operation The operation to apply to the setting.\n * @param value Operation value.\n * @param [unit=Units.NATIVE] Units of value.\n */\n public async onFireSet(\n action: TriggerAction,\n axis: number,\n setting: string,\n operation: TriggerOperation,\n value: number,\n unit: Units = Units.NATIVE\n ): Promise<void> {\n const request = new gateway.TriggerOnFireSetRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n request.setAction(action as any);\n request.setAxis(axis);\n request.setSetting(setting);\n request.setOperation(operation as any);\n request.setValue(value);\n request.setUnit(unit);\n\n await gateway.callAsync('trigger/on_fire_set', request);\n }\n\n /**\n * Set a trigger action to update a setting with the value of another setting.\n * @param action The action number to assign the command to.\n * @param axis The axis on which to change the setting.\n * Set to 0 to change the setting for the device.\n * @param setting The name of the setting to change.\n * Must have either integer or boolean type.\n * @param operation The operation to apply to the setting.\n * @param fromAxis The axis from which to read the setting.\n * Set to 0 to read the setting for the device.\n * @param fromSetting The name of the setting to read.\n * Must have either integer or boolean type.\n */\n public async onFireSetToSetting(\n action: TriggerAction,\n axis: number,\n setting: string,\n operation: TriggerOperation,\n fromAxis: number,\n fromSetting: string\n ): Promise<void> {\n const request = new gateway.TriggerOnFireSetToSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n request.setAction(action as any);\n request.setAxis(axis);\n request.setSetting(setting);\n request.setOperation(operation as any);\n request.setFromAxis(fromAxis);\n request.setFromSetting(fromSetting);\n\n await gateway.callAsync('trigger/on_fire_set_to_setting', request);\n }\n\n /**\n * Clear a trigger action.\n * @param [action=TriggerAction.ALL] The action number to clear.\n * The default option is to clear all actions.\n */\n public async clearAction(\n action: TriggerAction = TriggerAction.ALL\n ): Promise<void> {\n const request = new gateway.TriggerClearActionRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setTriggerNumber(this.triggerNumber);\n request.setAction(action as any);\n\n await gateway.callAsync('trigger/clear_action', request);\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
|
|
3
|
+
// ============= DO NOT EDIT DIRECTLY ============= //
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.TriggerAction = void 0;
|
|
6
|
+
/**
|
|
7
|
+
* Trigger action identifier.
|
|
8
|
+
*/
|
|
9
|
+
var TriggerAction;
|
|
10
|
+
(function (TriggerAction) {
|
|
11
|
+
TriggerAction[TriggerAction["ALL"] = 0] = "ALL";
|
|
12
|
+
TriggerAction[TriggerAction["A"] = 1] = "A";
|
|
13
|
+
TriggerAction[TriggerAction["B"] = 2] = "B";
|
|
14
|
+
})(TriggerAction = exports.TriggerAction || (exports.TriggerAction = {}));
|
|
15
|
+
//# sourceMappingURL=trigger_action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger_action.js","sourceRoot":"","sources":["../../../src/ascii/trigger_action.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;AAEtD;;GAEG;AACH,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,+CAAO,CAAA;IACP,2CAAK,CAAA;IACL,2CAAK,CAAA;AACP,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\n/**\n * Trigger action identifier.\n */\nexport enum TriggerAction {\n ALL = 0,\n A = 1,\n B = 2,\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
|
|
3
|
+
// ============= DO NOT EDIT DIRECTLY ============= //
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.TriggerCondition = void 0;
|
|
6
|
+
/**
|
|
7
|
+
* Comparison operator for trigger condition.
|
|
8
|
+
*/
|
|
9
|
+
var TriggerCondition;
|
|
10
|
+
(function (TriggerCondition) {
|
|
11
|
+
TriggerCondition[TriggerCondition["EQ"] = 0] = "EQ";
|
|
12
|
+
TriggerCondition[TriggerCondition["NE"] = 1] = "NE";
|
|
13
|
+
TriggerCondition[TriggerCondition["GT"] = 2] = "GT";
|
|
14
|
+
TriggerCondition[TriggerCondition["GE"] = 3] = "GE";
|
|
15
|
+
TriggerCondition[TriggerCondition["LT"] = 4] = "LT";
|
|
16
|
+
TriggerCondition[TriggerCondition["LE"] = 5] = "LE";
|
|
17
|
+
})(TriggerCondition = exports.TriggerCondition || (exports.TriggerCondition = {}));
|
|
18
|
+
//# sourceMappingURL=trigger_condition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger_condition.js","sourceRoot":"","sources":["../../../src/ascii/trigger_condition.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;AAEtD;;GAEG;AACH,IAAY,gBAOX;AAPD,WAAY,gBAAgB;IAC1B,mDAAM,CAAA;IACN,mDAAM,CAAA;IACN,mDAAM,CAAA;IACN,mDAAM,CAAA;IACN,mDAAM,CAAA;IACN,mDAAM,CAAA;AACR,CAAC,EAPW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAO3B","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\n/**\n * Comparison operator for trigger condition.\n */\nexport enum TriggerCondition {\n EQ = 0,\n NE = 1,\n GT = 2,\n GE = 3,\n LT = 4,\n LE = 5,\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The enabled state of a single trigger.
|
|
3
|
+
* Returns whether the given trigger is enabled and the number of times it will fire.
|
|
4
|
+
* This is a subset of the complete state, and is faster to query.
|
|
5
|
+
*/
|
|
6
|
+
export interface TriggerEnabledState {
|
|
7
|
+
/**
|
|
8
|
+
* The enabled state for a trigger.
|
|
9
|
+
*/
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The number of remaining fires for this trigger.
|
|
13
|
+
* If this is 0 and the trigger is enabled, there are unlimited remaining fires.
|
|
14
|
+
*/
|
|
15
|
+
firesRemaining: number;
|
|
16
|
+
}
|
|
17
|
+
export declare namespace TriggerEnabledState {
|
|
18
|
+
const __type = "TriggerEnabledState";
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
|
|
3
|
+
// ============= DO NOT EDIT DIRECTLY ============= //
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.TriggerEnabledState = void 0;
|
|
6
|
+
var TriggerEnabledState;
|
|
7
|
+
(function (TriggerEnabledState) {
|
|
8
|
+
TriggerEnabledState.__type = 'TriggerEnabledState';
|
|
9
|
+
/** @internal */
|
|
10
|
+
function fromProtobuf(pbData) {
|
|
11
|
+
return {
|
|
12
|
+
enabled: pbData.enabled,
|
|
13
|
+
firesRemaining: pbData.firesRemaining,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
TriggerEnabledState.fromProtobuf = fromProtobuf;
|
|
17
|
+
})(TriggerEnabledState = exports.TriggerEnabledState || (exports.TriggerEnabledState = {}));
|
|
18
|
+
//# sourceMappingURL=trigger_enabled_state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger_enabled_state.js","sourceRoot":"","sources":["../../../src/ascii/trigger_enabled_state.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;AAuBtD,IAAiB,mBAAmB,CAUnC;AAVD,WAAiB,mBAAmB;IACrB,0BAAM,GAAG,qBAAqB,CAAC;IAE5C,gBAAgB;IAChB,SAAgB,YAAY,CAAC,MAA4C;QACvE,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,cAAc,EAAE,MAAM,CAAC,cAAc;SACtC,CAAC;IACJ,CAAC;IALe,gCAAY,eAK3B,CAAA;AACH,CAAC,EAVgB,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAUnC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\n\n/**\n * The enabled state of a single trigger.\n * Returns whether the given trigger is enabled and the number of times it will fire.\n * This is a subset of the complete state, and is faster to query.\n */\nexport interface TriggerEnabledState {\n /**\n * The enabled state for a trigger.\n */\n enabled: boolean;\n\n /**\n * The number of remaining fires for this trigger.\n * If this is 0 and the trigger is enabled, there are unlimited remaining fires.\n */\n firesRemaining: number;\n\n}\n\nexport namespace TriggerEnabledState {\n export const __type = 'TriggerEnabledState';\n\n /** @internal */\n export function fromProtobuf(pbData: gateway.TriggerEnabledState.AsObject): TriggerEnabledState {\n return {\n enabled: pbData.enabled,\n firesRemaining: pbData.firesRemaining,\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
|
|
3
|
+
// ============= DO NOT EDIT DIRECTLY ============= //
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.TriggerOperation = void 0;
|
|
6
|
+
/**
|
|
7
|
+
* Operation for trigger action.
|
|
8
|
+
*/
|
|
9
|
+
var TriggerOperation;
|
|
10
|
+
(function (TriggerOperation) {
|
|
11
|
+
TriggerOperation[TriggerOperation["SET_TO"] = 0] = "SET_TO";
|
|
12
|
+
TriggerOperation[TriggerOperation["INCREMENT_BY"] = 1] = "INCREMENT_BY";
|
|
13
|
+
TriggerOperation[TriggerOperation["DECREMENT_BY"] = 2] = "DECREMENT_BY";
|
|
14
|
+
})(TriggerOperation = exports.TriggerOperation || (exports.TriggerOperation = {}));
|
|
15
|
+
//# sourceMappingURL=trigger_operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger_operation.js","sourceRoot":"","sources":["../../../src/ascii/trigger_operation.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;AAEtD;;GAEG;AACH,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,2DAAU,CAAA;IACV,uEAAgB,CAAA;IAChB,uEAAgB,CAAA;AAClB,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\n/**\n * Operation for trigger action.\n */\nexport enum TriggerOperation {\n SET_TO = 0,\n INCREMENT_BY = 1,\n DECREMENT_BY = 2,\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The complete state of a trigger.
|
|
3
|
+
*/
|
|
4
|
+
export interface TriggerState {
|
|
5
|
+
/**
|
|
6
|
+
* The firing condition for a trigger.
|
|
7
|
+
*/
|
|
8
|
+
condition: string;
|
|
9
|
+
/**
|
|
10
|
+
* The actions for a trigger.
|
|
11
|
+
*/
|
|
12
|
+
actions: string[];
|
|
13
|
+
/**
|
|
14
|
+
* The enabled state for a trigger.
|
|
15
|
+
*/
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The number of total fires for this trigger.
|
|
19
|
+
*/
|
|
20
|
+
firesTotal: number;
|
|
21
|
+
/**
|
|
22
|
+
* The number of remaining fires for this trigger.
|
|
23
|
+
*/
|
|
24
|
+
firesRemaining: number;
|
|
25
|
+
}
|
|
26
|
+
export declare namespace TriggerState {
|
|
27
|
+
const __type = "TriggerState";
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
|
|
3
|
+
// ============= DO NOT EDIT DIRECTLY ============= //
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.TriggerState = void 0;
|
|
6
|
+
var TriggerState;
|
|
7
|
+
(function (TriggerState) {
|
|
8
|
+
TriggerState.__type = 'TriggerState';
|
|
9
|
+
/** @internal */
|
|
10
|
+
function fromProtobuf(pbData) {
|
|
11
|
+
return {
|
|
12
|
+
condition: pbData.condition,
|
|
13
|
+
actions: pbData.actionsList,
|
|
14
|
+
enabled: pbData.enabled,
|
|
15
|
+
firesTotal: pbData.firesTotal,
|
|
16
|
+
firesRemaining: pbData.firesRemaining,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
TriggerState.fromProtobuf = fromProtobuf;
|
|
20
|
+
})(TriggerState = exports.TriggerState || (exports.TriggerState = {}));
|
|
21
|
+
//# sourceMappingURL=trigger_state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger_state.js","sourceRoot":"","sources":["../../../src/ascii/trigger_state.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;AAmCtD,IAAiB,YAAY,CAa5B;AAbD,WAAiB,YAAY;IACd,mBAAM,GAAG,cAAc,CAAC;IAErC,gBAAgB;IAChB,SAAgB,YAAY,CAAC,MAAqC;QAChE,OAAO;YACL,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,OAAO,EAAE,MAAM,CAAC,WAAW;YAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,cAAc,EAAE,MAAM,CAAC,cAAc;SACtC,CAAC;IACJ,CAAC;IARe,yBAAY,eAQ3B,CAAA;AACH,CAAC,EAbgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAa5B","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\n\n/**\n * The complete state of a trigger.\n */\nexport interface TriggerState {\n /**\n * The firing condition for a trigger.\n */\n condition: string;\n\n /**\n * The actions for a trigger.\n */\n actions: string[];\n\n /**\n * The enabled state for a trigger.\n */\n enabled: boolean;\n\n /**\n * The number of total fires for this trigger.\n */\n firesTotal: number;\n\n /**\n * The number of remaining fires for this trigger.\n */\n firesRemaining: number;\n\n}\n\nexport namespace TriggerState {\n export const __type = 'TriggerState';\n\n /** @internal */\n export function fromProtobuf(pbData: gateway.TriggerState.AsObject): TriggerState {\n return {\n condition: pbData.condition,\n actions: pbData.actionsList,\n enabled: pbData.enabled,\n firesTotal: pbData.firesTotal,\n firesRemaining: pbData.firesRemaining,\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Device } from './device';
|
|
2
|
+
import { Trigger } from './trigger';
|
|
3
|
+
import { TriggerState } from './trigger_state';
|
|
4
|
+
import { TriggerEnabledState } from './trigger_enabled_state';
|
|
5
|
+
/**
|
|
6
|
+
* Class providing access to device triggers.
|
|
7
|
+
* Please note that the Triggers API is currently an experimental feature.
|
|
8
|
+
* Requires at least Firmware 7.06.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Triggers {
|
|
11
|
+
/**
|
|
12
|
+
* Device that these triggers belong to.
|
|
13
|
+
*/
|
|
14
|
+
get device(): Device;
|
|
15
|
+
private _device;
|
|
16
|
+
constructor(device: Device);
|
|
17
|
+
/**
|
|
18
|
+
* Get the number of triggers for this device.
|
|
19
|
+
* @returns Number of triggers for this device.
|
|
20
|
+
*/
|
|
21
|
+
getNumberOfTriggers(): Promise<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Get the number of actions for each trigger for this device.
|
|
24
|
+
* @returns Number of actions for each trigger for this device.
|
|
25
|
+
*/
|
|
26
|
+
getNumberOfActions(): Promise<number>;
|
|
27
|
+
/**
|
|
28
|
+
* Get a specific trigger for this device.
|
|
29
|
+
* @param triggerNumber The number of the trigger to control. Trigger numbers start at 1.
|
|
30
|
+
* @returns Trigger instance.
|
|
31
|
+
*/
|
|
32
|
+
getTrigger(triggerNumber: number): Trigger;
|
|
33
|
+
/**
|
|
34
|
+
* Get the state for every trigger for this device.
|
|
35
|
+
* @returns Complete state for every trigger.
|
|
36
|
+
*/
|
|
37
|
+
getTriggerStates(): Promise<TriggerState[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the enabled state for every trigger for this device.
|
|
40
|
+
* @returns Whether triggers are enabled and the number of times they will fire.
|
|
41
|
+
*/
|
|
42
|
+
getEnabledStates(): Promise<TriggerEnabledState[]>;
|
|
43
|
+
}
|