@zaber/motion 2.8.1-alpha-2 → 2.10.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 (100) hide show
  1. package/dist/binding/wasm/zaber-motion-lib.wasm +0 -0
  2. package/dist/lib/ascii/device.d.ts +10 -0
  3. package/dist/lib/ascii/device.js +14 -0
  4. package/dist/lib/ascii/device.js.map +1 -1
  5. package/dist/lib/ascii/device_identity.d.ts +4 -0
  6. package/dist/lib/ascii/device_identity.js +1 -0
  7. package/dist/lib/ascii/device_identity.js.map +1 -1
  8. package/dist/lib/ascii/index.d.ts +3 -0
  9. package/dist/lib/ascii/index.js +7 -1
  10. package/dist/lib/ascii/index.js.map +1 -1
  11. package/dist/lib/ascii/oscilloscope.d.ts +62 -0
  12. package/dist/lib/ascii/oscilloscope.js +153 -0
  13. package/dist/lib/ascii/oscilloscope.js.map +1 -0
  14. package/dist/lib/ascii/oscilloscope_capture_properties.d.ts +16 -0
  15. package/dist/lib/ascii/oscilloscope_capture_properties.js +18 -0
  16. package/dist/lib/ascii/oscilloscope_capture_properties.js.map +1 -0
  17. package/dist/lib/ascii/oscilloscope_data.d.ts +67 -0
  18. package/dist/lib/ascii/oscilloscope_data.js +151 -0
  19. package/dist/lib/ascii/oscilloscope_data.js.map +1 -0
  20. package/dist/lib/ascii/stream.d.ts +23 -0
  21. package/dist/lib/ascii/stream.js +51 -0
  22. package/dist/lib/ascii/stream.js.map +1 -1
  23. package/dist/lib/ascii/stream_axis_definition.d.ts +1 -1
  24. package/dist/lib/ascii/stream_axis_definition.js +3 -0
  25. package/dist/lib/ascii/stream_axis_definition.js.map +1 -1
  26. package/dist/lib/ascii/stream_buffer.d.ts +1 -0
  27. package/dist/lib/ascii/stream_buffer.js +1 -0
  28. package/dist/lib/ascii/stream_buffer.js.map +1 -1
  29. package/dist/lib/ascii/transport.d.ts +4 -0
  30. package/dist/lib/ascii/transport.js +4 -0
  31. package/dist/lib/ascii/transport.js.map +1 -1
  32. package/dist/lib/ascii_ns.d.ts +6 -0
  33. package/dist/lib/ascii_ns.js +3 -0
  34. package/dist/lib/ascii_ns.js.map +1 -1
  35. package/dist/lib/exceptions/g_code_execution_exception.d.ts +14 -0
  36. package/dist/lib/exceptions/g_code_execution_exception.js +32 -0
  37. package/dist/lib/exceptions/g_code_execution_exception.js.map +1 -0
  38. package/dist/lib/exceptions/g_code_execution_exception_data.d.ts +17 -0
  39. package/dist/lib/exceptions/g_code_execution_exception_data.js +18 -0
  40. package/dist/lib/exceptions/g_code_execution_exception_data.js.map +1 -0
  41. package/dist/lib/exceptions/g_code_syntax_exception.d.ts +14 -0
  42. package/dist/lib/exceptions/g_code_syntax_exception.js +32 -0
  43. package/dist/lib/exceptions/g_code_syntax_exception.js.map +1 -0
  44. package/dist/lib/exceptions/g_code_syntax_exception_data.d.ts +17 -0
  45. package/dist/lib/exceptions/g_code_syntax_exception_data.js +18 -0
  46. package/dist/lib/exceptions/g_code_syntax_exception_data.js.map +1 -0
  47. package/dist/lib/exceptions/index.d.ts +5 -0
  48. package/dist/lib/exceptions/index.js +12 -2
  49. package/dist/lib/exceptions/index.js.map +1 -1
  50. package/dist/lib/exceptions/invalid_operation_exception.d.ts +7 -0
  51. package/dist/lib/exceptions/invalid_operation_exception.js +17 -0
  52. package/dist/lib/exceptions/invalid_operation_exception.js.map +1 -0
  53. package/dist/lib/finalizer.d.ts +5 -0
  54. package/dist/lib/finalizer.js +21 -0
  55. package/dist/lib/finalizer.js.map +1 -0
  56. package/dist/lib/gateway/convert_exceptions.js +3 -0
  57. package/dist/lib/gateway/convert_exceptions.js.map +1 -1
  58. package/dist/lib/gcode/axis_definition.d.ts +18 -0
  59. package/dist/lib/gcode/axis_definition.js +49 -0
  60. package/dist/lib/gcode/axis_definition.js.map +1 -0
  61. package/dist/lib/gcode/axis_mapping.d.ts +16 -0
  62. package/dist/lib/gcode/axis_mapping.js +41 -0
  63. package/dist/lib/gcode/axis_mapping.js.map +1 -0
  64. package/dist/lib/gcode/axis_transformation.d.ts +21 -0
  65. package/dist/lib/gcode/axis_transformation.js +43 -0
  66. package/dist/lib/gcode/axis_transformation.js.map +1 -0
  67. package/dist/lib/gcode/device_definition.d.ts +24 -0
  68. package/dist/lib/gcode/device_definition.js +44 -0
  69. package/dist/lib/gcode/device_definition.js.map +1 -0
  70. package/dist/lib/gcode/index.d.ts +9 -0
  71. package/dist/lib/gcode/index.js +22 -0
  72. package/dist/lib/gcode/index.js.map +1 -0
  73. package/dist/lib/gcode/offline_translator.d.ts +106 -0
  74. package/dist/lib/gcode/offline_translator.js +211 -0
  75. package/dist/lib/gcode/offline_translator.js.map +1 -0
  76. package/dist/lib/gcode/translate_message.d.ts +21 -0
  77. package/dist/lib/gcode/translate_message.js +19 -0
  78. package/dist/lib/gcode/translate_message.js.map +1 -0
  79. package/dist/lib/gcode/translate_result.d.ts +17 -0
  80. package/dist/lib/gcode/translate_result.js +19 -0
  81. package/dist/lib/gcode/translate_result.js.map +1 -0
  82. package/dist/lib/gcode/translator.d.ts +114 -0
  83. package/dist/lib/gcode/translator.js +225 -0
  84. package/dist/lib/gcode/translator.js.map +1 -0
  85. package/dist/lib/gcode/translator_config.d.ts +18 -0
  86. package/dist/lib/gcode/translator_config.js +44 -0
  87. package/dist/lib/gcode/translator_config.js.map +1 -0
  88. package/dist/lib/gcode_ns.d.ts +21 -0
  89. package/dist/lib/gcode_ns.js +36 -0
  90. package/dist/lib/gcode_ns.js.map +1 -0
  91. package/dist/lib/index.d.ts +1 -0
  92. package/dist/lib/index.js +1 -0
  93. package/dist/lib/index.js.map +1 -1
  94. package/dist/lib/measurement.d.ts +1 -1
  95. package/dist/lib/measurement.js +3 -0
  96. package/dist/lib/measurement.js.map +1 -1
  97. package/dist/lib/protobufs/main_pb.d.ts +1109 -24
  98. package/dist/lib/protobufs/main_pb.js +13539 -5174
  99. package/dist/lib/protobufs/main_pb.js.map +1 -1
  100. package/package.json +2 -2
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ // ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
3
+ // ============= DO NOT EDIT DIRECTLY ============= //
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.TranslateResult = void 0;
6
+ const translate_message_1 = require("./translate_message");
7
+ var TranslateResult;
8
+ (function (TranslateResult) {
9
+ TranslateResult.__type = 'TranslateResult';
10
+ /** @internal */
11
+ function fromProtobuf(pbData) {
12
+ return {
13
+ commands: pbData.commandsList,
14
+ warnings: pbData.warningsList.map(item => translate_message_1.TranslateMessage.fromProtobuf(item)),
15
+ };
16
+ }
17
+ TranslateResult.fromProtobuf = fromProtobuf;
18
+ })(TranslateResult = exports.TranslateResult || (exports.TranslateResult = {}));
19
+ //# sourceMappingURL=translate_result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translate_result.js","sourceRoot":"","sources":["../../../src/gcode/translate_result.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;AAGtD,2DAAuD;AAkBvD,IAAiB,eAAe,CAU/B;AAVD,WAAiB,eAAe;IACjB,sBAAM,GAAG,iBAAiB,CAAC;IAExC,gBAAgB;IAChB,SAAgB,YAAY,CAAC,MAAoD;QAC/E,OAAO;YACL,QAAQ,EAAE,MAAM,CAAC,YAAY;YAC7B,QAAQ,EAAE,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,oCAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;SAC/E,CAAC;IACJ,CAAC;IALe,4BAAY,eAK3B,CAAA;AACH,CAAC,EAVgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAU/B","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\nimport { TranslateMessage } from './translate_message';\n\n/**\n * Represents a result of a G-code block translation.\n */\nexport interface TranslateResult {\n /**\n * Stream commands resulting from the block.\n */\n commands: string[];\n\n /**\n * Messages informing about unsupported codes and features.\n */\n warnings: TranslateMessage[];\n\n}\n\nexport namespace TranslateResult {\n export const __type = 'TranslateResult';\n\n /** @internal */\n export function fromProtobuf(pbData: gateway.TranslatorTranslateResponse.AsObject): TranslateResult {\n return {\n commands: pbData.commandsList,\n warnings: pbData.warningsList.map(item => TranslateMessage.fromProtobuf(item)),\n };\n }\n}\n"]}
@@ -0,0 +1,114 @@
1
+ import { TranslateResult } from './translate_result';
2
+ import { TranslatorConfig } from './translator_config';
3
+ import { Stream } from '../ascii/stream';
4
+ import { Angle, Length, Native, AngularVelocity, Velocity } from '../units';
5
+ /**
6
+ * Represents a live G-Code translator.
7
+ * It allows to stream G-Code blocks to a connected device.
8
+ * It requires a stream to be setup on the device.
9
+ */
10
+ export declare class Translator {
11
+ /**
12
+ * The ID of the translator that serves to identify native resources.
13
+ */
14
+ get translatorId(): number;
15
+ private _translatorId;
16
+ /**
17
+ * Current coordinate system.
18
+ */
19
+ get coordinateSystem(): string;
20
+ constructor(translatorId: number);
21
+ /**
22
+ * Sets up the translator on top of a provided stream.
23
+ * @param stream The stream to setup the translator on.
24
+ * The stream must be already setup in a live or a store mode.
25
+ * @param config? Configuration of the translator.
26
+ * @return New instance of translator.
27
+ */
28
+ static setup(stream: Stream, config?: TranslatorConfig): Promise<Translator>;
29
+ /**
30
+ * Translates a single block (line) of G-code.
31
+ * The commands are queued in the underlying stream to ensure smooth continues movement.
32
+ * Returning of this method indicates that the commands are queued (not necessarily executed).
33
+ * @param block Block (line) of G-code.
34
+ * @return Result of translation containing the commands sent to the device.
35
+ */
36
+ translate(block: string): Promise<TranslateResult>;
37
+ /**
38
+ * Flushes the remaining stream commands waiting in optimization buffer into the underlying stream.
39
+ * The flush is also performed by M2 and M30 codes.
40
+ * @param waitUntilIdle Determines whether to wait for the stream to finish all the movements.
41
+ * @return The remaining stream commands.
42
+ */
43
+ flush(waitUntilIdle?: boolean): Promise<string[]>;
44
+ /**
45
+ * Resets position of the translator from the underlying stream.
46
+ * Call this method after performing a movement outside of translator.
47
+ */
48
+ resetPosition(): Promise<void>;
49
+ /**
50
+ * Sets the speed at which the device moves when traversing (G0).
51
+ * @param traverseRate The traverse rate.
52
+ * @param unit Units of the traverse rate.
53
+ */
54
+ setTraverseRate(traverseRate: number, unit: Velocity | AngularVelocity | Native): void;
55
+ /**
56
+ * Sets position of translator's axis.
57
+ * Use this method to set position after performing movement outside of the translator.
58
+ * This method does not cause any movement.
59
+ * @param axis Letter of the axis.
60
+ * @param position The position.
61
+ * @param unit Units of position.
62
+ */
63
+ setAxisPosition(axis: string, position: number, unit: Length | Angle | Native): void;
64
+ /**
65
+ * Gets position of translator's axis.
66
+ * This method does not query device but returns value from translator's state.
67
+ * @param axis Letter of the axis.
68
+ * @param unit Units of position.
69
+ * @return Position of translator's axis.
70
+ */
71
+ getAxisPosition(axis: string, unit: Length | Angle | Native): number;
72
+ /**
73
+ * Sets default position of translator's axis.
74
+ * This position is used by G28.
75
+ * @param axis Letter of the axis.
76
+ * @param position The default position.
77
+ * @param unit Units of position.
78
+ */
79
+ setAxisDefaultPosition(axis: string, position: number, unit: Length | Angle | Native): void;
80
+ /**
81
+ * Gets offset of an axis in a given coordinate system.
82
+ * @param coordinateSystem Coordinate system (e.g. G54).
83
+ * @param axis Letter of the axis.
84
+ * @param unit Units of position.
85
+ * @return Offset in translator units of the axis.
86
+ */
87
+ getAxisCoordinateSystemOffset(coordinateSystem: string, axis: string, unit: Length | Angle | Native): number;
88
+ /**
89
+ * Resets internal state after device rejected generated command.
90
+ * Axis positions become uninitialized.
91
+ */
92
+ resetAfterStreamError(): void;
93
+ /**
94
+ * Allows to scale feed rate of the translated code by a coefficient.
95
+ * @param coefficient Coefficient of the original feed rate.
96
+ */
97
+ setFeedRateOverride(coefficient: number): void;
98
+ /**
99
+ * Releases native resources of a translator.
100
+ * @param translatorId The ID of the translator.
101
+ */
102
+ private static _free;
103
+ /**
104
+ * Gets current coordinate system (e.g. G54).
105
+ * @return Current coordinate system.
106
+ */
107
+ private _getCurrentCoordinateSystem;
108
+ /**
109
+ * Releases the native resources of the translator.
110
+ * Should only be called if your environment does not support FinalizationRegistry.
111
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
112
+ */
113
+ free(): void;
114
+ }
@@ -0,0 +1,225 @@
1
+ "use strict";
2
+ // ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
3
+ // ============= DO NOT EDIT DIRECTLY ============= //
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
7
+ }) : (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ o[k2] = m[k];
10
+ }));
11
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
12
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
13
+ }) : function(o, v) {
14
+ o["default"] = v;
15
+ });
16
+ var __importStar = (this && this.__importStar) || function (mod) {
17
+ if (mod && mod.__esModule) return mod;
18
+ var result = {};
19
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
20
+ __setModuleDefault(result, mod);
21
+ return result;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.Translator = void 0;
25
+ const gateway = __importStar(require("../gateway"));
26
+ const translate_result_1 = require("./translate_result");
27
+ const translator_config_1 = require("./translator_config");
28
+ const finalizer_1 = require("../finalizer");
29
+ /**
30
+ * Represents a live G-Code translator.
31
+ * It allows to stream G-Code blocks to a connected device.
32
+ * It requires a stream to be setup on the device.
33
+ */
34
+ class Translator {
35
+ constructor(translatorId) {
36
+ this._translatorId = translatorId;
37
+ (0, finalizer_1.registerForFinalization)(this, Translator._free.bind(null, translatorId));
38
+ }
39
+ /**
40
+ * The ID of the translator that serves to identify native resources.
41
+ */
42
+ get translatorId() {
43
+ return this._translatorId;
44
+ }
45
+ /**
46
+ * Current coordinate system.
47
+ */
48
+ get coordinateSystem() {
49
+ return this._getCurrentCoordinateSystem();
50
+ }
51
+ /**
52
+ * Sets up the translator on top of a provided stream.
53
+ * @param stream The stream to setup the translator on.
54
+ * The stream must be already setup in a live or a store mode.
55
+ * @param config? Configuration of the translator.
56
+ * @return New instance of translator.
57
+ */
58
+ static async setup(stream, config) {
59
+ const request = new gateway.TranslatorCreateLiveRequest();
60
+ request.setDevice(stream.device.deviceAddress);
61
+ request.setInterfaceId(stream.device.connection.interfaceId);
62
+ request.setStreamId(stream.streamId);
63
+ request.setConfig(translator_config_1.TranslatorConfig.toProtobuf(config));
64
+ const response = await gateway.callAsync('gcode/create_live', request, gateway.TranslatorCreateResponse);
65
+ return new Translator(response.getTranslatorId());
66
+ }
67
+ /**
68
+ * Translates a single block (line) of G-code.
69
+ * The commands are queued in the underlying stream to ensure smooth continues movement.
70
+ * Returning of this method indicates that the commands are queued (not necessarily executed).
71
+ * @param block Block (line) of G-code.
72
+ * @return Result of translation containing the commands sent to the device.
73
+ */
74
+ async translate(block) {
75
+ const request = new gateway.TranslatorTranslateRequest();
76
+ request.setTranslatorId(this.translatorId);
77
+ request.setBlock(block);
78
+ const response = await gateway.callAsync('gcode/translate_live', request, gateway.TranslatorTranslateResponse);
79
+ return translate_result_1.TranslateResult.fromProtobuf(response.toObject());
80
+ }
81
+ /**
82
+ * Flushes the remaining stream commands waiting in optimization buffer into the underlying stream.
83
+ * The flush is also performed by M2 and M30 codes.
84
+ * @param waitUntilIdle Determines whether to wait for the stream to finish all the movements.
85
+ * @return The remaining stream commands.
86
+ */
87
+ async flush(waitUntilIdle = true) {
88
+ const request = new gateway.TranslatorFlushLiveRequest();
89
+ request.setTranslatorId(this.translatorId);
90
+ request.setWaitUntilIdle(waitUntilIdle);
91
+ const response = await gateway.callAsync('gcode/flush_live', request, gateway.TranslatorFlushResponse);
92
+ return response.getCommandsList();
93
+ }
94
+ /**
95
+ * Resets position of the translator from the underlying stream.
96
+ * Call this method after performing a movement outside of translator.
97
+ */
98
+ async resetPosition() {
99
+ const request = new gateway.TranslatorEmptyRequest();
100
+ request.setTranslatorId(this.translatorId);
101
+ await gateway.callAsync('gcode/reset_position_from_stream', request);
102
+ }
103
+ /**
104
+ * Sets the speed at which the device moves when traversing (G0).
105
+ * @param traverseRate The traverse rate.
106
+ * @param unit Units of the traverse rate.
107
+ */
108
+ setTraverseRate(traverseRate, unit) {
109
+ const request = new gateway.TranslatorSetTraverseRateRequest();
110
+ request.setTranslatorId(this.translatorId);
111
+ request.setTraverseRate(traverseRate);
112
+ request.setUnit(unit);
113
+ gateway.callSync('gcode/set_traverse_rate', request);
114
+ }
115
+ /**
116
+ * Sets position of translator's axis.
117
+ * Use this method to set position after performing movement outside of the translator.
118
+ * This method does not cause any movement.
119
+ * @param axis Letter of the axis.
120
+ * @param position The position.
121
+ * @param unit Units of position.
122
+ */
123
+ setAxisPosition(axis, position, unit) {
124
+ const request = new gateway.TranslatorSetAxisPositionRequest();
125
+ request.setTranslatorId(this.translatorId);
126
+ request.setAxis(axis);
127
+ request.setPosition(position);
128
+ request.setUnit(unit);
129
+ gateway.callSync('gcode/set_axis_position', request);
130
+ }
131
+ /**
132
+ * Gets position of translator's axis.
133
+ * This method does not query device but returns value from translator's state.
134
+ * @param axis Letter of the axis.
135
+ * @param unit Units of position.
136
+ * @return Position of translator's axis.
137
+ */
138
+ getAxisPosition(axis, unit) {
139
+ const request = new gateway.TranslatorGetAxisPositionRequest();
140
+ request.setTranslatorId(this.translatorId);
141
+ request.setAxis(axis);
142
+ request.setUnit(unit);
143
+ const response = gateway.callSync('gcode/get_axis_position', request, gateway.TranslatorGetAxisPositionResponse);
144
+ return response.getValue();
145
+ }
146
+ /**
147
+ * Sets default position of translator's axis.
148
+ * This position is used by G28.
149
+ * @param axis Letter of the axis.
150
+ * @param position The default position.
151
+ * @param unit Units of position.
152
+ */
153
+ setAxisDefaultPosition(axis, position, unit) {
154
+ const request = new gateway.TranslatorSetAxisPositionRequest();
155
+ request.setTranslatorId(this.translatorId);
156
+ request.setAxis(axis);
157
+ request.setPosition(position);
158
+ request.setUnit(unit);
159
+ gateway.callSync('gcode/set_axis_default', request);
160
+ }
161
+ /**
162
+ * Gets offset of an axis in a given coordinate system.
163
+ * @param coordinateSystem Coordinate system (e.g. G54).
164
+ * @param axis Letter of the axis.
165
+ * @param unit Units of position.
166
+ * @return Offset in translator units of the axis.
167
+ */
168
+ getAxisCoordinateSystemOffset(coordinateSystem, axis, unit) {
169
+ const request = new gateway.TranslatorGetAxisOffsetRequest();
170
+ request.setTranslatorId(this.translatorId);
171
+ request.setCoordinateSystem(coordinateSystem);
172
+ request.setAxis(axis);
173
+ request.setUnit(unit);
174
+ const response = gateway.callSync('gcode/get_axis_offset', request, gateway.TranslatorGetAxisPositionResponse);
175
+ return response.getValue();
176
+ }
177
+ /**
178
+ * Resets internal state after device rejected generated command.
179
+ * Axis positions become uninitialized.
180
+ */
181
+ resetAfterStreamError() {
182
+ const request = new gateway.TranslatorEmptyRequest();
183
+ request.setTranslatorId(this.translatorId);
184
+ gateway.callSync('gcode/reset_after_stream_error', request);
185
+ }
186
+ /**
187
+ * Allows to scale feed rate of the translated code by a coefficient.
188
+ * @param coefficient Coefficient of the original feed rate.
189
+ */
190
+ setFeedRateOverride(coefficient) {
191
+ const request = new gateway.TranslatorSetFeedRateOverrideRequest();
192
+ request.setTranslatorId(this.translatorId);
193
+ request.setCoefficient(coefficient);
194
+ gateway.callSync('gcode/set_feed_rate_override', request);
195
+ }
196
+ /**
197
+ * Releases native resources of a translator.
198
+ * @param translatorId The ID of the translator.
199
+ */
200
+ static _free(translatorId) {
201
+ const request = new gateway.TranslatorEmptyRequest();
202
+ request.setTranslatorId(translatorId);
203
+ gateway.callSync('gcode/free', request);
204
+ }
205
+ /**
206
+ * Gets current coordinate system (e.g. G54).
207
+ * @return Current coordinate system.
208
+ */
209
+ _getCurrentCoordinateSystem() {
210
+ const request = new gateway.TranslatorEmptyRequest();
211
+ request.setTranslatorId(this.translatorId);
212
+ const response = gateway.callSync('gcode/get_current_coordinate_system', request, gateway.TranslatorGetCurrentCoordinateSystemResponse);
213
+ return response.getValue();
214
+ }
215
+ /**
216
+ * Releases the native resources of the translator.
217
+ * Should only be called if your environment does not support FinalizationRegistry.
218
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
219
+ */
220
+ free() {
221
+ Translator._free(this.translatorId);
222
+ }
223
+ }
224
+ exports.Translator = Translator;
225
+ //# sourceMappingURL=translator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translator.js","sourceRoot":"","sources":["../../../src/gcode/translator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;AAEtD,oDAAsC;AACtC,yDAAqD;AACrD,2DAAuD;AAGvD,4CAAuD;AAEvD;;;;GAIG;AACH,MAAa,UAAU;IAgBrB,YAAY,YAAoB;QAC9B,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAA,mCAAuB,EAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAC3E,CAAC;IAlBD;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAGD;;OAEG;IACH,IAAW,gBAAgB;QACzB,OAAO,IAAI,CAAC,2BAA2B,EAAE,CAAC;IAC5C,CAAC;IAOD;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,KAAK,CACvB,MAAc,EACd,MAAyB;QAEzB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,2BAA2B,EAAE,CAAC;QAC1D,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC/C,OAAO,CAAC,cAAc,C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AAE,CAAC;QACrD,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAE3C,OAAO,CAAC,QAAQ,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED;;;OAGG;IACI,mBAAmB,CACxB,WAAmB;QAEnB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,oCAAoC,EAAE,CAAC;QACnE,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3C,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAEpC,OAAO,CAAC,QAAQ,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;;OAGG;IACK,MAAM,CAAC,KAAK,CAClB,YAAoB;QAEpB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;QACrD,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAEtC,OAAO,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACK,2BAA2B;QACjC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;QACrD,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAE3C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAC/B,qCAAqC,EACrC,OAAO,EACP,OAAO,CAAC,4CAA4C,CAAC,CAAC;QACxD,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACI,IAAI;QACT,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;CACF;AA1QD,gCA0QC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\nimport { TranslateResult } from './translate_result';\nimport { TranslatorConfig } from './translator_config';\nimport { Stream } from '../ascii/stream';\nimport { Angle, Length, Native, AngularVelocity, Velocity } from '../units';\nimport { registerForFinalization } from '../finalizer';\n\n/**\n * Represents a live G-Code translator.\n * It allows to stream G-Code blocks to a connected device.\n * It requires a stream to be setup on the device.\n */\nexport class Translator {\n /**\n * The ID of the translator that serves to identify native resources.\n */\n public get translatorId(): number {\n return this._translatorId;\n }\n private _translatorId: number;\n\n /**\n * Current coordinate system.\n */\n public get coordinateSystem(): string {\n return this._getCurrentCoordinateSystem();\n }\n\n constructor(translatorId: number) {\n this._translatorId = translatorId;\n registerForFinalization(this, Translator._free.bind(null, translatorId));\n }\n\n /**\n * Sets up the translator on top of a provided stream.\n * @param stream The stream to setup the translator on.\n * The stream must be already setup in a live or a store mode.\n * @param config? Configuration of the translator.\n * @return New instance of translator.\n */\n public static async setup(\n stream: Stream,\n config?: TranslatorConfig\n ): Promise<Translator> {\n const request = new gateway.TranslatorCreateLiveRequest();\n request.setDevice(stream.device.deviceAddress);\n request.setInterfaceId(stream.device.connection.interfaceId);\n request.setStreamId(stream.streamId);\n request.setConfig(TranslatorConfig.toProtobuf(config));\n\n const response = await gateway.callAsync<gateway.TranslatorCreateResponse>(\n 'gcode/create_live',\n request,\n gateway.TranslatorCreateResponse);\n return new Translator(response.getTranslatorId());\n }\n\n /**\n * Translates a single block (line) of G-code.\n * The commands are queued in the underlying stream to ensure smooth continues movement.\n * Returning of this method indicates that the commands are queued (not necessarily executed).\n * @param block Block (line) of G-code.\n * @return Result of translation containing the commands sent to the device.\n */\n public async translate(\n block: string\n ): Promise<TranslateResult> {\n const request = new gateway.TranslatorTranslateRequest();\n request.setTranslatorId(this.translatorId);\n request.setBlock(block);\n\n const response = await gateway.callAsync<gateway.TranslatorTranslateResponse>(\n 'gcode/translate_live',\n request,\n gateway.TranslatorTranslateResponse);\n return TranslateResult.fromProtobuf(response.toObject());\n }\n\n /**\n * Flushes the remaining stream commands waiting in optimization buffer into the underlying stream.\n * The flush is also performed by M2 and M30 codes.\n * @param waitUntilIdle Determines whether to wait for the stream to finish all the movements.\n * @return The remaining stream commands.\n */\n public async flush(\n waitUntilIdle: boolean = true\n ): Promise<string[]> {\n const request = new gateway.TranslatorFlushLiveRequest();\n request.setTranslatorId(this.translatorId);\n request.setWaitUntilIdle(waitUntilIdle);\n\n const response = await gateway.callAsync<gateway.TranslatorFlushResponse>(\n 'gcode/flush_live',\n request,\n gateway.TranslatorFlushResponse);\n return response.getCommandsList();\n }\n\n /**\n * Resets position of the translator from the underlying stream.\n * Call this method after performing a movement outside of translator.\n */\n public async resetPosition(): Promise<void> {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n await gateway.callAsync('gcode/reset_position_from_stream', request);\n }\n\n /**\n * Sets the speed at which the device moves when traversing (G0).\n * @param traverseRate The traverse rate.\n * @param unit Units of the traverse rate.\n */\n public setTraverseRate(\n traverseRate: number,\n unit: Velocity | AngularVelocity | Native\n ): void {\n const request = new gateway.TranslatorSetTraverseRateRequest();\n request.setTranslatorId(this.translatorId);\n request.setTraverseRate(traverseRate);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_traverse_rate', request);\n }\n\n /**\n * Sets position of translator's axis.\n * Use this method to set position after performing movement outside of the translator.\n * This method does not cause any movement.\n * @param axis Letter of the axis.\n * @param position The position.\n * @param unit Units of position.\n */\n public setAxisPosition(\n axis: string,\n position: number,\n unit: Length | Angle | Native\n ): void {\n const request = new gateway.TranslatorSetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setPosition(position);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_axis_position', request);\n }\n\n /**\n * Gets position of translator's axis.\n * This method does not query device but returns value from translator's state.\n * @param axis Letter of the axis.\n * @param unit Units of position.\n * @return Position of translator's axis.\n */\n public getAxisPosition(\n axis: string,\n unit: Length | Angle | Native\n ): number {\n const request = new gateway.TranslatorGetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.TranslatorGetAxisPositionResponse>(\n 'gcode/get_axis_position',\n request,\n gateway.TranslatorGetAxisPositionResponse);\n return response.getValue();\n }\n\n /**\n * Sets default position of translator's axis.\n * This position is used by G28.\n * @param axis Letter of the axis.\n * @param position The default position.\n * @param unit Units of position.\n */\n public setAxisDefaultPosition(\n axis: string,\n position: number,\n unit: Length | Angle | Native\n ): void {\n const request = new gateway.TranslatorSetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setPosition(position);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_axis_default', request);\n }\n\n /**\n * Gets offset of an axis in a given coordinate system.\n * @param coordinateSystem Coordinate system (e.g. G54).\n * @param axis Letter of the axis.\n * @param unit Units of position.\n * @return Offset in translator units of the axis.\n */\n public getAxisCoordinateSystemOffset(\n coordinateSystem: string,\n axis: string,\n unit: Length | Angle | Native\n ): number {\n const request = new gateway.TranslatorGetAxisOffsetRequest();\n request.setTranslatorId(this.translatorId);\n request.setCoordinateSystem(coordinateSystem);\n request.setAxis(axis);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.TranslatorGetAxisPositionResponse>(\n 'gcode/get_axis_offset',\n request,\n gateway.TranslatorGetAxisPositionResponse);\n return response.getValue();\n }\n\n /**\n * Resets internal state after device rejected generated command.\n * Axis positions become uninitialized.\n */\n public resetAfterStreamError(): void {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n gateway.callSync('gcode/reset_after_stream_error', request);\n }\n\n /**\n * Allows to scale feed rate of the translated code by a coefficient.\n * @param coefficient Coefficient of the original feed rate.\n */\n public setFeedRateOverride(\n coefficient: number\n ): void {\n const request = new gateway.TranslatorSetFeedRateOverrideRequest();\n request.setTranslatorId(this.translatorId);\n request.setCoefficient(coefficient);\n\n gateway.callSync('gcode/set_feed_rate_override', request);\n }\n\n /**\n * Releases native resources of a translator.\n * @param translatorId The ID of the translator.\n */\n private static _free(\n translatorId: number\n ): void {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(translatorId);\n\n gateway.callSync('gcode/free', request);\n }\n\n /**\n * Gets current coordinate system (e.g. G54).\n * @return Current coordinate system.\n */\n private _getCurrentCoordinateSystem(): string {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n const response = gateway.callSync<gateway.TranslatorGetCurrentCoordinateSystemResponse>(\n 'gcode/get_current_coordinate_system',\n request,\n gateway.TranslatorGetCurrentCoordinateSystemResponse);\n return response.getValue();\n }\n\n /**\n * Releases the native resources of the translator.\n * Should only be called if your environment does not support FinalizationRegistry.\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry\n */\n public free(): void {\n Translator._free(this.translatorId);\n }\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import { AxisMapping } from './axis_mapping';
2
+ import { AxisTransformation } from './axis_transformation';
3
+ /**
4
+ * Configuration of a translator.
5
+ */
6
+ export interface TranslatorConfig {
7
+ /**
8
+ * Optional custom mapping of translator axes to stream axes.
9
+ */
10
+ axisMappings?: AxisMapping[];
11
+ /**
12
+ * Optional transformation of axes.
13
+ */
14
+ axisTransformations?: AxisTransformation[];
15
+ }
16
+ export declare namespace TranslatorConfig {
17
+ const __type = "TranslatorConfig";
18
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ // ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
3
+ // ============= DO NOT EDIT DIRECTLY ============= //
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
7
+ }) : (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ o[k2] = m[k];
10
+ }));
11
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
12
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
13
+ }) : function(o, v) {
14
+ o["default"] = v;
15
+ });
16
+ var __importStar = (this && this.__importStar) || function (mod) {
17
+ if (mod && mod.__esModule) return mod;
18
+ var result = {};
19
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
20
+ __setModuleDefault(result, mod);
21
+ return result;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.TranslatorConfig = void 0;
25
+ const gateway = __importStar(require("../gateway"));
26
+ const axis_mapping_1 = require("./axis_mapping");
27
+ const axis_transformation_1 = require("./axis_transformation");
28
+ var TranslatorConfig;
29
+ (function (TranslatorConfig) {
30
+ TranslatorConfig.__type = 'TranslatorConfig';
31
+ /** @internal */
32
+ function toProtobuf(source) {
33
+ var _a, _b, _c, _d;
34
+ const pbData = new gateway.TranslatorConfig();
35
+ if (source == null) {
36
+ return pbData;
37
+ }
38
+ pbData.setAxisMappingsList((_b = (_a = source.axisMappings) === null || _a === void 0 ? void 0 : _a.map(item => axis_mapping_1.AxisMapping.toProtobuf(item))) !== null && _b !== void 0 ? _b : []);
39
+ pbData.setAxisTransformationsList((_d = (_c = source.axisTransformations) === null || _c === void 0 ? void 0 : _c.map(item => axis_transformation_1.AxisTransformation.toProtobuf(item))) !== null && _d !== void 0 ? _d : []);
40
+ return pbData;
41
+ }
42
+ TranslatorConfig.toProtobuf = toProtobuf;
43
+ })(TranslatorConfig = exports.TranslatorConfig || (exports.TranslatorConfig = {}));
44
+ //# sourceMappingURL=translator_config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translator_config.js","sourceRoot":"","sources":["../../../src/gcode/translator_config.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;AAEtD,oDAAsC;AACtC,iDAA6C;AAC7C,+DAA2D;AAkB3D,IAAiB,gBAAgB,CAchC;AAdD,WAAiB,gBAAgB;IAClB,uBAAM,GAAG,kBAAkB,CAAC;IAEzC,gBAAgB;IAChB,SAAgB,UAAU,CAAC,MAA2C;;QACpE,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC9C,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,OAAO,MAAM,CAAC;SACf;QAED,MAAM,CAAC,mBAAmB,CAAC,MAAA,MAAA,MAAM,CAAC,YAAY,0CAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,0BAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,mCAAI,EAAE,CAAC,CAAC;QACjG,MAAM,CAAC,0BAA0B,CAAC,MAAA,MAAA,MAAM,CAAC,mBAAmB,0CAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,wCAAkB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,mCAAI,EAAE,CAAC,CAAC;QACtH,OAAO,MAAM,CAAC;IAChB,CAAC;IATe,2BAAU,aASzB,CAAA;AACH,CAAC,EAdgB,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAchC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\nimport { AxisMapping } from './axis_mapping';\nimport { AxisTransformation } from './axis_transformation';\n\n/**\n * Configuration of a translator.\n */\nexport interface TranslatorConfig {\n /**\n * Optional custom mapping of translator axes to stream axes.\n */\n axisMappings?: AxisMapping[];\n\n /**\n * Optional transformation of axes.\n */\n axisTransformations?: AxisTransformation[];\n\n}\n\nexport namespace TranslatorConfig {\n export const __type = 'TranslatorConfig';\n\n /** @internal */\n export function toProtobuf(source: TranslatorConfig | null | undefined): gateway.TranslatorConfig {\n const pbData = new gateway.TranslatorConfig();\n if (source == null) {\n return pbData;\n }\n\n pbData.setAxisMappingsList(source.axisMappings?.map(item => AxisMapping.toProtobuf(item)) ?? []);\n pbData.setAxisTransformationsList(source.axisTransformations?.map(item => AxisTransformation.toProtobuf(item)) ?? []);\n return pbData;\n }\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import * as gcodeImport from './gcode';
2
+ export declare namespace gcode {
3
+ const TranslateMessage: typeof gcodeImport.TranslateMessage;
4
+ type TranslateMessage = gcodeImport.TranslateMessage;
5
+ const TranslateResult: typeof gcodeImport.TranslateResult;
6
+ type TranslateResult = gcodeImport.TranslateResult;
7
+ const AxisDefinition: typeof gcodeImport.AxisDefinition;
8
+ type AxisDefinition = gcodeImport.AxisDefinition;
9
+ const DeviceDefinition: typeof gcodeImport.DeviceDefinition;
10
+ type DeviceDefinition = gcodeImport.DeviceDefinition;
11
+ const TranslatorConfig: typeof gcodeImport.TranslatorConfig;
12
+ type TranslatorConfig = gcodeImport.TranslatorConfig;
13
+ const AxisMapping: typeof gcodeImport.AxisMapping;
14
+ type AxisMapping = gcodeImport.AxisMapping;
15
+ const AxisTransformation: typeof gcodeImport.AxisTransformation;
16
+ type AxisTransformation = gcodeImport.AxisTransformation;
17
+ const Translator: typeof gcodeImport.Translator;
18
+ type Translator = gcodeImport.Translator;
19
+ const OfflineTranslator: typeof gcodeImport.OfflineTranslator;
20
+ type OfflineTranslator = gcodeImport.OfflineTranslator;
21
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.gcode = void 0;
23
+ const gcodeImport = __importStar(require("./gcode"));
24
+ var gcode;
25
+ (function (gcode) {
26
+ gcode.TranslateMessage = gcodeImport.TranslateMessage;
27
+ gcode.TranslateResult = gcodeImport.TranslateResult;
28
+ gcode.AxisDefinition = gcodeImport.AxisDefinition;
29
+ gcode.DeviceDefinition = gcodeImport.DeviceDefinition;
30
+ gcode.TranslatorConfig = gcodeImport.TranslatorConfig;
31
+ gcode.AxisMapping = gcodeImport.AxisMapping;
32
+ gcode.AxisTransformation = gcodeImport.AxisTransformation;
33
+ gcode.Translator = gcodeImport.Translator;
34
+ gcode.OfflineTranslator = gcodeImport.OfflineTranslator;
35
+ })(gcode = exports.gcode || (exports.gcode = {}));
36
+ //# sourceMappingURL=gcode_ns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcode_ns.js","sourceRoot":"","sources":["../../src/gcode_ns.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AAEvC,IAAiB,KAAK,CAmBrB;AAnBD,WAAiB,KAAK;IACP,sBAAgB,GAAG,WAAW,CAAC,gBAAgB,CAAC;IAEhD,qBAAe,GAAG,WAAW,CAAC,eAAe,CAAC;IAE9C,oBAAc,GAAG,WAAW,CAAC,cAAc,CAAC;IAE5C,sBAAgB,GAAG,WAAW,CAAC,gBAAgB,CAAC;IAEhD,sBAAgB,GAAG,WAAW,CAAC,gBAAgB,CAAC;IAEhD,iBAAW,GAAG,WAAW,CAAC,WAAW,CAAC;IAEtC,wBAAkB,GAAG,WAAW,CAAC,kBAAkB,CAAC;IAEpD,gBAAU,GAAG,WAAW,CAAC,UAAU,CAAC;IAEpC,uBAAiB,GAAG,WAAW,CAAC,iBAAiB,CAAC;AAEjE,CAAC,EAnBgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAmBrB","sourcesContent":["import * as gcodeImport from './gcode';\n\nexport namespace gcode {\n export const TranslateMessage = gcodeImport.TranslateMessage;\n export type TranslateMessage = gcodeImport.TranslateMessage;\n export const TranslateResult = gcodeImport.TranslateResult;\n export type TranslateResult = gcodeImport.TranslateResult;\n export const AxisDefinition = gcodeImport.AxisDefinition;\n export type AxisDefinition = gcodeImport.AxisDefinition;\n export const DeviceDefinition = gcodeImport.DeviceDefinition;\n export type DeviceDefinition = gcodeImport.DeviceDefinition;\n export const TranslatorConfig = gcodeImport.TranslatorConfig;\n export type TranslatorConfig = gcodeImport.TranslatorConfig;\n export const AxisMapping = gcodeImport.AxisMapping;\n export type AxisMapping = gcodeImport.AxisMapping;\n export const AxisTransformation = gcodeImport.AxisTransformation;\n export type AxisTransformation = gcodeImport.AxisTransformation;\n export const Translator = gcodeImport.Translator;\n export type Translator = gcodeImport.Translator;\n export const OfflineTranslator = gcodeImport.OfflineTranslator;\n export type OfflineTranslator = gcodeImport.OfflineTranslator;\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  export * from './ascii_ns';
2
2
  export * from './binary_ns';
3
+ export * from './gcode_ns';
3
4
  export * from './exceptions';
4
5
  export { DeviceDbSourceType } from './device_db_source_type';
5
6
  export { FirmwareVersion } from './firmware_version';
package/dist/lib/index.js CHANGED
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.Tools = exports.CanSetStateDeviceResponse = exports.CanSetStateAxisResponse = exports.RotationDirection = exports.Measurement = exports.LogOutputMode = exports.Library = exports.FirmwareVersion = exports.DeviceDbSourceType = void 0;
14
14
  __exportStar(require("./ascii_ns"), exports);
15
15
  __exportStar(require("./binary_ns"), exports);
16
+ __exportStar(require("./gcode_ns"), exports);
16
17
  __exportStar(require("./exceptions"), exports);
17
18
  var device_db_source_type_1 = require("./device_db_source_type");
18
19
  Object.defineProperty(exports, "DeviceDbSourceType", { enumerable: true, get: function () { return device_db_source_type_1.DeviceDbSourceType; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,8CAA4B;AAC5B,+CAA6B;AAC7B,iEAA6D;AAApD,2HAAA,kBAAkB,OAAA;AAC3B,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,2DAAyD;AAAhD,uHAAA,iBAAiB,OAAA;AAC1B,6EAAwE;AAA/D,sIAAA,uBAAuB,OAAA;AAChC,iFAA4E;AAAnE,0IAAA,yBAAyB,OAAA;AAClC,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,0CAAwB","sourcesContent":["export * from './ascii_ns';\nexport * from './binary_ns';\nexport * from './exceptions';\nexport { DeviceDbSourceType } from './device_db_source_type';\nexport { FirmwareVersion } from './firmware_version';\nexport { Library } from './library';\nexport { LogOutputMode } from './log_output_mode';\nexport { Measurement } from './measurement';\nexport { RotationDirection } from './rotation_direction';\nexport { CanSetStateAxisResponse } from './can_set_state_axis_response';\nexport { CanSetStateDeviceResponse } from './can_set_state_device_response';\nexport { Tools } from './tools';\nexport * from './units';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,8CAA4B;AAC5B,6CAA2B;AAC3B,+CAA6B;AAC7B,iEAA6D;AAApD,2HAAA,kBAAkB,OAAA;AAC3B,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,2DAAyD;AAAhD,uHAAA,iBAAiB,OAAA;AAC1B,6EAAwE;AAA/D,sIAAA,uBAAuB,OAAA;AAChC,iFAA4E;AAAnE,0IAAA,yBAAyB,OAAA;AAClC,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,0CAAwB","sourcesContent":["export * from './ascii_ns';\nexport * from './binary_ns';\nexport * from './gcode_ns';\nexport * from './exceptions';\nexport { DeviceDbSourceType } from './device_db_source_type';\nexport { FirmwareVersion } from './firmware_version';\nexport { Library } from './library';\nexport { LogOutputMode } from './log_output_mode';\nexport { Measurement } from './measurement';\nexport { RotationDirection } from './rotation_direction';\nexport { CanSetStateAxisResponse } from './can_set_state_axis_response';\nexport { CanSetStateDeviceResponse } from './can_set_state_device_response';\nexport { Tools } from './tools';\nexport * from './units';\n"]}
@@ -10,7 +10,7 @@ export interface Measurement {
10
10
  /**
11
11
  * Optional units of the measurement.
12
12
  */
13
- unit?: Units | null;
13
+ unit?: Units;
14
14
  }
15
15
  export declare namespace Measurement {
16
16
  const __type = "Measurement";
@@ -29,6 +29,9 @@ var Measurement;
29
29
  /** @internal */
30
30
  function toProtobuf(source) {
31
31
  const pbData = new gateway.Measurement();
32
+ if (source == null) {
33
+ return pbData;
34
+ }
32
35
  pbData.setValue(source.value);
33
36
  pbData.setUnit(source.unit);
34
37
  return pbData;
@@ -1 +1 @@
1
- {"version":3,"file":"measurement.js","sourceRoot":"","sources":["../../src/measurement.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;AAEtD,mDAAqC;AAmBrC,IAAiB,WAAW,CAU3B;AAVD,WAAiB,WAAW;IACb,kBAAM,GAAG,aAAa,CAAC;IAEpC,gBAAgB;IAChB,SAAgB,UAAU,CAAC,MAAmB;QAC5C,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QACzC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAK,CAAC,CAAC;QAC7B,OAAO,MAAM,CAAC;IAChB,CAAC;IALe,sBAAU,aAKzB,CAAA;AACH,CAAC,EAVgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAU3B","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from './gateway';\nimport { Units } from './units';\n\n/**\n * Represents a numerical value with optional units specified.\n */\nexport interface Measurement {\n /**\n * Value of the measurement.\n */\n value: number;\n\n /**\n * Optional units of the measurement.\n */\n unit?: Units | null;\n\n}\n\nexport namespace Measurement {\n export const __type = 'Measurement';\n\n /** @internal */\n export function toProtobuf(source: Measurement): gateway.Measurement {\n const pbData = new gateway.Measurement();\n pbData.setValue(source.value);\n pbData.setUnit(source.unit!);\n return pbData;\n }\n}\n"]}
1
+ {"version":3,"file":"measurement.js","sourceRoot":"","sources":["../../src/measurement.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;AAEtD,mDAAqC;AAmBrC,IAAiB,WAAW,CAc3B;AAdD,WAAiB,WAAW;IACb,kBAAM,GAAG,aAAa,CAAC;IAEpC,gBAAgB;IAChB,SAAgB,UAAU,CAAC,MAAsC;QAC/D,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QACzC,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,OAAO,MAAM,CAAC;SACf;QAED,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAK,CAAC,CAAC;QAC7B,OAAO,MAAM,CAAC;IAChB,CAAC;IATe,sBAAU,aASzB,CAAA;AACH,CAAC,EAdgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAc3B","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from './gateway';\nimport { Units } from './units';\n\n/**\n * Represents a numerical value with optional units specified.\n */\nexport interface Measurement {\n /**\n * Value of the measurement.\n */\n value: number;\n\n /**\n * Optional units of the measurement.\n */\n unit?: Units;\n\n}\n\nexport namespace Measurement {\n export const __type = 'Measurement';\n\n /** @internal */\n export function toProtobuf(source: Measurement | null | undefined): gateway.Measurement {\n const pbData = new gateway.Measurement();\n if (source == null) {\n return pbData;\n }\n\n pbData.setValue(source.value);\n pbData.setUnit(source.unit!);\n return pbData;\n }\n}\n"]}