motion-master-client 0.0.406 → 0.0.408

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-master-client",
3
- "version": "0.0.406",
3
+ "version": "0.0.408",
4
4
  "type": "commonjs",
5
5
  "description": "A library and CLI program used for communicating with Motion Master.",
6
6
  "dependencies": {
@@ -12,9 +12,8 @@
12
12
  "ecatmod": "^2.2.11",
13
13
  "express": "^4.19.2",
14
14
  "fast-deep-equal": "^3.1.3",
15
- "js-untar": "^2.0.0",
15
+ "fflate": "^0.8.3",
16
16
  "lodash": "^4.17.21",
17
- "pako": "^2.1.0",
18
17
  "papaparse": "^5.4.1",
19
18
  "protobufjs": "^7.2.3",
20
19
  "python-struct": "^1.1.3",
package/src/api.js CHANGED
@@ -8,6 +8,7 @@ const express_1 = tslib_1.__importDefault(require("express"));
8
8
  const cors_1 = tslib_1.__importDefault(require("cors"));
9
9
  const rxjs_1 = require("rxjs");
10
10
  const device_1 = require("./lib/device");
11
+ const firmware_esi_1 = require("./lib/firmware-esi");
11
12
  const motion_master_client_1 = require("./lib/motion-master-client");
12
13
  const cia402_1 = require("./lib/cia402");
13
14
  const parameter_1 = require("./lib/parameter");
@@ -437,10 +438,18 @@ app.post('/api/devices/:deviceRef/start-firmware-installation', asyncHandler((re
437
438
  const skipSiiInstallation = asBoolean(req.query['skip-sii-installation']);
438
439
  const requestTimeout = parseInt(((_4 = req.query['request-timeout']) !== null && _4 !== void 0 ? _4 : '180000'));
439
440
  const skipFilesParam = req.query['skip-files'];
440
- let skipFiles = null;
441
+ let skipFiles;
441
442
  if (Array.isArray(skipFilesParam)) {
442
443
  skipFiles = skipFilesParam;
443
444
  }
445
+ else if (typeof skipFilesParam === 'string') {
446
+ skipFiles = [skipFilesParam];
447
+ }
448
+ else {
449
+ // Skip installing the ESI file (SOMANET_CiA_402.xml.zip) onto the drive by default. It is no longer written
450
+ // over FoE; pass an explicit `skip-files` query parameter to override (e.g. to still write the ESI).
451
+ skipFiles = [firmware_esi_1.esiZipFilename];
452
+ }
444
453
  const startDeviceFirmwareInstallationRequest = Object.assign(Object.assign({}, deviceRefObj), { firmwarePackageContent,
445
454
  skipSiiInstallation,
446
455
  skipFiles });
@@ -603,13 +612,42 @@ app.get('/api/devices/:deviceRef/cia402-state', asyncHandler((req, res) => tslib
603
612
  const state = yield (0, rxjs_1.lastValueFrom)(client.request.getCia402State(deviceRef, requestTimeout));
604
613
  res.send({ state });
605
614
  })));
615
+ /**
616
+ * Resolves once the target reached bit (0x6041) is set, or fails with 500 when the
617
+ * request times out before it is reached.
618
+ *
619
+ * @example curl "http://localhost:63526/api/devices/0/when-target-reached?monitoring-interval=1000&request-timeout=5000"
620
+ */
621
+ app.get('/api/devices/:deviceRef/when-target-reached', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
622
+ var _26, _27;
623
+ const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
624
+ const monitoringInterval = parseInt(((_26 = req.query['monitoring-interval']) !== null && _26 !== void 0 ? _26 : '10000'));
625
+ const requestTimeout = parseInt(((_27 = req.query['request-timeout']) !== null && _27 !== void 0 ? _27 : '5000'));
626
+ yield client.whenTargetReached(deviceRef, monitoringInterval, requestTimeout);
627
+ res.send({ targetReached: true });
628
+ })));
629
+ /**
630
+ * Resolves once the device reaches the specified CiA 402 state, or fails with 500 when
631
+ * the request times out before the state is reached.
632
+ *
633
+ * @example curl "http://localhost:63526/api/devices/0/when-cia402-state-reached/OPERATION_ENABLED?monitoring-interval=10000&request-timeout=60000"
634
+ */
635
+ app.get('/api/devices/:deviceRef/when-cia402-state-reached/:state', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
636
+ var _28, _29;
637
+ const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
638
+ const state = req.params['state'];
639
+ const monitoringInterval = parseInt(((_28 = req.query['monitoring-interval']) !== null && _28 !== void 0 ? _28 : '10000'));
640
+ const requestTimeout = parseInt(((_29 = req.query['request-timeout']) !== null && _29 !== void 0 ? _29 : '60000'));
641
+ yield client.whenCia402StateReached(deviceRef, state, monitoringInterval, requestTimeout);
642
+ res.send();
643
+ })));
606
644
  app.get('/api/devices/:deviceRef/save-config', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
607
645
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
608
646
  yield (0, rxjs_1.lastValueFrom)(client.request.saveConfig(deviceRef));
609
647
  res.send();
610
648
  })));
611
649
  app.put('/api/devices/:deviceRef/load-config', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
612
- var _26, _27;
650
+ var _30, _31;
613
651
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
614
652
  let content;
615
653
  if (Buffer.isBuffer(req.body)) {
@@ -619,21 +657,21 @@ app.put('/api/devices/:deviceRef/load-config', asyncHandler((req, res) => tslib_
619
657
  content = new Uint8Array(Buffer.from(req.body, 'utf-8'));
620
658
  }
621
659
  else {
622
- const contentType = (_26 = req.headers['content-type']) !== null && _26 !== void 0 ? _26 : '';
660
+ const contentType = (_30 = req.headers['content-type']) !== null && _30 !== void 0 ? _30 : '';
623
661
  throw new Error(`Unsupported body type for load-config: ${typeof req.body} (Content-Type: ${contentType})`);
624
662
  }
625
663
  const refresh = asBoolean(req.query['refresh']);
626
- const strategy = (_27 = req.query['strategy']) !== null && _27 !== void 0 ? _27 : 'replace';
664
+ const strategy = (_31 = req.query['strategy']) !== null && _31 !== void 0 ? _31 : 'replace';
627
665
  yield (0, rxjs_1.lastValueFrom)(client.request.loadConfig(deviceRef, content, strategy, { count: 20, delay: 500 }, refresh));
628
666
  res.send();
629
667
  })));
