motion-master-client 0.0.407 → 0.0.409
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
package/src/api.js
CHANGED
|
@@ -612,13 +612,42 @@ app.get('/api/devices/:deviceRef/cia402-state', asyncHandler((req, res) => tslib
|
|
|
612
612
|
const state = yield (0, rxjs_1.lastValueFrom)(client.request.getCia402State(deviceRef, requestTimeout));
|
|
613
613
|
res.send({ state });
|
|
614
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
|
+
})));
|
|
615
644
|
app.get('/api/devices/:deviceRef/save-config', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
616
645
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
617
646
|
yield (0, rxjs_1.lastValueFrom)(client.request.saveConfig(deviceRef));
|
|
618
647
|
res.send();
|
|
619
648
|
})));
|
|
620
649
|
app.put('/api/devices/:deviceRef/load-config', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
621
|
-
var
|
|
650
|
+
var _30, _31;
|
|
622
651
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
623
652
|
let content;
|
|
624
653
|
if (Buffer.isBuffer(req.body)) {
|
|
@@ -628,21 +657,21 @@ app.put('/api/devices/:deviceRef/load-config', asyncHandler((req, res) => tslib_
|
|
|
628
657
|
content = new Uint8Array(Buffer.from(req.body, 'utf-8'));
|
|
629
658
|
}
|
|
630
659
|
else {
|
|
631
|
-
const contentType = (
|
|
660
|
+
const contentType = (_30 = req.headers['content-type']) !== null && _30 !== void 0 ? _30 : '';
|
|
632
661
|
throw new Error(`Unsupported body type for load-config: ${typeof req.body} (Content-Type: ${contentType})`);
|
|
633
662
|
}
|
|
634
663
|
const refresh = asBoolean(req.query['refresh']);
|
|
635
|
-
const strategy = (
|
|
664
|
+
const strategy = (_31 = req.query['strategy']) !== null && _31 !== void 0 ? _31 : 'replace';
|
|
636
665
|
yield (0, rxjs_1.lastValueFrom)(client.request.loadConfig(deviceRef, content, strategy, { count: 20, delay: 500 }, refresh));
|
|
637
666
|
res.send();
|
|
638
667
|
})));
|
|
639
668
|
app.get('/api/devices/:deviceRef/compute-auto-tuning-gains/velocity', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
640
|
-
var
|
|
669
|
+
var _32, _33, _34;
|
|
641
670
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
642
671
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
643
|
-
const velocityLoopBandwidth = parseFloat(((
|
|
644
|
-
const velocityDamping = parseFloat(((
|
|
645
|
-
const requestTimeout = parseInt(((
|
|
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'));
|
|
646
675
|
const velocityParameters = { velocityLoopBandwidth, velocityDamping };
|
|
647
676
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.computeAutoTuningGains(Object.assign(Object.assign({}, deviceRefObj), { velocityParameters }), requestTimeout));
|
|
648
677
|
if (status.request === 'succeeded') {
|
|
@@ -653,17 +682,17 @@ app.get('/api/devices/:deviceRef/compute-auto-tuning-gains/velocity', asyncHandl
|
|
|
653
682
|
}
|
|
654
683
|
})));
|
|
655
684
|
app.get('/api/devices/:deviceRef/compute-auto-tuning-gains/position', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
656
|
-
var
|
|
685
|
+
var _35, _36, _37, _38, _39, _40, _41, _42, _43;
|
|
657
686
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
658
687
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
659
|
-
const controllerType = (
|
|
660
|
-
const settlingTime = parseFloat(((
|
|
661
|
-
const positionDamping = parseFloat(((
|
|
662
|
-
const alphaMult = parseInt(((
|
|
663
|
-
const order = parseInt(((
|
|
664
|
-
const lb = parseInt(((
|
|
665
|
-
const ub = parseInt(((
|
|
666
|
-
const requestTimeout = parseInt(((
|
|
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'));
|
|
667
696
|
const positionParameters = { controllerType, settlingTime, positionDamping, alphaMult, order, lb, ub };
|
|
668
697
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.computeAutoTuningGains(Object.assign(Object.assign({}, deviceRefObj), { positionParameters }), requestTimeout));
|
|
669
698
|
if (status.request === 'succeeded') {
|
|
@@ -674,15 +703,15 @@ app.get('/api/devices/:deviceRef/compute-auto-tuning-gains/position', asyncHandl
|
|
|
674
703
|
}
|
|
675
704
|
})));
|
|
676
705
|
app.get('/api/devices/:deviceRef/start-open-loop-field-control', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
677
|
-
var
|
|
706
|
+
var _44, _45, _46, _47, _48, _49;
|
|
678
707
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
679
708
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
680
|
-
const angle = parseInt(((
|
|
681
|
-
const velocity = parseInt(((
|
|
682
|
-
const acceleration = parseInt(((
|
|
683
|
-
const torque = parseInt(((
|
|
684
|
-
const torqueSpeed = parseInt(((
|
|
685
|
-
const requestTimeout = parseInt(((
|
|
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'));
|
|
686
715
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.startOpenLoopFieldControl(Object.assign(Object.assign({}, deviceRefObj), { angle, velocity, acceleration, torque, torqueSpeed }), requestTimeout));
|
|
687
716
|
if (status.request === 'succeeded') {
|
|
688
717
|
res.send();
|
|
@@ -692,17 +721,17 @@ app.get('/api/devices/:deviceRef/start-open-loop-field-control', asyncHandler((r
|
|
|
692
721
|
}
|
|
693
722
|
})));
|
|
694
723
|
app.get('/api/devices/:deviceRef/start-full-auto-tuning/velocity', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
695
|
-
var
|
|
724
|
+
var _50, _51, _52, _53;
|
|
696
725
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
697
726
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
698
727
|
const type = types_1.MotionMasterMessage.Request.StartFullAutoTuning.Type.VELOCITY;
|
|
699
|
-
const requestTimeout = parseInt(((
|
|
728
|
+
const requestTimeout = parseInt(((_50 = req.query['request-timeout']) !== null && _50 !== void 0 ? _50 : '60000'));
|
|
700
729
|
const props = Object.assign(Object.assign({}, deviceRefObj), { type });
|
|
701
730
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.startFullAutoTuning(props, requestTimeout));
|
|
702
731
|
if (status.request === 'succeeded') {
|
|
703
|
-
const dampingRatio = (
|
|
704
|
-
const settlingTime = (
|
|
705
|
-
const bandwidth = (
|
|
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;
|
|
706
735
|
const pidObj = {};
|
|
707
736
|
for (let subidx = 1; subidx < 5; subidx++) {
|
|
708
737
|
pidObj[(0, parameter_1.makeParameterId)(0x2011, subidx)] = yield client.request.upload(deviceRef, 0x2011, subidx);
|
|
@@ -717,17 +746,17 @@ app.get('/api/devices/:deviceRef/start-full-auto-tuning/velocity', asyncHandler(
|
|
|
717
746
|
}
|
|
718
747
|
})));
|
|
719
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* () {
|
|
720
|
-
var
|
|
749
|
+
var _54, _55, _56, _57;
|
|
721
750
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
722
751
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
723
752
|
const type = types_1.MotionMasterMessage.Request.StartFullAutoTuning.Type.POSITION;
|
|
724
753
|
let controllerType = types_1.MotionMasterMessage.Request.StartFullAutoTuning.ControllerType[req.params['controllerType'].toUpperCase()] || types_1.MotionMasterMessage.Request.StartFullAutoTuning.ControllerType.UNSPECIFIED;
|
|
725
|
-
const requestTimeout = parseInt(((
|
|
754
|
+
const requestTimeout = parseInt(((_54 = req.query['request-timeout']) !== null && _54 !== void 0 ? _54 : '60000'));
|
|
726
755
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.startFullAutoTuning(Object.assign(Object.assign({}, deviceRefObj), { type, controllerType }), requestTimeout));
|
|
727
756
|
if (status.request === 'succeeded') {
|
|
728
|
-
const dampingRatio = (
|
|
729
|
-
const settlingTime = (
|
|
730
|
-
const bandwidth = (
|
|
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;
|
|
731
760
|
const pidObj = {};
|
|
732
761
|
for (let subidx = 1; subidx < 9; subidx++) {
|
|
733
762
|
pidObj[(0, parameter_1.makeParameterId)(0x2012, subidx)] = yield client.request.upload(deviceRef, 0x2012, subidx);
|
|
@@ -742,10 +771,10 @@ app.get('/api/devices/:deviceRef/start-full-auto-tuning/position/:controllerType
|
|
|
742
771
|
}
|
|
743
772
|
})));
|
|
744
773
|
app.get('/api/devices/:deviceRef/stop-full-auto-tuning', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
745
|
-
var
|
|
774
|
+
var _58;
|
|
746
775
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
747
776
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
748
|
-
const requestTimeout = parseInt(((
|
|
777
|
+
const requestTimeout = parseInt(((_58 = req.query['request-timeout']) !== null && _58 !== void 0 ? _58 : '10000'));
|
|
749
778
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.stopFullAutoTuning(deviceRefObj, requestTimeout));
|
|
750
779
|
if (status.request == 'succeeded') {
|
|
751
780
|
res.send();
|
|
@@ -764,9 +793,9 @@ app.get('/api/devices/:deviceRef/set-halt-bit/:value', asyncHandler((req, res) =
|
|
|
764
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"
|
|
765
794
|
*/
|
|
766
795
|
app.get('/api/devices/:deviceRef/run-torque-profile', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
767
|
-
var
|
|
796
|
+
var _59, _60;
|
|
768
797
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
769
|
-
const target = parseInt(((
|
|
798
|
+
const target = parseInt(((_59 = req.query['target']) !== null && _59 !== void 0 ? _59 : '100'));
|
|
770
799
|
const holdingDuration = parseInt(req.query['holding-duration']) || undefined;
|
|
771
800
|
const skipQuickStop = req.query['skip-quick-stop'] !== undefined ? asBoolean(req.query['skip-quick-stop']) : true;
|
|
772
801
|
const targetReachTimeout = parseInt(req.query['target-reach-timeout']) || undefined;
|
|
@@ -774,7 +803,7 @@ app.get('/api/devices/:deviceRef/run-torque-profile', asyncHandler((req, res) =>
|
|
|
774
803
|
res.status(400).send('target-reach-timeout is required when skip-quick-stop is false');
|
|
775
804
|
return;
|
|
776
805
|
}
|
|
777
|
-
const slope = parseInt(((
|
|
806
|
+
const slope = parseInt(((_60 = req.query['slope']) !== null && _60 !== void 0 ? _60 : '50'));
|
|
778
807
|
const windowStr = req.query['window'];
|
|
779
808
|
const window = windowStr ? parseInt(windowStr) : undefined;
|
|
780
809
|
const windowTimeStr = req.query['window-time'];
|
|
@@ -806,11 +835,11 @@ app.get('/api/devices/:deviceRef/run-torque-profile', asyncHandler((req, res) =>
|
|
|
806
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"
|
|
807
836
|
*/
|
|
808
837
|
app.get('/api/devices/:deviceRef/run-velocity-profile', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
809
|
-
var
|
|
838
|
+
var _61, _62, _63;
|
|
810
839
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
811
|
-
const acceleration = parseInt(((
|
|
812
|
-
const target = parseInt(((
|
|
813
|
-
const deceleration = parseInt(((
|
|
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'));
|
|
814
843
|
const holdingDuration = parseInt(req.query['holding-duration']) || undefined;
|
|
815
844
|
const skipQuickStop = req.query['skip-quick-stop'] !== undefined ? asBoolean(req.query['skip-quick-stop']) : true;
|
|
816
845
|
const targetReachTimeout = parseInt(req.query['target-reach-timeout']) || undefined;
|
|
@@ -850,11 +879,11 @@ app.get('/api/devices/:deviceRef/run-velocity-profile', asyncHandler((req, res)
|
|
|
850
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"
|
|
851
880
|
*/
|
|
852
881
|
app.get('/api/devices/:deviceRef/run-position-profile', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
853
|
-
var
|
|
882
|
+
var _64, _65, _66, _67;
|
|
854
883
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
855
|
-
const acceleration = parseInt(((
|
|
856
|
-
const target = parseInt(((
|
|
857
|
-
const deceleration = parseInt(((
|
|
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'));
|
|
858
887
|
const holdingDuration = parseInt(req.query['holding-duration']) || undefined;
|
|
859
888
|
const relative = asBoolean(req.query['relative']);
|
|
860
889
|
const skipQuickStop = req.query['skip-quick-stop'] !== undefined ? asBoolean(req.query['skip-quick-stop']) : true;
|
|
@@ -863,7 +892,7 @@ app.get('/api/devices/:deviceRef/run-position-profile', asyncHandler((req, res)
|
|
|
863
892
|
res.status(400).send('target-reach-timeout is required when skip-quick-stop is false');
|
|
864
893
|
return;
|
|
865
894
|
}
|
|
866
|
-
const velocity = parseInt(((
|
|
895
|
+
const velocity = parseInt(((_67 = req.query['velocity']) !== null && _67 !== void 0 ? _67 : '100'));
|
|
867
896
|
const windowStr = req.query['window'];
|
|
868
897
|
const window = windowStr ? parseInt(windowStr) : undefined;
|
|
869
898
|
const windowTimeStr = req.query['window-time'];
|
|
@@ -905,14 +934,14 @@ app.get('/api/devices/:deviceRef/force-on-demand-parameters-update', asyncHandle
|
|
|
905
934
|
res.send();
|
|
906
935
|
})));
|
|
907
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* () {
|
|
908
|
-
var
|
|
937
|
+
var _68, _69, _70;
|
|
909
938
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
910
939
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
911
|
-
const encoderOrdinal = parseInt(((
|
|
940
|
+
const encoderOrdinal = parseInt(((_68 = req.query['encoder-ordinal']) !== null && _68 !== void 0 ? _68 : '1'));
|
|
912
941
|
const activateHealthMonitoring = asBoolean(req.query['activate-health-monitoring']);
|
|
913
942
|
const measurementOnly = asBoolean(req.query['measurement-only']);
|
|
914
|
-
const externalEncoderType = parseInt(((
|
|
915
|
-
const requestTimeout = parseInt(((
|
|
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'));
|
|
916
945
|
const statuses = yield (0, rxjs_1.lastValueFrom)(client.request
|
|
917
946
|
.startCirculoEncoderNarrowAngleCalibrationProcedure(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, activateHealthMonitoring, measurementOnly, externalEncoderType }), requestTimeout)
|
|
918
947
|
.pipe((0, rxjs_1.toArray)()));
|
|
@@ -962,13 +991,13 @@ app.get('/api/devices/:deviceRef/start-circulo-encoder-narrow-angle-calibration'
|
|
|
962
991
|
}
|
|
963
992
|
})));
|
|
964
993
|
app.get('/api/devices/:deviceRef/start-circulo-encoder-configuration', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
965
|
-
var
|
|
994
|
+
var _71, _72, _73, _74;
|
|
966
995
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
967
996
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
968
|
-
const encoderOrdinal = parseInt(((
|
|
969
|
-
const batteryModeMaxAcceleration = parseInt(((
|
|
970
|
-
const externalCirculoType = parseInt(((
|
|
971
|
-
const requestTimeout = parseInt(((
|
|
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'));
|
|
972
1001
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.startCirculoEncoderConfiguration(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, batteryModeMaxAcceleration, externalCirculoType }), requestTimeout));
|
|
973
1002
|
if (status.request === 'succeeded') {
|
|
974
1003
|
res.send();
|
|
@@ -978,9 +1007,9 @@ app.get('/api/devices/:deviceRef/start-circulo-encoder-configuration', asyncHand
|
|
|
978
1007
|
}
|
|
979
1008
|
})));
|
|
980
1009
|
app.get('/api/devices/:deviceRef/check-circulo-encoder-errors', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
981
|
-
var
|
|
1010
|
+
var _75;
|
|
982
1011
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
983
|
-
const encoderOrdinal = parseInt(((
|
|
1012
|
+
const encoderOrdinal = parseInt(((_75 = req.query['encoder-ordinal']) !== null && _75 !== void 0 ? _75 : '1'));
|
|
984
1013
|
const result = yield (0, rxjs_1.lastValueFrom)(client.request.checkCirculoEncoderErrors(deviceRef, encoderOrdinal));
|
|
985
1014
|
res.send(result);
|
|
986
1015
|
})));
|
|
@@ -990,12 +1019,12 @@ app.get('/api/devices/:deviceRef/start-integro-encoder-calibration', asyncHandle
|
|
|
990
1019
|
res.send();
|
|
991
1020
|
})));
|
|
992
1021
|
app.get('/api/devices/:deviceRef/circulo-encoder-magnet-distance', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
993
|
-
var
|
|
1022
|
+
var _76, _77, _78;
|
|
994
1023
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
995
1024
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
996
|
-
const encoderOrdinal = parseInt(((
|
|
997
|
-
const ringRevision = parseInt(((
|
|
998
|
-
const requestTimeout = parseInt(((
|
|
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'));
|
|
999
1028
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.getCirculoEncoderMagnetDistance(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, ringRevision }), requestTimeout));
|
|
1000
1029
|
if (status.request === 'succeeded') {
|
|
1001
1030
|
res.send({ distance: status.distance, position: status.position });
|
|
@@ -1005,7 +1034,7 @@ app.get('/api/devices/:deviceRef/circulo-encoder-magnet-distance', asyncHandler(
|
|
|
1005
1034
|
}
|
|
1006
1035
|
})));
|
|
1007
1036
|
app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1008
|
-
var
|
|
1037
|
+
var _79, _80, _81, _82;
|
|
1009
1038
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1010
1039
|
const commandQuery = req.query['command'];
|
|
1011
1040
|
if (!commandQuery) {
|
|
@@ -1020,12 +1049,12 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
|
|
|
1020
1049
|
return;
|
|
1021
1050
|
}
|
|
1022
1051
|
const commandArray = new Uint8Array(command);
|
|
1023
|
-
const commandTimeout = parseInt(((
|
|
1024
|
-
const responsePollingInterval = parseInt(((
|
|
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'));
|
|
1025
1054
|
const osCommandModeQuery = req.query['os-command-mode'];
|
|
1026
1055
|
const osCommandMode = osCommandModeQuery !== undefined && asBoolean(osCommandModeQuery)
|
|
1027
1056
|
? true
|
|
1028
|
-
: (
|
|
1057
|
+
: (_81 = os_command_1.OsCommandMode[osCommandModeQuery === null || osCommandModeQuery === void 0 ? void 0 : osCommandModeQuery.toUpperCase()]) !== null && _81 !== void 0 ? _81 : false;
|
|
1029
1058
|
const readFsBuffer = asBoolean(req.query['read-fs-buffer']);
|
|
1030
1059
|
const fsBufferContent = req.body;
|
|
1031
1060
|
let fsBufferContentArray = undefined;
|
|
@@ -1033,7 +1062,7 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
|
|
|
1033
1062
|
fsBufferContentArray = new Uint8Array(fsBufferContent);
|
|
1034
1063
|
}
|
|
1035
1064
|
const fsBuffer = fsBufferContentArray !== null && fsBufferContentArray !== void 0 ? fsBufferContentArray : readFsBuffer;
|
|
1036
|
-
const fsBufferReadWriteTimeout = parseInt(((
|
|
1065
|
+
const fsBufferReadWriteTimeout = parseInt(((_82 = req.query['fs-buffer-read-write-timeout']) !== null && _82 !== void 0 ? _82 : '30000'));
|
|
1037
1066
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.runOsCommand(deviceRef, commandArray, commandTimeout, responsePollingInterval, osCommandMode, fsBuffer, fsBufferReadWriteTimeout));
|
|
1038
1067
|
if (status.request === 'succeeded') {
|
|
1039
1068
|
res.send(status);
|
|
@@ -1043,10 +1072,10 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
|
|
|
1043
1072
|
}
|
|
1044
1073
|
})));
|
|
1045
1074
|
app.post('/api/devices/:deviceRef/configure-smm', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1046
|
-
var
|
|
1075
|
+
var _83, _84, _85;
|
|
1047
1076
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1048
|
-
const username = (
|
|
1049
|
-
const password = (
|
|
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';
|
|
1050
1079
|
let configString;
|
|
1051
1080
|
if (Buffer.isBuffer(req.body)) {
|
|
1052
1081
|
// application/octet-stream (or express.raw)
|
|
@@ -1057,49 +1086,49 @@ app.post('/api/devices/:deviceRef/configure-smm', asyncHandler((req, res) => tsl
|
|
|
1057
1086
|
configString = req.body;
|
|
1058
1087
|
}
|
|
1059
1088
|
else {
|
|
1060
|
-
const contentType = (
|
|
1089
|
+
const contentType = (_85 = req.headers['content-type']) !== null && _85 !== void 0 ? _85 : '';
|
|
1061
1090
|
throw new Error(`Unsupported body type for configure-smm: ${typeof req.body} (Content-Type: ${contentType})`);
|
|
1062
1091
|
}
|
|
1063
1092
|
const safetyParametersReport = yield (0, rxjs_1.lastValueFrom)(client.request.configureSmmFromFile(deviceRef, username, password, configString));
|
|
1064
1093
|
res.send(safetyParametersReport);
|
|
1065
1094
|
})));
|
|
1066
1095
|
app.post('/api/devices/:deviceRef/update-smm-software', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1067
|
-
var
|
|
1096
|
+
var _86, _87, _88, _89, _90, _91, _92;
|
|
1068
1097
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1069
|
-
const username = (
|
|
1070
|
-
const password = (
|
|
1071
|
-
const crc = parseInt(((
|
|
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);
|
|
1072
1101
|
// Validate CRC
|
|
1073
1102
|
if (Number.isNaN(crc)) {
|
|
1074
1103
|
res.status(400).send('Invalid CRC format. Expected hexadecimal string.');
|
|
1075
1104
|
return;
|
|
1076
1105
|
}
|
|
1077
1106
|
// Get optional parameters from query string
|
|
1078
|
-
const chunkSize = parseInt(((
|
|
1079
|
-
const commandTimeout = parseInt(((
|
|
1080
|
-
const responsePollingInterval = parseInt(((
|
|
1081
|
-
const fsBufferReadWriteTimeout = parseInt(((
|
|
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'));
|
|
1082
1111
|
// Create buffer from request body
|
|
1083
1112
|
const buffer = new Uint8Array(req.body);
|
|
1084
1113
|
yield (0, rxjs_1.lastValueFrom)(client.request.updateSmmSoftware(deviceRef, username, password, buffer, crc, chunkSize, commandTimeout, responsePollingInterval, fsBufferReadWriteTimeout));
|
|
1085
1114
|
res.send();
|
|
1086
1115
|
})));
|
|
1087
1116
|
app.post('/api/devices/:deviceRef/update-smm-software-to-encrypted', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1088
|
-
var
|
|
1117
|
+
var _93, _94, _95, _96, _97, _98, _99;
|
|
1089
1118
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1090
|
-
const username = (
|
|
1091
|
-
const password = (
|
|
1092
|
-
const crc = parseInt(((
|
|
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);
|
|
1093
1122
|
// Validate CRC
|
|
1094
1123
|
if (Number.isNaN(crc)) {
|
|
1095
1124
|
res.status(400).send('Invalid CRC format. Expected hexadecimal string.');
|
|
1096
1125
|
return;
|
|
1097
1126
|
}
|
|
1098
1127
|
// Get optional parameters from query string
|
|
1099
|
-
const chunkSize = parseInt(((
|
|
1100
|
-
const commandTimeout = parseInt(((
|
|
1101
|
-
const responsePollingInterval = parseInt(((
|
|
1102
|
-
const fsBufferReadWriteTimeout = parseInt(((
|
|
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'));
|
|
1103
1132
|
// Create buffer from request body
|
|
1104
1133
|
const buffer = new Uint8Array(req.body);
|
|
1105
1134
|
yield (0, rxjs_1.lastValueFrom)(client.request.updateSmmSoftwareToEncrypted(deviceRef, username, password, buffer, crc, chunkSize, commandTimeout, responsePollingInterval, fsBufferReadWriteTimeout));
|
|
@@ -1112,16 +1141,16 @@ app.get('/api/devices/:deviceRef/write-circulo-integrated-encoder-config-bin-fil
|
|
|
1112
1141
|
res.send(status);
|
|
1113
1142
|
})));
|
|
1114
1143
|
app.get('/api/devices/:deviceRef/run-chirp-signal', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1115
|
-
var
|
|
1116
|
-
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1117
|
-
const hrdStreamingDuration = parseInt(((
|
|
1118
|
-
const modesOfOperation = parseInt(((
|
|
1119
|
-
const signalType = parseInt(((
|
|
1120
|
-
const startFrequency = parseInt(((
|
|
1121
|
-
const startProcedure = parseInt(((
|
|
1122
|
-
const targetAmplitude = parseInt(((
|
|
1123
|
-
const targetFrequency = parseInt(((
|
|
1124
|
-
const transitionTime = parseInt(((
|
|
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'));
|
|
1125
1154
|
const options = {
|
|
1126
1155
|
hrdStreamingDuration,
|
|
1127
1156
|
modesOfOperation,
|
|
@@ -1142,18 +1171,18 @@ app.get('/api/devices/:deviceRef/run-chirp-signal', asyncHandler((req, res) => t
|
|
|
1142
1171
|
}
|
|
1143
1172
|
})));
|
|
1144
1173
|
app.get('/api/devices/:deviceRef/start-limited-range-system-identification', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1145
|
-
var
|
|
1174
|
+
var _108, _109, _110, _111, _112, _113, _114;
|
|
1146
1175
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1147
|
-
const hrdStreamingDuration = parseInt(((
|
|
1176
|
+
const hrdStreamingDuration = parseInt(((_108 = req.query['hrd-streaming-duration']) !== null && _108 !== void 0 ? _108 : '3200'));
|
|
1148
1177
|
const modesOfOperation = cia402_1.ModesOfOperation.CYCLIC_SYNC_POSITION_MODE;
|
|
1149
|
-
const rangeLimit = parseInt(((
|
|
1150
|
-
const rangeLimitMin = parseInt(((
|
|
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'));
|
|
1151
1180
|
const signalType = os_command_1.SystemIdentificationOsCommandSignalType.LINEAR_WITH_CONSTANT_AMPLITUDE;
|
|
1152
|
-
const startFrequency = parseInt(((
|
|
1181
|
+
const startFrequency = parseInt(((_111 = req.query['start-frequency']) !== null && _111 !== void 0 ? _111 : '1000'));
|
|
1153
1182
|
const startProcedure = os_command_1.SystemIdentificationOsCommandStartProcedure.WAIT_FOR_HRD_STREAMING_TO_START;
|
|
1154
|
-
const targetAmplitude = parseInt(((
|
|
1155
|
-
const targetFrequency = parseInt(((
|
|
1156
|
-
const transitionTime = parseInt(((
|
|
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'));
|
|
1157
1186
|
const options = {
|
|
1158
1187
|
hrdStreamingDuration,
|
|
1159
1188
|
modesOfOperation,
|
|
@@ -1196,15 +1225,15 @@ app.get('/api/motion-composer/stop', asyncHandler((_req, res) => tslib_1.__await
|
|
|
1196
1225
|
res.send();
|
|
1197
1226
|
})));
|
|
1198
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* () {
|
|
1199
|
-
var
|
|
1200
|
-
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1201
|
-
const rw = parseInt(((
|
|
1202
|
-
const registerAddress = parseInt(((
|
|
1203
|
-
const registerLength = parseInt(((
|
|
1204
|
-
const registerWriteValue = parseInt(((
|
|
1205
|
-
const commandTimeout = parseInt(((
|
|
1206
|
-
const responsePollingInterval = parseInt(((
|
|
1207
|
-
const osCommandMode = asBoolean(((
|
|
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'));
|
|
1208
1237
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.runKublerEncoderRegisterCommunicationOsCommand(deviceRef, rw, registerAddress, registerLength, registerWriteValue, commandTimeout, responsePollingInterval, osCommandMode));
|
|
1209
1238
|
if (status.request === 'succeeded') {
|
|
1210
1239
|
res.send(status);
|
|
@@ -1253,28 +1282,28 @@ app.get('/api/devices/:deviceRef/factory-reset', asyncHandler((req, res) => tsli
|
|
|
1253
1282
|
}
|
|
1254
1283
|
})));
|
|
1255
1284
|
app.get('/api/devices/:deviceRef/monitoring/start', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1256
|
-
var
|
|
1285
|
+
var _122;
|
|
1257
1286
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1258
1287
|
const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
|
|
1259
1288
|
const monitoringParameterIds = yield createDefaultDataMonitoringParameterIds(deviceRef);
|
|
1260
|
-
(
|
|
1289
|
+
(_122 = dataMonitoringMap.get(device.id)) === null || _122 === void 0 ? void 0 : _122.stop();
|
|
1261
1290
|
const dataMonitoring = client.createDataMonitoring(monitoringParameterIds, 1000);
|
|
1262
1291
|
dataMonitoring.start();
|
|
1263
1292
|
dataMonitoringMap.set(device.id, dataMonitoring);
|
|
1264
1293
|
res.send();
|
|
1265
1294
|
})));
|
|
1266
1295
|
app.get('/api/devices/:deviceRef/monitoring/data', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1267
|
-
var
|
|
1296
|
+
var _123;
|
|
1268
1297
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1269
1298
|
const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
|
|
1270
1299
|
const dataMonitoring = dataMonitoringMap.get(device.id);
|
|
1271
|
-
res.type('text/csv').send((
|
|
1300
|
+
res.type('text/csv').send((_123 = dataMonitoring === null || dataMonitoring === void 0 ? void 0 : dataMonitoring.csv) !== null && _123 !== void 0 ? _123 : '');
|
|
1272
1301
|
})));
|
|
1273
1302
|
app.get('/api/devices/:deviceRef/monitoring/stop', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1274
|
-
var
|
|
1303
|
+
var _124;
|
|
1275
1304
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1276
1305
|
const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
|
|
1277
|
-
(
|
|
1306
|
+
(_124 = dataMonitoringMap.get(device.id)) === null || _124 === void 0 ? void 0 : _124.stop();
|
|
1278
1307
|
res.send();
|
|
1279
1308
|
})));
|
|
1280
1309
|
app.listen(port, () => {
|