@zaber/motion 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/binding/wasm/zaber-motion-lib.wasm +0 -0
- package/dist/lib/ascii/connection.d.ts +5 -0
- package/dist/lib/ascii/connection.d.ts.map +1 -1
- package/dist/lib/ascii/connection.js +14 -0
- package/dist/lib/ascii/connection.js.map +1 -1
- package/dist/lib/library.js +1 -1
- package/dist/lib/library.js.map +1 -1
- package/package.json +1 -1
|
Binary file
|
|
@@ -177,6 +177,11 @@ export declare class Connection {
|
|
|
177
177
|
* @returns Array of detected devices.
|
|
178
178
|
*/
|
|
179
179
|
detectDevices(options?: Connection.DetectDevicesOptions): Promise<Device[]>;
|
|
180
|
+
/**
|
|
181
|
+
* Forgets all the information associated with devices on the connection.
|
|
182
|
+
* Useful when devices are removed from the chain indefinitely.
|
|
183
|
+
*/
|
|
184
|
+
forgetDevices(): void;
|
|
180
185
|
/**
|
|
181
186
|
* Stops all of the devices on this connection.
|
|
182
187
|
* @param [options.waitUntilIdle=true] Determines whether the function should return immediately
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/ascii/connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAiB,MAAM,MAAM,CAAC;AAKjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;GAEG;AACH,qBAAa,UAAU;IACrB;;OAEG;IACI,eAAe,EAAG,UAAU,CAAC,oBAAoB,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MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,OAAO,CAAC,EAAE,MAAM,CAAC;KACpB;IACD,UAAiB,sBAAsB;QACnC,YAAY,CAAC,EAAE,MAAM,CAAC;KACzB;IACD,UAAiB,oBAAoB;QACjC,eAAe,CAAC,EAAE,OAAO,CAAC;KAC7B;IACD,UAAiB,cAAc;QAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;KAC3B;IACD,UAAiB,cAAc;QAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;KAC3B;CACF"}
|
|
@@ -372,6 +372,20 @@ class Connection {
|
|
|
372
372
|
const response = await gateway.callAsync('device/detect', request, requests.DeviceDetectResponse.fromBinary);
|
|
373
373
|
return response.devices.map(deviceAddress => this.getDevice(deviceAddress));
|
|
374
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* Forgets all the information associated with devices on the connection.
|
|
377
|
+
* Useful when devices are removed from the chain indefinitely.
|
|
378
|
+
*/
|
|
379
|
+
forgetDevices() {
|
|
380
|
+
const request = {
|
|
381
|
+
...requests.InterfaceEmptyRequest.DEFAULT,
|
|
382
|
+
interfaceId: this.interfaceId,
|
|
383
|
+
toBinary() {
|
|
384
|
+
return requests.InterfaceEmptyRequest.toBinary(this);
|
|
385
|
+
},
|
|
386
|
+
};
|
|
387
|
+
gateway.callSync('device/forget', request);
|
|
388
|
+
}
|
|
375
389
|
/**
|
|
376
390
|
* Stops all of the devices on this connection.
|
|
377
391
|
* @param [options.waitUntilIdle=true] Determines whether the function should return immediately
|
|
@@ -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;AACjD,sDAAwC;AAExC,qCA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C,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAC1B,CAAC;QAEF,gBAAM,CAAC,IAAI,CACT,IAAA,qBAAW,EAA6B,wBAAwB,CAAC,EACjE,IAAA,kBAAM,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,CAAC,EACvD,IAAA,gBAAI,EAAC,CAAC,CAAC,EACP,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;;AA9pBH,gCA+pBC;AAppBC;;GAEG;AACoB,4BAAiB,GAAW,MAAM,AAAjB,CAAkB;AAE1D;;;GAGG;AACoB,yBAAc,GAAW,KAAK,AAAhB,CAAiB;AAEtD;;GAEG;AACoB,6BAAkB,GAAW,KAAK,AAAhB,CAAiB;AAE1D;;;;GAIG;AACoB,+BAAoB,GAAW,KAAK,AAAhB,CAAiB","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 * as requests from '../requests';\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: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.SERIAL_PORT,\n portName: portName,\n baudRate: baudRate,\n rejectRoutedConnection: direct,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\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: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.TCP,\n hostName: hostName,\n port: port,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\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: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.CUSTOM,\n transport: transport.transportId,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\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: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.IOT,\n cloudId: cloudId,\n token: token,\n connectionName: connectionName,\n realm: realm,\n api: api,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\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: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.NETWORK_SHARE,\n hostName: hostName,\n port: port,\n connectionName: connectionName,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\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: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n checkErrors: checkErrors,\n timeout: timeout,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<Response>(\n 'interface/generic_command',\n request,\n Response.fromBinary);\n return response;\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: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\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: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n checkErrors: checkErrors,\n timeout: timeout,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.GenericCommandResponseCollection>(\n 'interface/generic_command_multi_response',\n request,\n requests.GenericCommandResponseCollection.fromBinary);\n return response.responses;\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: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: 'set comm.alert 1',\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\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: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: 'set comm.alert 0',\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\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: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\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: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\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: requests.DeviceRenumberRequest & gateway.Message = {\n ...requests.DeviceRenumberRequest.DEFAULT,\n interfaceId: this.interfaceId,\n firstAddress: firstAddress,\n toBinary() {\n return requests.DeviceRenumberRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.IntResponse>(\n 'device/renumber',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\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: requests.DeviceDetectRequest & gateway.Message = {\n ...requests.DeviceDetectRequest.DEFAULT,\n interfaceId: this.interfaceId,\n identifyDevices: identifyDevices,\n toBinary() {\n return requests.DeviceDetectRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceDetectResponse>(\n 'device/detect',\n request,\n requests.DeviceDetectResponse.fromBinary);\n return response.devices.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: requests.DeviceOnAllRequest & gateway.Message = {\n ...requests.DeviceOnAllRequest.DEFAULT,\n interfaceId: this.interfaceId,\n waitUntilIdle: waitUntilIdle,\n toBinary() {\n return requests.DeviceOnAllRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceOnAllResponse>(\n 'device/stop_all',\n request,\n requests.DeviceOnAllResponse.fromBinary);\n return response.deviceAddresses;\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: requests.DeviceOnAllRequest & gateway.Message = {\n ...requests.DeviceOnAllRequest.DEFAULT,\n interfaceId: this.interfaceId,\n waitUntilIdle: waitUntilIdle,\n toBinary() {\n return requests.DeviceOnAllRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceOnAllResponse>(\n 'device/home_all',\n request,\n requests.DeviceOnAllResponse.fromBinary);\n return response.deviceAddresses;\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: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.StringResponse>(\n 'interface/to_string',\n request,\n requests.StringResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Returns default request timeout.\n * @returns Default request timeout.\n */\n private _retrieveTimeout(): number {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.IntResponse>(\n 'interface/get_timeout',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\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: requests.SetInterfaceTimeoutRequest & gateway.Message = {\n ...requests.SetInterfaceTimeoutRequest.DEFAULT,\n interfaceId: this.interfaceId,\n timeout: timeout,\n toBinary() {\n return requests.SetInterfaceTimeoutRequest.toBinary(this);\n },\n };\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: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.BoolResponse>(\n 'interface/get_checksum_enabled',\n request,\n requests.BoolResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Sets checksum enabled.\n * @param isEnabled Checksum enabled.\n */\n private _changeChecksumEnabled(\n isEnabled: boolean\n ): void {\n const request: requests.SetInterfaceChecksumEnabledRequest & gateway.Message = {\n ...requests.SetInterfaceChecksumEnabledRequest.DEFAULT,\n interfaceId: this.interfaceId,\n isEnabled: isEnabled,\n toBinary() {\n return requests.SetInterfaceChecksumEnabledRequest.toBinary(this);\n },\n };\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<requests.UnknownResponseEventWrapper>('interface/unknown_response'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.unknownResponse)\n );\n\n this.alert = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.AlertEventWrapper>('interface/alert'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.alert)\n );\n\n events.pipe(\n filterEvent<requests.DisconnectedEvent>('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;AACjD,sDAAwC;AAExC,qCA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AAC,KAAK,CAAC,eAAe,CAAC,CACpC,CAAC;QAEF,IAAI,CAAC,KAAK,GAAG,gBAAM,CAAC,IAAI,CACtB,IAAA,qBAAS,EAAC,IAAI,CAAC,aAAa,CAAC,EAC7B,IAAA,qBAAW,EAA6B,iBAAiB,CAAC,EAC1D,IAAA,kBAAM,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,CAAC,EACvD,IAAA,eAAG,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAC1B,CAAC;QAEF,gBAAM,CAAC,IAAI,CACT,IAAA,qBAAW,EAA6B,wBAAwB,CAAC,EACjE,IAAA,kBAAM,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,CAAC,EACvD,IAAA,gBAAI,EAAC,CAAC,CAAC,EACP,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;;AA9qBH,gCA+qBC;AApqBC;;GAEG;AACoB,4BAAiB,GAAW,MAAM,AAAjB,CAAkB;AAE1D;;;GAGG;AACoB,yBAAc,GAAW,KAAK,AAAhB,CAAiB;AAEtD;;GAEG;AACoB,6BAAkB,GAAW,KAAK,AAAhB,CAAiB;AAE1D;;;;GAIG;AACoB,+BAAoB,GAAW,KAAK,AAAhB,CAAiB","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 * as requests from '../requests';\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: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.SERIAL_PORT,\n portName: portName,\n baudRate: baudRate,\n rejectRoutedConnection: direct,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\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: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.TCP,\n hostName: hostName,\n port: port,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\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: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.CUSTOM,\n transport: transport.transportId,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\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: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.IOT,\n cloudId: cloudId,\n token: token,\n connectionName: connectionName,\n realm: realm,\n api: api,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\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: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.NETWORK_SHARE,\n hostName: hostName,\n port: port,\n connectionName: connectionName,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\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: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n checkErrors: checkErrors,\n timeout: timeout,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<Response>(\n 'interface/generic_command',\n request,\n Response.fromBinary);\n return response;\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: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\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: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n checkErrors: checkErrors,\n timeout: timeout,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.GenericCommandResponseCollection>(\n 'interface/generic_command_multi_response',\n request,\n requests.GenericCommandResponseCollection.fromBinary);\n return response.responses;\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: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: 'set comm.alert 1',\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\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: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: 'set comm.alert 0',\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\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: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\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: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\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: requests.DeviceRenumberRequest & gateway.Message = {\n ...requests.DeviceRenumberRequest.DEFAULT,\n interfaceId: this.interfaceId,\n firstAddress: firstAddress,\n toBinary() {\n return requests.DeviceRenumberRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.IntResponse>(\n 'device/renumber',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\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: requests.DeviceDetectRequest & gateway.Message = {\n ...requests.DeviceDetectRequest.DEFAULT,\n interfaceId: this.interfaceId,\n identifyDevices: identifyDevices,\n toBinary() {\n return requests.DeviceDetectRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceDetectResponse>(\n 'device/detect',\n request,\n requests.DeviceDetectResponse.fromBinary);\n return response.devices.map(deviceAddress => this.getDevice(deviceAddress));\n }\n\n /**\n * Forgets all the information associated with devices on the connection.\n * Useful when devices are removed from the chain indefinitely.\n */\n public forgetDevices(): void {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device/forget', request);\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: requests.DeviceOnAllRequest & gateway.Message = {\n ...requests.DeviceOnAllRequest.DEFAULT,\n interfaceId: this.interfaceId,\n waitUntilIdle: waitUntilIdle,\n toBinary() {\n return requests.DeviceOnAllRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceOnAllResponse>(\n 'device/stop_all',\n request,\n requests.DeviceOnAllResponse.fromBinary);\n return response.deviceAddresses;\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: requests.DeviceOnAllRequest & gateway.Message = {\n ...requests.DeviceOnAllRequest.DEFAULT,\n interfaceId: this.interfaceId,\n waitUntilIdle: waitUntilIdle,\n toBinary() {\n return requests.DeviceOnAllRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceOnAllResponse>(\n 'device/home_all',\n request,\n requests.DeviceOnAllResponse.fromBinary);\n return response.deviceAddresses;\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: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.StringResponse>(\n 'interface/to_string',\n request,\n requests.StringResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Returns default request timeout.\n * @returns Default request timeout.\n */\n private _retrieveTimeout(): number {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.IntResponse>(\n 'interface/get_timeout',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\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: requests.SetInterfaceTimeoutRequest & gateway.Message = {\n ...requests.SetInterfaceTimeoutRequest.DEFAULT,\n interfaceId: this.interfaceId,\n timeout: timeout,\n toBinary() {\n return requests.SetInterfaceTimeoutRequest.toBinary(this);\n },\n };\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: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.BoolResponse>(\n 'interface/get_checksum_enabled',\n request,\n requests.BoolResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Sets checksum enabled.\n * @param isEnabled Checksum enabled.\n */\n private _changeChecksumEnabled(\n isEnabled: boolean\n ): void {\n const request: requests.SetInterfaceChecksumEnabledRequest & gateway.Message = {\n ...requests.SetInterfaceChecksumEnabledRequest.DEFAULT,\n interfaceId: this.interfaceId,\n isEnabled: isEnabled,\n toBinary() {\n return requests.SetInterfaceChecksumEnabledRequest.toBinary(this);\n },\n };\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<requests.UnknownResponseEventWrapper>('interface/unknown_response'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.unknownResponse)\n );\n\n this.alert = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.AlertEventWrapper>('interface/alert'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.alert)\n );\n\n events.pipe(\n filterEvent<requests.DisconnectedEvent>('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"]}
|
package/dist/lib/library.js
CHANGED
package/dist/lib/library.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.js","sourceRoot":"","sources":["../../src/library.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,mDAAqC;AACrC,qDAAuC;AAIvC,MAAa,OAAO;IAClB;;;;OAIG;IACI,MAAM,CAAC,YAAY,CACxB,IAAmB,EACnB,QAAiB;QAEjB,MAAM,OAAO,GAAmD;YAC9D,GAAG,QAAQ,CAAC,mBAAmB,CAAC,OAAO;YACvC,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,QAAQ;YAClB,QAAQ;gBACN,OAAO,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,iBAAiB,CAC7B,UAA8B,EAC9B,aAAsB;QAEtB,MAAM,OAAO,GAAwD;YACnE,GAAG,QAAQ,CAAC,wBAAwB,CAAC,OAAO;YAC5C,UAAU,EAAE,UAAU;YACtB,aAAa,EAAE,aAAa;YAC5B,QAAQ;gBACN,OAAO,QAAQ,CAAC,wBAAwB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC1D,C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Q;gBACN,OAAO,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC5C,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,YAAY;QACxB,MAAM,OAAO,GAAmD;YAC9D,GAAG,QAAQ,CAAC,mBAAmB,CAAC,OAAO;YACvC,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,OAAO;YAChB,QAAQ;gBACN,OAAO,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;CACF;AAtID,0BAsIC;AAED,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from './gateway';\nimport * as requests from './requests';\nimport { LogOutputMode } from './log_output_mode';\nimport { DeviceDbSourceType } from './device_db_source_type';\n\nexport class Library {\n /**\n * Sets library logging output.\n * @param mode Logging output mode.\n * @param filePath Path of the file to open.\n */\n public static setLogOutput(\n mode: LogOutputMode,\n filePath?: string\n ): void {\n const request: requests.SetLogOutputRequest & gateway.Message = {\n ...requests.SetLogOutputRequest.DEFAULT,\n mode: mode,\n filePath: filePath,\n toBinary() {\n return requests.SetLogOutputRequest.toBinary(this);\n },\n };\n\n gateway.callSync('logging/set_output', request);\n }\n\n /**\n * Sets source of Device DB data. Allows selection of a web service or a local file.\n * @param sourceType Source type.\n * @param urlOrFilePath URL of the web service or path to the local file.\n * Leave empty for the default URL of Zaber web service.\n */\n public static setDeviceDbSource(\n sourceType: DeviceDbSourceType,\n urlOrFilePath?: string\n ): void {\n const request: requests.SetDeviceDbSourceRequest & gateway.Message = {\n ...requests.SetDeviceDbSourceRequest.DEFAULT,\n sourceType: sourceType,\n urlOrFilePath: urlOrFilePath,\n toBinary() {\n return requests.SetDeviceDbSourceRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/set_source', request);\n }\n\n /**\n * Enables Device DB store.\n * The store uses filesystem to save information obtained from the Device DB.\n * The stored data are later used instead of the Device DB.\n * @param storeLocation Specifies relative or absolute path of the folder used by the store.\n * If left empty defaults to a folder in user home directory.\n * Must be accessible by the process.\n */\n public static enableDeviceDbStore(\n storeLocation?: string\n ): void {\n const request: requests.ToggleDeviceDbStoreRequest & gateway.Message = {\n ...requests.ToggleDeviceDbStoreRequest.DEFAULT,\n toggleOn: true,\n storeLocation: storeLocation,\n toBinary() {\n return requests.ToggleDeviceDbStoreRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/toggle_store', request);\n }\n\n /**\n * Disables Device DB store.\n */\n public static disableDeviceDbStore(): void {\n const request: requests.ToggleDeviceDbStoreRequest & gateway.Message = {\n ...requests.ToggleDeviceDbStoreRequest.DEFAULT,\n toBinary() {\n return requests.ToggleDeviceDbStoreRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/toggle_store', request);\n }\n\n /**\n * Disables certain customer checks (like FF flag).\n * @param mode Whether to turn internal mode on or off.\n */\n public static setInternalMode(\n mode: boolean\n ): void {\n const request: requests.SetInternalModeRequest & gateway.Message = {\n ...requests.SetInternalModeRequest.DEFAULT,\n mode: mode,\n toBinary() {\n return requests.SetInternalModeRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/set_internal_mode', request);\n }\n\n /**\n * Sets the period between polling for IDLE during movements.\n * Caution: Setting the period too low may cause performance issues.\n * @param period Period in milliseconds.\n * Negative value restores the default period.\n */\n public static setIdlePollingPeriod(\n period: number\n ): void {\n const request: requests.IntRequest & gateway.Message = {\n ...requests.IntRequest.DEFAULT,\n value: period,\n toBinary() {\n return requests.IntRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/set_idle_polling_period', request);\n }\n\n /**\n * Throws an error if the version of the loaded shared library does not match the caller's version.\n */\n public static checkVersion(): void {\n const request: requests.CheckVersionRequest & gateway.Message = {\n ...requests.CheckVersionRequest.DEFAULT,\n host: 'js',\n version: '6.
|
|
1
|
+
{"version":3,"file":"library.js","sourceRoot":"","sources":["../../src/library.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,mDAAqC;AACrC,qDAAuC;AAIvC,MAAa,OAAO;IAClB;;;;OAIG;IACI,MAAM,CAAC,YAAY,CACxB,IAAmB,EACnB,QAAiB;QAEjB,MAAM,OAAO,GAAmD;YAC9D,GAAG,QAAQ,CAAC,mBAAmB,CAAC,OAAO;YACvC,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,QAAQ;YAClB,QAAQ;gBACN,OAAO,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,iBAAiB,CAC7B,UAA8B,EAC9B,aAAsB;QAEtB,MAAM,OAAO,GAAwD;YACnE,GAAG,QAAQ,CAAC,wBAAwB,CAAC,OAAO;YAC5C,UAAU,EAAE,UAAU;YACtB,aAAa,EAAE,aAAa;YAC5B,QAAQ;gBACN,OAAO,QAAQ,CAAC,wBAAwB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC1D,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,mBAAmB,CAC/B,aAAsB;QAEtB,MAAM,OAAO,GAA0D;YACrE,GAAG,QAAQ,CAAC,0BAA0B,CAAC,OAAO;YAC9C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AAmD;YAC9D,GAAG,QAAQ,CAAC,mBAAmB,CAAC,OAAO;YACvC,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,OAAO;YAChB,QAAQ;gBACN,OAAO,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;CACF;AAtID,0BAsIC;AAED,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from './gateway';\nimport * as requests from './requests';\nimport { LogOutputMode } from './log_output_mode';\nimport { DeviceDbSourceType } from './device_db_source_type';\n\nexport class Library {\n /**\n * Sets library logging output.\n * @param mode Logging output mode.\n * @param filePath Path of the file to open.\n */\n public static setLogOutput(\n mode: LogOutputMode,\n filePath?: string\n ): void {\n const request: requests.SetLogOutputRequest & gateway.Message = {\n ...requests.SetLogOutputRequest.DEFAULT,\n mode: mode,\n filePath: filePath,\n toBinary() {\n return requests.SetLogOutputRequest.toBinary(this);\n },\n };\n\n gateway.callSync('logging/set_output', request);\n }\n\n /**\n * Sets source of Device DB data. Allows selection of a web service or a local file.\n * @param sourceType Source type.\n * @param urlOrFilePath URL of the web service or path to the local file.\n * Leave empty for the default URL of Zaber web service.\n */\n public static setDeviceDbSource(\n sourceType: DeviceDbSourceType,\n urlOrFilePath?: string\n ): void {\n const request: requests.SetDeviceDbSourceRequest & gateway.Message = {\n ...requests.SetDeviceDbSourceRequest.DEFAULT,\n sourceType: sourceType,\n urlOrFilePath: urlOrFilePath,\n toBinary() {\n return requests.SetDeviceDbSourceRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/set_source', request);\n }\n\n /**\n * Enables Device DB store.\n * The store uses filesystem to save information obtained from the Device DB.\n * The stored data are later used instead of the Device DB.\n * @param storeLocation Specifies relative or absolute path of the folder used by the store.\n * If left empty defaults to a folder in user home directory.\n * Must be accessible by the process.\n */\n public static enableDeviceDbStore(\n storeLocation?: string\n ): void {\n const request: requests.ToggleDeviceDbStoreRequest & gateway.Message = {\n ...requests.ToggleDeviceDbStoreRequest.DEFAULT,\n toggleOn: true,\n storeLocation: storeLocation,\n toBinary() {\n return requests.ToggleDeviceDbStoreRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/toggle_store', request);\n }\n\n /**\n * Disables Device DB store.\n */\n public static disableDeviceDbStore(): void {\n const request: requests.ToggleDeviceDbStoreRequest & gateway.Message = {\n ...requests.ToggleDeviceDbStoreRequest.DEFAULT,\n toBinary() {\n return requests.ToggleDeviceDbStoreRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/toggle_store', request);\n }\n\n /**\n * Disables certain customer checks (like FF flag).\n * @param mode Whether to turn internal mode on or off.\n */\n public static setInternalMode(\n mode: boolean\n ): void {\n const request: requests.SetInternalModeRequest & gateway.Message = {\n ...requests.SetInternalModeRequest.DEFAULT,\n mode: mode,\n toBinary() {\n return requests.SetInternalModeRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/set_internal_mode', request);\n }\n\n /**\n * Sets the period between polling for IDLE during movements.\n * Caution: Setting the period too low may cause performance issues.\n * @param period Period in milliseconds.\n * Negative value restores the default period.\n */\n public static setIdlePollingPeriod(\n period: number\n ): void {\n const request: requests.IntRequest & gateway.Message = {\n ...requests.IntRequest.DEFAULT,\n value: period,\n toBinary() {\n return requests.IntRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/set_idle_polling_period', request);\n }\n\n /**\n * Throws an error if the version of the loaded shared library does not match the caller's version.\n */\n public static checkVersion(): void {\n const request: requests.CheckVersionRequest & gateway.Message = {\n ...requests.CheckVersionRequest.DEFAULT,\n host: 'js',\n version: '6.2.0',\n toBinary() {\n return requests.CheckVersionRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/check_version', request);\n }\n}\n\ngateway.addInitCallback(Library.checkVersion);\n"]}
|