630
668
  app.get('/api/devices/:deviceRef/compute-auto-tuning-gains/velocity', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
631
- var _28, _29, _30;
669
+ var _32, _33, _34;
632
670
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
633
671
  const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
634
- const velocityLoopBandwidth = parseFloat(((_28 = req.query['velocity-loop-bandwidth']) !== null && _28 !== void 0 ? _28 : '5'));
635
- const velocityDamping = parseFloat(((_29 = req.query['velocity-damping']) !== null && _29 !== void 0 ? _29 : '0.7'));
636
- const requestTimeout = parseInt(((_30 = req.query['request-timeout']) !== null && _30 !== void 0 ? _30 : '120000'));
672
+ const velocityLoopBandwidth = parseFloat(((_32 = req.query['velocity-loop-bandwidth']) !== null && _32 !== void 0 ? _32 : '5'));
673
+ const velocityDamping = parseFloat(((_33 = req.query['velocity-damping']) !== null && _33 !== void 0 ? _33 : '0.7'));
674
+ const requestTimeout = parseInt(((_34 = req.query['request-timeout']) !== null && _34 !== void 0 ? _34 : '120000'));
637
675
  const velocityParameters = { velocityLoopBandwidth, velocityDamping };
638
676
  const status = yield (0, rxjs_1.lastValueFrom)(client.request.computeAutoTuningGains(Object.assign(Object.assign({}, deviceRefObj), { velocityParameters }), requestTimeout));
639
677
  if (status.request === 'succeeded') {
@@ -644,17 +682,17 @@ app.get('/api/devices/:deviceRef/compute-auto-tuning-gains/velocity', asyncHandl
644
682
  }
645
683
  })));
646
684
  app.get('/api/devices/:deviceRef/compute-auto-tuning-gains/position', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
647
- var _31, _32, _33, _34, _35, _36, _37, _38, _39;
685
+ var _35, _36, _37, _38, _39, _40, _41, _42, _43;
648
686
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
649
687
  const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
650
- const controllerType = (_32 = types_1.MotionMasterMessage.Request.ComputeAutoTuningGains.PositionParameters.ControllerType[((_31 = req.query['controller-type']) !== null && _31 !== void 0 ? _31 : 'UNSPECIFIED')]) !== null && _32 !== void 0 ? _32 : types_1.MotionMasterMessage.Request.ComputeAutoTuningGains.PositionParameters.ControllerType.UNSPECIFIED;
651
- const settlingTime = parseFloat(((_33 = req.query['settling-time']) !== null && _33 !== void 0 ? _33 : '0.2'));
652
- const positionDamping = parseFloat(((_34 = req.query['position-damping']) !== null && _34 !== void 0 ? _34 : '1'));
653
- const alphaMult = parseInt(((_35 = req.query['alpha-mult']) !== null && _35 !== void 0 ? _35 : '1'));
654
- const order = parseInt(((_36 = req.query['order']) !== null && _36 !== void 0 ? _36 : '0'));
655
- const lb = parseInt(((_37 = req.query['lb']) !== null && _37 !== void 0 ? _37 : '1'));
656
- const ub = parseInt(((_38 = req.query['ub']) !== null && _38 !== void 0 ? _38 : '1001'));
657
- const requestTimeout = parseInt(((_39 = req.query['request-timeout']) !== null && _39 !== void 0 ? _39 : '120000'));
688
+ const controllerType = (_36 = types_1.MotionMasterMessage.Request.ComputeAutoTuningGains.PositionParameters.ControllerType[((_35 = req.query['controller-type']) !== null && _35 !== void 0 ? _35 : 'UNSPECIFIED')]) !== null && _36 !== void 0 ? _36 : types_1.MotionMasterMessage.Request.ComputeAutoTuningGains.PositionParameters.ControllerType.UNSPECIFIED;
689
+ const settlingTime = parseFloat(((_37 = req.query['settling-time']) !== null && _37 !== void 0 ? _37 : '0.2'));
690
+ const positionDamping = parseFloat(((_38 = req.query['position-damping']) !== null && _38 !== void 0 ? _38 : '1'));
691
+ const alphaMult = parseInt(((_39 = req.query['alpha-mult']) !== null && _39 !== void 0 ? _39 : '1'));
692
+ const order = parseInt(((_40 = req.query['order']) !== null && _40 !== void 0 ? _40 : '0'));
693
+ const lb = parseInt(((_41 = req.query['lb']) !== null && _41 !== void 0 ? _41 : '1'));
694
+ const ub = parseInt(((_42 = req.query['ub']) !== null && _42 !== void 0 ? _42 : '1001'));
695
+ const requestTimeout = parseInt(((_43 = req.query['request-timeout']) !== null && _43 !== void 0 ? _43 : '120000'));
658
696
  const positionParameters = { controllerType, settlingTime, positionDamping, alphaMult, order, lb, ub };
659
697
  const status = yield (0, rxjs_1.lastValueFrom)(client.request.computeAutoTuningGains(Object.assign(Object.assign({}, deviceRefObj), { positionParameters }), requestTimeout));
660
698
  if (status.request === 'succeeded') {
@@ -665,15 +703,15 @@ app.get('/api/devices/:deviceRef/compute-auto-tuning-gains/position', asyncHandl
665
703
  }
666
704
  })));
667
705
  app.get('/api/devices/:deviceRef/start-open-loop-field-control', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
668
- var _40, _41, _42, _43, _44, _45;
706
+ var _44, _45, _46, _47, _48, _49;
669
707
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
670
708
  const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
671
- const angle = parseInt(((_40 = req.query['angle']) !== null && _40 !== void 0 ? _40 : '360'));
672
- const velocity = parseInt(((_41 = req.query['velocity']) !== null && _41 !== void 0 ? _41 : '5'));
673
- const acceleration = parseInt(((_42 = req.query['acceleration']) !== null && _42 !== void 0 ? _42 : '1000'));
674
- const torque = parseInt(((_43 = req.query['torque']) !== null && _43 !== void 0 ? _43 : '1000'));
675
- const torqueSpeed = parseInt(((_44 = req.query['torqueSpeed']) !== null && _44 !== void 0 ? _44 : '10000'));
676
- const requestTimeout = parseInt(((_45 = req.query['request-timeout']) !== null && _45 !== void 0 ? _45 : '120000'));
709
+ const angle = parseInt(((_44 = req.query['angle']) !== null && _44 !== void 0 ? _44 : '360'));
710
+ const velocity = parseInt(((_45 = req.query['velocity']) !== null && _45 !== void 0 ? _45 : '5'));
711
+ const acceleration = parseInt(((_46 = req.query['acceleration']) !== null && _46 !== void 0 ? _46 : '1000'));
712
+ const torque = parseInt(((_47 = req.query['torque']) !== null && _47 !== void 0 ? _47 : '1000'));
713
+ const torqueSpeed = parseInt(((_48 = req.query['torqueSpeed']) !== null && _48 !== void 0 ? _48 : '10000'));
714
+ const requestTimeout = parseInt(((_49 = req.query['request-timeout']) !== null && _49 !== void 0 ? _49 : '120000'));
677
715
  const status = yield (0, rxjs_1.lastValueFrom)(client.request.startOpenLoopFieldControl(Object.assign(Object.assign({}, deviceRefObj), { angle, velocity, acceleration, torque, torqueSpeed }), requestTimeout));
678
716
  if (status.request === 'succeeded') {
679
717
  res.send();
@@ -683,17 +721,17 @@ app.get('/api/devices/:deviceRef/start-open-loop-field-control', asyncHandler((r
683
721
  }
684
722
  })));
