@zaber/motion 2.15.4 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/binding/wasm/zaber-motion-lib.wasm +0 -0
- package/dist/lib/ascii/all_axes.d.ts +21 -9
- package/dist/lib/ascii/all_axes.js +12 -9
- package/dist/lib/ascii/all_axes.js.map +1 -1
- package/dist/lib/ascii/axis.d.ts +116 -58
- package/dist/lib/ascii/axis.js +74 -58
- package/dist/lib/ascii/axis.js.map +1 -1
- package/dist/lib/ascii/axis_settings.d.ts +11 -10
- package/dist/lib/ascii/axis_settings.js +11 -10
- package/dist/lib/ascii/axis_settings.js.map +1 -1
- package/dist/lib/ascii/connection.d.ts +91 -68
- package/dist/lib/ascii/connection.js +60 -86
- package/dist/lib/ascii/connection.js.map +1 -1
- package/dist/lib/ascii/device.d.ts +46 -25
- package/dist/lib/ascii/device.js +31 -25
- package/dist/lib/ascii/device.js.map +1 -1
- package/dist/lib/ascii/device_io.d.ts +9 -9
- package/dist/lib/ascii/device_io.js +9 -9
- package/dist/lib/ascii/device_io.js.map +1 -1
- package/dist/lib/ascii/device_settings.d.ts +10 -10
- package/dist/lib/ascii/device_settings.js +10 -10
- package/dist/lib/ascii/device_settings.js.map +1 -1
- package/dist/lib/ascii/lockstep.d.ts +99 -49
- package/dist/lib/ascii/lockstep.js +63 -49
- package/dist/lib/ascii/lockstep.js.map +1 -1
- package/dist/lib/ascii/oscilloscope.d.ts +14 -13
- package/dist/lib/ascii/oscilloscope.js +14 -13
- package/dist/lib/ascii/oscilloscope.js.map +1 -1
- package/dist/lib/ascii/oscilloscope_data.d.ts +9 -9
- package/dist/lib/ascii/oscilloscope_data.js +9 -9
- package/dist/lib/ascii/oscilloscope_data.js.map +1 -1
- package/dist/lib/ascii/servo_tuner.d.ts +20 -10
- package/dist/lib/ascii/servo_tuner.js +13 -10
- package/dist/lib/ascii/servo_tuner.js.map +1 -1
- package/dist/lib/ascii/setting_constants.d.ts +2 -2
- package/dist/lib/ascii/setting_constants.js +2 -2
- package/dist/lib/ascii/setting_constants.js.map +1 -1
- package/dist/lib/ascii/storage.d.ts +49 -24
- package/dist/lib/ascii/storage.js +32 -24
- package/dist/lib/ascii/storage.js.map +1 -1
- package/dist/lib/ascii/stream.d.ts +29 -17
- package/dist/lib/ascii/stream.js +24 -17
- package/dist/lib/ascii/stream.js.map +1 -1
- package/dist/lib/ascii/stream_buffer.d.ts +1 -1
- package/dist/lib/ascii/stream_buffer.js +1 -1
- package/dist/lib/ascii/stream_buffer.js.map +1 -1
- package/dist/lib/ascii/transport.d.ts +2 -2
- package/dist/lib/ascii/transport.js +2 -2
- package/dist/lib/ascii/transport.js.map +1 -1
- package/dist/lib/ascii/warnings.d.ts +2 -2
- package/dist/lib/ascii/warnings.js +2 -2
- package/dist/lib/ascii/warnings.js.map +1 -1
- package/dist/lib/binary/connection.d.ts +46 -25
- package/dist/lib/binary/connection.js +30 -25
- package/dist/lib/binary/connection.js.map +1 -1
- package/dist/lib/binary/device.d.ts +66 -38
- package/dist/lib/binary/device.js +48 -38
- package/dist/lib/binary/device.js.map +1 -1
- package/dist/lib/binary/device_identity.d.ts +1 -0
- package/dist/lib/binary/device_identity.js.map +1 -1
- package/dist/lib/binary/device_settings.d.ts +3 -3
- package/dist/lib/binary/device_settings.js +3 -3
- package/dist/lib/binary/device_settings.js.map +1 -1
- package/dist/lib/exceptions/binary_command_failed_exception.js.map +1 -1
- package/dist/lib/exceptions/command_failed_exception.js.map +1 -1
- package/dist/lib/exceptions/command_preempted_exception.js.map +1 -1
- package/dist/lib/exceptions/command_too_long_exception.js.map +1 -1
- package/dist/lib/exceptions/connection_closed_exception.js.map +1 -1
- package/dist/lib/exceptions/connection_failed_exception.js.map +1 -1
- package/dist/lib/exceptions/conversion_failed_exception.js.map +1 -1
- package/dist/lib/exceptions/device_address_conflict_exception.js.map +1 -1
- package/dist/lib/exceptions/device_busy_exception.js.map +1 -1
- package/dist/lib/exceptions/device_db_failed_exception.js.map +1 -1
- package/dist/lib/exceptions/device_failed_exception.js.map +1 -1
- package/dist/lib/exceptions/device_not_identified_exception.js.map +1 -1
- package/dist/lib/exceptions/g_code_execution_exception.js.map +1 -1
- package/dist/lib/exceptions/g_code_syntax_exception.js.map +1 -1
- package/dist/lib/exceptions/internal_error_exception.js.map +1 -1
- package/dist/lib/exceptions/invalid_argument_exception.js.map +1 -1
- package/dist/lib/exceptions/invalid_data_exception.js.map +1 -1
- package/dist/lib/exceptions/invalid_operation_exception.js.map +1 -1
- package/dist/lib/exceptions/invalid_packet_exception.js.map +1 -1
- package/dist/lib/exceptions/invalid_park_state_exception.js.map +1 -1
- package/dist/lib/exceptions/invalid_response_exception.js.map +1 -1
- package/dist/lib/exceptions/io_channel_out_of_range_exception.js.map +1 -1
- package/dist/lib/exceptions/io_failed_exception.js.map +1 -1
- package/dist/lib/exceptions/lockstep_enabled_exception.js.map +1 -1
- package/dist/lib/exceptions/lockstep_not_enabled_exception.js.map +1 -1
- package/dist/lib/exceptions/motion_lib_exception.js.map +1 -1
- package/dist/lib/exceptions/movement_failed_exception.js.map +1 -1
- package/dist/lib/exceptions/movement_interrupted_exception.js.map +1 -1
- package/dist/lib/exceptions/no_device_found_exception.js.map +1 -1
- package/dist/lib/exceptions/no_value_for_key_exception.js.map +1 -1
- package/dist/lib/exceptions/not_supported_exception.js.map +1 -1
- package/dist/lib/exceptions/os_failed_exception.js.map +1 -1
- package/dist/lib/exceptions/out_of_request_ids_exception.js.map +1 -1
- package/dist/lib/exceptions/request_timeout_exception.js.map +1 -1
- package/dist/lib/exceptions/serial_port_busy_exception.js.map +1 -1
- package/dist/lib/exceptions/set_device_state_failed_exception.js.map +1 -1
- package/dist/lib/exceptions/set_peripheral_state_failed_exception.js.map +1 -1
- package/dist/lib/exceptions/setting_not_found_exception.js.map +1 -1
- package/dist/lib/exceptions/stream_execution_exception.js.map +1 -1
- package/dist/lib/exceptions/stream_mode_exception.js.map +1 -1
- package/dist/lib/exceptions/stream_movement_failed_exception.js.map +1 -1
- package/dist/lib/exceptions/stream_movement_interrupted_exception.js.map +1 -1
- package/dist/lib/exceptions/stream_setup_failed_exception.js.map +1 -1
- package/dist/lib/exceptions/transport_already_used_exception.js.map +1 -1
- package/dist/lib/exceptions/unknown_request_exception.js.map +1 -1
- package/dist/lib/gateway/events.js +4 -5
- package/dist/lib/gateway/events.js.map +1 -1
- package/dist/lib/gateway/serialization.js.map +1 -1
- package/dist/lib/gcode/offline_translator.d.ts +8 -7
- package/dist/lib/gcode/offline_translator.js +8 -7
- package/dist/lib/gcode/offline_translator.js.map +1 -1
- package/dist/lib/gcode/translator.d.ts +15 -8
- package/dist/lib/gcode/translator.js +10 -8
- package/dist/lib/gcode/translator.js.map +1 -1
- package/dist/lib/library.d.ts +3 -3
- package/dist/lib/library.js +3 -3
- package/dist/lib/library.js.map +1 -1
- package/dist/lib/tools.d.ts +3 -3
- package/dist/lib/tools.js +3 -3
- package/dist/lib/tools.js.map +1 -1
- package/dist/lib/wasm.js +1 -3
- package/dist/lib/wasm.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axis_settings.js","sourceRoot":"","sources":["../../../src/ascii/axis_settings.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtD,2DAAuD;AACvD,oCAAiC;AACjC,oDAAsC;AAEtC;;GAEG;AACH,MAAa,YAAY;IAGvB,YAAY,IAAU;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,GAAG,CACd,OAAe,EACf,OAAc,aAAK,CAAC,MAAM;QAE1B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;QACtD,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAA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AAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;QACtD,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACjE,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACnD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACvC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAE5B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAC/B,4BAA4B,EAC5B,OAAO,EACP,OAAO,CAAC,YAAY,CAAC,CAAC;QACxB,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,wBAAwB,CACnC,WAA+B;QAE/B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,+BAA+B,EAAE,CAAC;QAC9D,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACjE,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACnD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACvC,OAAO,CAAC,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,oCAAgB,CAAC,UAAU,CAAC,CAAC,CAAC;QAEzE,MAAM,OAAO,CAAC,SAAS,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;CACF;AA1OD,oCA0OC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Axis } from './axis';\nimport { ConversionFactor } from './conversion_factor';\nimport { Units } from '../units';\nimport * as gateway from '../gateway';\n\n/**\n * Class providing access to various axis settings and properties.\n */\nexport class AxisSettings {\n private _axis: Axis;\n\n constructor(axis: Axis) {\n this._axis = axis;\n }\n\n /**\n * Returns any axis setting or property.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_settings).\n * @param setting Name of the setting.\n * @param unit Units of setting.\n * @return Setting value.\n */\n public async get(\n setting: string,\n unit: Units = Units.NATIVE\n ): Promise<number> {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n request.setUnit(unit);\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 * Sets any axis setting.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_settings).\n * @param setting Name of the setting.\n * @param value Value of the setting.\n * @param unit Units of setting.\n */\n public async set(\n setting: string,\n value: number,\n unit: Units = Units.NATIVE\n ): Promise<void> {\n const request = new gateway.DeviceSetSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n request.setValue(value);\n request.setUnit(unit);\n\n await gateway.callAsync('device/set_setting', request);\n }\n\n /**\n * Returns any axis setting or property as a string.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_settings).\n * @param setting Name of the setting.\n * @return Setting value.\n */\n public async getString(\n setting: string\n ): Promise<string> {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n\n const response = await gateway.callAsync<gateway.StringResponse>(\n 'device/get_setting_str',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n\n /**\n * Sets any axis setting as a string.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_settings).\n * @param setting Name of the setting.\n * @param value Value of the setting.\n */\n public async setString(\n setting: string,\n value: string\n ): Promise<void> {\n const request = new gateway.DeviceSetSettingStrRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n request.setValue(value);\n\n await gateway.callAsync('device/set_setting_str', request);\n }\n\n /**\n * Convert arbitrary setting value to Zaber native units.\n * @param setting Name of the setting.\n * @param value Value of the setting in units specified by following argument.\n * @param unit Units of the value.\n * @return Setting value.\n */\n public convertToNativeUnits(\n setting: string,\n value: number,\n unit: Units\n ): number {\n const request = new gateway.DeviceConvertSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n request.setValue(value);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.DoubleResponse>(\n 'device/convert_setting',\n request,\n gateway.DoubleResponse);\n return response.getValue();\n }\n\n /**\n * Convert arbitrary setting value from Zaber native units.\n * @param setting Name of the setting.\n * @param value Value of the setting in Zaber native units.\n * @param unit Units to convert value to.\n * @return Setting value.\n */\n public convertFromNativeUnits(\n setting: string,\n value: number,\n unit: Units\n ): number {\n const request = new gateway.DeviceConvertSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setFromNative(true);\n request.setSetting(setting);\n request.setValue(value);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.DoubleResponse>(\n 'device/convert_setting',\n request,\n gateway.DoubleResponse);\n return response.getValue();\n }\n\n /**\n * Returns the default value of a setting.\n * @param setting Name of the setting.\n * @param unit Units of setting.\n * @return Default setting value.\n */\n public getDefault(\n setting: string,\n unit: Units = Units.NATIVE\n ): number {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.DoubleResponse>(\n 'device/get_setting_default',\n request,\n gateway.DoubleResponse);\n return response.getValue();\n }\n\n /**\n * Returns the default value of a setting as a string.\n * @param setting Name of the setting.\n * @return Default setting value.\n */\n public getDefaultString(\n setting: string\n ): string {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n\n const response = gateway.callSync<gateway.StringResponse>(\n 'device/get_setting_default_str',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n\n /**\n * Indicates if given setting can be converted from and to native units.\n * @param setting Name of the setting.\n * @return True if unit conversion can be performed.\n */\n public canConvertNativeUnits(\n setting: string\n ): boolean {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n\n const response = gateway.callSync<gateway.BoolResponse>(\n 'device/can_convert_setting',\n request,\n gateway.BoolResponse);\n return response.getValue();\n }\n\n /**\n * Overrides default unit conversions.\n * Conversion factors are specified by setting names representing underlying dimensions.\n * @param conversions Factors of all conversions to override.\n */\n public async setCustomUnitConversions(\n conversions: ConversionFactor[]\n ): Promise<void> {\n const request = new gateway.DeviceSetUnitConversionsRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setConversionsList(conversions.map(ConversionFactor.toProtobuf));\n\n await gateway.callAsync('device/set_unit_conversions', request);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"axis_settings.js","sourceRoot":"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CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACnD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACvC,OAAO,CAAC,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,oCAAgB,CAAC,UAAU,CAAC,CAAC,CAAC;QAEzE,MAAM,OAAO,CAAC,SAAS,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;CACF;AA3OD,oCA2OC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Axis } from './axis';\nimport { ConversionFactor } from './conversion_factor';\nimport { Units } from '../units';\nimport * as gateway from '../gateway';\n\n/**\n * Class providing access to various axis settings and properties.\n */\nexport class AxisSettings {\n private _axis: Axis;\n\n constructor(axis: Axis) {\n this._axis = axis;\n }\n\n /**\n * Returns any axis setting or property.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_settings).\n * @param setting Name of the setting.\n * @param [unit=Units.NATIVE] Units of setting.\n * @returns Setting value.\n */\n public async get(\n setting: string,\n unit: Units = Units.NATIVE\n ): Promise<number> {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n request.setUnit(unit);\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 * Sets any axis setting.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_settings).\n * @param setting Name of the setting.\n * @param value Value of the setting.\n * @param [unit=Units.NATIVE] Units of setting.\n */\n public async set(\n setting: string,\n value: number,\n unit: Units = Units.NATIVE\n ): Promise<void> {\n const request = new gateway.DeviceSetSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n request.setValue(value);\n request.setUnit(unit);\n\n await gateway.callAsync('device/set_setting', request);\n }\n\n /**\n * Returns any axis setting or property as a string.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_settings).\n * @param setting Name of the setting.\n * @returns Setting value.\n */\n public async getString(\n setting: string\n ): Promise<string> {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n\n const response = await gateway.callAsync<gateway.StringResponse>(\n 'device/get_setting_str',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n\n /**\n * Sets any axis setting as a string.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_settings).\n * @param setting Name of the setting.\n * @param value Value of the setting.\n */\n public async setString(\n setting: string,\n value: string\n ): Promise<void> {\n const request = new gateway.DeviceSetSettingStrRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n request.setValue(value);\n\n await gateway.callAsync('device/set_setting_str', request);\n }\n\n /**\n * Convert arbitrary setting value to Zaber native units.\n * @param setting Name of the setting.\n * @param value Value of the setting in units specified by following argument.\n * @param unit Units of the value.\n * @returns Setting value.\n */\n public convertToNativeUnits(\n setting: string,\n value: number,\n unit: Units\n ): number {\n const request = new gateway.DeviceConvertSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n request.setValue(value);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.DoubleResponse>(\n 'device/convert_setting',\n request,\n gateway.DoubleResponse);\n return response.getValue();\n }\n\n /**\n * Convert arbitrary setting value from Zaber native units.\n * @param setting Name of the setting.\n * @param value Value of the setting in Zaber native units.\n * @param unit Units to convert value to.\n * @returns Setting value.\n */\n public convertFromNativeUnits(\n setting: string,\n value: number,\n unit: Units\n ): number {\n const request = new gateway.DeviceConvertSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setFromNative(true);\n request.setSetting(setting);\n request.setValue(value);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.DoubleResponse>(\n 'device/convert_setting',\n request,\n gateway.DoubleResponse);\n return response.getValue();\n }\n\n /**\n * Returns the default value of a setting.\n * @param setting Name of the setting.\n * @param [unit=Units.NATIVE] Units of setting.\n * @returns Default setting value.\n */\n public getDefault(\n setting: string,\n unit: Units = Units.NATIVE\n ): number {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.DoubleResponse>(\n 'device/get_setting_default',\n request,\n gateway.DoubleResponse);\n return response.getValue();\n }\n\n /**\n * Returns the default value of a setting as a string.\n * @param setting Name of the setting.\n * @returns Default setting value.\n */\n public getDefaultString(\n setting: string\n ): string {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n\n const response = gateway.callSync<gateway.StringResponse>(\n 'device/get_setting_default_str',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n\n /**\n * Indicates if given setting can be converted from and to native units.\n * @param setting Name of the setting.\n * @returns True if unit conversion can be performed.\n */\n public canConvertNativeUnits(\n setting: string\n ): boolean {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setSetting(setting);\n\n const response = gateway.callSync<gateway.BoolResponse>(\n 'device/can_convert_setting',\n request,\n gateway.BoolResponse);\n return response.getValue();\n }\n\n /**\n * Overrides default unit conversions.\n * Conversion factors are specified by setting names representing underlying dimensions.\n * Requires at least Firmware 7.30.\n * @param conversions Factors of all conversions to override.\n */\n public async setCustomUnitConversions(\n conversions: ConversionFactor[]\n ): Promise<void> {\n const request = new gateway.DeviceSetUnitConversionsRequest();\n request.setInterfaceId(this._axis.device.connection.interfaceId);\n request.setDevice(this._axis.device.deviceAddress);\n request.setAxis(this._axis.axisNumber);\n request.setConversionsList(conversions.map(ConversionFactor.toProtobuf));\n\n await gateway.callAsync('device/set_unit_conversions', request);\n }\n}\n"]}
|
|
@@ -51,107 +51,89 @@ export declare class Connection {
|
|
|
51
51
|
constructor(interfaceId: number);
|
|
52
52
|
/**
|
|
53
53
|
* Opens a serial port, if Zaber Launcher controls the port, the port will be opened through Zaber Launcher.
|
|
54
|
-
* Zaber Launcher allows sharing of the port between multiple applications
|
|
55
|
-
*
|
|
54
|
+
* Zaber Launcher allows sharing of the port between multiple applications,
|
|
55
|
+
* If port sharing is not desirable, use the `direct` parameter.
|
|
56
56
|
* @param portName Name of the port to open.
|
|
57
|
-
* @param baudRate Optional baud rate (defaults to 115200).
|
|
58
|
-
* @
|
|
57
|
+
* @param [options.baudRate=Connection.DEFAULT_BAUD_RATE] Optional baud rate (defaults to 115200).
|
|
58
|
+
* @param [options.direct=false] If true will connect to the serial port directly,
|
|
59
|
+
* failing if the connection is already opened by a message router instance.
|
|
60
|
+
* @returns An object representing the port.
|
|
59
61
|
*/
|
|
60
|
-
static openSerialPort(portName: string,
|
|
61
|
-
/**
|
|
62
|
-
* Opens a serial port, bypassing Zaber Launcher.
|
|
63
|
-
* If the port is already opened by Zaber Launcher, this will fail.
|
|
64
|
-
* @param portName Name of the port to open.
|
|
65
|
-
* @param baudRate Optional baud rate (defaults to 115200).
|
|
66
|
-
* @return An object representing the port.
|
|
67
|
-
*/
|
|
68
|
-
static openSerialPortDirectly(portName: string, baudRate?: number): Promise<Connection>;
|
|
62
|
+
static openSerialPort(portName: string, options?: Connection.OpenSerialPortOptions): Promise<Connection>;
|
|
69
63
|
/**
|
|
70
64
|
* Opens a TCP connection.
|
|
71
65
|
* @param hostName Hostname or IP address.
|
|
72
|
-
* @param port
|
|
73
|
-
* @
|
|
66
|
+
* @param [port=Connection.TCP_PORT_CHAIN] Optional port number (defaults to 55550).
|
|
67
|
+
* @returns An object representing the connection.
|
|
74
68
|
*/
|
|
75
|
-
static openTcp(hostName: string, port
|
|
69
|
+
static openTcp(hostName: string, port?: number): Promise<Connection>;
|
|
76
70
|
/**
|
|
77
71
|
* Opens a connection using a custom transport.
|
|
78
72
|
* @param transport The custom connection transport.
|
|
79
|
-
* @
|
|
73
|
+
* @returns An object representing the connection.
|
|
80
74
|
*/
|
|
81
75
|
static openCustom(transport: Transport): Promise<Connection>;
|
|
82
|
-
/**
|
|
83
|
-
* Opens a unauthenticated connection to a cloud connected device chain.
|
|
84
|
-
* Use this method to connect to Virtual Device free trial instances.
|
|
85
|
-
* The connection is not secured.
|
|
86
|
-
* @param cloudId The cloud ID to connect to.
|
|
87
|
-
* @param connectionName The name of the connection to open.
|
|
88
|
-
* Can be left empty to default to the only connection present.
|
|
89
|
-
* Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.
|
|
90
|
-
* @param api The URL of the API to receive connection info from.
|
|
91
|
-
* @return An object representing the connection.
|
|
92
|
-
*/
|
|
93
|
-
static openIotUnauthenticated(cloudId: string, connectionName?: string, api?: string): Promise<Connection>;
|
|
94
76
|
/**
|
|
95
77
|
* Opens a secured connection to a cloud connected device chain.
|
|
96
78
|
* Use this method to connect to devices on your account.
|
|
97
79
|
* @param cloudId The cloud ID to connect to.
|
|
98
|
-
* @param token The token to authenticate with.
|
|
99
|
-
* @param connectionName The name of the connection to open.
|
|
80
|
+
* @param [options.token='unauthenticated'] The token to authenticate with. By default the connection will be unauthenticated.
|
|
81
|
+
* @param [options.connectionName=''] The name of the connection to open.
|
|
100
82
|
* Can be left empty to default to the only connection present.
|
|
101
83
|
* Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.
|
|
102
|
-
* @param realm The realm to connect to.
|
|
84
|
+
* @param [options.realm=''] The realm to connect to.
|
|
103
85
|
* Can be left empty for the default account realm.
|
|
104
|
-
* @param api The URL of the API to receive connection info from.
|
|
105
|
-
* @
|
|
86
|
+
* @param [options.api='https://api.zaber.io'] The URL of the API to receive connection info from.
|
|
87
|
+
* @returns An object representing the connection.
|
|
106
88
|
*/
|
|
107
|
-
static
|
|
89
|
+
static openIot(cloudId: string, options?: Connection.OpenIotOptions): Promise<Connection>;
|
|
108
90
|
/**
|
|
109
91
|
* Opens a connection to Zaber Launcher in your Local Area Network.
|
|
110
92
|
* The connection is not secured.
|
|
111
93
|
* @param hostName Hostname or IP address.
|
|
112
94
|
* @param port Port number.
|
|
113
|
-
* @param connectionName The name of the connection to open.
|
|
95
|
+
* @param [connectionName=''] The name of the connection to open.
|
|
114
96
|
* Can be left empty to default to the only connection present.
|
|
115
97
|
* Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.
|
|
116
|
-
* @
|
|
98
|
+
* @returns An object representing the connection.
|
|
117
99
|
*/
|
|
118
100
|
static openNetworkShare(hostName: string, port: number, connectionName?: string): Promise<Connection>;
|
|
119
101
|
/**
|
|
120
102
|
* Sends a generic ASCII command to this connection.
|
|
121
103
|
* For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
|
|
122
104
|
* @param command Command and its parameters.
|
|
123
|
-
* @param device Optional device address to send the command to.
|
|
124
|
-
* @param axis Optional axis number to send the command to.
|
|
125
|
-
* @param checkErrors Controls whether to throw an exception when the device rejects the command.
|
|
126
|
-
* @param timeout The timeout, in milliseconds, for a device to respond to the command.
|
|
105
|
+
* @param [options.device=0] Optional device address to send the command to.
|
|
106
|
+
* @param [options.axis=0] Optional axis number to send the command to.
|
|
107
|
+
* @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.
|
|
108
|
+
* @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.
|
|
127
109
|
* Overrides the connection default request timeout.
|
|
128
|
-
* @
|
|
110
|
+
* @returns A response to the command.
|
|
129
111
|
*/
|
|
130
|
-
genericCommand(command: string,
|
|
112
|
+
genericCommand(command: string, options?: Connection.GenericCommandOptions): Promise<Response>;
|
|
131
113
|
/**
|
|
132
114
|
* Sends a generic ASCII command to this connection without expecting a response and without adding a message ID.
|
|
133
115
|
* For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
|
|
134
116
|
* @param command Command and its parameters.
|
|
135
|
-
* @param device Optional device address to send the command to.
|
|
117
|
+
* @param [options.device=0] Optional device address to send the command to.
|
|
136
118
|
* Specifying -1 omits the number completely.
|
|
137
|
-
* @param axis Optional axis number to send the command to.
|
|
119
|
+
* @param [options.axis=0] Optional axis number to send the command to.
|
|
138
120
|
* Specifying -1 omits the number completely.
|
|
139
121
|
*/
|
|
140
|
-
genericCommandNoResponse(command: string,
|
|
122
|
+
genericCommandNoResponse(command: string, options?: Connection.GenericCommandNoResponseOptions): Promise<void>;
|
|
141
123
|
/**
|
|
142
124
|
* Sends a generic ASCII command to this connection and expect multiple responses,
|
|
143
125
|
* either from one device or from many devices.
|
|
144
126
|
* Responses are returned in order of arrival.
|
|
145
127
|
* For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
|
|
146
128
|
* @param command Command and its parameters.
|
|
147
|
-
* @param device Optional device address to send the command to.
|
|
148
|
-
* @param axis Optional axis number to send the command to.
|
|
149
|
-
* @param checkErrors Controls whether to throw an exception when a device rejects the command.
|
|
150
|
-
* @param timeout The timeout, in milliseconds, for a device to respond to the command.
|
|
129
|
+
* @param [options.device=0] Optional device address to send the command to.
|
|
130
|
+
* @param [options.axis=0] Optional axis number to send the command to.
|
|
131
|
+
* @param [options.checkErrors=true] Controls whether to throw an exception when a device rejects the command.
|
|
132
|
+
* @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.
|
|
151
133
|
* Overrides the connection default request timeout.
|
|
152
|
-
* @
|
|
134
|
+
* @returns All responses to the command.
|
|
153
135
|
*/
|
|
154
|
-
genericCommandMultiResponse(command: string,
|
|
136
|
+
genericCommandMultiResponse(command: string, options?: Connection.GenericCommandMultiResponseOptions): Promise<Response[]>;
|
|
155
137
|
/**
|
|
156
138
|
* Resets ASCII protocol message IDs. Only for testing purposes.
|
|
157
139
|
*/
|
|
@@ -164,44 +146,44 @@ export declare class Connection {
|
|
|
164
146
|
* Gets a Device class instance which allows you to control a particular device on this connection.
|
|
165
147
|
* Devices are numbered from 1.
|
|
166
148
|
* @param deviceAddress Address of device intended to control. Address is configured for each device.
|
|
167
|
-
* @
|
|
149
|
+
* @returns Device instance.
|
|
168
150
|
*/
|
|
169
151
|
getDevice(deviceAddress: number): Device;
|
|
170
152
|
/**
|
|
171
153
|
* Renumbers devices present on this connection. After renumbering, devices need to be identified again.
|
|
172
|
-
* @param firstAddress This is the address that the device closest to the computer is given.
|
|
154
|
+
* @param [options.firstAddress=1] This is the address that the device closest to the computer is given.
|
|
173
155
|
* Remaining devices are numbered consecutively.
|
|
174
|
-
* @
|
|
156
|
+
* @returns Total number of devices that responded to the renumber.
|
|
175
157
|
*/
|
|
176
|
-
renumberDevices(
|
|
158
|
+
renumberDevices(options?: Connection.RenumberDevicesOptions): Promise<number>;
|
|
177
159
|
/**
|
|
178
160
|
* Attempts to detect any devices present on this connection.
|
|
179
|
-
* @param identifyDevices Determines whether device identification should be performed as well.
|
|
180
|
-
* @
|
|
161
|
+
* @param [options.identifyDevices=true] Determines whether device identification should be performed as well.
|
|
162
|
+
* @returns Array of detected devices.
|
|
181
163
|
*/
|
|
182
|
-
detectDevices(
|
|
164
|
+
detectDevices(options?: Connection.DetectDevicesOptions): Promise<Device[]>;
|
|
183
165
|
/**
|
|
184
166
|
* Stops all of the devices on this connection.
|
|
185
|
-
* @param waitUntilIdle Determines whether the function should return immediately
|
|
167
|
+
* @param [options.waitUntilIdle=true] Determines whether the function should return immediately
|
|
186
168
|
* or wait until the devices are stopped.
|
|
187
|
-
* @
|
|
169
|
+
* @returns The addresses of the devices that were stopped by this command.
|
|
188
170
|
*/
|
|
189
|
-
stopAll(
|
|
171
|
+
stopAll(options?: Connection.StopAllOptions): Promise<number[]>;
|
|
190
172
|
/**
|
|
191
173
|
* Homes all of the devices on this connection.
|
|
192
|
-
* @param waitUntilIdle Determines whether the function should return immediately
|
|
174
|
+
* @param [options.waitUntilIdle=true] Determines whether the function should return immediately
|
|
193
175
|
* or wait until the devices are homed.
|
|
194
|
-
* @
|
|
176
|
+
* @returns The addresses of the devices that were homed by this command.
|
|
195
177
|
*/
|
|
196
|
-
homeAll(
|
|
178
|
+
homeAll(options?: Connection.HomeAllOptions): Promise<number[]>;
|
|
197
179
|
/**
|
|
198
180
|
* Returns a string that represents the connection.
|
|
199
|
-
* @
|
|
181
|
+
* @returns A string that represents the connection.
|
|
200
182
|
*/
|
|
201
183
|
toString(): string;
|
|
202
184
|
/**
|
|
203
185
|
* Returns default request timeout.
|
|
204
|
-
* @
|
|
186
|
+
* @returns Default request timeout.
|
|
205
187
|
*/
|
|
206
188
|
private _retrieveTimeout;
|
|
207
189
|
/**
|
|
@@ -211,7 +193,7 @@ export declare class Connection {
|
|
|
211
193
|
private _changeTimeout;
|
|
212
194
|
/**
|
|
213
195
|
* Returns checksum enabled.
|
|
214
|
-
* @
|
|
196
|
+
* @returns Checksum enabled.
|
|
215
197
|
*/
|
|
216
198
|
private _retrieveChecksumEnabled;
|
|
217
199
|
/**
|
|
@@ -226,3 +208,44 @@ export declare class Connection {
|
|
|
226
208
|
get disconnected(): Observable<MotionLibException>;
|
|
227
209
|
private _subscribe;
|
|
228
210
|
}
|
|
211
|
+
declare namespace Connection {
|
|
212
|
+
interface OpenSerialPortOptions {
|
|
213
|
+
baudRate?: number;
|
|
214
|
+
direct?: boolean;
|
|
215
|
+
}
|
|
216
|
+
interface OpenIotOptions {
|
|
217
|
+
token?: string;
|
|
218
|
+
connectionName?: string;
|
|
219
|
+
realm?: string;
|
|
220
|
+
api?: string;
|
|
221
|
+
}
|
|
222
|
+
interface GenericCommandOptions {
|
|
223
|
+
device?: number;
|
|
224
|
+
axis?: number;
|
|
225
|
+
checkErrors?: boolean;
|
|
226
|
+
timeout?: number;
|
|
227
|
+
}
|
|
228
|
+
interface GenericCommandNoResponseOptions {
|
|
229
|
+
device?: number;
|
|
230
|
+
axis?: number;
|
|
231
|
+
}
|
|
232
|
+
interface GenericCommandMultiResponseOptions {
|
|
233
|
+
device?: number;
|
|
234
|
+
axis?: number;
|
|
235
|
+
checkErrors?: boolean;
|
|
236
|
+
timeout?: number;
|
|
237
|
+
}
|
|
238
|
+
interface RenumberDevicesOptions {
|
|
239
|
+
firstAddress?: number;
|
|
240
|
+
}
|
|
241
|
+
interface DetectDevicesOptions {
|
|
242
|
+
identifyDevices?: boolean;
|
|
243
|
+
}
|
|
244
|
+
interface StopAllOptions {
|
|
245
|
+
waitUntilIdle?: boolean;
|
|
246
|
+
}
|
|
247
|
+
interface HomeAllOptions {
|
|
248
|
+
waitUntilIdle?: boolean;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
export {};
|
|
@@ -70,43 +70,31 @@ class Connection {
|
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* Opens a serial port, if Zaber Launcher controls the port, the port will be opened through Zaber Launcher.
|
|
73
|
-
* Zaber Launcher allows sharing of the port between multiple applications
|
|
74
|
-
*
|
|
73
|
+
* Zaber Launcher allows sharing of the port between multiple applications,
|
|
74
|
+
* If port sharing is not desirable, use the `direct` parameter.
|
|
75
75
|
* @param portName Name of the port to open.
|
|
76
|
-
* @param baudRate Optional baud rate (defaults to 115200).
|
|
77
|
-
* @
|
|
76
|
+
* @param [options.baudRate=Connection.DEFAULT_BAUD_RATE] Optional baud rate (defaults to 115200).
|
|
77
|
+
* @param [options.direct=false] If true will connect to the serial port directly,
|
|
78
|
+
* failing if the connection is already opened by a message router instance.
|
|
79
|
+
* @returns An object representing the port.
|
|
78
80
|
*/
|
|
79
|
-
static async openSerialPort(portName,
|
|
81
|
+
static async openSerialPort(portName, options = {}) {
|
|
82
|
+
const { baudRate = Connection.DEFAULT_BAUD_RATE, direct = false, } = options;
|
|
80
83
|
const request = new gateway.OpenInterfaceRequest();
|
|
81
84
|
request.setInterfaceType(gateway.InterfaceType.SERIAL_PORT);
|
|
82
85
|
request.setPortName(portName);
|
|
83
86
|
request.setBaudRate(baudRate);
|
|
84
|
-
|
|
85
|
-
return new Connection(response.getInterfaceId());
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Opens a serial port, bypassing Zaber Launcher.
|
|
89
|
-
* If the port is already opened by Zaber Launcher, this will fail.
|
|
90
|
-
* @param portName Name of the port to open.
|
|
91
|
-
* @param baudRate Optional baud rate (defaults to 115200).
|
|
92
|
-
* @return An object representing the port.
|
|
93
|
-
*/
|
|
94
|
-
static async openSerialPortDirectly(portName, baudRate = Connection.DEFAULT_BAUD_RATE) {
|
|
95
|
-
const request = new gateway.OpenInterfaceRequest();
|
|
96
|
-
request.setInterfaceType(gateway.InterfaceType.SERIAL_PORT);
|
|
97
|
-
request.setRejectRoutedConnection(true);
|
|
98
|
-
request.setPortName(portName);
|
|
99
|
-
request.setBaudRate(baudRate);
|
|
87
|
+
request.setRejectRoutedConnection(direct);
|
|
100
88
|
const response = await gateway.callAsync('interface/open', request, gateway.OpenInterfaceResponse);
|
|
101
89
|
return new Connection(response.getInterfaceId());
|
|
102
90
|
}
|
|
103
91
|
/**
|
|
104
92
|
* Opens a TCP connection.
|
|
105
93
|
* @param hostName Hostname or IP address.
|
|
106
|
-
* @param port
|
|
107
|
-
* @
|
|
94
|
+
* @param [port=Connection.TCP_PORT_CHAIN] Optional port number (defaults to 55550).
|
|
95
|
+
* @returns An object representing the connection.
|
|
108
96
|
*/
|
|
109
|
-
static async openTcp(hostName, port) {
|
|
97
|
+
static async openTcp(hostName, port = Connection.TCP_PORT_CHAIN) {
|
|
110
98
|
const request = new gateway.OpenInterfaceRequest();
|
|
111
99
|
request.setInterfaceType(gateway.InterfaceType.TCP);
|
|
112
100
|
request.setHostName(hostName);
|
|
@@ -117,7 +105,7 @@ class Connection {
|
|
|
117
105
|
/**
|
|
118
106
|
* Opens a connection using a custom transport.
|
|
119
107
|
* @param transport The custom connection transport.
|
|
120
|
-
* @
|
|
108
|
+
* @returns An object representing the connection.
|
|
121
109
|
*/
|
|
122
110
|
static async openCustom(transport) {
|
|
123
111
|
const request = new gateway.OpenInterfaceRequest();
|
|
@@ -126,42 +114,21 @@ class Connection {
|
|
|
126
114
|
const response = await gateway.callAsync('interface/open', request, gateway.OpenInterfaceResponse);
|
|
127
115
|
return new Connection(response.getInterfaceId());
|
|
128
116
|
}
|
|
129
|
-
/**
|
|
130
|
-
* Opens a unauthenticated connection to a cloud connected device chain.
|
|
131
|
-
* Use this method to connect to Virtual Device free trial instances.
|
|
132
|
-
* The connection is not secured.
|
|
133
|
-
* @param cloudId The cloud ID to connect to.
|
|
134
|
-
* @param connectionName The name of the connection to open.
|
|
135
|
-
* Can be left empty to default to the only connection present.
|
|
136
|
-
* Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.
|
|
137
|
-
* @param api The URL of the API to receive connection info from.
|
|
138
|
-
* @return An object representing the connection.
|
|
139
|
-
*/
|
|
140
|
-
static async openIotUnauthenticated(cloudId, connectionName = '', api = 'https://api.zaber.io') {
|
|
141
|
-
const request = new gateway.OpenInterfaceRequest();
|
|
142
|
-
request.setInterfaceType(gateway.InterfaceType.IOT);
|
|
143
|
-
request.setRealm('unauthenticated');
|
|
144
|
-
request.setToken('unauthenticated');
|
|
145
|
-
request.setCloudId(cloudId);
|
|
146
|
-
request.setConnectionName(connectionName);
|
|
147
|
-
request.setApi(api);
|
|
148
|
-
const response = await gateway.callAsync('interface/open', request, gateway.OpenInterfaceResponse);
|
|
149
|
-
return new Connection(response.getInterfaceId());
|
|
150
|
-
}
|
|
151
117
|
/**
|
|
152
118
|
* Opens a secured connection to a cloud connected device chain.
|
|
153
119
|
* Use this method to connect to devices on your account.
|
|
154
120
|
* @param cloudId The cloud ID to connect to.
|
|
155
|
-
* @param token The token to authenticate with.
|
|
156
|
-
* @param connectionName The name of the connection to open.
|
|
121
|
+
* @param [options.token='unauthenticated'] The token to authenticate with. By default the connection will be unauthenticated.
|
|
122
|
+
* @param [options.connectionName=''] The name of the connection to open.
|
|
157
123
|
* Can be left empty to default to the only connection present.
|
|
158
124
|
* Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.
|
|
159
|
-
* @param realm The realm to connect to.
|
|
125
|
+
* @param [options.realm=''] The realm to connect to.
|
|
160
126
|
* Can be left empty for the default account realm.
|
|
161
|
-
* @param api The URL of the API to receive connection info from.
|
|
162
|
-
* @
|
|
127
|
+
* @param [options.api='https://api.zaber.io'] The URL of the API to receive connection info from.
|
|
128
|
+
* @returns An object representing the connection.
|
|
163
129
|
*/
|
|
164
|
-
static async
|
|
130
|
+
static async openIot(cloudId, options = {}) {
|
|
131
|
+
const { token = 'unauthenticated', connectionName = '', realm = '', api = 'https://api.zaber.io', } = options;
|
|
165
132
|
const request = new gateway.OpenInterfaceRequest();
|
|
166
133
|
request.setInterfaceType(gateway.InterfaceType.IOT);
|
|
167
134
|
request.setCloudId(cloudId);
|
|
@@ -177,10 +144,10 @@ class Connection {
|
|
|
177
144
|
* The connection is not secured.
|
|
178
145
|
* @param hostName Hostname or IP address.
|
|
179
146
|
* @param port Port number.
|
|
180
|
-
* @param connectionName The name of the connection to open.
|
|
147
|
+
* @param [connectionName=''] The name of the connection to open.
|
|
181
148
|
* Can be left empty to default to the only connection present.
|
|
182
149
|
* Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.
|
|
183
|
-
* @
|
|
150
|
+
* @returns An object representing the connection.
|
|
184
151
|
*/
|
|
185
152
|
static async openNetworkShare(hostName, port, connectionName = '') {
|
|
186
153
|
const request = new gateway.OpenInterfaceRequest();
|
|
@@ -195,14 +162,15 @@ class Connection {
|
|
|
195
162
|
* Sends a generic ASCII command to this connection.
|
|
196
163
|
* For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
|
|
197
164
|
* @param command Command and its parameters.
|
|
198
|
-
* @param device Optional device address to send the command to.
|
|
199
|
-
* @param axis Optional axis number to send the command to.
|
|
200
|
-
* @param checkErrors Controls whether to throw an exception when the device rejects the command.
|
|
201
|
-
* @param timeout The timeout, in milliseconds, for a device to respond to the command.
|
|
165
|
+
* @param [options.device=0] Optional device address to send the command to.
|
|
166
|
+
* @param [options.axis=0] Optional axis number to send the command to.
|
|
167
|
+
* @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.
|
|
168
|
+
* @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.
|
|
202
169
|
* Overrides the connection default request timeout.
|
|
203
|
-
* @
|
|
170
|
+
* @returns A response to the command.
|
|
204
171
|
*/
|
|
205
|
-
async genericCommand(command,
|
|
172
|
+
async genericCommand(command, options = {}) {
|
|
173
|
+
const { device = 0, axis = 0, checkErrors = true, timeout = 0, } = options;
|
|
206
174
|
const request = new gateway.GenericCommandRequest();
|
|
207
175
|
request.setInterfaceId(this.interfaceId);
|
|
208
176
|
request.setCommand(command);
|
|
@@ -217,12 +185,13 @@ class Connection {
|
|
|
217
185
|
* Sends a generic ASCII command to this connection without expecting a response and without adding a message ID.
|
|
218
186
|
* For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
|
|
219
187
|
* @param command Command and its parameters.
|
|
220
|
-
* @param device Optional device address to send the command to.
|
|
188
|
+
* @param [options.device=0] Optional device address to send the command to.
|
|
221
189
|
* Specifying -1 omits the number completely.
|
|
222
|
-
* @param axis Optional axis number to send the command to.
|
|
190
|
+
* @param [options.axis=0] Optional axis number to send the command to.
|
|
223
191
|
* Specifying -1 omits the number completely.
|
|
224
192
|
*/
|
|
225
|
-
async genericCommandNoResponse(command,
|
|
193
|
+
async genericCommandNoResponse(command, options = {}) {
|
|
194
|
+
const { device = 0, axis = 0, } = options;
|
|
226
195
|
const request = new gateway.GenericCommandRequest();
|
|
227
196
|
request.setInterfaceId(this.interfaceId);
|
|
228
197
|
request.setCommand(command);
|
|
@@ -236,14 +205,15 @@ class Connection {
|
|
|
236
205
|
* Responses are returned in order of arrival.
|
|
237
206
|
* For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
|
|
238
207
|
* @param command Command and its parameters.
|
|
239
|
-
* @param device Optional device address to send the command to.
|
|
240
|
-
* @param axis Optional axis number to send the command to.
|
|
241
|
-
* @param checkErrors Controls whether to throw an exception when a device rejects the command.
|
|
242
|
-
* @param timeout The timeout, in milliseconds, for a device to respond to the command.
|
|
208
|
+
* @param [options.device=0] Optional device address to send the command to.
|
|
209
|
+
* @param [options.axis=0] Optional axis number to send the command to.
|
|
210
|
+
* @param [options.checkErrors=true] Controls whether to throw an exception when a device rejects the command.
|
|
211
|
+
* @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.
|
|
243
212
|
* Overrides the connection default request timeout.
|
|
244
|
-
* @
|
|
213
|
+
* @returns All responses to the command.
|
|
245
214
|
*/
|
|
246
|
-
async genericCommandMultiResponse(command,
|
|
215
|
+
async genericCommandMultiResponse(command, options = {}) {
|
|
216
|
+
const { device = 0, axis = 0, checkErrors = true, timeout = 0, } = options;
|
|
247
217
|
const request = new gateway.GenericCommandRequest();
|
|
248
218
|
request.setInterfaceId(this.interfaceId);
|
|
249
219
|
request.setCommand(command);
|
|
@@ -274,7 +244,7 @@ class Connection {
|
|
|
274
244
|
* Gets a Device class instance which allows you to control a particular device on this connection.
|
|
275
245
|
* Devices are numbered from 1.
|
|
276
246
|
* @param deviceAddress Address of device intended to control. Address is configured for each device.
|
|
277
|
-
* @
|
|
247
|
+
* @returns Device instance.
|
|
278
248
|
*/
|
|
279
249
|
getDevice(deviceAddress) {
|
|
280
250
|
if (deviceAddress <= 0) {
|
|
@@ -284,11 +254,12 @@ class Connection {
|
|
|
284
254
|
}
|
|
285
255
|
/**
|
|
286
256
|
* Renumbers devices present on this connection. After renumbering, devices need to be identified again.
|
|
287
|
-
* @param firstAddress This is the address that the device closest to the computer is given.
|
|
257
|
+
* @param [options.firstAddress=1] This is the address that the device closest to the computer is given.
|
|
288
258
|
* Remaining devices are numbered consecutively.
|
|
289
|
-
* @
|
|
259
|
+
* @returns Total number of devices that responded to the renumber.
|
|
290
260
|
*/
|
|
291
|
-
async renumberDevices(
|
|
261
|
+
async renumberDevices(options = {}) {
|
|
262
|
+
const { firstAddress = 1, } = options;
|
|
292
263
|
if (firstAddress <= 0) {
|
|
293
264
|
throw new TypeError('Invalid value; device addresses are numbered from 1.');
|
|
294
265
|
}
|
|
@@ -300,10 +271,11 @@ class Connection {
|
|
|
300
271
|
}
|
|
301
272
|
/**
|
|
302
273
|
* Attempts to detect any devices present on this connection.
|
|
303
|
-
* @param identifyDevices Determines whether device identification should be performed as well.
|
|
304
|
-
* @
|
|
274
|
+
* @param [options.identifyDevices=true] Determines whether device identification should be performed as well.
|
|
275
|
+
* @returns Array of detected devices.
|
|
305
276
|
*/
|
|
306
|
-
async detectDevices(
|
|
277
|
+
async detectDevices(options = {}) {
|
|
278
|
+
const { identifyDevices = true, } = options;
|
|
307
279
|
const request = new gateway.DeviceDetectRequest();
|
|
308
280
|
request.setInterfaceId(this.interfaceId);
|
|
309
281
|
request.setIdentifyDevices(identifyDevices);
|
|
@@ -312,11 +284,12 @@ class Connection {
|
|
|
312
284
|
}
|
|
313
285
|
/**
|
|
314
286
|
* Stops all of the devices on this connection.
|
|
315
|
-
* @param waitUntilIdle Determines whether the function should return immediately
|
|
287
|
+
* @param [options.waitUntilIdle=true] Determines whether the function should return immediately
|
|
316
288
|
* or wait until the devices are stopped.
|
|
317
|
-
* @
|
|
289
|
+
* @returns The addresses of the devices that were stopped by this command.
|
|
318
290
|
*/
|
|
319
|
-
async stopAll(
|
|
291
|
+
async stopAll(options = {}) {
|
|
292
|
+
const { waitUntilIdle = true, } = options;
|
|
320
293
|
const request = new gateway.DeviceOnAllRequest();
|
|
321
294
|
request.setInterfaceId(this.interfaceId);
|
|
322
295
|
request.setWaitUntilIdle(waitUntilIdle);
|
|
@@ -325,11 +298,12 @@ class Connection {
|
|
|
325
298
|
}
|
|
326
299
|
/**
|
|
327
300
|
* Homes all of the devices on this connection.
|
|
328
|
-
* @param waitUntilIdle Determines whether the function should return immediately
|
|
301
|
+
* @param [options.waitUntilIdle=true] Determines whether the function should return immediately
|
|
329
302
|
* or wait until the devices are homed.
|
|
330
|
-
* @
|
|
303
|
+
* @returns The addresses of the devices that were homed by this command.
|
|
331
304
|
*/
|
|
332
|
-
async homeAll(
|
|
305
|
+
async homeAll(options = {}) {
|
|
306
|
+
const { waitUntilIdle = true, } = options;
|
|
333
307
|
const request = new gateway.DeviceOnAllRequest();
|
|
334
308
|
request.setInterfaceId(this.interfaceId);
|
|
335
309
|
request.setWaitUntilIdle(waitUntilIdle);
|
|
@@ -338,7 +312,7 @@ class Connection {
|
|
|
338
312
|
}
|
|
339
313
|
/**
|
|
340
314
|
* Returns a string that represents the connection.
|
|
341
|
-
* @
|
|
315
|
+
* @returns A string that represents the connection.
|
|
342
316
|
*/
|
|
343
317
|
toString() {
|
|
344
318
|
const request = new gateway.InterfaceEmptyRequest();
|
|
@@ -348,7 +322,7 @@ class Connection {
|
|
|
348
322
|
}
|
|
349
323
|
/**
|
|
350
324
|
* Returns default request timeout.
|
|
351
|
-
* @
|
|
325
|
+
* @returns Default request timeout.
|
|
352
326
|
*/
|
|
353
327
|
_retrieveTimeout() {
|
|
354
328
|
const request = new gateway.InterfaceEmptyRequest();
|
|
@@ -368,7 +342,7 @@ class Connection {
|
|
|
368
342
|
}
|
|
369
343
|
/**
|
|
370
344
|
* Returns checksum enabled.
|
|
371
|
-
* @
|
|
345
|
+
* @returns Checksum enabled.
|
|
372
346
|
*/
|
|
373
347
|
_retrieveChecksumEnabled() {
|
|
374
348
|
const request = new gateway.InterfaceEmptyRequest();
|