@zaber/motion 4.5.1 → 4.6.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.
Files changed (90) hide show
  1. package/dist/binding/wasm/zaber-motion-lib.wasm +0 -0
  2. package/dist/lib/ascii/axis.js +1 -1
  3. package/dist/lib/ascii/axis.js.map +1 -1
  4. package/dist/lib/ascii/axis_group.d.ts +62 -0
  5. package/dist/lib/ascii/axis_group.js +154 -0
  6. package/dist/lib/ascii/axis_group.js.map +1 -0
  7. package/dist/lib/ascii/axis_settings.d.ts +15 -0
  8. package/dist/lib/ascii/axis_settings.js +31 -0
  9. package/dist/lib/ascii/axis_settings.js.map +1 -1
  10. package/dist/lib/ascii/device.js +1 -1
  11. package/dist/lib/ascii/device.js.map +1 -1
  12. package/dist/lib/ascii/device_settings.d.ts +15 -0
  13. package/dist/lib/ascii/device_settings.js +29 -0
  14. package/dist/lib/ascii/device_settings.js.map +1 -1
  15. package/dist/lib/ascii/get_axis_setting.d.ts +17 -0
  16. package/dist/lib/ascii/get_axis_setting.js +45 -0
  17. package/dist/lib/ascii/get_axis_setting.js.map +1 -0
  18. package/dist/lib/ascii/get_axis_setting_result.d.ts +21 -0
  19. package/dist/lib/ascii/get_axis_setting_result.js +19 -0
  20. package/dist/lib/ascii/get_axis_setting_result.js.map +1 -0
  21. package/dist/lib/ascii/get_setting.d.ts +21 -0
  22. package/dist/lib/ascii/get_setting.js +47 -0
  23. package/dist/lib/ascii/get_setting.js.map +1 -0
  24. package/dist/lib/ascii/get_setting_result.d.ts +21 -0
  25. package/dist/lib/ascii/get_setting_result.js +19 -0
  26. package/dist/lib/ascii/get_setting_result.js.map +1 -0
  27. package/dist/lib/ascii/index.d.ts +5 -0
  28. package/dist/lib/ascii/index.js +12 -1
  29. package/dist/lib/ascii/index.js.map +1 -1
  30. package/dist/lib/ascii/setting_constants.d.ts +116 -0
  31. package/dist/lib/ascii/setting_constants.js +116 -0
  32. package/dist/lib/ascii/setting_constants.js.map +1 -1
  33. package/dist/lib/ascii_ns.d.ts +10 -0
  34. package/dist/lib/ascii_ns.js +5 -0
  35. package/dist/lib/ascii_ns.js.map +1 -1
  36. package/dist/lib/axis_address.d.ts +16 -0
  37. package/dist/lib/axis_address.js +53 -0
  38. package/dist/lib/axis_address.js.map +1 -0
  39. package/dist/lib/exceptions/index.d.ts +2 -0
  40. package/dist/lib/exceptions/index.js +6 -2
  41. package/dist/lib/exceptions/index.js.map +1 -1
  42. package/dist/lib/exceptions/operation_failed_exception.d.ts +14 -0
  43. package/dist/lib/exceptions/operation_failed_exception.js +32 -0
  44. package/dist/lib/exceptions/operation_failed_exception.js.map +1 -0
  45. package/dist/lib/exceptions/operation_failed_exception_data.d.ts +24 -0
  46. package/dist/lib/exceptions/operation_failed_exception_data.js +20 -0
  47. package/dist/lib/exceptions/operation_failed_exception_data.js.map +1 -0
  48. package/dist/lib/gateway/convert_exceptions.js +1 -0
  49. package/dist/lib/gateway/convert_exceptions.js.map +1 -1
  50. package/dist/lib/gcode/axis_transformation.js +1 -0
  51. package/dist/lib/gcode/axis_transformation.js.map +1 -1
  52. package/dist/lib/gcode/device_definition.js +1 -0
  53. package/dist/lib/gcode/device_definition.js.map +1 -1
  54. package/dist/lib/index.d.ts +1 -0
  55. package/dist/lib/index.js +3 -1
  56. package/dist/lib/index.js.map +1 -1
  57. package/dist/lib/microscopy/filter_changer.d.ts +36 -0
  58. package/dist/lib/microscopy/filter_changer.js +98 -0
  59. package/dist/lib/microscopy/filter_changer.js.map +1 -0
  60. package/dist/lib/microscopy/illuminator.d.ts +56 -0
  61. package/dist/lib/microscopy/illuminator.js +109 -0
  62. package/dist/lib/microscopy/illuminator.js.map +1 -0
  63. package/dist/lib/microscopy/illuminator_channel.d.ts +128 -0
  64. package/dist/lib/microscopy/illuminator_channel.js +260 -0
  65. package/dist/lib/microscopy/illuminator_channel.js.map +1 -0
  66. package/dist/lib/microscopy/index.d.ts +5 -0
  67. package/dist/lib/microscopy/index.js +11 -1
  68. package/dist/lib/microscopy/index.js.map +1 -1
  69. package/dist/lib/microscopy/microscope.d.ts +77 -0
  70. package/dist/lib/microscopy/microscope.js +142 -0
  71. package/dist/lib/microscopy/microscope.js.map +1 -0
  72. package/dist/lib/microscopy/microscope_config.d.ts +34 -0
  73. package/dist/lib/microscopy/microscope_config.js +65 -0
  74. package/dist/lib/microscopy/microscope_config.js.map +1 -0
  75. package/dist/lib/microscopy/objective_changer.d.ts +23 -14
  76. package/dist/lib/microscopy/objective_changer.js +58 -31
  77. package/dist/lib/microscopy/objective_changer.js.map +1 -1
  78. package/dist/lib/microscopy_ns.d.ts +8 -0
  79. package/dist/lib/microscopy_ns.js +4 -0
  80. package/dist/lib/microscopy_ns.js.map +1 -1
  81. package/dist/lib/product/process.d.ts +5 -0
  82. package/dist/lib/product/process.js +13 -0
  83. package/dist/lib/product/process.js.map +1 -1
  84. package/dist/lib/product/process_controller.d.ts +6 -1
  85. package/dist/lib/product/process_controller.js +12 -1
  86. package/dist/lib/product/process_controller.js.map +1 -1
  87. package/dist/lib/protobufs/main_pb.d.ts +520 -3
  88. package/dist/lib/protobufs/main_pb.js +10314 -6233
  89. package/dist/lib/protobufs/main_pb.js.map +1 -1
  90. package/package.json +1 -1
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ // ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
3
+ // ============= DO NOT EDIT DIRECTLY ============= //
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || function (mod) {
21
+ if (mod && mod.__esModule) return mod;
22
+ var result = {};
23
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
+ __setModuleDefault(result, mod);
25
+ return result;
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.Illuminator = void 0;
29
+ const gateway = __importStar(require("../gateway"));
30
+ const device_1 = require("../ascii/device");
31
+ const device_io_1 = require("../ascii/device_io");
32
+ const illuminator_channel_1 = require("./illuminator_channel");
33
+ /**
34
+ * Use to manage an LED controller.
35
+ * It is subject to breaking changes without warning until further notice.
36
+ * Requires at least Firmware 7.09.
37
+ */
38
+ class Illuminator {
39
+ /**
40
+ * The base device of this illuminator.
41
+ */
42
+ get device() {
43
+ return this._device;
44
+ }
45
+ /**
46
+ * I/O channels of this device.
47
+ */
48
+ get io() {
49
+ return this._io;
50
+ }
51
+ /**
52
+ * Creates instance of `Illuminator` based on the given device.
53
+ * If the device is identified, this constructor will ensure it is an illuminator.
54
+ */
55
+ constructor(device) {
56
+ this._device = device;
57
+ this._io = new device_io_1.DeviceIO(device);
58
+ this._verifyIsIlluminator();
59
+ }
60
+ /**
61
+ * Gets an IlluminatorChannel class instance that allows control of a particular channel.
62
+ * Channels are numbered from 1.
63
+ * @param channelNumber Number of channel to control.
64
+ * @returns Illuminator channel instance.
65
+ */
66
+ getChannel(channelNumber) {
67
+ if (channelNumber <= 0) {
68
+ throw new TypeError('Invalid value; channels are numbered from 1.');
69
+ }
70
+ return new illuminator_channel_1.IlluminatorChannel(this, channelNumber);
71
+ }
72
+ /**
73
+ * Checks if this is an illuminator or some other type of device and throws an error if it is not.
74
+ */
75
+ _verifyIsIlluminator() {
76
+ const request = new gateway.DeviceEmptyRequest();
77
+ request.setInterfaceId(this.device.connection.interfaceId);
78
+ request.setDevice(this.device.deviceAddress);
79
+ gateway.callSync('illuminator/verify', request);
80
+ }
81
+ /**
82
+ * Finds an illuminator on a connection.
83
+ * In case of conflict, specify the optional device address.
84
+ * @param connection Connection on which to detect the illuminator.
85
+ * @param [options.deviceAddress=0] Optional device address of the illuminator.
86
+ * @returns New instance of illuminator.
87
+ */
88
+ static async find(connection, options = {}) {
89
+ const { deviceAddress = 0, } = options;
90
+ const request = new gateway.FindDeviceRequest();
91
+ request.setInterfaceId(connection.interfaceId);
92
+ request.setDeviceAddress(deviceAddress);
93
+ const response = await gateway.callAsync('illuminator/detect', request, gateway.FindDeviceResponse);
94
+ return new Illuminator(new device_1.Device(connection, response.getAddress()));
95
+ }
96
+ /**
97
+ * Returns a string that represents the device.
98
+ * @returns A string that represents the device.
99
+ */
100
+ toString() {
101
+ const request = new gateway.AxisToStringRequest();
102
+ request.setInterfaceId(this.device.connection.interfaceId);
103
+ request.setDevice(this.device.deviceAddress);
104
+ const response = gateway.callSync('device/device_to_string', request, gateway.StringResponse);
105
+ return response.getValue();
106
+ }
107
+ }
108
+ exports.Illuminator = Illuminator;
109
+ //# sourceMappingURL=illuminator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"illuminator.js","sourceRoot":"","sources":["../../../src/microscopy/illuminator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,oDAAsC;AACtC,4CAAyC;AACzC,kDAA8C;AAE9C,+DAA2D;AAE3D;;;;GAIG;AACH,MAAa,WAAW;IACtB;;OAEG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAGD;;OAEG;IACH,IAAW,EAAE;QACX,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAGD;;;OAGG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IA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AAG,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAClD,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3D,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAE7C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAC/B,yBAAyB,EACzB,OAAO,EACP,OAAO,CAAC,cAAc,CAAC,CAAC;QAC1B,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;CACF;AA7FD,kCA6FC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\nimport { Device } from '../ascii/device';\nimport { DeviceIO } from '../ascii/device_io';\nimport { Connection } from '../ascii/connection';\nimport { IlluminatorChannel } from './illuminator_channel';\n\n/**\n * Use to manage an LED controller.\n * It is subject to breaking changes without warning until further notice.\n * Requires at least Firmware 7.09.\n */\nexport class Illuminator {\n /**\n * The base device of this illuminator.\n */\n public get device(): Device {\n return this._device;\n }\n private _device: Device;\n\n /**\n * I/O channels of this device.\n */\n public get io(): DeviceIO {\n return this._io;\n }\n private _io: DeviceIO;\n\n /**\n * Creates instance of `Illuminator` based on the given device.\n * If the device is identified, this constructor will ensure it is an illuminator.\n */\n constructor(device: Device) {\n this._device = device;\n this._io = new DeviceIO(device);\n this._verifyIsIlluminator();\n }\n\n /**\n * Gets an IlluminatorChannel class instance that allows control of a particular channel.\n * Channels are numbered from 1.\n * @param channelNumber Number of channel to control.\n * @returns Illuminator channel instance.\n */\n public getChannel(\n channelNumber: number\n ): IlluminatorChannel {\n if (channelNumber <= 0) {\n throw new TypeError('Invalid value; channels are numbered from 1.');\n }\n return new IlluminatorChannel(this, channelNumber);\n }\n\n /**\n * Checks if this is an illuminator or some other type of device and throws an error if it is not.\n */\n private _verifyIsIlluminator(): void {\n const request = new gateway.DeviceEmptyRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n\n gateway.callSync('illuminator/verify', request);\n }\n\n /**\n * Finds an illuminator on a connection.\n * In case of conflict, specify the optional device address.\n * @param connection Connection on which to detect the illuminator.\n * @param [options.deviceAddress=0] Optional device address of the illuminator.\n * @returns New instance of illuminator.\n */\n public static async find(\n connection: Connection,\n options: Illuminator.FindOptions = {}\n ): Promise<Illuminator> {\n const {\n deviceAddress = 0,\n } = options;\n const request = new gateway.FindDeviceRequest();\n request.setInterfaceId(connection.interfaceId);\n request.setDeviceAddress(deviceAddress);\n\n const response = await gateway.callAsync<gateway.FindDeviceResponse>(\n 'illuminator/detect',\n request,\n gateway.FindDeviceResponse);\n return new Illuminator(new Device(connection, response.getAddress()));\n }\n\n /**\n * Returns a string that represents the device.\n * @returns A string that represents the device.\n */\n public toString(): string {\n const request = new gateway.AxisToStringRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n\n const response = gateway.callSync<gateway.StringResponse>(\n 'device/device_to_string',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n}\n\nnamespace Illuminator {\n export interface FindOptions {\n deviceAddress?: number;\n }\n}\n"]}
@@ -0,0 +1,128 @@
1
+ import { AxisStorage } from '../ascii/storage';
2
+ import { AxisSettings } from '../ascii/axis_settings';
3
+ import { Warnings } from '../ascii/warnings';
4
+ import { Response } from '../ascii/response';
5
+ import type { Illuminator } from './illuminator';
6
+ /**
7
+ * Use to control a channel (LED lamp) on an illuminator.
8
+ * It is subject to breaking changes without warning until further notice.
9
+ * Requires at least Firmware 7.09.
10
+ */
11
+ export declare class IlluminatorChannel {
12
+ /**
13
+ * Illuminator of this channel.
14
+ */
15
+ get illuminator(): Illuminator;
16
+ private _illuminator;
17
+ /**
18
+ * The channel number identifies the channel on the illuminator.
19
+ */
20
+ get channelNumber(): number;
21
+ private _channelNumber;
22
+ private _axis;
23
+ /**
24
+ * Settings and properties of this channel.
25
+ */
26
+ get settings(): AxisSettings;
27
+ private _settings;
28
+ /**
29
+ * Key-value storage of this channel.
30
+ */
31
+ get storage(): AxisStorage;
32
+ private _storage;
33
+ /**
34
+ * Warnings and faults of this channel.
35
+ */
36
+ get warnings(): Warnings;
37
+ private _warnings;
38
+ constructor(illuminator: Illuminator, channelNumber: number);
39
+ /**
40
+ * Turns this channel on.
41
+ */
42
+ on(): Promise<void>;
43
+ /**
44
+ * Turns this channel off.
45
+ */
46
+ off(): Promise<void>;
47
+ /**
48
+ * Turns this channel on or off.
49
+ * @param on True to turn channel on, false to turn it off.
50
+ */
51
+ setOn(on: boolean): Promise<void>;
52
+ /**
53
+ * Checks if this channel is on.
54
+ * @returns True if channel is on, false otherwise.
55
+ */
56
+ isOn(): Promise<boolean>;
57
+ /**
58
+ * Sets channel intensity as a fraction of the maximum flux.
59
+ * @param intensity Fraction of intensity to set (between 0 and 1).
60
+ */
61
+ setIntensity(intensity: number): Promise<void>;
62
+ /**
63
+ * Gets the current intensity of this channel.
64
+ * @returns Current intensity as fraction of maximum flux.
65
+ */
66
+ getIntensity(): Promise<number>;
67
+ /**
68
+ * Sends a generic ASCII command to this channel.
69
+ * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
70
+ * @param command Command and its parameters.
71
+ * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.
72
+ * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.
73
+ * Overrides the connection default request timeout.
74
+ * @returns A response to the command.
75
+ */
76
+ genericCommand(command: string, options?: IlluminatorChannel.GenericCommandOptions): Promise<Response>;
77
+ /**
78
+ * Sends a generic ASCII command to this channel and expects multiple responses.
79
+ * Responses are returned in order of arrival.
80
+ * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
81
+ * @param command Command and its parameters.
82
+ * @param [options.checkErrors=true] Controls whether to throw an exception when a device rejects the command.
83
+ * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.
84
+ * Overrides the connection default request timeout.
85
+ * @returns All responses to the command.
86
+ */
87
+ genericCommandMultiResponse(command: string, options?: IlluminatorChannel.GenericCommandMultiResponseOptions): Promise<Response[]>;
88
+ /**
89
+ * Sends a generic ASCII command to this channel without expecting a response and without adding a message ID
90
+ * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
91
+ * @param command Command and its parameters.
92
+ */
93
+ genericCommandNoResponse(command: string): Promise<void>;
94
+ /**
95
+ * Returns a serialization of the current channel state that can be saved and reapplied.
96
+ * @returns A serialization of the current state of the channel.
97
+ */
98
+ getState(): Promise<string>;
99
+ /**
100
+ * Applies a saved state to this channel.
101
+ * @param state The state object to apply to this channel.
102
+ */
103
+ setState(state: string): Promise<void>;
104
+ /**
105
+ * Checks if a state can be applied to this channel.
106
+ * This only covers exceptions that can be determined statically such as mismatches of ID or version,
107
+ * the process of applying the state can still fail when running.
108
+ * @param state The state object to check against.
109
+ * @returns An explanation of why this state cannot be set to this channel.
110
+ */
111
+ canSetState(state: string): Promise<string>;
112
+ /**
113
+ * Returns a string that represents the channel.
114
+ * @returns A string that represents the channel.
115
+ */
116
+ toString(): string;
117
+ }
118
+ declare namespace IlluminatorChannel {
119
+ interface GenericCommandOptions {
120
+ checkErrors?: boolean;
121
+ timeout?: number;
122
+ }
123
+ interface GenericCommandMultiResponseOptions {
124
+ checkErrors?: boolean;
125
+ timeout?: number;
126
+ }
127
+ }
128
+ export {};
@@ -0,0 +1,260 @@
1
+ "use strict";
2
+ // ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
3
+ // ============= DO NOT EDIT DIRECTLY ============= //
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || function (mod) {
21
+ if (mod && mod.__esModule) return mod;
22
+ var result = {};
23
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
+ __setModuleDefault(result, mod);
25
+ return result;
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.IlluminatorChannel = void 0;
29
+ const gateway = __importStar(require("../gateway"));
30
+ const axis_1 = require("../ascii/axis");
31
+ const storage_1 = require("../ascii/storage");
32
+ const axis_settings_1 = require("../ascii/axis_settings");
33
+ const warnings_1 = require("../ascii/warnings");
34
+ const response_1 = require("../ascii/response");
35
+ /**
36
+ * Use to control a channel (LED lamp) on an illuminator.
37
+ * It is subject to breaking changes without warning until further notice.
38
+ * Requires at least Firmware 7.09.
39
+ */
40
+ class IlluminatorChannel {
41
+ /**
42
+ * Illuminator of this channel.
43
+ */
44
+ get illuminator() {
45
+ return this._illuminator;
46
+ }
47
+ /**
48
+ * The channel number identifies the channel on the illuminator.
49
+ */
50
+ get channelNumber() {
51
+ return this._channelNumber;
52
+ }
53
+ /**
54
+ * Settings and properties of this channel.
55
+ */
56
+ get settings() {
57
+ return this._settings;
58
+ }
59
+ /**
60
+ * Key-value storage of this channel.
61
+ */
62
+ get storage() {
63
+ return this._storage;
64
+ }
65
+ /**
66
+ * Warnings and faults of this channel.
67
+ */
68
+ get warnings() {
69
+ return this._warnings;
70
+ }
71
+ constructor(illuminator, channelNumber) {
72
+ this._illuminator = illuminator;
73
+ this._channelNumber = channelNumber;
74
+ this._axis = new axis_1.Axis(illuminator.device, channelNumber);
75
+ this._settings = new axis_settings_1.AxisSettings(this._axis);
76
+ this._storage = new storage_1.AxisStorage(this._axis);
77
+ this._warnings = new warnings_1.Warnings(illuminator.device, channelNumber);
78
+ }
79
+ /**
80
+ * Turns this channel on.
81
+ */
82
+ async on() {
83
+ const request = new gateway.ChannelOn();
84
+ request.setInterfaceId(this.illuminator.device.connection.interfaceId);
85
+ request.setDevice(this.illuminator.device.deviceAddress);
86
+ request.setAxis(this.channelNumber);
87
+ request.setOn(true);
88
+ await gateway.callAsync('illuminator/on', request);
89
+ }
90
+ /**
91
+ * Turns this channel off.
92
+ */
93
+ async off() {
94
+ const request = new gateway.ChannelOn();
95
+ request.setInterfaceId(this.illuminator.device.connection.interfaceId);
96
+ request.setDevice(this.illuminator.device.deviceAddress);
97
+ request.setAxis(this.channelNumber);
98
+ request.setOn(false);
99
+ await gateway.callAsync('illuminator/on', request);
100
+ }
101
+ /**
102
+ * Turns this channel on or off.
103
+ * @param on True to turn channel on, false to turn it off.
104
+ */
105
+ async setOn(on) {
106
+ const request = new gateway.ChannelOn();
107
+ request.setInterfaceId(this.illuminator.device.connection.interfaceId);
108
+ request.setDevice(this.illuminator.device.deviceAddress);
109
+ request.setAxis(this.channelNumber);
110
+ request.setOn(on);
111
+ await gateway.callAsync('illuminator/on', request);
112
+ }
113
+ /**
114
+ * Checks if this channel is on.
115
+ * @returns True if channel is on, false otherwise.
116
+ */
117
+ async isOn() {
118
+ const request = new gateway.AxisEmptyRequest();
119
+ request.setInterfaceId(this.illuminator.device.connection.interfaceId);
120
+ request.setDevice(this.illuminator.device.deviceAddress);
121
+ request.setAxis(this.channelNumber);
122
+ const response = await gateway.callAsync('illuminator/is_on', request, gateway.BoolResponse);
123
+ return response.getValue();
124
+ }
125
+ /**
126
+ * Sets channel intensity as a fraction of the maximum flux.
127
+ * @param intensity Fraction of intensity to set (between 0 and 1).
128
+ */
129
+ async setIntensity(intensity) {
130
+ const request = new gateway.ChannelSetIntensity();
131
+ request.setInterfaceId(this.illuminator.device.connection.interfaceId);
132
+ request.setDevice(this.illuminator.device.deviceAddress);
133
+ request.setAxis(this.channelNumber);
134
+ request.setIntensity(intensity);
135
+ await gateway.callAsync('illuminator/set_intensity', request);
136
+ }
137
+ /**
138
+ * Gets the current intensity of this channel.
139
+ * @returns Current intensity as fraction of maximum flux.
140
+ */
141
+ async getIntensity() {
142
+ const request = new gateway.AxisEmptyRequest();
143
+ request.setInterfaceId(this.illuminator.device.connection.interfaceId);
144
+ request.setDevice(this.illuminator.device.deviceAddress);
145
+ request.setAxis(this.channelNumber);
146
+ const response = await gateway.callAsync('illuminator/get_intensity', request, gateway.DoubleResponse);
147
+ return response.getValue();
148
+ }
149
+ /**
150
+ * Sends a generic ASCII command to this channel.
151
+ * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
152
+ * @param command Command and its parameters.
153
+ * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.
154
+ * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.
155
+ * Overrides the connection default request timeout.
156
+ * @returns A response to the command.
157
+ */
158
+ async genericCommand(command, options = {}) {
159
+ const { checkErrors = true, timeout = 0, } = options;
160
+ const request = new gateway.GenericCommandRequest();
161
+ request.setInterfaceId(this.illuminator.device.connection.interfaceId);
162
+ request.setDevice(this.illuminator.device.deviceAddress);
163
+ request.setAxis(this.channelNumber);
164
+ request.setCommand(command);
165
+ request.setCheckErrors(checkErrors);
166
+ request.setTimeout(timeout);
167
+ const response = await gateway.callAsync('interface/generic_command', request, gateway.GenericCommandResponse);
168
+ return response_1.Response.fromProtobuf(response.toObject());
169
+ }
170
+ /**
171
+ * Sends a generic ASCII command to this channel and expects multiple responses.
172
+ * Responses are returned in order of arrival.
173
+ * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
174
+ * @param command Command and its parameters.
175
+ * @param [options.checkErrors=true] Controls whether to throw an exception when a device rejects the command.
176
+ * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.
177
+ * Overrides the connection default request timeout.
178
+ * @returns All responses to the command.
179
+ */
180
+ async genericCommandMultiResponse(command, options = {}) {
181
+ const { checkErrors = true, timeout = 0, } = options;
182
+ const request = new gateway.GenericCommandRequest();
183
+ request.setInterfaceId(this.illuminator.device.connection.interfaceId);
184
+ request.setDevice(this.illuminator.device.deviceAddress);
185
+ request.setAxis(this.channelNumber);
186
+ request.setCommand(command);
187
+ request.setCheckErrors(checkErrors);
188
+ request.setTimeout(timeout);
189
+ const response = await gateway.callAsync('interface/generic_command_multi_response', request, gateway.GenericCommandResponseCollection);
190
+ return response.getResponsesList().map(a => response_1.Response.fromProtobuf(a.toObject()));
191
+ }
192
+ /**
193
+ * Sends a generic ASCII command to this channel without expecting a response and without adding a message ID
194
+ * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).
195
+ * @param command Command and its parameters.
196
+ */
197
+ async genericCommandNoResponse(command) {
198
+ const request = new gateway.GenericCommandRequest();
199
+ request.setInterfaceId(this.illuminator.device.connection.interfaceId);
200
+ request.setDevice(this.illuminator.device.deviceAddress);
201
+ request.setAxis(this.channelNumber);
202
+ request.setCommand(command);
203
+ await gateway.callAsync('interface/generic_command_no_response', request);
204
+ }
205
+ /**
206
+ * Returns a serialization of the current channel state that can be saved and reapplied.
207
+ * @returns A serialization of the current state of the channel.
208
+ */
209
+ async getState() {
210
+ const request = new gateway.AxisEmptyRequest();
211
+ request.setInterfaceId(this.illuminator.device.connection.interfaceId);
212
+ request.setDevice(this.illuminator.device.deviceAddress);
213
+ request.setAxis(this.channelNumber);
214
+ const response = await gateway.callAsync('device/get_state', request, gateway.StringResponse);
215
+ return response.getValue();
216
+ }
217
+ /**
218
+ * Applies a saved state to this channel.
219
+ * @param state The state object to apply to this channel.
220
+ */
221
+ async setState(state) {
222
+ const request = new gateway.SetStateRequest();
223
+ request.setInterfaceId(this.illuminator.device.connection.interfaceId);
224
+ request.setDevice(this.illuminator.device.deviceAddress);
225
+ request.setAxis(this.channelNumber);
226
+ request.setState(state);
227
+ await gateway.callAsync('device/set_state', request);
228
+ }
229
+ /**
230
+ * Checks if a state can be applied to this channel.
231
+ * This only covers exceptions that can be determined statically such as mismatches of ID or version,
232
+ * the process of applying the state can still fail when running.
233
+ * @param state The state object to check against.
234
+ * @returns An explanation of why this state cannot be set to this channel.
235
+ */
236
+ async canSetState(state) {
237
+ const request = new gateway.CanSetStateRequest();
238
+ request.setInterfaceId(this.illuminator.device.connection.interfaceId);
239
+ request.setDevice(this.illuminator.device.deviceAddress);
240
+ request.setAxis(this.channelNumber);
241
+ request.setState(state);
242
+ const response = await gateway.callAsync('device/can_set_axis_state', request, gateway.CanSetStateAxisResponse);
243
+ return response.getError();
244
+ }
245
+ /**
246
+ * Returns a string that represents the channel.
247
+ * @returns A string that represents the channel.
248
+ */
249
+ toString() {
250
+ const request = new gateway.AxisToStringRequest();
251
+ request.setInterfaceId(this.illuminator.device.connection.interfaceId);
252
+ request.setDevice(this.illuminator.device.deviceAddress);
253
+ request.setAxis(this.channelNumber);
254
+ request.setTypeOverride('Channel');
255
+ const response = gateway.callSync('device/axis_to_string', request, gateway.StringResponse);
256
+ return response.getValue();
257
+ }
258
+ }
259
+ exports.IlluminatorChannel = IlluminatorChannel;
260
+ //# sourceMappingURL=illuminator_channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"illuminator_channel.js","sourceRoot":"","sources":["../../../src/microscopy/illuminator_channel.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,oDAAsC;AACtC,wCAAqC;AACrC,8CAA+C;AAC/C,0DAAsD;AACtD,gDAA6C;AAC7C,gDAA6C;AAG7C;;;;GAIG;AACH,MAAa,kBAAkB;IAC7B;;OAEG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B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uB,CAAC,CAAC;QACnC,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,QAAQ;QACb,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAClD,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACvE,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACzD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACpC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;QAEnC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAC/B,uBAAuB,EACvB,OAAO,EACP,OAAO,CAAC,cAAc,CAAC,CAAC;QAC1B,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;CACF;AA3SD,gDA2SC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\nimport { Axis } from '../ascii/axis';\nimport { AxisStorage } from '../ascii/storage';\nimport { AxisSettings } from '../ascii/axis_settings';\nimport { Warnings } from '../ascii/warnings';\nimport { Response } from '../ascii/response';\nimport type { Illuminator } from './illuminator';\n\n/**\n * Use to control a channel (LED lamp) on an illuminator.\n * It is subject to breaking changes without warning until further notice.\n * Requires at least Firmware 7.09.\n */\nexport class IlluminatorChannel {\n /**\n * Illuminator of this channel.\n */\n public get illuminator(): Illuminator {\n return this._illuminator;\n }\n private _illuminator: Illuminator;\n\n /**\n * The channel number identifies the channel on the illuminator.\n */\n public get channelNumber(): number {\n return this._channelNumber;\n }\n private _channelNumber: number;\n\n private _axis: Axis;\n\n /**\n * Settings and properties of this channel.\n */\n public get settings(): AxisSettings {\n return this._settings;\n }\n private _settings: AxisSettings;\n\n /**\n * Key-value storage of this channel.\n */\n public get storage(): AxisStorage {\n return this._storage;\n }\n private _storage: AxisStorage;\n\n /**\n * Warnings and faults of this channel.\n */\n public get warnings(): Warnings {\n return this._warnings;\n }\n private _warnings: Warnings;\n\n constructor(illuminator: Illuminator, channelNumber: number) {\n this._illuminator = illuminator;\n this._channelNumber = channelNumber;\n this._axis = new Axis(illuminator.device, channelNumber);\n this._settings = new AxisSettings(this._axis);\n this._storage = new AxisStorage(this._axis);\n this._warnings = new Warnings(illuminator.device, channelNumber);\n }\n\n /**\n * Turns this channel on.\n */\n public async on(): Promise<void> {\n const request = new gateway.ChannelOn();\n request.setInterfaceId(this.illuminator.device.connection.interfaceId);\n request.setDevice(this.illuminator.device.deviceAddress);\n request.setAxis(this.channelNumber);\n request.setOn(true);\n\n await gateway.callAsync('illuminator/on', request);\n }\n\n /**\n * Turns this channel off.\n */\n public async off(): Promise<void> {\n const request = new gateway.ChannelOn();\n request.setInterfaceId(this.illuminator.device.connection.interfaceId);\n request.setDevice(this.illuminator.device.deviceAddress);\n request.setAxis(this.channelNumber);\n request.setOn(false);\n\n await gateway.callAsync('illuminator/on', request);\n }\n\n /**\n * Turns this channel on or off.\n * @param on True to turn channel on, false to turn it off.\n */\n public async setOn(\n on: boolean\n ): Promise<void> {\n const request = new gateway.ChannelOn();\n request.setInterfaceId(this.illuminator.device.connection.interfaceId);\n request.setDevice(this.illuminator.device.deviceAddress);\n request.setAxis(this.channelNumber);\n request.setOn(on);\n\n await gateway.callAsync('illuminator/on', request);\n }\n\n /**\n * Checks if this channel is on.\n * @returns True if channel is on, false otherwise.\n */\n public async isOn(): Promise<boolean> {\n const request = new gateway.AxisEmptyRequest();\n request.setInterfaceId(this.illuminator.device.connection.interfaceId);\n request.setDevice(this.illuminator.device.deviceAddress);\n request.setAxis(this.channelNumber);\n\n const response = await gateway.callAsync<gateway.BoolResponse>(\n 'illuminator/is_on',\n request,\n gateway.BoolResponse);\n return response.getValue();\n }\n\n /**\n * Sets channel intensity as a fraction of the maximum flux.\n * @param intensity Fraction of intensity to set (between 0 and 1).\n */\n public async setIntensity(\n intensity: number\n ): Promise<void> {\n const request = new gateway.ChannelSetIntensity();\n request.setInterfaceId(this.illuminator.device.connection.interfaceId);\n request.setDevice(this.illuminator.device.deviceAddress);\n request.setAxis(this.channelNumber);\n request.setIntensity(intensity);\n\n await gateway.callAsync('illuminator/set_intensity', request);\n }\n\n /**\n * Gets the current intensity of this channel.\n * @returns Current intensity as fraction of maximum flux.\n */\n public async getIntensity(): Promise<number> {\n const request = new gateway.AxisEmptyRequest();\n request.setInterfaceId(this.illuminator.device.connection.interfaceId);\n request.setDevice(this.illuminator.device.deviceAddress);\n request.setAxis(this.channelNumber);\n\n const response = await gateway.callAsync<gateway.DoubleResponse>(\n 'illuminator/get_intensity',\n request,\n gateway.DoubleResponse);\n return response.getValue();\n }\n\n /**\n * Sends a generic ASCII command to this channel.\n * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns A response to the command.\n */\n public async genericCommand(\n command: string,\n options: IlluminatorChannel.GenericCommandOptions = {}\n ): Promise<Response> {\n const {\n checkErrors = true,\n timeout = 0,\n } = options;\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.illuminator.device.connection.interfaceId);\n request.setDevice(this.illuminator.device.deviceAddress);\n request.setAxis(this.channelNumber);\n request.setCommand(command);\n request.setCheckErrors(checkErrors);\n request.setTimeout(timeout);\n\n const response = await gateway.callAsync<gateway.GenericCommandResponse>(\n 'interface/generic_command',\n request,\n gateway.GenericCommandResponse);\n return Response.fromProtobuf(response.toObject());\n }\n\n /**\n * Sends a generic ASCII command to this channel and expects multiple responses.\n * Responses are returned in order of arrival.\n * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.checkErrors=true] Controls whether to throw an exception when a device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns All responses to the command.\n */\n public async genericCommandMultiResponse(\n command: string,\n options: IlluminatorChannel.GenericCommandMultiResponseOptions = {}\n ): Promise<Response[]> {\n const {\n checkErrors = true,\n timeout = 0,\n } = options;\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.illuminator.device.connection.interfaceId);\n request.setDevice(this.illuminator.device.deviceAddress);\n request.setAxis(this.channelNumber);\n request.setCommand(command);\n request.setCheckErrors(checkErrors);\n request.setTimeout(timeout);\n\n const response = await gateway.callAsync<gateway.GenericCommandResponseCollection>(\n 'interface/generic_command_multi_response',\n request,\n gateway.GenericCommandResponseCollection);\n return response.getResponsesList().map(a => Response.fromProtobuf(a.toObject()));\n }\n\n /**\n * Sends a generic ASCII command to this channel without expecting a response and without adding a message ID\n * For more information refer to: [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n */\n public async genericCommandNoResponse(\n command: string\n ): Promise<void> {\n const request = new gateway.GenericCommandRequest();\n request.setInterfaceId(this.illuminator.device.connection.interfaceId);\n request.setDevice(this.illuminator.device.deviceAddress);\n request.setAxis(this.channelNumber);\n request.setCommand(command);\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Returns a serialization of the current channel state that can be saved and reapplied.\n * @returns A serialization of the current state of the channel.\n */\n public async getState(): Promise<string> {\n const request = new gateway.AxisEmptyRequest();\n request.setInterfaceId(this.illuminator.device.connection.interfaceId);\n request.setDevice(this.illuminator.device.deviceAddress);\n request.setAxis(this.channelNumber);\n\n const response = await gateway.callAsync<gateway.StringResponse>(\n 'device/get_state',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n\n /**\n * Applies a saved state to this channel.\n * @param state The state object to apply to this channel.\n */\n public async setState(\n state: string\n ): Promise<void> {\n const request = new gateway.SetStateRequest();\n request.setInterfaceId(this.illuminator.device.connection.interfaceId);\n request.setDevice(this.illuminator.device.deviceAddress);\n request.setAxis(this.channelNumber);\n request.setState(state);\n\n await gateway.callAsync('device/set_state', request);\n }\n\n /**\n * Checks if a state can be applied to this channel.\n * This only covers exceptions that can be determined statically such as mismatches of ID or version,\n * the process of applying the state can still fail when running.\n * @param state The state object to check against.\n * @returns An explanation of why this state cannot be set to this channel.\n */\n public async canSetState(\n state: string\n ): Promise<string> {\n const request = new gateway.CanSetStateRequest();\n request.setInterfaceId(this.illuminator.device.connection.interfaceId);\n request.setDevice(this.illuminator.device.deviceAddress);\n request.setAxis(this.channelNumber);\n request.setState(state);\n\n const response = await gateway.callAsync<gateway.CanSetStateAxisResponse>(\n 'device/can_set_axis_state',\n request,\n gateway.CanSetStateAxisResponse);\n return response.getError();\n }\n\n /**\n * Returns a string that represents the channel.\n * @returns A string that represents the channel.\n */\n public toString(): string {\n const request = new gateway.AxisToStringRequest();\n request.setInterfaceId(this.illuminator.device.connection.interfaceId);\n request.setDevice(this.illuminator.device.deviceAddress);\n request.setAxis(this.channelNumber);\n request.setTypeOverride('Channel');\n\n const response = gateway.callSync<gateway.StringResponse>(\n 'device/axis_to_string',\n request,\n gateway.StringResponse);\n return response.getValue();\n }\n}\n\nnamespace IlluminatorChannel {\n export interface GenericCommandOptions {\n checkErrors?: boolean;\n timeout?: number;\n }\n export interface GenericCommandMultiResponseOptions {\n checkErrors?: boolean;\n timeout?: number;\n }\n}\n"]}
@@ -1 +1,6 @@
1
1
  export { ObjectiveChanger } from './objective_changer';
2
+ export { Illuminator } from './illuminator';
3
+ export { IlluminatorChannel } from './illuminator_channel';
4
+ export { Microscope } from './microscope';
5
+ export { MicroscopeConfig } from './microscope_config';
6
+ export { FilterChanger } from './filter_changer';
@@ -1,6 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObjectiveChanger = void 0;
3
+ exports.FilterChanger = exports.MicroscopeConfig = exports.Microscope = exports.IlluminatorChannel = exports.Illuminator = exports.ObjectiveChanger = void 0;
4
4
  var objective_changer_1 = require("./objective_changer");
5
5
  Object.defineProperty(exports, "ObjectiveChanger", { enumerable: true, get: function () { return objective_changer_1.ObjectiveChanger; } });
6
+ var illuminator_1 = require("./illuminator");
7
+ Object.defineProperty(exports, "Illuminator", { enumerable: true, get: function () { return illuminator_1.Illuminator; } });
8
+ var illuminator_channel_1 = require("./illuminator_channel");
9
+ Object.defineProperty(exports, "IlluminatorChannel", { enumerable: true, get: function () { return illuminator_channel_1.IlluminatorChannel; } });
10
+ var microscope_1 = require("./microscope");
11
+ Object.defineProperty(exports, "Microscope", { enumerable: true, get: function () { return microscope_1.Microscope; } });
12
+ var microscope_config_1 = require("./microscope_config");
13
+ Object.defineProperty(exports, "MicroscopeConfig", { enumerable: true, get: function () { return microscope_config_1.MicroscopeConfig; } });
14
+ var filter_changer_1 = require("./filter_changer");
15
+ Object.defineProperty(exports, "FilterChanger", { enumerable: true, get: function () { return filter_changer_1.FilterChanger; } });
6
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/microscopy/index.ts"],"names":[],"mappings":";;;AAAA,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA","sourcesContent":["export { ObjectiveChanger } from './objective_changer';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/microscopy/index.ts"],"names":[],"mappings":";;;AAAA,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AACzB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAC3B,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AACzB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA","sourcesContent":["export { ObjectiveChanger } from './objective_changer';\nexport { Illuminator } from './illuminator';\nexport { IlluminatorChannel } from './illuminator_channel';\nexport { Microscope } from './microscope';\nexport { MicroscopeConfig } from './microscope_config';\nexport { FilterChanger } from './filter_changer';\n"]}
@@ -0,0 +1,77 @@
1
+ import { Axis } from '../ascii/axis';
2
+ import { AxisGroup } from '../ascii/axis_group';
3
+ import { Connection } from '../ascii/connection';
4
+ import { Illuminator } from './illuminator';
5
+ import { ObjectiveChanger } from './objective_changer';
6
+ import { MicroscopeConfig } from './microscope_config';
7
+ import { FilterChanger } from './filter_changer';
8
+ /**
9
+ * Represent a microscope.
10
+ * It is subject to breaking changes without warning until further notice.
11
+ * Parts of the microscope may or may not be instantiated depending on the configuration.
12
+ * Requires at least Firmware 7.34.
13
+ */
14
+ export declare class Microscope {
15
+ /**
16
+ * Connection of the microscope.
17
+ */
18
+ get connection(): Connection;
19
+ private _connection;
20
+ private _config;
21
+ /**
22
+ * The illuminator.
23
+ */
24
+ get illuminator(): Illuminator | undefined;
25
+ private _illuminator;
26
+ /**
27
+ * The focus axis.
28
+ */
29
+ get focusAxis(): Axis | undefined;
30
+ private _focusAxis;
31
+ /**
32
+ * The X axis.
33
+ */
34
+ get xAxis(): Axis | undefined;
35
+ private _xAxis;
36
+ /**
37
+ * The Y axis.
38
+ */
39
+ get yAxis(): Axis | undefined;
40
+ private _yAxis;
41
+ /**
42
+ * Axis group consisting of X and Y axes representing the plate of the microscope.
43
+ */
44
+ get plate(): AxisGroup | undefined;
45
+ private _plate;
46
+ /**
47
+ * The objective changer.
48
+ */
49
+ get objectiveChanger(): ObjectiveChanger | undefined;
50
+ private _objectiveChanger;
51
+ /**
52
+ * The filter changer.
53
+ */
54
+ get filterChanger(): FilterChanger | undefined;
55
+ private _filterChanger;
56
+ /**
57
+ * Creates instance of `Microscope` from the given config.
58
+ * Parts are instantiated depending on device addresses in the config.
59
+ */
60
+ constructor(connection: Connection, config: MicroscopeConfig);
61
+ /**
62
+ * Finds a microscope on a connection.
63
+ * @param connection Connection on which to detect the microscope.
64
+ * @returns New instance of microscope.
65
+ */
66
+ static find(connection: Connection): Promise<Microscope>;
67
+ /**
68
+ * Initializes the microscope.
69
+ * Homes all axes, filter changer, and objective changer.
70
+ */
71
+ initialize(): Promise<void>;
72
+ /**
73
+ * Returns a string that represents the microscope.
74
+ * @returns A string that represents the microscope.
75
+ */
76
+ toString(): string;
77
+ }