685
723
  app.get('/api/devices/:deviceRef/start-full-auto-tuning/velocity', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
686
- var _46, _47, _48, _49;
724
+ var _50, _51, _52, _53;
687
725
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
688
726
  const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
689
727
  const type = types_1.MotionMasterMessage.Request.StartFullAutoTuning.Type.VELOCITY;
690
- const requestTimeout = parseInt(((_46 = req.query['request-timeout']) !== null && _46 !== void 0 ? _46 : '60000'));
728
+ const requestTimeout = parseInt(((_50 = req.query['request-timeout']) !== null && _50 !== void 0 ? _50 : '60000'));
691
729
  const props = Object.assign(Object.assign({}, deviceRefObj), { type });
692
730
  const status = yield (0, rxjs_1.lastValueFrom)(client.request.startFullAutoTuning(props, requestTimeout));
693
731
  if (status.request === 'succeeded') {
694
- const dampingRatio = (_47 = status.dampingRatio) !== null && _47 !== void 0 ? _47 : 0;
695
- const settlingTime = (_48 = status.settlingTime) !== null && _48 !== void 0 ? _48 : 0;
696
- const bandwidth = (_49 = status.bandwidth) !== null && _49 !== void 0 ? _49 : 0;
732
+ const dampingRatio = (_51 = status.dampingRatio) !== null && _51 !== void 0 ? _51 : 0;
733
+ const settlingTime = (_52 = status.settlingTime) !== null && _52 !== void 0 ? _52 : 0;
734
+ const bandwidth = (_53 = status.bandwidth) !== null && _53 !== void 0 ? _53 : 0;
697
735
  const pidObj = {};
698
736
  for (let subidx = 1; subidx < 5; subidx++) {
699
737
  pidObj[(0, parameter_1.makeParameterId)(0x2011, subidx)] = yield client.request.upload(deviceRef, 0x2011, subidx);
@@ -708,17 +746,17 @@ app.get('/api/devices/:deviceRef/start-full-auto-tuning/velocity', asyncHandler(
708
746
  }
709
747
  })));
710
748
  app.get('/api/devices/:deviceRef/start-full-auto-tuning/position/:controllerType', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
711
- var _50, _51, _52, _53;
749
+ var _54, _55, _56, _57;
712
750
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
713
751
  const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
714
752
  const type = types_1.MotionMasterMessage.Request.StartFullAutoTuning.Type.POSITION;
715
753
  let controllerType = types_1.MotionMasterMessage.Request.StartFullAutoTuning.ControllerType[req.params['controllerType'].toUpperCase()] || types_1.MotionMasterMessage.Request.StartFullAutoTuning.ControllerType.UNSPECIFIED;
716
- const requestTimeout = parseInt(((_50 = req.query['request-timeout']) !== null && _50 !== void 0 ? _50 : '60000'));
754
+ const requestTimeout = parseInt(((_54 = req.query['request-timeout']) !== null && _54 !== void 0 ? _54 : '60000'));
717
755
  const status = yield (0, rxjs_1.lastValueFrom)(client.request.startFullAutoTuning(Object.assign(Object.assign({}, deviceRefObj), { type, controllerType }), requestTimeout));
718
756
  if (status.request === 'succeeded') {
719
- const dampingRatio = (_51 = status.dampingRatio) !== null && _51 !== void 0 ? _51 : 0;
720
- const settlingTime = (_52 = status.settlingTime) !== null && _52 !== void 0 ? _52 : 0;
721
- const bandwidth = (_53 = status.bandwidth) !== null && _53 !== void 0 ? _53 : 0;
757
+ const dampingRatio = (_55 = status.dampingRatio) !== null && _55 !== void 0 ? _55 : 0;
758
+ const settlingTime = (_56 = status.settlingTime) !== null && _56 !== void 0 ? _56 : 0;
759
+ const bandwidth = (_57 = status.bandwidth) !== null && _57 !== void 0 ? _57 : 0;
722
760
  const pidObj = {};
723
761
  for (let subidx = 1; subidx < 9; subidx++) {
724
762
  pidObj[(0, parameter_1.makeParameterId)(0x2012, subidx)] = yield client.request.upload(deviceRef, 0x2012, subidx);
@@ -733,10 +771,10 @@ app.get('/api/devices/:deviceRef/start-full-auto-tuning/position/:controllerType
733
771
  }
734
772
  })));
