@zaber/motion 2.9.0 → 2.10.1
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/connection.d.ts +11 -0
- package/dist/lib/ascii/connection.js +11 -0
- package/dist/lib/ascii/connection.js.map +1 -1
- package/dist/lib/ascii/device.d.ts +10 -0
- package/dist/lib/ascii/device.js +14 -0
- package/dist/lib/ascii/device.js.map +1 -1
- package/dist/lib/ascii/device_identity.d.ts +4 -0
- package/dist/lib/ascii/device_identity.js +1 -0
- package/dist/lib/ascii/device_identity.js.map +1 -1
- package/dist/lib/ascii/index.d.ts +3 -0
- package/dist/lib/ascii/index.js +7 -1
- package/dist/lib/ascii/index.js.map +1 -1
- package/dist/lib/ascii/oscilloscope.d.ts +62 -0
- package/dist/lib/ascii/oscilloscope.js +153 -0
- package/dist/lib/ascii/oscilloscope.js.map +1 -0
- package/dist/lib/ascii/oscilloscope_capture_properties.d.ts +16 -0
- package/dist/lib/ascii/oscilloscope_capture_properties.js +18 -0
- package/dist/lib/ascii/oscilloscope_capture_properties.js.map +1 -0
- package/dist/lib/ascii/oscilloscope_data.d.ts +67 -0
- package/dist/lib/ascii/oscilloscope_data.js +151 -0
- package/dist/lib/ascii/oscilloscope_data.js.map +1 -0
- package/dist/lib/ascii/stream.d.ts +17 -0
- package/dist/lib/ascii/stream.js +38 -0
- package/dist/lib/ascii/stream.js.map +1 -1
- package/dist/lib/ascii/stream_axis_definition.js +3 -0
- package/dist/lib/ascii/stream_axis_definition.js.map +1 -1
- package/dist/lib/ascii/transport.d.ts +4 -0
- package/dist/lib/ascii/transport.js +4 -0
- package/dist/lib/ascii/transport.js.map +1 -1
- package/dist/lib/ascii_ns.d.ts +6 -0
- package/dist/lib/ascii_ns.js +3 -0
- package/dist/lib/ascii_ns.js.map +1 -1
- package/dist/lib/exceptions/index.d.ts +1 -0
- package/dist/lib/exceptions/index.js +4 -2
- package/dist/lib/exceptions/index.js.map +1 -1
- package/dist/lib/exceptions/invalid_operation_exception.d.ts +7 -0
- package/dist/lib/exceptions/invalid_operation_exception.js +17 -0
- package/dist/lib/exceptions/invalid_operation_exception.js.map +1 -0
- package/dist/lib/gateway/convert_exceptions.js +1 -0
- package/dist/lib/gateway/convert_exceptions.js.map +1 -1
- package/dist/lib/gcode/axis_definition.d.ts +18 -0
- package/dist/lib/gcode/{translator_axis_definition.js → axis_definition.js} +11 -10
- package/dist/lib/gcode/axis_definition.js.map +1 -0
- package/dist/lib/gcode/axis_mapping.js +3 -0
- package/dist/lib/gcode/axis_mapping.js.map +1 -1
- package/dist/lib/gcode/axis_transformation.d.ts +21 -0
- package/dist/lib/gcode/axis_transformation.js +43 -0
- package/dist/lib/gcode/axis_transformation.js.map +1 -0
- package/dist/lib/gcode/device_definition.d.ts +24 -0
- package/dist/lib/gcode/{translator_definition.js → device_definition.js} +14 -9
- package/dist/lib/gcode/device_definition.js.map +1 -0
- package/dist/lib/gcode/index.d.ts +4 -3
- package/dist/lib/gcode/index.js +9 -7
- package/dist/lib/gcode/index.js.map +1 -1
- package/dist/lib/gcode/offline_translator.d.ts +114 -0
- package/dist/lib/gcode/offline_translator.js +226 -0
- package/dist/lib/gcode/offline_translator.js.map +1 -0
- package/dist/lib/gcode/translator.d.ts +66 -12
- package/dist/lib/gcode/translator.js +113 -17
- package/dist/lib/gcode/translator.js.map +1 -1
- package/dist/lib/gcode/translator_config.d.ts +6 -6
- package/dist/lib/gcode/translator_config.js +7 -4
- package/dist/lib/gcode/translator_config.js.map +1 -1
- package/dist/lib/gcode_ns.d.ts +8 -6
- package/dist/lib/gcode_ns.js +4 -3
- package/dist/lib/gcode_ns.js.map +1 -1
- package/dist/lib/measurement.js +3 -0
- package/dist/lib/measurement.js.map +1 -1
- package/dist/lib/protobufs/main_pb.d.ts +621 -14
- package/dist/lib/protobufs/main_pb.js +6265 -1581
- package/dist/lib/protobufs/main_pb.js.map +1 -1
- package/package.json +1 -1
- package/dist/lib/gcode/translator_axis_definition.d.ts +0 -20
- package/dist/lib/gcode/translator_axis_definition.js.map +0 -1
- package/dist/lib/gcode/translator_definition.d.ts +0 -18
- package/dist/lib/gcode/translator_definition.js.map +0 -1
- package/dist/lib/gcode/translator_live.d.ts +0 -70
- package/dist/lib/gcode/translator_live.js +0 -147
- package/dist/lib/gcode/translator_live.js.map +0 -1
|
@@ -0,0 +1,153 @@
|
|
|
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
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
7
|
+
}) : (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
o[k2] = m[k];
|
|
10
|
+
}));
|
|
11
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
12
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
13
|
+
}) : function(o, v) {
|
|
14
|
+
o["default"] = v;
|
|
15
|
+
});
|
|
16
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
17
|
+
if (mod && mod.__esModule) return mod;
|
|
18
|
+
var result = {};
|
|
19
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
20
|
+
__setModuleDefault(result, mod);
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.Oscilloscope = void 0;
|
|
25
|
+
const oscilloscope_data_1 = require("./oscilloscope_data");
|
|
26
|
+
const units_1 = require("../units");
|
|
27
|
+
const gateway = __importStar(require("../gateway"));
|
|
28
|
+
/**
|
|
29
|
+
* Provides a convenient way to control the oscilloscope data recording feature of some devices.
|
|
30
|
+
* The oscilloscope can record the values of some settings over time at high resolution.
|
|
31
|
+
*/
|
|
32
|
+
class Oscilloscope {
|
|
33
|
+
constructor(device) {
|
|
34
|
+
this._device = device;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Device that this Oscilloscope measures.
|
|
38
|
+
*/
|
|
39
|
+
get device() {
|
|
40
|
+
return this._device;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Select a setting to be recorded.
|
|
44
|
+
* @param axis The 1-based index of the axis to record the value from.
|
|
45
|
+
* @param setting The name of a setting to record.
|
|
46
|
+
*/
|
|
47
|
+
async addChannel(axis, setting) {
|
|
48
|
+
const request = new gateway.OscilloscopeAddChannelRequest();
|
|
49
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
50
|
+
request.setDevice(this.device.deviceAddress);
|
|
51
|
+
request.setAxis(axis);
|
|
52
|
+
request.setSetting(setting);
|
|
53
|
+
await gateway.callAsync('oscilloscope/add_channel', request);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Clear the list of channels to record.
|
|
57
|
+
*/
|
|
58
|
+
async clear() {
|
|
59
|
+
const request = new gateway.OscilloscopeClearChannelsRequest();
|
|
60
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
61
|
+
request.setDevice(this.device.deviceAddress);
|
|
62
|
+
await gateway.callAsync('oscilloscope/clear_channels', request);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get the current sampling interval.
|
|
66
|
+
* @param unit Unit of measure to represent the timebase in.
|
|
67
|
+
* @return The current sampling interval in the selected time units.
|
|
68
|
+
*/
|
|
69
|
+
async getTimebase(unit = units_1.Units.NATIVE) {
|
|
70
|
+
const request = new gateway.DeviceGetSettingRequest();
|
|
71
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
72
|
+
request.setDevice(this.device.deviceAddress);
|
|
73
|
+
request.setSetting('scope.timebase');
|
|
74
|
+
request.setUnit(unit);
|
|
75
|
+
const response = await gateway.callAsync('device/get_setting', request, gateway.DeviceGetSettingResponse);
|
|
76
|
+
return response.getValue();
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Set the sampling interval.
|
|
80
|
+
* @param interval Sample interval for the next oscilloscope recording. Minimum value is 100µs.
|
|
81
|
+
* @param unit Unit of measure the timebase is represented in.
|
|
82
|
+
*/
|
|
83
|
+
async setTimebase(interval, unit = units_1.Units.NATIVE) {
|
|
84
|
+
const request = new gateway.DeviceSetSettingRequest();
|
|
85
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
86
|
+
request.setDevice(this.device.deviceAddress);
|
|
87
|
+
request.setSetting('scope.timebase');
|
|
88
|
+
request.setValue(interval);
|
|
89
|
+
request.setUnit(unit);
|
|
90
|
+
await gateway.callAsync('device/set_setting', request);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get the delay before oscilloscope recording starts.
|
|
94
|
+
* @param unit Unit of measure to represent the delay in.
|
|
95
|
+
* @return The current start delay in the selected time units.
|
|
96
|
+
*/
|
|
97
|
+
async getDelay(unit = units_1.Units.NATIVE) {
|
|
98
|
+
const request = new gateway.DeviceGetSettingRequest();
|
|
99
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
100
|
+
request.setDevice(this.device.deviceAddress);
|
|
101
|
+
request.setSetting('scope.delay');
|
|
102
|
+
request.setUnit(unit);
|
|
103
|
+
const response = await gateway.callAsync('device/get_setting', request, gateway.DeviceGetSettingResponse);
|
|
104
|
+
return response.getValue();
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Set the sampling start delay.
|
|
108
|
+
* @param interval Delay time between triggering a recording and the first data point being recorded.
|
|
109
|
+
* @param unit Unit of measure the delay is represented in.
|
|
110
|
+
*/
|
|
111
|
+
async setDelay(interval, unit = units_1.Units.NATIVE) {
|
|
112
|
+
const request = new gateway.DeviceSetSettingRequest();
|
|
113
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
114
|
+
request.setDevice(this.device.deviceAddress);
|
|
115
|
+
request.setSetting('scope.delay');
|
|
116
|
+
request.setValue(interval);
|
|
117
|
+
request.setUnit(unit);
|
|
118
|
+
await gateway.callAsync('device/set_setting', request);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Trigger data recording.
|
|
122
|
+
*/
|
|
123
|
+
async start() {
|
|
124
|
+
const request = new gateway.OscilloscopeStartStopRequest();
|
|
125
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
126
|
+
request.setDevice(this.device.deviceAddress);
|
|
127
|
+
request.setStart(true);
|
|
128
|
+
await gateway.callAsync('oscilloscope/start_or_stop', request);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* End data recording if currently in progress.
|
|
132
|
+
*/
|
|
133
|
+
async stop() {
|
|
134
|
+
const request = new gateway.OscilloscopeStartStopRequest();
|
|
135
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
136
|
+
request.setDevice(this.device.deviceAddress);
|
|
137
|
+
request.setStart(false);
|
|
138
|
+
await gateway.callAsync('oscilloscope/start_or_stop', request);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Reads the last-recorded data from the oscilloscope. Will block until any in-progress recording completes.
|
|
142
|
+
* @return Array of recorded channel data arrays, in the order added.
|
|
143
|
+
*/
|
|
144
|
+
async read() {
|
|
145
|
+
const request = new gateway.OscilloscopeReadRequest();
|
|
146
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
147
|
+
request.setDevice(this.device.deviceAddress);
|
|
148
|
+
const response = await gateway.callAsync('oscilloscope/read', request, gateway.OscilloscopeReadResponse);
|
|
149
|
+
return response.getDataIdsList().map(id => new oscilloscope_data_1.OscilloscopeData(this.device, id));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
exports.Oscilloscope = Oscilloscope;
|
|
153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AQ,CAAC,IAAI,CAAC,CAAC;QAEvB,MAAM,OAAO,CAAC,SAAS,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI;QACf,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,4BAA4B,EAAE,CAAC;QAC3D,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3D,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC7C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAExB,MAAM,OAAO,CAAC,SAAS,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,IAAI;QACf,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;QACtD,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3D,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAE7C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,SAAS,CACtC,mBAAmB,EACnB,OAAO,EACP,OAAO,CAAC,wBAAwB,CAAC,CAAC;QACpC,OAAO,QAAQ,CAAC,cAAc,EAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,oCAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IACrF,CAAC;CACF;AAjKD,oCAiKC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Device } from './device';\nimport { OscilloscopeData } from './oscilloscope_data';\nimport { Native, Time, Units } from '../units';\nimport * as gateway from '../gateway';\n\n/**\n * Provides a convenient way to control the oscilloscope data recording feature of some devices.\n * The oscilloscope can record the values of some settings over time at high resolution.\n */\nexport class Oscilloscope {\n /**\n * Device that this Oscilloscope measures.\n */\n public get device(): Device {\n return this._device;\n }\n private _device: Device;\n\n constructor(device: Device) {\n this._device = device;\n }\n\n /**\n * Select a setting to be recorded.\n * @param axis The 1-based index of the axis to record the value from.\n * @param setting The name of a setting to record.\n */\n public async addChannel(\n axis: number,\n setting: string\n ): Promise<void> {\n const request = new gateway.OscilloscopeAddChannelRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setAxis(axis);\n request.setSetting(setting);\n\n await gateway.callAsync('oscilloscope/add_channel', request);\n }\n\n /**\n * Clear the list of channels to record.\n */\n public async clear(): Promise<void> {\n const request = new gateway.OscilloscopeClearChannelsRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n\n await gateway.callAsync('oscilloscope/clear_channels', request);\n }\n\n /**\n * Get the current sampling interval.\n * @param unit Unit of measure to represent the timebase in.\n * @return The current sampling interval in the selected time units.\n */\n public async getTimebase(\n unit: Time | Native = Units.NATIVE\n ): Promise<number> {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setSetting('scope.timebase');\n request.setUnit(unit);\n\n const response = await gateway.callAsync<gateway.DeviceGetSettingResponse>(\n 'device/get_setting',\n request,\n gateway.DeviceGetSettingResponse);\n return response.getValue();\n }\n\n /**\n * Set the sampling interval.\n * @param interval Sample interval for the next oscilloscope recording. Minimum value is 100µs.\n * @param unit Unit of measure the timebase is represented in.\n */\n public async setTimebase(\n interval: number,\n unit: Time | Native = Units.NATIVE\n ): Promise<void> {\n const request = new gateway.DeviceSetSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setSetting('scope.timebase');\n request.setValue(interval);\n request.setUnit(unit);\n\n await gateway.callAsync('device/set_setting', request);\n }\n\n /**\n * Get the delay before oscilloscope recording starts.\n * @param unit Unit of measure to represent the delay in.\n * @return The current start delay in the selected time units.\n */\n public async getDelay(\n unit: Time | Native = Units.NATIVE\n ): Promise<number> {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setSetting('scope.delay');\n request.setUnit(unit);\n\n const response = await gateway.callAsync<gateway.DeviceGetSettingResponse>(\n 'device/get_setting',\n request,\n gateway.DeviceGetSettingResponse);\n return response.getValue();\n }\n\n /**\n * Set the sampling start delay.\n * @param interval Delay time between triggering a recording and the first data point being recorded.\n * @param unit Unit of measure the delay is represented in.\n */\n public async setDelay(\n interval: number,\n unit: Time | Native = Units.NATIVE\n ): Promise<void> {\n const request = new gateway.DeviceSetSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setSetting('scope.delay');\n request.setValue(interval);\n request.setUnit(unit);\n\n await gateway.callAsync('device/set_setting', request);\n }\n\n /**\n * Trigger data recording.\n */\n public async start(): Promise<void> {\n const request = new gateway.OscilloscopeStartStopRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setStart(true);\n\n await gateway.callAsync('oscilloscope/start_or_stop', request);\n }\n\n /**\n * End data recording if currently in progress.\n */\n public async stop(): Promise<void> {\n const request = new gateway.OscilloscopeStartStopRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setStart(false);\n\n await gateway.callAsync('oscilloscope/start_or_stop', request);\n }\n\n /**\n * Reads the last-recorded data from the oscilloscope. Will block until any in-progress recording completes.\n * @return Array of recorded channel data arrays, in the order added.\n */\n public async read(): Promise<OscilloscopeData[]> {\n const request = new gateway.OscilloscopeReadRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n\n const response = await gateway.callAsync<gateway.OscilloscopeReadResponse>(\n 'oscilloscope/read',\n request,\n gateway.OscilloscopeReadResponse);\n return response.getDataIdsList()!.map(id => new OscilloscopeData(this.device, id));\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public properties of one channel of recorded oscilloscope data.
|
|
3
|
+
*/
|
|
4
|
+
export interface OscilloscopeCaptureProperties {
|
|
5
|
+
/**
|
|
6
|
+
* The name of the recorded setting.
|
|
7
|
+
*/
|
|
8
|
+
setting: string;
|
|
9
|
+
/**
|
|
10
|
+
* The number of the axis the data was recorded from, or 0 for the controller.
|
|
11
|
+
*/
|
|
12
|
+
axisNumber: number;
|
|
13
|
+
}
|
|
14
|
+
export declare namespace OscilloscopeCaptureProperties {
|
|
15
|
+
const __type = "OscilloscopeCaptureProperties";
|
|
16
|
+
}
|
|
@@ -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.OscilloscopeCaptureProperties = void 0;
|
|
6
|
+
var OscilloscopeCaptureProperties;
|
|
7
|
+
(function (OscilloscopeCaptureProperties) {
|
|
8
|
+
OscilloscopeCaptureProperties.__type = 'OscilloscopeCaptureProperties';
|
|
9
|
+
/** @internal */
|
|
10
|
+
function fromProtobuf(pbData) {
|
|
11
|
+
return {
|
|
12
|
+
setting: pbData.setting,
|
|
13
|
+
axisNumber: pbData.axisNumber,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
OscilloscopeCaptureProperties.fromProtobuf = fromProtobuf;
|
|
17
|
+
})(OscilloscopeCaptureProperties = exports.OscilloscopeCaptureProperties || (exports.OscilloscopeCaptureProperties = {}));
|
|
18
|
+
//# sourceMappingURL=oscilloscope_capture_properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oscilloscope_capture_properties.js","sourceRoot":"","sources":["../../../src/ascii/oscilloscope_capture_properties.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;AAoBtD,IAAiB,6BAA6B,CAU7C;AAVD,WAAiB,6BAA6B;IAC/B,oCAAM,GAAG,+BAA+B,CAAC;IAEtD,gBAAgB;IAChB,SAAgB,YAAY,CAAC,MAAsD;QACjF,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC;IACJ,CAAC;IALe,0CAAY,eAK3B,CAAA;AACH,CAAC,EAVgB,6BAA6B,GAA7B,qCAA6B,KAA7B,qCAA6B,QAU7C","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\n\n/**\n * The public properties of one channel of recorded oscilloscope data.\n */\nexport interface OscilloscopeCaptureProperties {\n /**\n * The name of the recorded setting.\n */\n setting: string;\n\n /**\n * The number of the axis the data was recorded from, or 0 for the controller.\n */\n axisNumber: number;\n\n}\n\nexport namespace OscilloscopeCaptureProperties {\n export const __type = 'OscilloscopeCaptureProperties';\n\n /** @internal */\n export function fromProtobuf(pbData: gateway.OscilloscopeCaptureProperties.AsObject): OscilloscopeCaptureProperties {\n return {\n setting: pbData.setting,\n axisNumber: pbData.axisNumber,\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Device } from './device';
|
|
2
|
+
import { Native, Time, Units } from '../units';
|
|
3
|
+
/**
|
|
4
|
+
* Contains a block of contiguous recorded data for one channel of the device's oscilloscope.
|
|
5
|
+
*/
|
|
6
|
+
export declare class OscilloscopeData {
|
|
7
|
+
/**
|
|
8
|
+
* Device that this Oscilloscope measures.
|
|
9
|
+
*/
|
|
10
|
+
get device(): Device;
|
|
11
|
+
private _device;
|
|
12
|
+
/**
|
|
13
|
+
* Unique ID for this block of recorded data.
|
|
14
|
+
*/
|
|
15
|
+
get dataId(): number;
|
|
16
|
+
private _dataId;
|
|
17
|
+
/**
|
|
18
|
+
* The name of the recorded setting.
|
|
19
|
+
*/
|
|
20
|
+
get setting(): string;
|
|
21
|
+
/**
|
|
22
|
+
* The number of the axis the data was recorded from, or 0 for the controller.
|
|
23
|
+
*/
|
|
24
|
+
get axisNumber(): number;
|
|
25
|
+
constructor(device: Device, dataId: number);
|
|
26
|
+
/**
|
|
27
|
+
* Get the sample interval that this data was recorded with.
|
|
28
|
+
* @param unit Unit of measure to represent the timebase in.
|
|
29
|
+
* @return The timebase setting at the time the data was recorded.
|
|
30
|
+
*/
|
|
31
|
+
getTimebase(unit?: Time | Native): number;
|
|
32
|
+
/**
|
|
33
|
+
* Get the sample interval that this data was recorded with.
|
|
34
|
+
* @param unit Unit of measure to represent the delay in.
|
|
35
|
+
* @return The delay setting at the time the data was recorded.
|
|
36
|
+
*/
|
|
37
|
+
getDelay(unit?: Time | Native): number;
|
|
38
|
+
/**
|
|
39
|
+
* Calculate the time a sample was recorded, relative to when the recording was triggered.
|
|
40
|
+
* @param index 0-based index of the sample to calculate the time of.
|
|
41
|
+
* @param unit Unit of measure to represent the calculated time in.
|
|
42
|
+
* @return The calculated time offset of the data sample at the given index.
|
|
43
|
+
*/
|
|
44
|
+
getSampleTime(index: number, unit?: Time | Native): number;
|
|
45
|
+
/**
|
|
46
|
+
* Get the recorded data as an array of doubles.
|
|
47
|
+
* @param unit Unit of measure to convert the data to.
|
|
48
|
+
* @return The recorded data for one oscilloscope channel, converted to the units specified.
|
|
49
|
+
*/
|
|
50
|
+
getData(unit?: Units): number[];
|
|
51
|
+
/**
|
|
52
|
+
* Releases native resources of an oscilloscope data buffer.
|
|
53
|
+
* @param dataId The ID of the data buffer to delete.
|
|
54
|
+
*/
|
|
55
|
+
private static _free;
|
|
56
|
+
/**
|
|
57
|
+
* Returns recording properties.
|
|
58
|
+
* @return Capture properties.
|
|
59
|
+
*/
|
|
60
|
+
private _retrieveProperties;
|
|
61
|
+
/**
|
|
62
|
+
* Releases the native resources of the oscilloscope data.
|
|
63
|
+
* Should only be called if your environment does not support FinalizationRegistry.
|
|
64
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
|
|
65
|
+
*/
|
|
66
|
+
free(): void;
|
|
67
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
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
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
7
|
+
}) : (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
o[k2] = m[k];
|
|
10
|
+
}));
|
|
11
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
12
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
13
|
+
}) : function(o, v) {
|
|
14
|
+
o["default"] = v;
|
|
15
|
+
});
|
|
16
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
17
|
+
if (mod && mod.__esModule) return mod;
|
|
18
|
+
var result = {};
|
|
19
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
20
|
+
__setModuleDefault(result, mod);
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.OscilloscopeData = void 0;
|
|
25
|
+
const units_1 = require("../units");
|
|
26
|
+
const gateway = __importStar(require("../gateway"));
|
|
27
|
+
const finalizer_1 = require("../finalizer");
|
|
28
|
+
const oscilloscope_capture_properties_1 = require("./oscilloscope_capture_properties");
|
|
29
|
+
/**
|
|
30
|
+
* Contains a block of contiguous recorded data for one channel of the device's oscilloscope.
|
|
31
|
+
*/
|
|
32
|
+
class OscilloscopeData {
|
|
33
|
+
constructor(device, dataId) {
|
|
34
|
+
this._device = device;
|
|
35
|
+
this._dataId = dataId;
|
|
36
|
+
(0, finalizer_1.registerForFinalization)(this, OscilloscopeData._free.bind(null, dataId));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Device that this Oscilloscope measures.
|
|
40
|
+
*/
|
|
41
|
+
get device() {
|
|
42
|
+
return this._device;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Unique ID for this block of recorded data.
|
|
46
|
+
*/
|
|
47
|
+
get dataId() {
|
|
48
|
+
return this._dataId;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The name of the recorded setting.
|
|
52
|
+
*/
|
|
53
|
+
get setting() {
|
|
54
|
+
return this._retrieveProperties().setting;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The number of the axis the data was recorded from, or 0 for the controller.
|
|
58
|
+
*/
|
|
59
|
+
get axisNumber() {
|
|
60
|
+
return this._retrieveProperties().axisNumber;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get the sample interval that this data was recorded with.
|
|
64
|
+
* @param unit Unit of measure to represent the timebase in.
|
|
65
|
+
* @return The timebase setting at the time the data was recorded.
|
|
66
|
+
*/
|
|
67
|
+
getTimebase(unit = units_1.Units.NATIVE) {
|
|
68
|
+
const request = new gateway.OscilloscopeDataGetSavedSettingRequest();
|
|
69
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
70
|
+
request.setDevice(this.device.deviceAddress);
|
|
71
|
+
request.setDataId(this.dataId);
|
|
72
|
+
request.setUnit(unit);
|
|
73
|
+
const response = gateway.callSync('oscilloscopedata/get_timebase', request, gateway.OscilloscopeDataGetSavedSettingResponse);
|
|
74
|
+
return response.getValue();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get the sample interval that this data was recorded with.
|
|
78
|
+
* @param unit Unit of measure to represent the delay in.
|
|
79
|
+
* @return The delay setting at the time the data was recorded.
|
|
80
|
+
*/
|
|
81
|
+
getDelay(unit = units_1.Units.NATIVE) {
|
|
82
|
+
const request = new gateway.OscilloscopeDataGetSavedSettingRequest();
|
|
83
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
84
|
+
request.setDevice(this.device.deviceAddress);
|
|
85
|
+
request.setDataId(this.dataId);
|
|
86
|
+
request.setUnit(unit);
|
|
87
|
+
const response = gateway.callSync('oscilloscopedata/get_delay', request, gateway.OscilloscopeDataGetSavedSettingResponse);
|
|
88
|
+
return response.getValue();
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Calculate the time a sample was recorded, relative to when the recording was triggered.
|
|
92
|
+
* @param index 0-based index of the sample to calculate the time of.
|
|
93
|
+
* @param unit Unit of measure to represent the calculated time in.
|
|
94
|
+
* @return The calculated time offset of the data sample at the given index.
|
|
95
|
+
*/
|
|
96
|
+
getSampleTime(index, unit = units_1.Units.NATIVE) {
|
|
97
|
+
const request = new gateway.OscilloscopeDataGetSampleTimeRequest();
|
|
98
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
99
|
+
request.setDevice(this.device.deviceAddress);
|
|
100
|
+
request.setDataId(this.dataId);
|
|
101
|
+
request.setIndex(index);
|
|
102
|
+
request.setUnit(unit);
|
|
103
|
+
const response = gateway.callSync('oscilloscopedata/get_sample_time', request, gateway.OscilloscopeDataGetSavedSettingResponse);
|
|
104
|
+
return response.getValue();
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Get the recorded data as an array of doubles.
|
|
108
|
+
* @param unit Unit of measure to convert the data to.
|
|
109
|
+
* @return The recorded data for one oscilloscope channel, converted to the units specified.
|
|
110
|
+
*/
|
|
111
|
+
getData(unit = units_1.Units.NATIVE) {
|
|
112
|
+
const request = new gateway.OscilloscopeDataGetSamplesRequest();
|
|
113
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
114
|
+
request.setDevice(this.device.deviceAddress);
|
|
115
|
+
request.setDataId(this.dataId);
|
|
116
|
+
request.setUnit(unit);
|
|
117
|
+
const response = gateway.callSync('oscilloscopedata/get_samples', request, gateway.OscilloscopeDataGetSamplesResponse);
|
|
118
|
+
return response.getDataList();
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Releases native resources of an oscilloscope data buffer.
|
|
122
|
+
* @param dataId The ID of the data buffer to delete.
|
|
123
|
+
*/
|
|
124
|
+
static _free(dataId) {
|
|
125
|
+
const request = new gateway.OscilloscopeDataIdentifier();
|
|
126
|
+
request.setDataId(dataId);
|
|
127
|
+
gateway.callSync('oscilloscopedata/free', request);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Returns recording properties.
|
|
131
|
+
* @return Capture properties.
|
|
132
|
+
*/
|
|
133
|
+
_retrieveProperties() {
|
|
134
|
+
const request = new gateway.OscilloscopeDataIdentifier();
|
|
135
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
136
|
+
request.setDevice(this.device.deviceAddress);
|
|
137
|
+
request.setDataId(this.dataId);
|
|
138
|
+
const response = gateway.callSync('oscilloscopedata/get_properties', request, gateway.OscilloscopeDataGetPropertiesResponse);
|
|
139
|
+
return oscilloscope_capture_properties_1.OscilloscopeCaptureProperties.fromProtobuf(response.getProperties().toObject());
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Releases the native resources of the oscilloscope data.
|
|
143
|
+
* Should only be called if your environment does not support FinalizationRegistry.
|
|
144
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
|
|
145
|
+
*/
|
|
146
|
+
free() {
|
|
147
|
+
OscilloscopeData._free(this.dataId);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.OscilloscopeData = OscilloscopeData;
|
|
151
|
+
//# sourceMappingURL=oscilloscope_data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oscilloscope_data.js","sourceRoot":"","sources":["../../../src/ascii/oscilloscope_data.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;AAGtD,oCAA+C;AAC/C,oDAAsC;AACtC,4CAAuD;AAEvD,uFAAkF;AAElF;;GAEG;AACH,MAAa,gBAAgB;IA+B3B,YAAY,MAAc,EAAE,MAAc;QACxC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAA,mCAAuB,EAAC,IAAI,EAAE,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3E,CAAC;IAlCD;;OAEG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAGD;;OAEG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAGD;;OAEG;IACH,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC,UAAU,CAAC;IAC/C,CAAC;IAQD;;;;OAIG;IACI,WAAW,CAChB,OAAsB,aAAK,CAAC,MAAM;QAElC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,sCAAsC,EAAE,CAAC;QACrE,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3D,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC7C,OAAO,CAAC,SAAS,CAAC,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C7C,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE/B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAC/B,iCAAiC,EACjC,OAAO,EACP,OAAO,CAAC,qCAAqC,CAAC,CAAC;QACjD,OAAO,+DAA6B,CAAC,YAAY,CAAC,QAAQ,CAAC,aAAa,EAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED;;;;OAIG;IACI,IAAI;QACT,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;CACF;AAlKD,4CAkKC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Device } from './device';\nimport { Native, Time, Units } from '../units';\nimport * as gateway from '../gateway';\nimport { registerForFinalization } from '../finalizer';\n\nimport { OscilloscopeCaptureProperties } from './oscilloscope_capture_properties';\n\n/**\n * Contains a block of contiguous recorded data for one channel of the device's oscilloscope.\n */\nexport class OscilloscopeData {\n /**\n * Device that this Oscilloscope measures.\n */\n public get device(): Device {\n return this._device;\n }\n private _device: Device;\n\n /**\n * Unique ID for this block of recorded data.\n */\n public get dataId(): number {\n return this._dataId;\n }\n private _dataId: number;\n\n /**\n * The name of the recorded setting.\n */\n public get setting(): string {\n return this._retrieveProperties().setting;\n }\n\n /**\n * The number of the axis the data was recorded from, or 0 for the controller.\n */\n public get axisNumber(): number {\n return this._retrieveProperties().axisNumber;\n }\n\n constructor(device: Device, dataId: number) {\n this._device = device;\n this._dataId = dataId;\n registerForFinalization(this, OscilloscopeData._free.bind(null, dataId));\n }\n\n /**\n * Get the sample interval that this data was recorded with.\n * @param unit Unit of measure to represent the timebase in.\n * @return The timebase setting at the time the data was recorded.\n */\n public getTimebase(\n unit: Time | Native = Units.NATIVE\n ): number {\n const request = new gateway.OscilloscopeDataGetSavedSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setDataId(this.dataId);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.OscilloscopeDataGetSavedSettingResponse>(\n 'oscilloscopedata/get_timebase',\n request,\n gateway.OscilloscopeDataGetSavedSettingResponse);\n return response.getValue();\n }\n\n /**\n * Get the sample interval that this data was recorded with.\n * @param unit Unit of measure to represent the delay in.\n * @return The delay setting at the time the data was recorded.\n */\n public getDelay(\n unit: Time | Native = Units.NATIVE\n ): number {\n const request = new gateway.OscilloscopeDataGetSavedSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setDataId(this.dataId);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.OscilloscopeDataGetSavedSettingResponse>(\n 'oscilloscopedata/get_delay',\n request,\n gateway.OscilloscopeDataGetSavedSettingResponse);\n return response.getValue();\n }\n\n /**\n * Calculate the time a sample was recorded, relative to when the recording was triggered.\n * @param index 0-based index of the sample to calculate the time of.\n * @param unit Unit of measure to represent the calculated time in.\n * @return The calculated time offset of the data sample at the given index.\n */\n public getSampleTime(\n index: number,\n unit: Time | Native = Units.NATIVE\n ): number {\n const request = new gateway.OscilloscopeDataGetSampleTimeRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setDataId(this.dataId);\n request.setIndex(index);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.OscilloscopeDataGetSavedSettingResponse>(\n 'oscilloscopedata/get_sample_time',\n request,\n gateway.OscilloscopeDataGetSavedSettingResponse);\n return response.getValue();\n }\n\n /**\n * Get the recorded data as an array of doubles.\n * @param unit Unit of measure to convert the data to.\n * @return The recorded data for one oscilloscope channel, converted to the units specified.\n */\n public getData(\n unit: Units = Units.NATIVE\n ): number[] {\n const request = new gateway.OscilloscopeDataGetSamplesRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setDataId(this.dataId);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.OscilloscopeDataGetSamplesResponse>(\n 'oscilloscopedata/get_samples',\n request,\n gateway.OscilloscopeDataGetSamplesResponse);\n return response.getDataList();\n }\n\n /**\n * Releases native resources of an oscilloscope data buffer.\n * @param dataId The ID of the data buffer to delete.\n */\n private static _free(\n dataId: number\n ): void {\n const request = new gateway.OscilloscopeDataIdentifier();\n request.setDataId(dataId);\n\n gateway.callSync('oscilloscopedata/free', request);\n }\n\n /**\n * Returns recording properties.\n * @return Capture properties.\n */\n private _retrieveProperties(): OscilloscopeCaptureProperties {\n const request = new gateway.OscilloscopeDataIdentifier();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setDataId(this.dataId);\n\n const response = gateway.callSync<gateway.OscilloscopeDataGetPropertiesResponse>(\n 'oscilloscopedata/get_properties',\n request,\n gateway.OscilloscopeDataGetPropertiesResponse);\n return OscilloscopeCaptureProperties.fromProtobuf(response.getProperties()!.toObject());\n }\n\n /**\n * Releases the native resources of the oscilloscope data.\n * Should only be called if your environment does not support FinalizationRegistry.\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry\n */\n public free(): void {\n OscilloscopeData._free(this.dataId);\n }\n}\n"]}
|
|
@@ -212,6 +212,16 @@ export declare class Stream {
|
|
|
212
212
|
* Channel numbers are numbered from one.
|
|
213
213
|
*/
|
|
214
214
|
toggleDigitalOutput(channelNumber: number): Promise<void>;
|
|
215
|
+
/**
|
|
216
|
+
* Sets values for all digital output channels.
|
|
217
|
+
* @param values True to set the output channel to conducting and false to turn it off.
|
|
218
|
+
*/
|
|
219
|
+
setAllDigitalOutputs(values: boolean[]): Promise<void>;
|
|
220
|
+
/**
|
|
221
|
+
* Sets values for all analog output channels.
|
|
222
|
+
* @param values Voltage values to set the output channels to.
|
|
223
|
+
*/
|
|
224
|
+
setAllAnalogOutputs(values: number[]): Promise<void>;
|
|
215
225
|
/**
|
|
216
226
|
* Wait a specified time.
|
|
217
227
|
* @param time Amount of time to wait.
|
|
@@ -300,6 +310,13 @@ export declare class Stream {
|
|
|
300
310
|
* @param command Command and its parameters.
|
|
301
311
|
*/
|
|
302
312
|
genericCommand(command: string): Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Sends a batch of generic ASCII commands to the stream.
|
|
315
|
+
* Keeps resending command while the device rejects with AGAIN reason.
|
|
316
|
+
* The batch is atomic in terms of thread safety.
|
|
317
|
+
* @param batch Array of commands.
|
|
318
|
+
*/
|
|
319
|
+
genericCommandBatch(batch: string[]): Promise<void>;
|
|
303
320
|
/**
|
|
304
321
|
* Gets the axes of the stream.
|
|
305
322
|
* @return An array of axis numbers of the axes the stream is set up to control.
|
package/dist/lib/ascii/stream.js
CHANGED
|
@@ -453,6 +453,30 @@ class Stream {
|
|
|
453
453
|
request.setChannelNumber(channelNumber);
|
|
454
454
|
await gateway.callAsync('device/stream_toggle_digital_output', request);
|
|
455
455
|
}
|
|
456
|
+
/**
|
|
457
|
+
* Sets values for all digital output channels.
|
|
458
|
+
* @param values True to set the output channel to conducting and false to turn it off.
|
|
459
|
+
*/
|
|
460
|
+
async setAllDigitalOutputs(values) {
|
|
461
|
+
const request = new gateway.StreamSetAllDigitalOutputsRequest();
|
|
462
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
463
|
+
request.setDevice(this.device.deviceAddress);
|
|
464
|
+
request.setStreamId(this.streamId);
|
|
465
|
+
request.setValuesList(values);
|
|
466
|
+
await gateway.callAsync('device/stream_set_all_digital_outputs', request);
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Sets values for all analog output channels.
|
|
470
|
+
* @param values Voltage values to set the output channels to.
|
|
471
|
+
*/
|
|
472
|
+
async setAllAnalogOutputs(values) {
|
|
473
|
+
const request = new gateway.StreamSetAllAnalogOutputsRequest();
|
|
474
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
475
|
+
request.setDevice(this.device.deviceAddress);
|
|
476
|
+
request.setStreamId(this.streamId);
|
|
477
|
+
request.setValuesList(values);
|
|
478
|
+
await gateway.callAsync('device/stream_set_all_analog_outputs', request);
|
|
479
|
+
}
|
|
456
480
|
/**
|
|
457
481
|
* Wait a specified time.
|
|
458
482
|
* @param time Amount of time to wait.
|
|
@@ -643,6 +667,20 @@ class Stream {
|
|
|
643
667
|
request.setCommand(command);
|
|
644
668
|
await gateway.callAsync('device/stream_generic_command', request);
|
|
645
669
|
}
|
|
670
|
+
/**
|
|
671
|
+
* Sends a batch of generic ASCII commands to the stream.
|
|
672
|
+
* Keeps resending command while the device rejects with AGAIN reason.
|
|
673
|
+
* The batch is atomic in terms of thread safety.
|
|
674
|
+
* @param batch Array of commands.
|
|
675
|
+
*/
|
|
676
|
+
async genericCommandBatch(batch) {
|
|
677
|
+
const request = new gateway.StreamGenericCommandBatchRequest();
|
|
678
|
+
request.setInterfaceId(this.device.connection.interfaceId);
|
|
679
|
+
request.setDevice(this.device.deviceAddress);
|
|
680
|
+
request.setStreamId(this.streamId);
|
|
681
|
+
request.setBatchList(batch);
|
|
682
|
+
await gateway.callAsync('device/stream_generic_command_batch', request);
|
|
683
|
+
}
|
|
646
684
|
/**
|
|
647
685
|
* Gets the axes of the stream.
|
|
648
686
|
* @return An array of axis numbers of the axes the stream is set up to control.
|