@zaber/motion 5.1.0 → 5.1.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.
@@ -5,6 +5,8 @@ import { Angle, Length, Native } from '../units';
5
5
  * Groups multiple axes across devices into a single group to allow for simultaneous movement.
6
6
  * Note that the movement is not coordinated and trajectory is inconsistent and not repeatable between calls.
7
7
  * Make sure that any possible trajectory is clear of potential obstacles.
8
+ * The movement methods return after all the axes finish the movement successfully
9
+ * or throw an error as soon as possible.
8
10
  */
9
11
  export declare class AxisGroup {
10
12
  /**
@@ -46,6 +48,16 @@ export declare class AxisGroup {
46
48
  * Waits until all the axes stop moving.
47
49
  */
48
50
  waitUntilIdle(): Promise<void>;
51
+ /**
52
+ * Returns bool indicating whether any of the axes is executing a motion command.
53
+ * @returns True if any of the axes is currently executing a motion command. False otherwise.
54
+ */
55
+ isBusy(): Promise<boolean>;
56
+ /**
57
+ * Returns bool indicating whether all the axes are homed.
58
+ * @returns True if all the axes are homed. False otherwise.
59
+ */
60
+ isHomed(): Promise<boolean>;
49
61
  /**
50
62
  * Returns current axes position.
51
63
  * The positions are requested sequentially.
@@ -32,6 +32,8 @@ const gateway = __importStar(require("../gateway"));
32
32
  * Groups multiple axes across devices into a single group to allow for simultaneous movement.
33
33
  * Note that the movement is not coordinated and trajectory is inconsistent and not repeatable between calls.
34
34
  * Make sure that any possible trajectory is clear of potential obstacles.
35
+ * The movement methods return after all the axes finish the movement successfully
36
+ * or throw an error as soon as possible.
35
37
  */
36
38
  class AxisGroup {
37
39
  /**
@@ -120,6 +122,30 @@ class AxisGroup {
120
122
  request.setAxesList(this._axes.map(axis => axis.axisNumber));
121
123
  await gateway.callAsync('axes/wait_until_idle', request);
122
124
  }
125
+ /**
126
+ * Returns bool indicating whether any of the axes is executing a motion command.
127
+ * @returns True if any of the axes is currently executing a motion command. False otherwise.
128
+ */
129
+ async isBusy() {
130
+ const request = new gateway.AxesEmptyRequest();
131
+ request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));
132
+ request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));
133
+ request.setAxesList(this._axes.map(axis => axis.axisNumber));
134
+ const response = await gateway.callAsync('axes/is_busy', request, gateway.BoolResponse);
135
+ return response.getValue();
136
+ }
137
+ /**
138
+ * Returns bool indicating whether all the axes are homed.
139
+ * @returns True if all the axes are homed. False otherwise.
140
+ */
141
+ async isHomed() {
142
+ const request = new gateway.AxesEmptyRequest();
143
+ request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));
144
+ request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));
145
+ request.setAxesList(this._axes.map(axis => axis.axisNumber));
146
+ const response = await gateway.callAsync('axes/is_homed', request, gateway.BoolResponse);
147
+ return response.getValue();
148
+ }
123
149
  /**
124
150
  * Returns current axes position.
125
151
  * The positions are requested sequentially.
@@ -1 +1 @@
1
- {"version":3,"file":"axis_group.js","sourceRoot":"","sources":["../../../src/ascii/axis_group.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtD,gDAA6C;AAE7C,oDAAsC;AAEtC;;;;GAIG;AACH,MAAa,SAAS;IACpB;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAGD;;OAEG;IACH,YAAY,IAAY;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI;QACf,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC/C,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;QACtF,OAAO,CAAC,cAAc,CAAC,IAAI,CA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AC;IAED;;;OAGG;IACI,QAAQ;QACb,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC/C,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;QACtF,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QAE7D,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAC/B,gBAAgB,EAChB,OAAO,EACP,OAAO,CAAC,cAAc,CAAC,CAAC;QAC1B,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;CACF;AApJD,8BAoJC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Axis } from './axis';\nimport { Measurement } from '../measurement';\nimport { Angle, Length, Native } from '../units';\nimport * as gateway from '../gateway';\n\n/**\n * Groups multiple axes across devices into a single group to allow for simultaneous movement.\n * Note that the movement is not coordinated and trajectory is inconsistent and not repeatable between calls.\n * Make sure that any possible trajectory is clear of potential obstacles.\n */\nexport class AxisGroup {\n /**\n * Axes of the group.\n */\n public get axes(): Axis[] {\n return this._axes;\n }\n private _axes: Axis[];\n\n /**\n * Initializes the group with the axes to be controlled.\n */\n constructor(axes: Axis[]) {\n this._axes = axes.slice();\n }\n\n /**\n * Homes the axes.\n */\n public async home(): Promise<void> {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n await gateway.callAsync('axes/home', request);\n }\n\n /**\n * Stops the axes.\n */\n public async stop(): Promise<void> {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n await gateway.callAsync('axes/stop', request);\n }\n\n /**\n * Moves the axes to absolute position.\n * @param position Position.\n */\n public async moveAbsolute(\n ...position: Measurement[]\n ): Promise<void> {\n const request = new gateway.AxesMoveRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n request.setPositionList(position.map(Measurement.toProtobuf));\n\n await gateway.callAsync('axes/move_absolute', request);\n }\n\n /**\n * Move axes to position relative to the current position.\n * @param position Position.\n */\n public async moveRelative(\n ...position: Measurement[]\n ): Promise<void> {\n const request = new gateway.AxesMoveRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n request.setPositionList(position.map(Measurement.toProtobuf));\n\n await gateway.callAsync('axes/move_relative', request);\n }\n\n /**\n * Moves axes to the minimum position as specified by limit.min.\n */\n public async moveMin(): Promise<void> {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n await gateway.callAsync('axes/move_min', request);\n }\n\n /**\n * Moves axes to the maximum position as specified by limit.max.\n */\n public async moveMax(): Promise<void> {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n await gateway.callAsync('axes/move_max', request);\n }\n\n /**\n * Waits until all the axes stop moving.\n */\n public async waitUntilIdle(): Promise<void> {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n await gateway.callAsync('axes/wait_until_idle', request);\n }\n\n /**\n * Returns current axes position.\n * The positions are requested sequentially.\n * The result position may not be accurate if the axes are moving.\n * @param unit Units of position. You can specify units once or for each axis separately.\n * @returns Axes position.\n */\n public async getPosition(\n ...unit: (Length | Angle | Native)[]\n ): Promise<number[]> {\n const request = new gateway.AxesGetSettingRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n request.setSetting('pos');\n request.setUnitList(unit);\n\n const response = await gateway.callAsync<gateway.DoubleArrayResponse>(\n 'axes/get_setting',\n request,\n gateway.DoubleArrayResponse);\n return response.getValuesList();\n }\n\n /**\n * Returns a string that represents the axes.\n * @returns A string that represents the axes.\n */\n public toString(): string {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n const response = gateway.callSync<gateway.StringResponse>(\n 'axes/to_string',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n}\n\nnamespace AxisGroup {\n}\n"]}
1
+ {"version":3,"file":"axis_group.js","sourceRoot":"","sources":["../../../src/ascii/axis_group.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;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CAAC,QAAQ,CAC/B,gBAAgB,EAChB,OAAO,EACP,OAAO,CAAC,cAAc,CAAC,CAAC;QAC1B,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;CACF;AAtLD,8BAsLC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Axis } from './axis';\nimport { Measurement } from '../measurement';\nimport { Angle, Length, Native } from '../units';\nimport * as gateway from '../gateway';\n\n/**\n * Groups multiple axes across devices into a single group to allow for simultaneous movement.\n * Note that the movement is not coordinated and trajectory is inconsistent and not repeatable between calls.\n * Make sure that any possible trajectory is clear of potential obstacles.\n * The movement methods return after all the axes finish the movement successfully\n * or throw an error as soon as possible.\n */\nexport class AxisGroup {\n /**\n * Axes of the group.\n */\n public get axes(): Axis[] {\n return this._axes;\n }\n private _axes: Axis[];\n\n /**\n * Initializes the group with the axes to be controlled.\n */\n constructor(axes: Axis[]) {\n this._axes = axes.slice();\n }\n\n /**\n * Homes the axes.\n */\n public async home(): Promise<void> {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n await gateway.callAsync('axes/home', request);\n }\n\n /**\n * Stops the axes.\n */\n public async stop(): Promise<void> {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n await gateway.callAsync('axes/stop', request);\n }\n\n /**\n * Moves the axes to absolute position.\n * @param position Position.\n */\n public async moveAbsolute(\n ...position: Measurement[]\n ): Promise<void> {\n const request = new gateway.AxesMoveRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n request.setPositionList(position.map(Measurement.toProtobuf));\n\n await gateway.callAsync('axes/move_absolute', request);\n }\n\n /**\n * Move axes to position relative to the current position.\n * @param position Position.\n */\n public async moveRelative(\n ...position: Measurement[]\n ): Promise<void> {\n const request = new gateway.AxesMoveRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n request.setPositionList(position.map(Measurement.toProtobuf));\n\n await gateway.callAsync('axes/move_relative', request);\n }\n\n /**\n * Moves axes to the minimum position as specified by limit.min.\n */\n public async moveMin(): Promise<void> {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n await gateway.callAsync('axes/move_min', request);\n }\n\n /**\n * Moves axes to the maximum position as specified by limit.max.\n */\n public async moveMax(): Promise<void> {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n await gateway.callAsync('axes/move_max', request);\n }\n\n /**\n * Waits until all the axes stop moving.\n */\n public async waitUntilIdle(): Promise<void> {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n await gateway.callAsync('axes/wait_until_idle', request);\n }\n\n /**\n * Returns bool indicating whether any of the axes is executing a motion command.\n * @returns True if any of the axes is currently executing a motion command. False otherwise.\n */\n public async isBusy(): Promise<boolean> {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n const response = await gateway.callAsync<gateway.BoolResponse>(\n 'axes/is_busy',\n request,\n gateway.BoolResponse);\n return response.getValue();\n }\n\n /**\n * Returns bool indicating whether all the axes are homed.\n * @returns True if all the axes are homed. False otherwise.\n */\n public async isHomed(): Promise<boolean> {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n const response = await gateway.callAsync<gateway.BoolResponse>(\n 'axes/is_homed',\n request,\n gateway.BoolResponse);\n return response.getValue();\n }\n\n /**\n * Returns current axes position.\n * The positions are requested sequentially.\n * The result position may not be accurate if the axes are moving.\n * @param unit Units of position. You can specify units once or for each axis separately.\n * @returns Axes position.\n */\n public async getPosition(\n ...unit: (Length | Angle | Native)[]\n ): Promise<number[]> {\n const request = new gateway.AxesGetSettingRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n request.setSetting('pos');\n request.setUnitList(unit);\n\n const response = await gateway.callAsync<gateway.DoubleArrayResponse>(\n 'axes/get_setting',\n request,\n gateway.DoubleArrayResponse);\n return response.getValuesList();\n }\n\n /**\n * Returns a string that represents the axes.\n * @returns A string that represents the axes.\n */\n public toString(): string {\n const request = new gateway.AxesEmptyRequest();\n request.setInterfacesList(this._axes.map(axis => axis.device.connection.interfaceId));\n request.setDevicesList(this._axes.map(axis => axis.device.deviceAddress));\n request.setAxesList(this._axes.map(axis => axis.axisNumber));\n\n const response = gateway.callSync<gateway.StringResponse>(\n 'axes/to_string',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n}\n\nnamespace AxisGroup {\n}\n"]}
@@ -22,10 +22,14 @@ export declare class Connection {
22
22
  */
23
23
  static readonly DEFAULT_BAUD_RATE: number;
24
24
  /**
25
- * Commands send over this port are forwarded to the device chain.
25
+ * Commands sent over this port are forwarded to the device chain.
26
26
  * The bandwidth may be limited as the commands are forwarded over a serial connection.
27
27
  */
28
28
  static readonly TCP_PORT_CHAIN: number;
29
+ /**
30
+ * Local area network share port.
31
+ */
32
+ static readonly NETWORK_SHARE_PORT: number;
29
33
  /**
30
34
  * Commands send over this port are processed only by the device
31
35
  * and not forwarded to the rest of the chain.
@@ -92,13 +96,13 @@ export declare class Connection {
92
96
  * Opens a connection to Zaber Launcher in your Local Area Network.
93
97
  * The connection is not secured.
94
98
  * @param hostName Hostname or IP address.
95
- * @param port Port number.
99
+ * @param [port=Connection.NETWORK_SHARE_PORT] Port number.
96
100
  * @param [connectionName=''] The name of the connection to open.
97
101
  * Can be left empty to default to the only connection present.
98
102
  * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.
99
103
  * @returns An object representing the connection.
100
104
  */
101
- static openNetworkShare(hostName: string, port: number, connectionName?: string): Promise<Connection>;
105
+ static openNetworkShare(hostName: string, port?: number, connectionName?: string): Promise<Connection>;
102
106
  /**
103
107
  * Sends a generic ASCII command to this connection.
104
108
  * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
@@ -144,13 +144,13 @@ class Connection {
144
144
  * Opens a connection to Zaber Launcher in your Local Area Network.
145
145
  * The connection is not secured.
146
146
  * @param hostName Hostname or IP address.
147
- * @param port Port number.
147
+ * @param [port=Connection.NETWORK_SHARE_PORT] Port number.
148
148
  * @param [connectionName=''] The name of the connection to open.
149
149
  * Can be left empty to default to the only connection present.
150
150
  * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.
151
151
  * @returns An object representing the connection.
152
152
  */
153
- static async openNetworkShare(hostName, port, connectionName = '') {
153
+ static async openNetworkShare(hostName, port = Connection.NETWORK_SHARE_PORT, connectionName = '') {
154
154
  const request = new gateway.OpenInterfaceRequest();
155
155
  request.setInterfaceType(gateway.InterfaceType.NETWORK_SHARE);
156
156
  request.setHostName(hostName);
@@ -399,10 +399,14 @@ exports.Connection = Connection;
399
399
  */
400
400
  Connection.DEFAULT_BAUD_RATE = 115200;
401
401
  /**
402
- * Commands send over this port are forwarded to the device chain.
402
+ * Commands sent over this port are forwarded to the device chain.
403
403
  * The bandwidth may be limited as the commands are forwarded over a serial connection.
404
404
  */
405
405
  Connection.TCP_PORT_CHAIN = 55550;
406
+ /**
407
+ * Local area network share port.
408
+ */
409
+ Connection.NETWORK_SHARE_PORT = 11421;
406
410
  /**
407
411
  * Commands send over this port are processed only by the device
408
412
  * and not forwarded to the rest of the chain.
@@ -1 +1 @@
1
- {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/ascii/connection.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,+BAAiD;AACjD,8CAA8D;AAC9D,oDAAsC;AACtC,wCAAiD;AAEjD,qCAAkC;AAClC,yCAAsC;AACtC,qEAAgE;AAChE,+CAA2C;AAG3C;;GAEG;AACH,MAAa,UAAU;IA6BrB;;OAEG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAGD;;;;OAIG;IACH,IAAW,qBAAqB;QAC9B,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACjC,CAAC;IAED,IAAW,qBAAqB,CAAC,KAAa;QAC5C,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACzC,CAAC;IAED,IAAW,eAAe,CAAC,KAAc;QACvC,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,YAAY,WAAmB;QAqdvB,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P,IAAA,eAAG,EAAC,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAC1F,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC;;AAhjBH,gCAijBC;AAtiBC;;GAEG;AACoB,4BAAiB,GAAW,MAAM,CAAC;AAE1D;;;GAGG;AACoB,yBAAc,GAAW,KAAK,CAAC;AAEtD;;;;GAIG;AACoB,+BAAoB,GAAW,KAAK,CAAC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Observable, ReplaySubject } from 'rxjs';\nimport { map, filter, takeUntil, take } from 'rxjs/operators';\nimport * as gateway from '../gateway';\nimport { events, filterEvent } from '../gateway';\nimport { Transport } from './transport';\nimport { Device } from './device';\nimport { Response } from './response';\nimport { UnknownResponseEvent } from './unknown_response_event';\nimport { AlertEvent } from './alert_event';\nimport { MotionLibException } from '../exceptions';\n\n/**\n * Class representing access to particular connection (serial port, TCP connection).\n */\nexport class Connection {\n /**\n * Event invoked when a response from a device cannot be matched to any known request.\n */\n public unknownResponse!: Observable<UnknownResponseEvent>;\n\n /**\n * Event invoked when an alert is received from a device.\n */\n public alert!: Observable<AlertEvent>;\n\n /**\n * Default baud rate for serial connections.\n */\n public static readonly DEFAULT_BAUD_RATE: number = 115200;\n\n /**\n * Commands send over this port are forwarded to the device chain.\n * The bandwidth may be limited as the commands are forwarded over a serial connection.\n */\n public static readonly TCP_PORT_CHAIN: number = 55550;\n\n /**\n * Commands send over this port are processed only by the device\n * and not forwarded to the rest of the chain.\n * Using this port typically makes the communication faster.\n */\n public static readonly TCP_PORT_DEVICE_ONLY: number = 55551;\n\n /**\n * The interface ID identifies this Connection instance with the underlying library.\n */\n public get interfaceId(): number {\n return this._interfaceId;\n }\n private _interfaceId: number;\n\n /**\n * The default timeout, in milliseconds, for a device to respond to a request.\n * Setting the timeout to a too low value may cause request timeout exceptions.\n * The initial value is 1000 (one second).\n */\n public get defaultRequestTimeout(): number {\n return this._retrieveTimeout();\n }\n\n public set defaultRequestTimeout(value: number) {\n this._changeTimeout(value);\n }\n\n /**\n * Controls whether outgoing messages contain checksum.\n */\n public get checksumEnabled(): boolean {\n return this._retrieveChecksumEnabled();\n }\n\n public set checksumEnabled(value: boolean) {\n this._changeChecksumEnabled(value);\n }\n\n constructor(interfaceId: number) {\n this._interfaceId = interfaceId;\n this._subscribe();\n }\n\n /**\n * Opens a serial port, if Zaber Launcher controls the port, the port will be opened through Zaber Launcher.\n * Zaber Launcher allows sharing of the port between multiple applications,\n * If port sharing is not desirable, use the `direct` parameter.\n * @param portName Name of the port to open.\n * @param [options.baudRate=Connection.DEFAULT_BAUD_RATE] Optional baud rate (defaults to 115200).\n * @param [options.direct=false] If true will connect to the serial port directly,\n * failing if the connection is already opened by a message router instance.\n * @returns An object representing the port.\n */\n public static async openSerialPort(\n portName: string,\n options: Connection.OpenSerialPortOptions = {}\n ): Promise<Connection> {\n const {\n baudRate = Connection.DEFAULT_BAUD_RATE,\n direct = false,\n } = options;\n const request = new gateway.OpenInterfaceRequest();\n request.setInterfaceType(gateway.InterfaceType.SERIAL_PORT);\n request.setPortName(portName);\n request.setBaudRate(baudRate);\n request.setRejectRoutedConnection(direct);\n\n const response = await gateway.callAsync<gateway.OpenInterfaceResponse>(\n 'interface/open',\n request,\n gateway.OpenInterfaceResponse);\n return new Connection(response.getInterfaceId());\n }\n\n /**\n * Opens a TCP connection.\n * @param hostName Hostname or IP address.\n * @param [port=Connection.TCP_PORT_CHAIN] Optional port number (defaults to 55550).\n * @returns An object representing the connection.\n */\n public static async openTcp(\n hostName: string,\n port: number = Connection.TCP_PORT_CHAIN\n ): Promise<Connection> {\n const request = new gateway.OpenInterfaceRequest();\n request.setInterfaceType(gateway.InterfaceType.TCP);\n request.setHostName(hostName);\n request.setPort(port);\n\n const response = await gateway.callAsync<gateway.OpenInterfaceResponse>(\n 'interface/open',\n request,\n gateway.OpenInterfaceResponse);\n return new Connection(response.getInterfaceId());\n }\n\n /**\n * Opens a connection using a custom transport.\n * @param transport The custom connection transport.\n * @returns An object representing the connection.\n */\n public static async openCustom(\n transport: Transport\n ): Promise<Connection> {\n const request = new gateway.OpenInterfaceRequest();\n request.setInterfaceType(gateway.InterfaceType.CUSTOM);\n request.setTransport(transport.transportId);\n\n const response = await gateway.callAsync<gateway.OpenInterfaceResponse>(\n 'interface/open',\n request,\n gateway.OpenInterfaceResponse);\n return new Connection(response.getInterfaceId());\n }\n\n /**\n * Opens a secured connection to a cloud connected device chain.\n * Use this method to connect to devices on your account.\n * @param cloudId The cloud ID to connect to.\n * @param [options.token='unauthenticated'] The token to authenticate with. By default the connection will be unauthenticated.\n * @param [options.connectionName=''] The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n * @param [options.realm=''] The realm to connect to.\n * Can be left empty for the default account realm.\n * @param [options.api='https://api.zaber.io'] The URL of the API to receive connection info from.\n * @returns An object representing the connection.\n */\n public static async openIot(\n cloudId: string,\n options: Connection.OpenIotOptions = {}\n ): Promise<Connection> {\n const {\n token = 'unauthenticated',\n connectionName = '',\n realm = '',\n api = 'https://api.zaber.io',\n } = options;\n const request = new gateway.OpenInterfaceRequest();\n request.setInterfaceType(gateway.InterfaceType.IOT);\n request.setCloudId(cloudId);\n request.setToken(token);\n request.setConnectionName(connectionName);\n request.setRealm(realm);\n request.setApi(api);\n\n const response = await gateway.callAsync<gateway.OpenInterfaceResponse>(\n 'interface/open',\n request,\n gateway.OpenInterfaceResponse);\n return new Connection(response.getInterfaceId());\n }\n\n /**\n * Opens a connection to Zaber Launcher in your Local Area Network.\n * The connection is not secured.\n * @param hostName Hostname or IP address.\n * @param port Port number.\n * @param [connectionName=''] The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n * @returns An object representing the connection.\n */\n public static async openNetworkShare(\n hostName: string,\n port: number,\n connectionName: string = ''\n ): Promise<Connection> {\n const request = new gateway.OpenInterfaceRequest();\n request.setInterfaceType(gateway.InterfaceType.NETWORK_SHARE);\n request.setHostName(hostName);\n request.setPort(port);\n request.setConnectionName(connectionName);\n\n const response = await gateway.callAsync<gateway.OpenInterfaceResponse>(\n 'interface/open',\n request,\n gateway.OpenInterfaceResponse);\n return new Connection(response.getInterfaceId());\n }\n\n /**\n * Sends a generic ASCII command to this connection.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * @param [options.axis=0] Optional axis number to send the command to.\n * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns A response to the command.\n */\n public async genericCommand(\n command: string,\n options: Connection.GenericCommandOptions = {}\n ): Promise<Response> {\n const {\n device = 0,\n axis = 0,\n checkErrors = true,\n timeout = 0,\n } = options;\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.interfaceId);\n request.setCommand(command);\n request.setDevice(device);\n request.setAxis(axis);\n request.setCheckErrors(checkErrors);\n request.setTimeout(timeout);\n\n const response = await gateway.callAsync<gateway.GenericCommandResponse>(\n 'interface/generic_command',\n request,\n gateway.GenericCommandResponse);\n return Response.fromProtobuf(response.toObject());\n }\n\n /**\n * Sends a generic ASCII command to this connection without expecting a response and without adding a message ID.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * Specifying -1 omits the number completely.\n * @param [options.axis=0] Optional axis number to send the command to.\n * Specifying -1 omits the number completely.\n */\n public async genericCommandNoResponse(\n command: string,\n options: Connection.GenericCommandNoResponseOptions = {}\n ): Promise<void> {\n const {\n device = 0,\n axis = 0,\n } = options;\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.interfaceId);\n request.setCommand(command);\n request.setDevice(device);\n request.setAxis(axis);\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Sends a generic ASCII command to this connection and expect multiple responses,\n * either from one device or from many devices.\n * Responses are returned in order of arrival.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * @param [options.axis=0] Optional axis number to send the command to.\n * @param [options.checkErrors=true] Controls whether to throw an exception when a device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns All responses to the command.\n */\n public async genericCommandMultiResponse(\n command: string,\n options: Connection.GenericCommandMultiResponseOptions = {}\n ): Promise<Response[]> {\n const {\n device = 0,\n axis = 0,\n checkErrors = true,\n timeout = 0,\n } = options;\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.interfaceId);\n request.setCommand(command);\n request.setDevice(device);\n request.setAxis(axis);\n request.setCheckErrors(checkErrors);\n request.setTimeout(timeout);\n\n const response = await gateway.callAsync<gateway.GenericCommandResponseCollection>(\n 'interface/generic_command_multi_response',\n request,\n gateway.GenericCommandResponseCollection);\n return response.getResponsesList().map(a => Response.fromProtobuf(a.toObject()));\n }\n\n /**\n * Enables alerts for all devices on the connection.\n * This will change the \"comm.alert\" setting to 1 on all supported devices.\n */\n public async enableAlerts(): Promise<void> {\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.interfaceId);\n request.setCommand('set comm.alert 1');\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Disables alerts for all devices on the connection.\n * This will change the \"comm.alert\" setting to 0 on all supported devices.\n */\n public async disableAlerts(): Promise<void> {\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.interfaceId);\n request.setCommand('set comm.alert 0');\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Resets ASCII protocol message IDs. Only for testing purposes.\n */\n public resetIds(): void {\n const request = new gateway.InterfaceEmptyRequest();\n request.setInterfaceId(this.interfaceId);\n\n gateway.callSync('interface/reset_ids', request);\n }\n\n /**\n * Close the connection.\n */\n public async close(): Promise<void> {\n const request = new gateway.InterfaceEmptyRequest();\n request.setInterfaceId(this.interfaceId);\n\n await gateway.callAsync('interface/close', request);\n }\n\n /**\n * Gets a Device class instance which allows you to control a particular device on this connection.\n * Devices are numbered from 1.\n * @param deviceAddress Address of device intended to control. Address is configured for each device.\n * @returns Device instance.\n */\n public getDevice(\n deviceAddress: number\n ): Device {\n if (deviceAddress <= 0) {\n throw new TypeError('Invalid value; physical devices are numbered from 1.');\n }\n return new Device(this, deviceAddress);\n }\n\n /**\n * Renumbers devices present on this connection. After renumbering, devices need to be identified again.\n * @param [options.firstAddress=1] This is the address that the device closest to the computer is given.\n * Remaining devices are numbered consecutively.\n * @returns Total number of devices that responded to the renumber.\n */\n public async renumberDevices(\n options: Connection.RenumberDevicesOptions = {}\n ): Promise<number> {\n const {\n firstAddress = 1,\n } = options;\n if (firstAddress <= 0) {\n throw new TypeError('Invalid value; device addresses are numbered from 1.');\n }\n const request = new gateway.DeviceRenumberRequest();\n request.setInterfaceId(this.interfaceId);\n request.setFirstAddress(firstAddress);\n\n const response = await gateway.callAsync<gateway.IntResponse>(\n 'device/renumber',\n request,\n gateway.IntResponse);\n return response.getValue();\n }\n\n /**\n * Attempts to detect any devices present on this connection.\n * @param [options.identifyDevices=true] Determines whether device identification should be performed as well.\n * @returns Array of detected devices.\n */\n public async detectDevices(\n options: Connection.DetectDevicesOptions = {}\n ): Promise<Device[]> {\n const {\n identifyDevices = true,\n } = options;\n const request = new gateway.DeviceDetectRequest();\n request.setInterfaceId(this.interfaceId);\n request.setIdentifyDevices(identifyDevices);\n\n const response = await gateway.callAsync<gateway.DeviceDetectResponse>(\n 'device/detect',\n request,\n gateway.DeviceDetectResponse);\n return response.getDevicesList().map(deviceAddress => this.getDevice(deviceAddress));\n }\n\n /**\n * Stops all of the devices on this connection.\n * @param [options.waitUntilIdle=true] Determines whether the function should return immediately\n * or wait until the devices are stopped.\n * @returns The addresses of the devices that were stopped by this command.\n */\n public async stopAll(\n options: Connection.StopAllOptions = {}\n ): Promise<number[]> {\n const {\n waitUntilIdle = true,\n } = options;\n const request = new gateway.DeviceOnAllRequest();\n request.setInterfaceId(this.interfaceId);\n request.setWaitUntilIdle(waitUntilIdle);\n\n const response = await gateway.callAsync<gateway.DeviceOnAllResponse>(\n 'device/stop_all',\n request,\n gateway.DeviceOnAllResponse);\n return response.getDeviceAddressesList();\n }\n\n /**\n * Homes all of the devices on this connection.\n * @param [options.waitUntilIdle=true] Determines whether the function should return immediately\n * or wait until the devices are homed.\n * @returns The addresses of the devices that were homed by this command.\n */\n public async homeAll(\n options: Connection.HomeAllOptions = {}\n ): Promise<number[]> {\n const {\n waitUntilIdle = true,\n } = options;\n const request = new gateway.DeviceOnAllRequest();\n request.setInterfaceId(this.interfaceId);\n request.setWaitUntilIdle(waitUntilIdle);\n\n const response = await gateway.callAsync<gateway.DeviceOnAllResponse>(\n 'device/home_all',\n request,\n gateway.DeviceOnAllResponse);\n return response.getDeviceAddressesList();\n }\n\n /**\n * Returns a string that represents the connection.\n * @returns A string that represents the connection.\n */\n public toString(): string {\n const request = new gateway.InterfaceEmptyRequest();\n request.setInterfaceId(this.interfaceId);\n\n const response = gateway.callSync<gateway.StringResponse>(\n 'interface/to_string',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n\n /**\n * Returns default request timeout.\n * @returns Default request timeout.\n */\n private _retrieveTimeout(): number {\n const request = new gateway.InterfaceEmptyRequest();\n request.setInterfaceId(this.interfaceId);\n\n const response = gateway.callSync<gateway.IntResponse>(\n 'interface/get_timeout',\n request,\n gateway.IntResponse);\n return response.getValue();\n }\n\n /**\n * Sets default request timeout.\n * @param timeout Default request timeout.\n */\n private _changeTimeout(\n timeout: number\n ): void {\n const request = new gateway.SetInterfaceTimeoutRequest();\n request.setInterfaceId(this.interfaceId);\n request.setTimeout(timeout);\n\n gateway.callSync('interface/set_timeout', request);\n }\n\n /**\n * Returns checksum enabled.\n * @returns Checksum enabled.\n */\n private _retrieveChecksumEnabled(): boolean {\n const request = new gateway.InterfaceEmptyRequest();\n request.setInterfaceId(this.interfaceId);\n\n const response = gateway.callSync<gateway.BoolResponse>(\n 'interface/get_checksum_enabled',\n request,\n gateway.BoolResponse);\n return response.getValue();\n }\n\n /**\n * Sets checksum enabled.\n * @param isEnabled Checksum enabled.\n */\n private _changeChecksumEnabled(\n isEnabled: boolean\n ): void {\n const request = new gateway.SetInterfaceChecksumEnabledRequest();\n request.setInterfaceId(this.interfaceId);\n request.setIsEnabled(isEnabled);\n\n gateway.callSync('interface/set_checksum_enabled', request);\n }\n\n private _disconnected = new ReplaySubject<MotionLibException>();\n\n /**\n * Event invoked when connection is interrupted or closed.\n */\n public get disconnected(): Observable<MotionLibException> {\n return this._disconnected;\n }\n\n private _subscribe(): void {\n this.unknownResponse = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<gateway.UnknownResponseEvent.AsObject>('interface/unknown_response'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => UnknownResponseEvent.fromProtobuf(event))\n );\n\n this.alert = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<gateway.AlertEvent.AsObject>('interface/alert'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => AlertEvent.fromProtobuf(event))\n );\n\n events.pipe(\n filterEvent<gateway.DisconnectedEvent.AsObject>('interface/disconnected'),\n filter(event => event.interfaceId === this.interfaceId),\n take(1),\n map(({ errorMessage, errorType }) => gateway.convertToException(errorType, errorMessage))\n ).subscribe(this._disconnected);\n }\n}\n\nnamespace Connection {\n export interface OpenSerialPortOptions {\n baudRate?: number;\n direct?: boolean;\n }\n export interface OpenIotOptions {\n token?: string;\n connectionName?: string;\n realm?: string;\n api?: string;\n }\n export interface GenericCommandOptions {\n device?: number;\n axis?: number;\n checkErrors?: boolean;\n timeout?: number;\n }\n export interface GenericCommandNoResponseOptions {\n device?: number;\n axis?: number;\n }\n export interface GenericCommandMultiResponseOptions {\n device?: number;\n axis?: number;\n checkErrors?: boolean;\n timeout?: number;\n }\n export interface RenumberDevicesOptions {\n firstAddress?: number;\n }\n export interface DetectDevicesOptions {\n identifyDevices?: boolean;\n }\n export interface StopAllOptions {\n waitUntilIdle?: boolean;\n }\n export interface HomeAllOptions {\n waitUntilIdle?: boolean;\n }\n}\n"]}
1
+ {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/ascii/connection.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,+BAAiD;AACjD,8CAA8D;AAC9D,oDAAsC;AACtC,wCAAiD;AAEjD,qCAAkC;AAClC,yCAAsC;AACtC,qEAAgE;AAChE,+CAA2C;AAG3C;;GAEG;AACH,MAAa,UAAU;IAkCrB;;OAEG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAGD;;;;OAIG;IACH,IAAW,qBAAqB;QAC9B,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACjC,CAAC;IAED,IAAW,qBAAqB,CAAC,KAAa;QAC5C,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACzC,CAAC;IAED,IAAW,eAAe,CAAC,KAAc;QACvC,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,YAAY,WAAmB;QAqdvB,kBAAa,GAAG,IAAI,oBAAa,EAAsB,CAAC;QApd9D,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,UAAU,EAAE,CAAC;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AC,SAAS,EAAE,YAAY,CAAC,CAAC,CAC1F,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC;;AArjBH,gCAsjBC;AA3iBC;;GAEG;AACoB,4BAAiB,GAAW,MAAM,CAAC;AAE1D;;;GAGG;AACoB,yBAAc,GAAW,KAAK,CAAC;AAEtD;;GAEG;AACoB,6BAAkB,GAAW,KAAK,CAAC;AAE1D;;;;GAIG;AACoB,+BAAoB,GAAW,KAAK,CAAC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Observable, ReplaySubject } from 'rxjs';\nimport { map, filter, takeUntil, take } from 'rxjs/operators';\nimport * as gateway from '../gateway';\nimport { events, filterEvent } from '../gateway';\nimport { Transport } from './transport';\nimport { Device } from './device';\nimport { Response } from './response';\nimport { UnknownResponseEvent } from './unknown_response_event';\nimport { AlertEvent } from './alert_event';\nimport { MotionLibException } from '../exceptions';\n\n/**\n * Class representing access to particular connection (serial port, TCP connection).\n */\nexport class Connection {\n /**\n * Event invoked when a response from a device cannot be matched to any known request.\n */\n public unknownResponse!: Observable<UnknownResponseEvent>;\n\n /**\n * Event invoked when an alert is received from a device.\n */\n public alert!: Observable<AlertEvent>;\n\n /**\n * Default baud rate for serial connections.\n */\n public static readonly DEFAULT_BAUD_RATE: number = 115200;\n\n /**\n * Commands sent over this port are forwarded to the device chain.\n * The bandwidth may be limited as the commands are forwarded over a serial connection.\n */\n public static readonly TCP_PORT_CHAIN: number = 55550;\n\n /**\n * Local area network share port.\n */\n public static readonly NETWORK_SHARE_PORT: number = 11421;\n\n /**\n * Commands send over this port are processed only by the device\n * and not forwarded to the rest of the chain.\n * Using this port typically makes the communication faster.\n */\n public static readonly TCP_PORT_DEVICE_ONLY: number = 55551;\n\n /**\n * The interface ID identifies this Connection instance with the underlying library.\n */\n public get interfaceId(): number {\n return this._interfaceId;\n }\n private _interfaceId: number;\n\n /**\n * The default timeout, in milliseconds, for a device to respond to a request.\n * Setting the timeout to a too low value may cause request timeout exceptions.\n * The initial value is 1000 (one second).\n */\n public get defaultRequestTimeout(): number {\n return this._retrieveTimeout();\n }\n\n public set defaultRequestTimeout(value: number) {\n this._changeTimeout(value);\n }\n\n /**\n * Controls whether outgoing messages contain checksum.\n */\n public get checksumEnabled(): boolean {\n return this._retrieveChecksumEnabled();\n }\n\n public set checksumEnabled(value: boolean) {\n this._changeChecksumEnabled(value);\n }\n\n constructor(interfaceId: number) {\n this._interfaceId = interfaceId;\n this._subscribe();\n }\n\n /**\n * Opens a serial port, if Zaber Launcher controls the port, the port will be opened through Zaber Launcher.\n * Zaber Launcher allows sharing of the port between multiple applications,\n * If port sharing is not desirable, use the `direct` parameter.\n * @param portName Name of the port to open.\n * @param [options.baudRate=Connection.DEFAULT_BAUD_RATE] Optional baud rate (defaults to 115200).\n * @param [options.direct=false] If true will connect to the serial port directly,\n * failing if the connection is already opened by a message router instance.\n * @returns An object representing the port.\n */\n public static async openSerialPort(\n portName: string,\n options: Connection.OpenSerialPortOptions = {}\n ): Promise<Connection> {\n const {\n baudRate = Connection.DEFAULT_BAUD_RATE,\n direct = false,\n } = options;\n const request = new gateway.OpenInterfaceRequest();\n request.setInterfaceType(gateway.InterfaceType.SERIAL_PORT);\n request.setPortName(portName);\n request.setBaudRate(baudRate);\n request.setRejectRoutedConnection(direct);\n\n const response = await gateway.callAsync<gateway.OpenInterfaceResponse>(\n 'interface/open',\n request,\n gateway.OpenInterfaceResponse);\n return new Connection(response.getInterfaceId());\n }\n\n /**\n * Opens a TCP connection.\n * @param hostName Hostname or IP address.\n * @param [port=Connection.TCP_PORT_CHAIN] Optional port number (defaults to 55550).\n * @returns An object representing the connection.\n */\n public static async openTcp(\n hostName: string,\n port: number = Connection.TCP_PORT_CHAIN\n ): Promise<Connection> {\n const request = new gateway.OpenInterfaceRequest();\n request.setInterfaceType(gateway.InterfaceType.TCP);\n request.setHostName(hostName);\n request.setPort(port);\n\n const response = await gateway.callAsync<gateway.OpenInterfaceResponse>(\n 'interface/open',\n request,\n gateway.OpenInterfaceResponse);\n return new Connection(response.getInterfaceId());\n }\n\n /**\n * Opens a connection using a custom transport.\n * @param transport The custom connection transport.\n * @returns An object representing the connection.\n */\n public static async openCustom(\n transport: Transport\n ): Promise<Connection> {\n const request = new gateway.OpenInterfaceRequest();\n request.setInterfaceType(gateway.InterfaceType.CUSTOM);\n request.setTransport(transport.transportId);\n\n const response = await gateway.callAsync<gateway.OpenInterfaceResponse>(\n 'interface/open',\n request,\n gateway.OpenInterfaceResponse);\n return new Connection(response.getInterfaceId());\n }\n\n /**\n * Opens a secured connection to a cloud connected device chain.\n * Use this method to connect to devices on your account.\n * @param cloudId The cloud ID to connect to.\n * @param [options.token='unauthenticated'] The token to authenticate with. By default the connection will be unauthenticated.\n * @param [options.connectionName=''] The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n * @param [options.realm=''] The realm to connect to.\n * Can be left empty for the default account realm.\n * @param [options.api='https://api.zaber.io'] The URL of the API to receive connection info from.\n * @returns An object representing the connection.\n */\n public static async openIot(\n cloudId: string,\n options: Connection.OpenIotOptions = {}\n ): Promise<Connection> {\n const {\n token = 'unauthenticated',\n connectionName = '',\n realm = '',\n api = 'https://api.zaber.io',\n } = options;\n const request = new gateway.OpenInterfaceRequest();\n request.setInterfaceType(gateway.InterfaceType.IOT);\n request.setCloudId(cloudId);\n request.setToken(token);\n request.setConnectionName(connectionName);\n request.setRealm(realm);\n request.setApi(api);\n\n const response = await gateway.callAsync<gateway.OpenInterfaceResponse>(\n 'interface/open',\n request,\n gateway.OpenInterfaceResponse);\n return new Connection(response.getInterfaceId());\n }\n\n /**\n * Opens a connection to Zaber Launcher in your Local Area Network.\n * The connection is not secured.\n * @param hostName Hostname or IP address.\n * @param [port=Connection.NETWORK_SHARE_PORT] Port number.\n * @param [connectionName=''] The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n * @returns An object representing the connection.\n */\n public static async openNetworkShare(\n hostName: string,\n port: number = Connection.NETWORK_SHARE_PORT,\n connectionName: string = ''\n ): Promise<Connection> {\n const request = new gateway.OpenInterfaceRequest();\n request.setInterfaceType(gateway.InterfaceType.NETWORK_SHARE);\n request.setHostName(hostName);\n request.setPort(port);\n request.setConnectionName(connectionName);\n\n const response = await gateway.callAsync<gateway.OpenInterfaceResponse>(\n 'interface/open',\n request,\n gateway.OpenInterfaceResponse);\n return new Connection(response.getInterfaceId());\n }\n\n /**\n * Sends a generic ASCII command to this connection.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * @param [options.axis=0] Optional axis number to send the command to.\n * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns A response to the command.\n */\n public async genericCommand(\n command: string,\n options: Connection.GenericCommandOptions = {}\n ): Promise<Response> {\n const {\n device = 0,\n axis = 0,\n checkErrors = true,\n timeout = 0,\n } = options;\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.interfaceId);\n request.setCommand(command);\n request.setDevice(device);\n request.setAxis(axis);\n request.setCheckErrors(checkErrors);\n request.setTimeout(timeout);\n\n const response = await gateway.callAsync<gateway.GenericCommandResponse>(\n 'interface/generic_command',\n request,\n gateway.GenericCommandResponse);\n return Response.fromProtobuf(response.toObject());\n }\n\n /**\n * Sends a generic ASCII command to this connection without expecting a response and without adding a message ID.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * Specifying -1 omits the number completely.\n * @param [options.axis=0] Optional axis number to send the command to.\n * Specifying -1 omits the number completely.\n */\n public async genericCommandNoResponse(\n command: string,\n options: Connection.GenericCommandNoResponseOptions = {}\n ): Promise<void> {\n const {\n device = 0,\n axis = 0,\n } = options;\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.interfaceId);\n request.setCommand(command);\n request.setDevice(device);\n request.setAxis(axis);\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Sends a generic ASCII command to this connection and expect multiple responses,\n * either from one device or from many devices.\n * Responses are returned in order of arrival.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * @param [options.axis=0] Optional axis number to send the command to.\n * @param [options.checkErrors=true] Controls whether to throw an exception when a device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns All responses to the command.\n */\n public async genericCommandMultiResponse(\n command: string,\n options: Connection.GenericCommandMultiResponseOptions = {}\n ): Promise<Response[]> {\n const {\n device = 0,\n axis = 0,\n checkErrors = true,\n timeout = 0,\n } = options;\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.interfaceId);\n request.setCommand(command);\n request.setDevice(device);\n request.setAxis(axis);\n request.setCheckErrors(checkErrors);\n request.setTimeout(timeout);\n\n const response = await gateway.callAsync<gateway.GenericCommandResponseCollection>(\n 'interface/generic_command_multi_response',\n request,\n gateway.GenericCommandResponseCollection);\n return response.getResponsesList().map(a => Response.fromProtobuf(a.toObject()));\n }\n\n /**\n * Enables alerts for all devices on the connection.\n * This will change the \"comm.alert\" setting to 1 on all supported devices.\n */\n public async enableAlerts(): Promise<void> {\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.interfaceId);\n request.setCommand('set comm.alert 1');\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Disables alerts for all devices on the connection.\n * This will change the \"comm.alert\" setting to 0 on all supported devices.\n */\n public async disableAlerts(): Promise<void> {\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.interfaceId);\n request.setCommand('set comm.alert 0');\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Resets ASCII protocol message IDs. Only for testing purposes.\n */\n public resetIds(): void {\n const request = new gateway.InterfaceEmptyRequest();\n request.setInterfaceId(this.interfaceId);\n\n gateway.callSync('interface/reset_ids', request);\n }\n\n /**\n * Close the connection.\n */\n public async close(): Promise<void> {\n const request = new gateway.InterfaceEmptyRequest();\n request.setInterfaceId(this.interfaceId);\n\n await gateway.callAsync('interface/close', request);\n }\n\n /**\n * Gets a Device class instance which allows you to control a particular device on this connection.\n * Devices are numbered from 1.\n * @param deviceAddress Address of device intended to control. Address is configured for each device.\n * @returns Device instance.\n */\n public getDevice(\n deviceAddress: number\n ): Device {\n if (deviceAddress <= 0) {\n throw new TypeError('Invalid value; physical devices are numbered from 1.');\n }\n return new Device(this, deviceAddress);\n }\n\n /**\n * Renumbers devices present on this connection. After renumbering, devices need to be identified again.\n * @param [options.firstAddress=1] This is the address that the device closest to the computer is given.\n * Remaining devices are numbered consecutively.\n * @returns Total number of devices that responded to the renumber.\n */\n public async renumberDevices(\n options: Connection.RenumberDevicesOptions = {}\n ): Promise<number> {\n const {\n firstAddress = 1,\n } = options;\n if (firstAddress <= 0) {\n throw new TypeError('Invalid value; device addresses are numbered from 1.');\n }\n const request = new gateway.DeviceRenumberRequest();\n request.setInterfaceId(this.interfaceId);\n request.setFirstAddress(firstAddress);\n\n const response = await gateway.callAsync<gateway.IntResponse>(\n 'device/renumber',\n request,\n gateway.IntResponse);\n return response.getValue();\n }\n\n /**\n * Attempts to detect any devices present on this connection.\n * @param [options.identifyDevices=true] Determines whether device identification should be performed as well.\n * @returns Array of detected devices.\n */\n public async detectDevices(\n options: Connection.DetectDevicesOptions = {}\n ): Promise<Device[]> {\n const {\n identifyDevices = true,\n } = options;\n const request = new gateway.DeviceDetectRequest();\n request.setInterfaceId(this.interfaceId);\n request.setIdentifyDevices(identifyDevices);\n\n const response = await gateway.callAsync<gateway.DeviceDetectResponse>(\n 'device/detect',\n request,\n gateway.DeviceDetectResponse);\n return response.getDevicesList().map(deviceAddress => this.getDevice(deviceAddress));\n }\n\n /**\n * Stops all of the devices on this connection.\n * @param [options.waitUntilIdle=true] Determines whether the function should return immediately\n * or wait until the devices are stopped.\n * @returns The addresses of the devices that were stopped by this command.\n */\n public async stopAll(\n options: Connection.StopAllOptions = {}\n ): Promise<number[]> {\n const {\n waitUntilIdle = true,\n } = options;\n const request = new gateway.DeviceOnAllRequest();\n request.setInterfaceId(this.interfaceId);\n request.setWaitUntilIdle(waitUntilIdle);\n\n const response = await gateway.callAsync<gateway.DeviceOnAllResponse>(\n 'device/stop_all',\n request,\n gateway.DeviceOnAllResponse);\n return response.getDeviceAddressesList();\n }\n\n /**\n * Homes all of the devices on this connection.\n * @param [options.waitUntilIdle=true] Determines whether the function should return immediately\n * or wait until the devices are homed.\n * @returns The addresses of the devices that were homed by this command.\n */\n public async homeAll(\n options: Connection.HomeAllOptions = {}\n ): Promise<number[]> {\n const {\n waitUntilIdle = true,\n } = options;\n const request = new gateway.DeviceOnAllRequest();\n request.setInterfaceId(this.interfaceId);\n request.setWaitUntilIdle(waitUntilIdle);\n\n const response = await gateway.callAsync<gateway.DeviceOnAllResponse>(\n 'device/home_all',\n request,\n gateway.DeviceOnAllResponse);\n return response.getDeviceAddressesList();\n }\n\n /**\n * Returns a string that represents the connection.\n * @returns A string that represents the connection.\n */\n public toString(): string {\n const request = new gateway.InterfaceEmptyRequest();\n request.setInterfaceId(this.interfaceId);\n\n const response = gateway.callSync<gateway.StringResponse>(\n 'interface/to_string',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n\n /**\n * Returns default request timeout.\n * @returns Default request timeout.\n */\n private _retrieveTimeout(): number {\n const request = new gateway.InterfaceEmptyRequest();\n request.setInterfaceId(this.interfaceId);\n\n const response = gateway.callSync<gateway.IntResponse>(\n 'interface/get_timeout',\n request,\n gateway.IntResponse);\n return response.getValue();\n }\n\n /**\n * Sets default request timeout.\n * @param timeout Default request timeout.\n */\n private _changeTimeout(\n timeout: number\n ): void {\n const request = new gateway.SetInterfaceTimeoutRequest();\n request.setInterfaceId(this.interfaceId);\n request.setTimeout(timeout);\n\n gateway.callSync('interface/set_timeout', request);\n }\n\n /**\n * Returns checksum enabled.\n * @returns Checksum enabled.\n */\n private _retrieveChecksumEnabled(): boolean {\n const request = new gateway.InterfaceEmptyRequest();\n request.setInterfaceId(this.interfaceId);\n\n const response = gateway.callSync<gateway.BoolResponse>(\n 'interface/get_checksum_enabled',\n request,\n gateway.BoolResponse);\n return response.getValue();\n }\n\n /**\n * Sets checksum enabled.\n * @param isEnabled Checksum enabled.\n */\n private _changeChecksumEnabled(\n isEnabled: boolean\n ): void {\n const request = new gateway.SetInterfaceChecksumEnabledRequest();\n request.setInterfaceId(this.interfaceId);\n request.setIsEnabled(isEnabled);\n\n gateway.callSync('interface/set_checksum_enabled', request);\n }\n\n private _disconnected = new ReplaySubject<MotionLibException>();\n\n /**\n * Event invoked when connection is interrupted or closed.\n */\n public get disconnected(): Observable<MotionLibException> {\n return this._disconnected;\n }\n\n private _subscribe(): void {\n this.unknownResponse = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<gateway.UnknownResponseEvent.AsObject>('interface/unknown_response'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => UnknownResponseEvent.fromProtobuf(event))\n );\n\n this.alert = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<gateway.AlertEvent.AsObject>('interface/alert'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => AlertEvent.fromProtobuf(event))\n );\n\n events.pipe(\n filterEvent<gateway.DisconnectedEvent.AsObject>('interface/disconnected'),\n filter(event => event.interfaceId === this.interfaceId),\n take(1),\n map(({ errorMessage, errorType }) => gateway.convertToException(errorType, errorMessage))\n ).subscribe(this._disconnected);\n }\n}\n\nnamespace Connection {\n export interface OpenSerialPortOptions {\n baudRate?: number;\n direct?: boolean;\n }\n export interface OpenIotOptions {\n token?: string;\n connectionName?: string;\n realm?: string;\n api?: string;\n }\n export interface GenericCommandOptions {\n device?: number;\n axis?: number;\n checkErrors?: boolean;\n timeout?: number;\n }\n export interface GenericCommandNoResponseOptions {\n device?: number;\n axis?: number;\n }\n export interface GenericCommandMultiResponseOptions {\n device?: number;\n axis?: number;\n checkErrors?: boolean;\n timeout?: number;\n }\n export interface RenumberDevicesOptions {\n firstAddress?: number;\n }\n export interface DetectDevicesOptions {\n identifyDevices?: boolean;\n }\n export interface StopAllOptions {\n waitUntilIdle?: boolean;\n }\n export interface HomeAllOptions {\n waitUntilIdle?: boolean;\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { ProcessController } from './process_controller';
2
+ import { Native, Time } from '../units';
2
3
  import { Response } from '../ascii/response';
3
4
  import { AxisSettings } from '../ascii/axis_settings';
4
5
  import { AxisStorage } from '../ascii/storage';
@@ -45,9 +46,10 @@ export declare class Process {
45
46
  enable(enabled?: boolean): Promise<void>;
46
47
  /**
47
48
  * Turns this process on. In manual mode, this supplies voltage; in controlled mode, it starts the control loop.
48
- * @param [duration=0] How long to leave the process on in milliseconds.
49
+ * @param [duration=0] How long to leave the process on.
50
+ * @param [unit=Units.NATIVE] Units of time.
49
51
  */
50
- on(duration?: number): Promise<void>;
52
+ on(duration?: number, unit?: Time | Native): Promise<void>;
51
53
  /**
52
54
  * Turns this process off.
53
55
  */
@@ -27,6 +27,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
28
  exports.Process = void 0;
29
29
  const gateway = __importStar(require("../gateway"));
30
+ const units_1 = require("../units");
30
31
  const axis_1 = require("../ascii/axis");
31
32
  const response_1 = require("../ascii/response");
32
33
  const axis_settings_1 = require("../ascii/axis_settings");
@@ -91,15 +92,17 @@ class Process {
91
92
  }
92
93
  /**
93
94
  * Turns this process on. In manual mode, this supplies voltage; in controlled mode, it starts the control loop.
94
- * @param [duration=0] How long to leave the process on in milliseconds.
95
+ * @param [duration=0] How long to leave the process on.
96
+ * @param [unit=Units.NATIVE] Units of time.
95
97
  */
96
- async on(duration = 0) {
98
+ async on(duration = 0, unit = units_1.Units.NATIVE) {
97
99
  const request = new gateway.ProcessOn();
98
100
  request.setInterfaceId(this.controller.device.connection.interfaceId);
99
101
  request.setDevice(this.controller.device.deviceAddress);
100
102
  request.setAxis(this.processNumber);
101
103
  request.setOn(true);
102
104
  request.setDuration(duration);
105
+ request.setUnit(unit);
103
106
  await gateway.callAsync('process-controller/on', request);
104
107
  }
105
108
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"process.js","sourceRoot":"","sources":["../../../src/product/process.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtD,oDAAsC;AACtC,wCAAqC;AACrC,gDAA6C;AAC7C,0DAAsD;AACtD,8CAA+C;AAC/C,gDAA6C;AAE7C,2EAAsE;AACtE,gDAA6C;AAE7C;;;GAGG;AACH,MAAa,OAAO;IAClB;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAGD;;OAEG;IACH,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAKD;;OAEG;IACH,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAGD;;OAEG;IACH,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAGD;;OAEG;IACH,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAGD,YAAY,UAA6B,EAAE,aAAqB;QAC9D,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,IAAI,WAAI,CAAC,UAAU,CAAC,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,CAAC,CAAC;QACtE,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACxD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACpC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;QAEnC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAC/B,uBAAuB,EACvB,OAAO,EACP,OAAO,CAAC,cAAc,CAAC,CAAC;QAC1B,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;CACF;AA9XD,0BA8XC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { ProcessController } from './process_controller';\nimport * as gateway from '../gateway';\nimport { Axis } from '../ascii/axis';\nimport { Response } from '../ascii/response';\nimport { AxisSettings } from '../ascii/axis_settings';\nimport { AxisStorage } from '../ascii/storage';\nimport { Warnings } from '../ascii/warnings';\nimport { ProcessControllerMode } from './process_controller_mode';\nimport { ProcessControllerSource } from './process_controller_source';\nimport { Measurement } from '../measurement';\n\n/**\n * Use to drive voltage for a process such as a heater, valve, Peltier device, etc.\n * Requires at least Firmware 7.35.\n */\nexport class Process {\n /**\n * Controller for this process.\n */\n public get controller(): ProcessController {\n return this._controller;\n }\n private _controller: ProcessController;\n\n /**\n * The process number identifies the process on the controller.\n */\n public get processNumber(): number {\n return this._processNumber;\n }\n private _processNumber: number;\n\n private _axis: Axis;\n\n /**\n * Settings and properties of this process.\n */\n public get settings(): AxisSettings {\n return this._settings;\n }\n private _settings: AxisSettings;\n\n /**\n * Key-value storage of this process.\n */\n public get storage(): AxisStorage {\n return this._storage;\n }\n private _storage: AxisStorage;\n\n /**\n * Warnings and faults of this process.\n */\n public get warnings(): Warnings {\n return this._warnings;\n }\n private _warnings: Warnings;\n\n constructor(controller: ProcessController, processNumber: number) {\n this._controller = controller;\n this._processNumber = processNumber;\n this._axis = new Axis(controller.device, processNumber);\n this._settings = new AxisSettings(this._axis);\n this._storage = new AxisStorage(this._axis);\n this._warnings = new Warnings(controller.device, processNumber);\n }\n\n /**\n * Sets the enabled state of the driver.\n * @param [enabled=true] If true (default) enables drive. If false disables.\n */\n public async enable(\n enabled: boolean = true\n ): Promise<void> {\n const request = new gateway.ProcessOn();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setOn(enabled);\n\n await gateway.callAsync('process-controller/enable', request);\n }\n\n /**\n * Turns this process on. In manual mode, this supplies voltage; in controlled mode, it starts the control loop.\n * @param [duration=0] How long to leave the process on in milliseconds.\n */\n public async on(\n duration: number = 0\n ): Promise<void> {\n const request = new gateway.ProcessOn();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setOn(true);\n request.setDuration(duration);\n\n await gateway.callAsync('process-controller/on', request);\n }\n\n /**\n * Turns this process off.\n */\n public async off(): Promise<void> {\n const request = new gateway.ProcessOn();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setOn(false);\n\n await gateway.callAsync('process-controller/on', request);\n }\n\n /**\n * Sets the control mode of this process.\n * @param mode Mode to set this process to.\n */\n public async setMode(\n mode: ProcessControllerMode\n ): Promise<void> {\n const request = new gateway.DeviceSetSettingRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setSetting('process.control.mode');\n request.setValue(mode);\n\n await gateway.callAsync('device/set_setting', request);\n }\n\n /**\n * Gets the control mode of this process.\n * @returns Control mode.\n */\n public async getMode(): Promise<ProcessControllerMode> {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setSetting('process.control.mode');\n\n const response = await gateway.callAsync<gateway.DoubleResponse>(\n 'device/get_setting',\n request,\n gateway.DoubleResponse);\n return response.getValue();\n }\n\n /**\n * Gets the source used to control this process.\n * @returns The source providing feedback for this process.\n */\n public async getSource(): Promise<ProcessControllerSource> {\n const request = new gateway.AxisEmptyRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n\n const response = await gateway.callAsync<gateway.ProcessControllerSource>(\n 'process_controller/get_source',\n request,\n gateway.ProcessControllerSource);\n return ProcessControllerSource.fromProtobuf(response.toObject());\n }\n\n /**\n * Sets the source used to control this process.\n * @param source Sets the source that should provide feedback for this process.\n */\n public async setSource(\n source: ProcessControllerSource\n ): Promise<void> {\n const request = new gateway.SetProcessControllerSource();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setSource(ProcessControllerSource.toProtobuf(source));\n\n await gateway.callAsync('process_controller/set_source', request);\n }\n\n /**\n * Gets the current value of the source used to control this process.\n * @returns The current value of this process's controlling source.\n */\n public async getInput(): Promise<Measurement> {\n const request = new gateway.AxisEmptyRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n\n const response = await gateway.callAsync<gateway.Measurement>(\n 'process_controller/get_input',\n request,\n gateway.Measurement);\n return Measurement.fromProtobuf(response.toObject());\n }\n\n /**\n * Creates an H-bridge between this process and its neighbor. This method is only callable on axis 1 and 3.\n */\n public async bridge(): Promise<void> {\n const request = new gateway.ProcessOn();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setOn(true);\n\n await gateway.callAsync('process_controller/bridge', request);\n }\n\n /**\n * Breaks the H-bridge between this process and its neighbor, allowing them to be independently controlled.\n * This method is only callable on axis 1 and 3.\n */\n public async unbridge(): Promise<void> {\n const request = new gateway.ProcessOn();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setOn(false);\n\n await gateway.callAsync('process_controller/bridge', request);\n }\n\n /**\n * Detects if the given process is in bridging mode.\n * @returns Whether this process is bridged with its neighbor.\n */\n public async isBridge(): Promise<boolean> {\n const request = new gateway.AxisEmptyRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n\n const response = await gateway.callAsync<gateway.BoolResponse>(\n 'process_controller/is_bridge',\n request,\n gateway.BoolResponse);\n return response.getValue();\n }\n\n /**\n * Sends a generic ASCII command to this process' underlying axis.\n * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns A response to the command.\n */\n public async genericCommand(\n command: string,\n options: Process.GenericCommandOptions = {}\n ): Promise<Response> {\n const {\n checkErrors = true,\n timeout = 0,\n } = options;\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setCommand(command);\n request.setCheckErrors(checkErrors);\n request.setTimeout(timeout);\n\n const response = await gateway.callAsync<gateway.GenericCommandResponse>(\n 'interface/generic_command',\n request,\n gateway.GenericCommandResponse);\n return Response.fromProtobuf(response.toObject());\n }\n\n /**\n * Sends a generic ASCII command to this process and expect multiple responses.\n * Responses are returned in order of arrival.\n * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.checkErrors=true] Controls whether to throw an exception when a device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns All responses to the command.\n */\n public async genericCommandMultiResponse(\n command: string,\n options: Process.GenericCommandMultiResponseOptions = {}\n ): Promise<Response[]> {\n const {\n checkErrors = true,\n timeout = 0,\n } = options;\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setCommand(command);\n request.setCheckErrors(checkErrors);\n request.setTimeout(timeout);\n\n const response = await gateway.callAsync<gateway.GenericCommandResponseCollection>(\n 'interface/generic_command_multi_response',\n request,\n gateway.GenericCommandResponseCollection);\n return response.getResponsesList().map(a => Response.fromProtobuf(a.toObject()));\n }\n\n /**\n * Sends a generic ASCII command to this process without expecting a response and without adding a message ID\n * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n */\n public async genericCommandNoResponse(\n command: string\n ): Promise<void> {\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setCommand(command);\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Returns a serialization of the current process state that can be saved and reapplied.\n * @returns A serialization of the current state of the process.\n */\n public async getState(): Promise<string> {\n const request = new gateway.AxisEmptyRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n\n const response = await gateway.callAsync<gateway.StringResponse>(\n 'device/get_state',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n\n /**\n * Applies a saved state to this process.\n * @param state The state object to apply to this process.\n */\n public async setState(\n state: string\n ): Promise<void> {\n const request = new gateway.SetStateRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setState(state);\n\n await gateway.callAsync('device/set_state', request);\n }\n\n /**\n * Checks if a state can be applied to this process.\n * This only covers exceptions that can be determined statically such as mismatches of ID or version,\n * the process of applying the state can still fail when running.\n * @param state The state object to check against.\n * @returns An explanation of why this state cannot be set to this process.\n */\n public async canSetState(\n state: string\n ): Promise<string> {\n const request = new gateway.CanSetStateRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setState(state);\n\n const response = await gateway.callAsync<gateway.CanSetStateAxisResponse>(\n 'device/can_set_axis_state',\n request,\n gateway.CanSetStateAxisResponse);\n return response.getError();\n }\n\n /**\n * Returns a string that represents the process.\n * @returns A string that represents the process.\n */\n public toString(): string {\n const request = new gateway.AxisToStringRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setTypeOverride('Process');\n\n const response = gateway.callSync<gateway.StringResponse>(\n 'device/axis_to_string',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n}\n\nnamespace Process {\n export interface GenericCommandOptions {\n checkErrors?: boolean;\n timeout?: number;\n }\n export interface GenericCommandMultiResponseOptions {\n checkErrors?: boolean;\n timeout?: number;\n }\n}\n"]}
1
+ {"version":3,"file":"process.js","sourceRoot":"","sources":["../../../src/product/process.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtD,oDAAsC;AACtC,oCAA+C;AAC/C,wCAAqC;AACrC,gDAA6C;AAC7C,0DAAsD;AACtD,8CAA+C;AAC/C,gDAA6C;AAE7C,2EAAsE;AACtE,gDAA6C;AAE7C;;;GAGG;AACH,MAAa,OAAO;IAClB;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAGD;;OAEG;IACH,IAAW,aAAa;QACtB,O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AAC;QACtE,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACxD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAExB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,SAAS,CACtC,2BAA2B,EAC3B,OAAO,EACP,OAAO,CAAC,uBAAuB,CAAC,CAAC;QACnC,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,QAAQ;QACb,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAClD,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACtE,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACxD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACpC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;QAEnC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAC/B,uBAAuB,EACvB,OAAO,EACP,OAAO,CAAC,cAAc,CAAC,CAAC;QAC1B,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;CACF;AAjYD,0BAiYC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { ProcessController } from './process_controller';\nimport * as gateway from '../gateway';\nimport { Native, Units, Time } from '../units';\nimport { Axis } from '../ascii/axis';\nimport { Response } from '../ascii/response';\nimport { AxisSettings } from '../ascii/axis_settings';\nimport { AxisStorage } from '../ascii/storage';\nimport { Warnings } from '../ascii/warnings';\nimport { ProcessControllerMode } from './process_controller_mode';\nimport { ProcessControllerSource } from './process_controller_source';\nimport { Measurement } from '../measurement';\n\n/**\n * Use to drive voltage for a process such as a heater, valve, Peltier device, etc.\n * Requires at least Firmware 7.35.\n */\nexport class Process {\n /**\n * Controller for this process.\n */\n public get controller(): ProcessController {\n return this._controller;\n }\n private _controller: ProcessController;\n\n /**\n * The process number identifies the process on the controller.\n */\n public get processNumber(): number {\n return this._processNumber;\n }\n private _processNumber: number;\n\n private _axis: Axis;\n\n /**\n * Settings and properties of this process.\n */\n public get settings(): AxisSettings {\n return this._settings;\n }\n private _settings: AxisSettings;\n\n /**\n * Key-value storage of this process.\n */\n public get storage(): AxisStorage {\n return this._storage;\n }\n private _storage: AxisStorage;\n\n /**\n * Warnings and faults of this process.\n */\n public get warnings(): Warnings {\n return this._warnings;\n }\n private _warnings: Warnings;\n\n constructor(controller: ProcessController, processNumber: number) {\n this._controller = controller;\n this._processNumber = processNumber;\n this._axis = new Axis(controller.device, processNumber);\n this._settings = new AxisSettings(this._axis);\n this._storage = new AxisStorage(this._axis);\n this._warnings = new Warnings(controller.device, processNumber);\n }\n\n /**\n * Sets the enabled state of the driver.\n * @param [enabled=true] If true (default) enables drive. If false disables.\n */\n public async enable(\n enabled: boolean = true\n ): Promise<void> {\n const request = new gateway.ProcessOn();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setOn(enabled);\n\n await gateway.callAsync('process-controller/enable', request);\n }\n\n /**\n * Turns this process on. In manual mode, this supplies voltage; in controlled mode, it starts the control loop.\n * @param [duration=0] How long to leave the process on.\n * @param [unit=Units.NATIVE] Units of time.\n */\n public async on(\n duration: number = 0,\n unit: Time | Native = Units.NATIVE\n ): Promise<void> {\n const request = new gateway.ProcessOn();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setOn(true);\n request.setDuration(duration);\n request.setUnit(unit);\n\n await gateway.callAsync('process-controller/on', request);\n }\n\n /**\n * Turns this process off.\n */\n public async off(): Promise<void> {\n const request = new gateway.ProcessOn();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setOn(false);\n\n await gateway.callAsync('process-controller/on', request);\n }\n\n /**\n * Sets the control mode of this process.\n * @param mode Mode to set this process to.\n */\n public async setMode(\n mode: ProcessControllerMode\n ): Promise<void> {\n const request = new gateway.DeviceSetSettingRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setSetting('process.control.mode');\n request.setValue(mode);\n\n await gateway.callAsync('device/set_setting', request);\n }\n\n /**\n * Gets the control mode of this process.\n * @returns Control mode.\n */\n public async getMode(): Promise<ProcessControllerMode> {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setSetting('process.control.mode');\n\n const response = await gateway.callAsync<gateway.DoubleResponse>(\n 'device/get_setting',\n request,\n gateway.DoubleResponse);\n return response.getValue();\n }\n\n /**\n * Gets the source used to control this process.\n * @returns The source providing feedback for this process.\n */\n public async getSource(): Promise<ProcessControllerSource> {\n const request = new gateway.AxisEmptyRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n\n const response = await gateway.callAsync<gateway.ProcessControllerSource>(\n 'process_controller/get_source',\n request,\n gateway.ProcessControllerSource);\n return ProcessControllerSource.fromProtobuf(response.toObject());\n }\n\n /**\n * Sets the source used to control this process.\n * @param source Sets the source that should provide feedback for this process.\n */\n public async setSource(\n source: ProcessControllerSource\n ): Promise<void> {\n const request = new gateway.SetProcessControllerSource();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setSource(ProcessControllerSource.toProtobuf(source));\n\n await gateway.callAsync('process_controller/set_source', request);\n }\n\n /**\n * Gets the current value of the source used to control this process.\n * @returns The current value of this process's controlling source.\n */\n public async getInput(): Promise<Measurement> {\n const request = new gateway.AxisEmptyRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n\n const response = await gateway.callAsync<gateway.Measurement>(\n 'process_controller/get_input',\n request,\n gateway.Measurement);\n return Measurement.fromProtobuf(response.toObject());\n }\n\n /**\n * Creates an H-bridge between this process and its neighbor. This method is only callable on axis 1 and 3.\n */\n public async bridge(): Promise<void> {\n const request = new gateway.ProcessOn();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setOn(true);\n\n await gateway.callAsync('process_controller/bridge', request);\n }\n\n /**\n * Breaks the H-bridge between this process and its neighbor, allowing them to be independently controlled.\n * This method is only callable on axis 1 and 3.\n */\n public async unbridge(): Promise<void> {\n const request = new gateway.ProcessOn();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setOn(false);\n\n await gateway.callAsync('process_controller/bridge', request);\n }\n\n /**\n * Detects if the given process is in bridging mode.\n * @returns Whether this process is bridged with its neighbor.\n */\n public async isBridge(): Promise<boolean> {\n const request = new gateway.AxisEmptyRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n\n const response = await gateway.callAsync<gateway.BoolResponse>(\n 'process_controller/is_bridge',\n request,\n gateway.BoolResponse);\n return response.getValue();\n }\n\n /**\n * Sends a generic ASCII command to this process' underlying axis.\n * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns A response to the command.\n */\n public async genericCommand(\n command: string,\n options: Process.GenericCommandOptions = {}\n ): Promise<Response> {\n const {\n checkErrors = true,\n timeout = 0,\n } = options;\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setCommand(command);\n request.setCheckErrors(checkErrors);\n request.setTimeout(timeout);\n\n const response = await gateway.callAsync<gateway.GenericCommandResponse>(\n 'interface/generic_command',\n request,\n gateway.GenericCommandResponse);\n return Response.fromProtobuf(response.toObject());\n }\n\n /**\n * Sends a generic ASCII command to this process and expect multiple responses.\n * Responses are returned in order of arrival.\n * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.checkErrors=true] Controls whether to throw an exception when a device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns All responses to the command.\n */\n public async genericCommandMultiResponse(\n command: string,\n options: Process.GenericCommandMultiResponseOptions = {}\n ): Promise<Response[]> {\n const {\n checkErrors = true,\n timeout = 0,\n } = options;\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setCommand(command);\n request.setCheckErrors(checkErrors);\n request.setTimeout(timeout);\n\n const response = await gateway.callAsync<gateway.GenericCommandResponseCollection>(\n 'interface/generic_command_multi_response',\n request,\n gateway.GenericCommandResponseCollection);\n return response.getResponsesList().map(a => Response.fromProtobuf(a.toObject()));\n }\n\n /**\n * Sends a generic ASCII command to this process without expecting a response and without adding a message ID\n * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n */\n public async genericCommandNoResponse(\n command: string\n ): Promise<void> {\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setCommand(command);\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Returns a serialization of the current process state that can be saved and reapplied.\n * @returns A serialization of the current state of the process.\n */\n public async getState(): Promise<string> {\n const request = new gateway.AxisEmptyRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n\n const response = await gateway.callAsync<gateway.StringResponse>(\n 'device/get_state',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n\n /**\n * Applies a saved state to this process.\n * @param state The state object to apply to this process.\n */\n public async setState(\n state: string\n ): Promise<void> {\n const request = new gateway.SetStateRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setState(state);\n\n await gateway.callAsync('device/set_state', request);\n }\n\n /**\n * Checks if a state can be applied to this process.\n * This only covers exceptions that can be determined statically such as mismatches of ID or version,\n * the process of applying the state can still fail when running.\n * @param state The state object to check against.\n * @returns An explanation of why this state cannot be set to this process.\n */\n public async canSetState(\n state: string\n ): Promise<string> {\n const request = new gateway.CanSetStateRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setState(state);\n\n const response = await gateway.callAsync<gateway.CanSetStateAxisResponse>(\n 'device/can_set_axis_state',\n request,\n gateway.CanSetStateAxisResponse);\n return response.getError();\n }\n\n /**\n * Returns a string that represents the process.\n * @returns A string that represents the process.\n */\n public toString(): string {\n const request = new gateway.AxisToStringRequest();\n request.setInterfaceId(this.controller.device.connection.interfaceId);\n request.setDevice(this.controller.device.deviceAddress);\n request.setAxis(this.processNumber);\n request.setTypeOverride('Process');\n\n const response = gateway.callSync<gateway.StringResponse>(\n 'device/axis_to_string',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n}\n\nnamespace Process {\n export interface GenericCommandOptions {\n checkErrors?: boolean;\n timeout?: number;\n }\n export interface GenericCommandMultiResponseOptions {\n checkErrors?: boolean;\n timeout?: number;\n }\n}\n"]}
@@ -7494,6 +7494,9 @@ export class ProcessOn extends jspb.Message {
7494
7494
  getDuration(): number;
7495
7495
  setDuration(value: number): void;
7496
7496
 
7497
+ getUnit(): string;
7498
+ setUnit(value: string): void;
7499
+
7497
7500
  serializeBinary(): Uint8Array;
7498
7501
  toObject(includeInstance?: boolean): ProcessOn.AsObject;
7499
7502
  static toObject(includeInstance: boolean, msg: ProcessOn): ProcessOn.AsObject;
@@ -7511,6 +7514,7 @@ export namespace ProcessOn {
7511
7514
  axis: number,
7512
7515
  on: boolean,
7513
7516
  duration: number,
7517
+ unit: string,
7514
7518
  }
7515
7519
  }
7516
7520
 
@@ -57597,7 +57597,8 @@ proto.zaber.motion.protobufs.ProcessOn.toObject = function(includeInstance, msg)
57597
57597
  device: jspb.Message.getFieldWithDefault(msg, 2, 0),
57598
57598
  axis: jspb.Message.getFieldWithDefault(msg, 3, 0),
57599
57599
  on: jspb.Message.getBooleanFieldWithDefault(msg, 4, false),
57600
- duration: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0)
57600
+ duration: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0),
57601
+ unit: jspb.Message.getFieldWithDefault(msg, 6, "")
57601
57602
  };