735
773
  app.get('/api/devices/:deviceRef/stop-full-auto-tuning', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
736
- var _54;
774
+ var _58;
737
775
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
738
776
  const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
739
- const requestTimeout = parseInt(((_54 = req.query['request-timeout']) !== null && _54 !== void 0 ? _54 : '10000'));
777
+ const requestTimeout = parseInt(((_58 = req.query['request-timeout']) !== null && _58 !== void 0 ? _58 : '10000'));
740
778
  const status = yield (0, rxjs_1.lastValueFrom)(client.request.stopFullAutoTuning(deviceRefObj, requestTimeout));
741
779
  if (status.request == 'succeeded') {
742
780
  res.send();
@@ -755,9 +793,9 @@ app.get('/api/devices/:deviceRef/set-halt-bit/:value', asyncHandler((req, res) =
755
793
  * @example curl "http://localhost:63500/api/devices/0/run-torque-profile?target=100&holding-duration=3000&skip-quick-stop=false&target-reach-timeout=5000&slope=50&window=30&window-time=1"
756
794
  */
757
795
  app.get('/api/devices/:deviceRef/run-torque-profile', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
758
- var _55, _56;
796
+ var _59, _60;
759
797
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
760
- const target = parseInt(((_55 = req.query['target']) !== null && _55 !== void 0 ? _55 : '100'));
798
+ const target = parseInt(((_59 = req.query['target']) !== null && _59 !== void 0 ? _59 : '100'));
761
799
  const holdingDuration = parseInt(req.query['holding-duration']) || undefined;
762
800
  const skipQuickStop = req.query['skip-quick-stop'] !== undefined ? asBoolean(req.query['skip-quick-stop']) : true;
763
801
  const targetReachTimeout = parseInt(req.query['target-reach-timeout']) || undefined;
@@ -765,7 +803,7 @@ app.get('/api/devices/:deviceRef/run-torque-profile', asyncHandler((req, res) =>
765
803
  res.status(400).send('target-reach-timeout is required when skip-quick-stop is false');
766
804
  return;
767
805
  }
768
- const slope = parseInt(((_56 = req.query['slope']) !== null && _56 !== void 0 ? _56 : '50'));
806
+ const slope = parseInt(((_60 = req.query['slope']) !== null && _60 !== void 0 ? _60 : '50'));
769
807
  const windowStr = req.query['window'];
770
808
  const window = windowStr ? parseInt(windowStr) : undefined;
771
809
  const windowTimeStr = req.query['window-time'];
@@ -797,11 +835,11 @@ app.get('/api/devices/:deviceRef/run-torque-profile', asyncHandler((req, res) =>
797
835
  * @example curl "http://localhost:63500/api/devices/0/run-velocity-profile?acceleration=5000&target=1000&deceleration=5000&holding-duration=2000&skip-quick-stop=false&target-reach-timeout=5000&window=10&window-time=1"
798
836
  */
799
837
  app.get('/api/devices/:deviceRef/run-velocity-profile', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
800
- var _57, _58, _59;
838
+ var _61, _62, _63;
801
839
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
802
- const acceleration = parseInt(((_57 = req.query['acceleration']) !== null && _57 !== void 0 ? _57 : '1000'));
803
- const target = parseInt(((_58 = req.query['target']) !== null && _58 !== void 0 ? _58 : '1000'));
804
- const deceleration = parseInt(((_59 = req.query['deceleration']) !== null && _59 !== void 0 ? _59 : '1000'));
840
+ const acceleration = parseInt(((_61 = req.query['acceleration']) !== null && _61 !== void 0 ? _61 : '1000'));
841
+ const target = parseInt(((_62 = req.query['target']) !== null && _62 !== void 0 ? _62 : '1000'));
842
+ const deceleration = parseInt(((_63 = req.query['deceleration']) !== null && _63 !== void 0 ? _63 : '1000'));
805
843
  const holdingDuration = parseInt(req.query['holding-duration']) || undefined;
806
844
  const skipQuickStop = req.query['skip-quick-stop'] !== undefined ? asBoolean(req.query['skip-quick-stop']) : true;
807
845
  const targetReachTimeout = parseInt(req.query['target-reach-timeout']) || undefined;
@@ -841,11 +879,11 @@ app.get('/api/devices/:deviceRef/run-velocity-profile', asyncHandler((req, res)
841
879
  * @example curl "http://localhost:63500/api/devices/0/run-position-profile?acceleration=5000&target=10000&deceleration=5000&holding-duration=2000&relative=true&skip-quick-stop=false&target-reach-timeout=5000&velocity=2000&window=10&window-time=1"
842
880
  */
843
881
  app.get('/api/devices/:deviceRef/run-position-profile', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
844
- var _60, _61, _62, _63;
882
+ var _64, _65, _66, _67;
845
883
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
846
- const acceleration = parseInt(((_60 = req.query['acceleration']) !== null && _60 !== void 0 ? _60 : '1000'));
847
- const target = parseInt(((_61 = req.query['target']) !== null && _61 !== void 0 ? _61 : '1000'));
848
- const deceleration = parseInt(((_62 = req.query['deceleration']) !== null && _62 !== void 0 ? _62 : '1000'));
884
+ const acceleration = parseInt(((_64 = req.query['acceleration']) !== null && _64 !== void 0 ? _64 : '1000'));
885
+ const target = parseInt(((_65 = req.query['target']) !== null && _65 !== void 0 ? _65 : '1000'));
886
+ const deceleration = parseInt(((_66 = req.query['deceleration']) !== null && _66 !== void 0 ? _66 : '1000'));
849
887
  const holdingDuration = parseInt(req.query['holding-duration']) || undefined;
850
888
  const relative = asBoolean(req.query['relative']);
851
889
  const skipQuickStop = req.query['skip-quick-stop'] !== undefined ? asBoolean(req.query['skip-quick-stop']) : true;
@@ -854,7 +892,7 @@ app.get('/api/devices/:deviceRef/run-position-profile', asyncHandler((req, res)
854
892
  res.status(400).send('target-reach-timeout is required when skip-quick-stop is false');
855
893
  return;
856
894
  }
857
- const velocity = parseInt(((_63 = req.query['velocity']) !== null && _63 !== void 0 ? _63 : '100'));
895
+ const velocity = parseInt(((_67 = req.query['velocity']) !== null && _67 !== void 0 ? _67 : '100'));
858
896
  const windowStr = req.query['window'];
859
897
  const window = windowStr ? parseInt(windowStr) : undefined;
860
898
  const windowTimeStr = req.query['window-time'];
@@ -896,14 +934,14 @@ app.get('/api/devices/:deviceRef/force-on-demand-parameters-update', asyncHandle
896
934
  res.send();
897
935
  })));
898
936
  app.get('/api/devices/:deviceRef/start-circulo-encoder-narrow-angle-calibration', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
899
- var _64, _65, _66;
937
+ var _68, _69, _70;
900
938
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
901
939
  const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
902
- const encoderOrdinal = parseInt(((_64 = req.query['encoder-ordinal']) !== null && _64 !== void 0 ? _64 : '1'));
940
+ const encoderOrdinal = parseInt(((_68 = req.query['encoder-ordinal']) !== null && _68 !== void 0 ? _68 : '1'));
903
941
  const activateHealthMonitoring = asBoolean(req.query['activate-health-monitoring']);
904
942
  const measurementOnly = asBoolean(req.query['measurement-only']);
905
- const externalEncoderType = parseInt(((_65 = req.query['external-encoder-type']) !== null && _65 !== void 0 ? _65 : '0'));
906
- const requestTimeout = parseInt(((_66 = req.query['request-timeout']) !== null && _66 !== void 0 ? _66 : '120000'));
943
+ const externalEncoderType = parseInt(((_69 = req.query['external-encoder-type']) !== null && _69 !== void 0 ? _69 : '0'));
944
+ const requestTimeout = parseInt(((_70 = req.query['request-timeout']) !== null && _70 !== void 0 ? _70 : '120000'));
907
945
  const statuses = yield (0, rxjs_1.lastValueFrom)(client.request
908
946
  .startCirculoEncoderNarrowAngleCalibrationProcedure(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, activateHealthMonitoring, measurementOnly, externalEncoderType }), requestTimeout)
909
947
  .pipe((0, rxjs_1.toArray)()));
@@ -953,13 +991,13 @@ app.get('/api/devices/:deviceRef/start-circulo-encoder-narrow-angle-calibration'
953
991
  }
954
992
  })));
955
993
  app.get('/api/devices/:deviceRef/start-circulo-encoder-configuration', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
956
- var _67, _68, _69, _70;
994
+ var _71, _72, _73, _74;
957
995
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
958
996
  const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
959
- const encoderOrdinal = parseInt(((_67 = req.query['encoder-ordinal']) !== null && _67 !== void 0 ? _67 : '1'));
960
- const batteryModeMaxAcceleration = parseInt(((_68 = req.query['battery-mode-max-acceleration']) !== null && _68 !== void 0 ? _68 : '0'));
961
- const externalCirculoType = parseInt(((_69 = req.query['external-circulo-type']) !== null && _69 !== void 0 ? _69 : '0'));
962
- const requestTimeout = parseInt(((_70 = req.query['request-timeout']) !== null && _70 !== void 0 ? _70 : '30000'));
997
+ const encoderOrdinal = parseInt(((_71 = req.query['encoder-ordinal']) !== null && _71 !== void 0 ? _71 : '1'));
998
+ const batteryModeMaxAcceleration = parseInt(((_72 = req.query['battery-mode-max-acceleration']) !== null && _72 !== void 0 ? _72 : '0'));
999
+ const externalCirculoType = parseInt(((_73 = req.query['external-circulo-type']) !== null && _73 !== void 0 ? _73 : '0'));
1000
+ const requestTimeout = parseInt(((_74 = req.query['request-timeout']) !== null && _74 !== void 0 ? _74 : '30000'));
963
1001
  const status = yield (0, rxjs_1.lastValueFrom)(client.request.startCirculoEncoderConfiguration(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, batteryModeMaxAcceleration, externalCirculoType }), requestTimeout));
964
1002
  if (status.request === 'succeeded') {
965
1003
  res.send();
@@ -969,9 +1007,9 @@ app.get('/api/devices/:deviceRef/start-circulo-encoder-configuration', asyncHand
969
1007
  }
970
1008
  })));
971
1009
  app.get('/api/devices/:deviceRef/check-circulo-encoder-errors', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
972
- var _71;
1010
+ var _75;
973
1011
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
974
- const encoderOrdinal = parseInt(((_71 = req.query['encoder-ordinal']) !== null && _71 !== void 0 ? _71 : '1'));
1012
+ const encoderOrdinal = parseInt(((_75 = req.query['encoder-ordinal']) !== null && _75 !== void 0 ? _75 : '1'));
975
1013
  const result = yield (0, rxjs_1.lastValueFrom)(client.request.checkCirculoEncoderErrors(deviceRef, encoderOrdinal));
976
1014
  res.send(result);
977
1015
  })));
@@ -981,12 +1019,12 @@ app.get('/api/devices/:deviceRef/start-integro-encoder-calibration', asyncHandle
981
1019
  res.send();
982
1020
  })));
983
1021
  app.get('/api/devices/:deviceRef/circulo-encoder-magnet-distance', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
984
- var _72, _73, _74;
1022
+ var _76, _77, _78;
985
1023
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
986
1024
  const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
987
- const encoderOrdinal = parseInt(((_72 = req.query['encoder-ordinal']) !== null && _72 !== void 0 ? _72 : '1'));
988
- const ringRevision = parseInt(((_73 = req.query['ring-revision']) !== null && _73 !== void 0 ? _73 : '0'));
989
- const requestTimeout = parseInt(((_74 = req.query['request-timeout']) !== null && _74 !== void 0 ? _74 : '5000'));
1025
+ const encoderOrdinal = parseInt(((_76 = req.query['encoder-ordinal']) !== null && _76 !== void 0 ? _76 : '1'));
1026
+ const ringRevision = parseInt(((_77 = req.query['ring-revision']) !== null && _77 !== void 0 ? _77 : '0'));
1027
+ const requestTimeout = parseInt(((_78 = req.query['request-timeout']) !== null && _78 !== void 0 ? _78 : '5000'));
990
1028
  const status = yield (0, rxjs_1.lastValueFrom)(client.request.getCirculoEncoderMagnetDistance(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, ringRevision }), requestTimeout));
991
1029
  if (status.request === 'succeeded') {
992
1030
  res.send({ distance: status.distance, position: status.position });
@@ -996,7 +1034,7 @@ app.get('/api/devices/:deviceRef/circulo-encoder-magnet-distance', asyncHandler(
996
1034
  }
997
1035
  })));
998
1036
  app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
999
- var _75, _76, _77, _78;
1037
+ var _79, _80, _81, _82;
1000
1038
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
1001
1039
  const commandQuery = req.query['command'];
1002
1040
  if (!commandQuery) {
@@ -1011,12 +1049,12 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
1011
1049
  return;
1012
1050
  }
1013
1051
  const commandArray = new Uint8Array(command);
1014
- const commandTimeout = parseInt(((_75 = req.query['command-timeout']) !== null && _75 !== void 0 ? _75 : '10000'));
1015
- const responsePollingInterval = parseInt(((_76 = req.query['response-polling-interval']) !== null && _76 !== void 0 ? _76 : '1000'));
1052
+ const commandTimeout = parseInt(((_79 = req.query['command-timeout']) !== null && _79 !== void 0 ? _79 : '10000'));
1053
+ const responsePollingInterval = parseInt(((_80 = req.query['response-polling-interval']) !== null && _80 !== void 0 ? _80 : '1000'));
1016
1054
  const osCommandModeQuery = req.query['os-command-mode'];
1017
1055
  const osCommandMode = osCommandModeQuery !== undefined && asBoolean(osCommandModeQuery)
1018
1056
  ? true
1019
- : (_77 = os_command_1.OsCommandMode[osCommandModeQuery === null || osCommandModeQuery === void 0 ? void 0 : osCommandModeQuery.toUpperCase()]) !== null && _77 !== void 0 ? _77 : false;
1057
+ : (_81 = os_command_1.OsCommandMode[osCommandModeQuery === null || osCommandModeQuery === void 0 ? void 0 : osCommandModeQuery.toUpperCase()]) !== null && _81 !== void 0 ? _81 : false;
1020
1058
  const readFsBuffer = asBoolean(req.query['read-fs-buffer']);