57602
57603
 
57603
57604
  if (includeInstance) {
@@ -57654,6 +57655,10 @@ proto.zaber.motion.protobufs.ProcessOn.deserializeBinaryFromReader = function(ms
57654
57655
  var value = /** @type {number} */ (reader.readDouble());
57655
57656
  msg.setDuration(value);
57656
57657
  break;
57658
+ case 6:
57659
+ var value = /** @type {string} */ (reader.readString());
57660
+ msg.setUnit(value);
57661
+ break;
57657
57662
  default:
57658
57663
  reader.skipField();
57659
57664
  break;
@@ -57718,6 +57723,13 @@ proto.zaber.motion.protobufs.ProcessOn.serializeBinaryToWriter = function(messag
57718
57723
  f
57719
57724
  );
57720
57725
  }
57726
+ f = message.getUnit();
57727
+ if (f.length > 0) {
57728
+ writer.writeString(
57729
+ 6,
57730
+ f
57731
+ );
57732
+ }
57721
57733
  };
57722
57734
 
57723
57735
 
@@ -57811,6 +57823,24 @@ proto.zaber.motion.protobufs.ProcessOn.prototype.setDuration = function(value) {
57811
57823
  };
57812
57824
 
57813
57825
 
57826
+ /**
57827
+ * optional string unit = 6;
57828
+ * @return {string}
57829
+ */
57830
+ proto.zaber.motion.protobufs.ProcessOn.prototype.getUnit = function() {
57831
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, ""));
57832
+ };
57833
+
57834
+
57835
+ /**
57836
+ * @param {string} value
57837
+ * @return {!proto.zaber.motion.protobufs.ProcessOn} returns this
57838
+ */
57839
+ proto.zaber.motion.protobufs.ProcessOn.prototype.setUnit = function(value) {
57840
+ return jspb.Message.setProto3StringField(this, 6, value);
57841
+ };
57842
+
57843
+
57814
57844
 
57815
57845
 
57816
57846