1021
1059
  const fsBufferContent = req.body;
1022
1060
  let fsBufferContentArray = undefined;
@@ -1024,7 +1062,7 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
1024
1062
  fsBufferContentArray = new Uint8Array(fsBufferContent);
1025
1063
  }
1026
1064
  const fsBuffer = fsBufferContentArray !== null && fsBufferContentArray !== void 0 ? fsBufferContentArray : readFsBuffer;
1027
- const fsBufferReadWriteTimeout = parseInt(((_78 = req.query['fs-buffer-read-write-timeout']) !== null && _78 !== void 0 ? _78 : '30000'));
1065
+ const fsBufferReadWriteTimeout = parseInt(((_82 = req.query['fs-buffer-read-write-timeout']) !== null && _82 !== void 0 ? _82 : '30000'));
1028
1066
  const status = yield (0, rxjs_1.lastValueFrom)(client.request.runOsCommand(deviceRef, commandArray, commandTimeout, responsePollingInterval, osCommandMode, fsBuffer, fsBufferReadWriteTimeout));
1029
1067
  if (status.request === 'succeeded') {
1030
1068
  res.send(status);
@@ -1034,10 +1072,10 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
1034
1072
  }
1035
1073
  })));
1036
1074
  app.post('/api/devices/:deviceRef/configure-smm', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
1037
- var _79, _80, _81;
1075
+ var _83, _84, _85;
1038
1076
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
1039
- const username = (_79 = req.query['username']) !== null && _79 !== void 0 ? _79 : 'Test';
1040
- const password = (_80 = req.query['password']) !== null && _80 !== void 0 ? _80 : 'SomanetSMM';
1077
+ const username = (_83 = req.query['username']) !== null && _83 !== void 0 ? _83 : 'Test';
1078
+ const password = (_84 = req.query['password']) !== null && _84 !== void 0 ? _84 : 'SomanetSMM';
1041
1079
  let configString;
1042
1080
  if (Buffer.isBuffer(req.body)) {
1043
1081
  // application/octet-stream (or express.raw)
@@ -1048,49 +1086,49 @@ app.post('/api/devices/:deviceRef/configure-smm', asyncHandler((req, res) => tsl
1048
1086
  configString = req.body;
1049
1087
  }
1050
1088
  else {
1051
- const contentType = (_81 = req.headers['content-type']) !== null && _81 !== void 0 ? _81 : '';
1089
+ const contentType = (_85 = req.headers['content-type']) !== null && _85 !== void 0 ? _85 : '';
1052
1090
  throw new Error(`Unsupported body type for configure-smm: ${typeof req.body} (Content-Type: ${contentType})`);
1053
1091
  }
1054
1092
  const safetyParametersReport = yield (0, rxjs_1.lastValueFrom)(client.request.configureSmmFromFile(deviceRef, username, password, configString));
1055
1093
  res.send(safetyParametersReport);
1056
1094
  })));
1057
1095
  app.post('/api/devices/:deviceRef/update-smm-software', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
1058
- var _82, _83, _84, _85, _86, _87, _88;
1096
+ var _86, _87, _88, _89, _90, _91, _92;
1059
1097
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
1060
- const username = (_82 = req.query['username']) !== null && _82 !== void 0 ? _82 : 'Test';
1061
- const password = (_83 = req.query['password']) !== null && _83 !== void 0 ? _83 : 'SomanetSMM';
1062
- const crc = parseInt(((_84 = req.query['crc']) !== null && _84 !== void 0 ? _84 : ''), 16);
1098
+ const username = (_86 = req.query['username']) !== null && _86 !== void 0 ? _86 : 'Test';
1099
+ const password = (_87 = req.query['password']) !== null && _87 !== void 0 ? _87 : 'SomanetSMM';
1100
+ const crc = parseInt(((_88 = req.query['crc']) !== null && _88 !== void 0 ? _88 : ''), 16);
1063
1101
  // Validate CRC
1064
1102
  if (Number.isNaN(crc)) {
1065
1103
  res.status(400).send('Invalid CRC format. Expected hexadecimal string.');
1066
1104
  return;
1067
1105
  }
1068
1106
  // Get optional parameters from query string
1069
- const chunkSize = parseInt(((_85 = req.query['chunkSize']) !== null && _85 !== void 0 ? _85 : '1000'));
1070
- const commandTimeout = parseInt(((_86 = req.query['commandTimeout']) !== null && _86 !== void 0 ? _86 : '30000'));
1071
- const responsePollingInterval = parseInt(((_87 = req.query['responsePollingInterval']) !== null && _87 !== void 0 ? _87 : '1000'));
1072
- const fsBufferReadWriteTimeout = parseInt(((_88 = req.query['fsBufferReadWriteTimeout']) !== null && _88 !== void 0 ? _88 : '120000'));
1107
+ const chunkSize = parseInt(((_89 = req.query['chunkSize']) !== null && _89 !== void 0 ? _89 : '1000'));
1108
+ const commandTimeout = parseInt(((_90 = req.query['commandTimeout']) !== null && _90 !== void 0 ? _90 : '30000'));
1109
+ const responsePollingInterval = parseInt(((_91 = req.query['responsePollingInterval']) !== null && _91 !== void 0 ? _91 : '1000'));
1110
+ const fsBufferReadWriteTimeout = parseInt(((_92 = req.query['fsBufferReadWriteTimeout']) !== null && _92 !== void 0 ? _92 : '120000'));
1073
1111
  // Create buffer from request body
1074
1112
  const buffer = new Uint8Array(req.body);
1075
1113
  yield (0, rxjs_1.lastValueFrom)(client.request.updateSmmSoftware(deviceRef, username, password, buffer, crc, chunkSize, commandTimeout, responsePollingInterval, fsBufferReadWriteTimeout));
1076
1114
  res.send();
1077
1115
  })));
1078
1116
  app.post('/api/devices/:deviceRef/update-smm-software-to-encrypted', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
1079
- var _89, _90, _91, _92, _93, _94, _95;
1117
+ var _93, _94, _95, _96, _97, _98, _99;
1080
1118
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
1081
- const username = (_89 = req.query['username']) !== null && _89 !== void 0 ? _89 : 'Test';
1082
- const password = (_90 = req.query['password']) !== null && _90 !== void 0 ? _90 : 'SomanetSMM';
1083
- const crc = parseInt(((_91 = req.query['crc']) !== null && _91 !== void 0 ? _91 : ''), 16);
1119
+ const username = (_93 = req.query['username']) !== null && _93 !== void 0 ? _93 : 'Test';
1120
+ const password = (_94 = req.query['password']) !== null && _94 !== void 0 ? _94 : 'SomanetSMM';
1121
+ const crc = parseInt(((_95 = req.query['crc']) !== null && _95 !== void 0 ? _95 : ''), 16);
1084
1122
  // Validate CRC
1085
1123
  if (Number.isNaN(crc)) {
1086
1124
  res.status(400).send('Invalid CRC format. Expected hexadecimal string.');
1087
1125
  return;
1088
1126
  }
1089
1127
  // Get optional parameters from query string
1090
- const chunkSize = parseInt(((_92 = req.query['chunkSize']) !== null && _92 !== void 0 ? _92 : '1000'));
1091
- const commandTimeout = parseInt(((_93 = req.query['commandTimeout']) !== null && _93 !== void 0 ? _93 : '30000'));
1092
- const responsePollingInterval = parseInt(((_94 = req.query['responsePollingInterval']) !== null && _94 !== void 0 ? _94 : '1000'));
1093
- const fsBufferReadWriteTimeout = parseInt(((_95 = req.query['fsBufferReadWriteTimeout']) !== null && _95 !== void 0 ? _95 : '120000'));
1128
+ const chunkSize = parseInt(((_96 = req.query['chunkSize']) !== null && _96 !== void 0 ? _96 : '1000'));
1129
+ const commandTimeout = parseInt(((_97 = req.query['commandTimeout']) !== null && _97 !== void 0 ? _97 : '30000'));
1130
+ const responsePollingInterval = parseInt(((_98 = req.query['responsePollingInterval']) !== null && _98 !== void 0 ? _98 : '1000'));
1131
+ const fsBufferReadWriteTimeout = parseInt(((_99 = req.query['fsBufferReadWriteTimeout']) !== null && _99 !== void 0 ? _99 : '120000'));
1094
1132
  // Create buffer from request body
1095
1133
  const buffer = new Uint8Array(req.body);
1096
1134
  yield (0, rxjs_1.lastValueFrom)(client.request.updateSmmSoftwareToEncrypted(deviceRef, username, password, buffer, crc, chunkSize, commandTimeout, responsePollingInterval, fsBufferReadWriteTimeout));
@@ -1103,16 +1141,16 @@ app.get('/api/devices/:deviceRef/write-circulo-integrated-encoder-config-bin-fil
1103
1141
  res.send(status);
1104
1142
  })));
1105
1143
  app.get('/api/devices/:deviceRef/run-chirp-signal', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
1106
- var _96, _97, _98, _99, _100, _101, _102, _103;
1107
- const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
1108
- const hrdStreamingDuration = parseInt(((_96 = req.query['hrd-streaming-duration']) !== null && _96 !== void 0 ? _96 : '4000'));
1109
- const modesOfOperation = parseInt(((_97 = req.query['modes-of-operation']) !== null && _97 !== void 0 ? _97 : '10'));
1110
- const signalType = parseInt(((_98 = req.query['signal-type']) !== null && _98 !== void 0 ? _98 : '0'));
1111
- const startFrequency = parseInt(((_99 = req.query['start-frequency']) !== null && _99 !== void 0 ? _99 : '2000'));
1112
- const startProcedure = parseInt(((_100 = req.query['start-procedure']) !== null && _100 !== void 0 ? _100 : '2'));
1113
- const targetAmplitude = parseInt(((_101 = req.query['target-amplitude']) !== null && _101 !== void 0 ? _101 : '300'));
1114
- const targetFrequency = parseInt(((_102 = req.query['target-frequency']) !== null && _102 !== void 0 ? _102 : '100000'));
1115
- const transitionTime = parseInt(((_103 = req.query['transition-time']) !== null && _103 !== void 0 ? _103 : '3000'));
1144
+ var _100, _101, _102, _103, _104, _105, _106, _107;
1145
+ const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
1146
+ const hrdStreamingDuration = parseInt(((_100 = req.query['hrd-streaming-duration']) !== null && _100 !== void 0 ? _100 : '4000'));
1147
+ const modesOfOperation = parseInt(((_101 = req.query['modes-of-operation']) !== null && _101 !== void 0 ? _101 : '10'));
1148
+ const signalType = parseInt(((_102 = req.query['signal-type']) !== null && _102 !== void 0 ? _102 : '0'));
1149
+ const startFrequency = parseInt(((_103 = req.query['start-frequency']) !== null && _103 !== void 0 ? _103 : '2000'));
1150
+ const startProcedure = parseInt(((_104 = req.query['start-procedure']) !== null && _104 !== void 0 ? _104 : '2'));
1151
+ const targetAmplitude = parseInt(((_105 = req.query['target-amplitude']) !== null && _105 !== void 0 ? _105 : '300'));
1152
+ const targetFrequency = parseInt(((_106 = req.query['target-frequency']) !== null && _106 !== void 0 ? _106 : '100000'));
1153
+ const transitionTime = parseInt(((_107 = req.query['transition-time']) !== null && _107 !== void 0 ? _107 : '3000'));
1116
1154
  const options = {
1117
1155
  hrdStreamingDuration,
1118
1156
  modesOfOperation,
@@ -1133,18 +1171,18 @@ app.get('/api/devices/:deviceRef/run-chirp-signal', asyncHandler((req, res) => t
1133
1171
  }
1134
1172
  })));
1135
1173
  app.get('/api/devices/:deviceRef/start-limited-range-system-identification', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
1136
- var _104, _105, _106, _107, _108, _109, _110;
1174
+ var _108, _109, _110, _111, _112, _113, _114;
1137
1175
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
1138
- const hrdStreamingDuration = parseInt(((_104 = req.query['hrd-streaming-duration']) !== null && _104 !== void 0 ? _104 : '3200'));
1176
+ const hrdStreamingDuration = parseInt(((_108 = req.query['hrd-streaming-duration']) !== null && _108 !== void 0 ? _108 : '3200'));
1139
1177
  const modesOfOperation = cia402_1.ModesOfOperation.CYCLIC_SYNC_POSITION_MODE;
1140
- const rangeLimit = parseInt(((_105 = req.query['range-limit']) !== null && _105 !== void 0 ? _105 : '10000'));
1141
- const rangeLimitMin = parseInt(((_106 = req.query['range-limit-min']) !== null && _106 !== void 0 ? _106 : '1000'));
1178
+ const rangeLimit = parseInt(((_109 = req.query['range-limit']) !== null && _109 !== void 0 ? _109 : '10000'));
1179
+ const rangeLimitMin = parseInt(((_110 = req.query['range-limit-min']) !== null && _110 !== void 0 ? _110 : '1000'));
1142
1180
  const signalType = os_command_1.SystemIdentificationOsCommandSignalType.LINEAR_WITH_CONSTANT_AMPLITUDE;
1143
- const startFrequency = parseInt(((_107 = req.query['start-frequency']) !== null && _107 !== void 0 ? _107 : '1000'));
1181
+ const startFrequency = parseInt(((_111 = req.query['start-frequency']) !== null && _111 !== void 0 ? _111 : '1000'));
1144
1182
  const startProcedure = os_command_1.SystemIdentificationOsCommandStartProcedure.WAIT_FOR_HRD_STREAMING_TO_START;
1145
- const targetAmplitude = parseInt(((_108 = req.query['target-amplitude']) !== null && _108 !== void 0 ? _108 : '300'));
1146
- const targetFrequency = parseInt(((_109 = req.query['target-frequency']) !== null && _109 !== void 0 ? _109 : '10000'));
1147
- const transitionTime = parseInt(((_110 = req.query['transition-time']) !== null && _110 !== void 0 ? _110 : '3000'));
1183
+ const targetAmplitude = parseInt(((_112 = req.query['target-amplitude']) !== null && _112 !== void 0 ? _112 : '300'));
1184
+ const targetFrequency = parseInt(((_113 = req.query['target-frequency']) !== null && _113 !== void 0 ? _113 : '10000'));
1185
+ const transitionTime = parseInt(((_114 = req.query['transition-time']) !== null && _114 !== void 0 ? _114 : '3000'));
1148
1186
  const options = {
1149
1187
  hrdStreamingDuration,
1150
1188
  modesOfOperation,
@@ -1187,15 +1225,15 @@ app.get('/api/motion-composer/stop', asyncHandler((_req, res) => tslib_1.__await
1187
1225
  res.send();
1188
1226
  })));
1189
1227
  app.get('/api/devices/:deviceRef/run-kubler-encoder-register-communication-os-command', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
1190
- var _111, _112, _113, _114, _115, _116, _117;
1191
- const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
1192
- const rw = parseInt(((_111 = req.query['rw']) !== null && _111 !== void 0 ? _111 : '0'));
1193
- const registerAddress = parseInt(((_112 = req.query['register-address']) !== null && _112 !== void 0 ? _112 : '0'));
1194
- const registerLength = parseInt(((_113 = req.query['register-length']) !== null && _113 !== void 0 ? _113 : '0'));
1195
- const registerWriteValue = parseInt(((_114 = req.query['register-write-value']) !== null && _114 !== void 0 ? _114 : '0'));
1196
- const commandTimeout = parseInt(((_115 = req.query['command-timeout']) !== null && _115 !== void 0 ? _115 : '10000'));
1197
- const responsePollingInterval = parseInt(((_116 = req.query['response-polling-interval']) !== null && _116 !== void 0 ? _116 : '1000'));
1198
- const osCommandMode = asBoolean(((_117 = req.query['os-command-mode']) !== null && _117 !== void 0 ? _117 : 'false'));
1228
+ var _115, _116, _117, _118, _119, _120, _121;
1229
+ const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
1230
+ const rw = parseInt(((_115 = req.query['rw']) !== null && _115 !== void 0 ? _115 : '0'));
1231
+ const registerAddress = parseInt(((_116 = req.query['register-address']) !== null && _116 !== void 0 ? _116 : '0'));
1232
+ const registerLength = parseInt(((_117 = req.query['register-length']) !== null && _117 !== void 0 ? _117 : '0'));
1233
+ const registerWriteValue = parseInt(((_118 = req.query['register-write-value']) !== null && _118 !== void 0 ? _118 : '0'));
1234
+ const commandTimeout = parseInt(((_119 = req.query['command-timeout']) !== null && _119 !== void 0 ? _119 : '10000'));
1235
+ const responsePollingInterval = parseInt(((_120 = req.query['response-polling-interval']) !== null && _120 !== void 0 ? _120 : '1000'));
1236
+ const osCommandMode = asBoolean(((_121 = req.query['os-command-mode']) !== null && _121 !== void 0 ? _121 : 'false'));
1199
1237
  const status = yield (0, rxjs_1.lastValueFrom)(client.request.runKublerEncoderRegisterCommunicationOsCommand(deviceRef, rw, registerAddress, registerLength, registerWriteValue, commandTimeout, responsePollingInterval, osCommandMode));
1200
1238
  if (status.request === 'succeeded') {
1201
1239
  res.send(status);
@@ -1244,28 +1282,28 @@ app.get('/api/devices/:deviceRef/factory-reset', asyncHandler((req, res) => tsli
1244
1282
  }
1245
1283
  })));
1246
1284
  app.get('/api/devices/:deviceRef/monitoring/start', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
1247
- var _118;
1285
+ var _122;
1248
1286
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
1249
1287
  const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
1250
1288
  const monitoringParameterIds = yield createDefaultDataMonitoringParameterIds(deviceRef);
1251
- (_118 = dataMonitoringMap.get(device.id)) === null || _118 === void 0 ? void 0 : _118.stop();
1289
+ (_122 = dataMonitoringMap.get(device.id)) === null || _122 === void 0 ? void 0 : _122.stop();
1252
1290
  const dataMonitoring = client.createDataMonitoring(monitoringParameterIds, 1000);
1253
1291
  dataMonitoring.start();
1254
1292
  dataMonitoringMap.set(device.id, dataMonitoring);
1255
1293
  res.send();
1256
1294
  })));
1257
1295
  app.get('/api/devices/:deviceRef/monitoring/data', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
1258
- var _119;
1296
+ var _123;
1259
1297
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
1260
1298
  const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
1261
1299
  const dataMonitoring = dataMonitoringMap.get(device.id);
1262
- res.type('text/csv').send((_119 = dataMonitoring === null || dataMonitoring === void 0 ? void 0 : dataMonitoring.csv) !== null && _119 !== void 0 ? _119 : '');
1300
+ res.type('text/csv').send((_123 = dataMonitoring === null || dataMonitoring === void 0 ? void 0 : dataMonitoring.csv) !== null && _123 !== void 0 ? _123 : '');
1263
1301
  })));
1264
1302
  app.get('/api/devices/:deviceRef/monitoring/stop', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
1265
- var _120;
1303
+ var _124;
1266
1304
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
1267
1305
  const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
1268
- (_120 = dataMonitoringMap.get(device.id)) === null || _120 === void 0 ? void 0 : _120.stop();
1306
+ (_124 = dataMonitoringMap.get(device.id)) === null || _124 === void 0 ? void 0 : _124.stop();
1269
1307
  res.send();
1270
1308
  })));
1271
1309
  app.listen(port, () => {