motion-master-client 0.0.418 → 0.0.420
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 +1 -1
- package/src/api.js +105 -107
- package/src/api.js.map +1 -1
- package/src/lib/circulo.d.ts +56 -1
- package/src/lib/circulo.js +79 -4
- package/src/lib/circulo.js.map +1 -1
- package/src/lib/motion-master-req-res-client.d.ts +5 -0
- package/src/lib/motion-master-req-res-client.js +18 -1
- package/src/lib/motion-master-req-res-client.js.map +1 -1
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -1048,70 +1048,68 @@ app.get('/api/devices/:deviceRef/force-on-demand-parameters-update', asyncHandle
|
|
|
1048
1048
|
res.send();
|
|
1049
1049
|
})));
|
|
1050
1050
|
app.get('/api/devices/:deviceRef/start-circulo-encoder-narrow-angle-calibration', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1051
|
-
var _74, _75, _76;
|
|
1051
|
+
var _74, _75, _76, _77, _78;
|
|
1052
1052
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1053
1053
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
1054
1054
|
const encoderOrdinal = parseInt(((_74 = req.query['encoder-ordinal']) !== null && _74 !== void 0 ? _74 : '1'));
|
|
1055
1055
|
const activateHealthMonitoring = asBoolean(req.query['activate-health-monitoring']);
|
|
1056
1056
|
const measurementOnly = asBoolean(req.query['measurement-only']);
|
|
1057
1057
|
const externalEncoderType = parseInt(((_75 = req.query['external-encoder-type']) !== null && _75 !== void 0 ? _75 : '0'));
|
|
1058
|
-
const requestTimeout = parseInt(((_76 = req.query['request-timeout']) !== null && _76 !== void 0 ? _76 : '
|
|
1058
|
+
const requestTimeout = parseInt(((_76 = req.query['request-timeout']) !== null && _76 !== void 0 ? _76 : '600000'));
|
|
1059
1059
|
const statuses = yield (0, rxjs_1.lastValueFrom)(client.request
|
|
1060
1060
|
.startCirculoEncoderNarrowAngleCalibrationProcedure(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, activateHealthMonitoring, measurementOnly, externalEncoderType }), requestTimeout)
|
|
1061
1061
|
.pipe((0, rxjs_1.toArray)()));
|
|
1062
|
-
|
|
1063
|
-
|
|
1062
|
+
// One entry per calibration iteration. Only the iteration flagged `final` measures an already
|
|
1063
|
+
// calibrated encoder; the earlier ones measure an encoder that is still being calibrated, so
|
|
1064
|
+
// their percentage is not the quality of the calibration.
|
|
1065
|
+
const result = statuses.reduce((acc, status) => {
|
|
1064
1066
|
var _a, _b, _c;
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
return [p, phaseError];
|
|
1072
|
-
}
|
|
1073
|
-
return undefined;
|
|
1074
|
-
})
|
|
1075
|
-
.filter((pt) => Array.isArray(pt));
|
|
1076
|
-
let maxIndex = 0;
|
|
1077
|
-
data.forEach((point, i) => {
|
|
1078
|
-
if (Math.abs(point[1]) > Math.abs(data[maxIndex][1])) {
|
|
1079
|
-
maxIndex = i;
|
|
1080
|
-
}
|
|
1081
|
-
});
|
|
1082
|
-
const maxValue = (_c = data[maxIndex]) === null || _c === void 0 ? void 0 : _c[1];
|
|
1083
|
-
const yDomainLimit = 256;
|
|
1084
|
-
let maxValuePercentage = 0;
|
|
1085
|
-
if (maxValue !== undefined) {
|
|
1086
|
-
maxValuePercentage = 100 - Math.floor((Math.abs(maxValue) / yDomainLimit) * 100);
|
|
1087
|
-
maxValuePercentage = Math.max(maxValuePercentage, 0);
|
|
1088
|
-
}
|
|
1089
|
-
const meaning = (0, circulo_1.getCirculoEncoderCalibrationMaxValuePercentageLabel)(maxValuePercentage);
|
|
1090
|
-
result.push({
|
|
1091
|
-
data,
|
|
1067
|
+
const computed = (0, circulo_1.computeCirculoEncoderCalibrationProgressResult)(status.progress);
|
|
1068
|
+
if (computed) {
|
|
1069
|
+
acc.push({
|
|
1070
|
+
iteration: (_b = (_a = status.progress) === null || _a === void 0 ? void 0 : _a.iteration) !== null && _b !== void 0 ? _b : 0,
|
|
1071
|
+
final: ((_c = status.progress) === null || _c === void 0 ? void 0 : _c.final) === true,
|
|
1072
|
+
data: computed.data,
|
|
1092
1073
|
result: {
|
|
1093
|
-
value:
|
|
1094
|
-
meaning,
|
|
1074
|
+
value: computed.value,
|
|
1075
|
+
meaning: computed.meaning,
|
|
1076
|
+
maxPermissiblePhaseError: computed.maxPermissiblePhaseError,
|
|
1095
1077
|
},
|
|
1096
1078
|
});
|
|
1097
1079
|
}
|
|
1098
|
-
|
|
1080
|
+
return acc;
|
|
1081
|
+
}, []);
|
|
1099
1082
|
const finalStatus = statuses.at(-1);
|
|
1100
1083
|
if ((finalStatus === null || finalStatus === void 0 ? void 0 : finalStatus.request) === 'succeeded') {
|
|
1101
1084
|
res.json(result);
|
|
1102
1085
|
}
|
|
1103
1086
|
else {
|
|
1104
|
-
|
|
1087
|
+
// The procedure failed or was stopped. Preserve the standard `{ message, code }` error body that the
|
|
1088
|
+
// rest of the API returns on 500 (so existing clients keep reading those fields unchanged), and extend
|
|
1089
|
+
// it with `data`: the phase-error samples collected before the procedure ended, so callers can still
|
|
1090
|
+
// diagnose why the calibration did not succeed instead of getting an empty response.
|
|
1091
|
+
//
|
|
1092
|
+
// A stop resolves to a failed request through a `success` status (code STOPPED) rather than an `error`,
|
|
1093
|
+
// so its message comes from there. `code` is taken only from a genuine `error`: the STOPPED success
|
|
1094
|
+
// code (4) collides numerically with Error TIMED_OUT (4), so we omit it on a stop rather than report an
|
|
1095
|
+
// ambiguous code — the message still explains what happened. The per-iteration robustness verdict from
|
|
1096
|
+
// `result` is intentionally omitted too: it labels a *successful* calibration, which this was not.
|
|
1097
|
+
const failure = (_77 = finalStatus === null || finalStatus === void 0 ? void 0 : finalStatus.error) !== null && _77 !== void 0 ? _77 : finalStatus === null || finalStatus === void 0 ? void 0 : finalStatus.success;
|
|
1098
|
+
res.status(500).json({
|
|
1099
|
+
code: (_78 = finalStatus === null || finalStatus === void 0 ? void 0 : finalStatus.error) === null || _78 === void 0 ? void 0 : _78.code,
|
|
1100
|
+
message: failure === null || failure === void 0 ? void 0 : failure.message,
|
|
1101
|
+
data: result.map((iteration) => iteration.data),
|
|
1102
|
+
});
|
|
1105
1103
|
}
|
|
1106
1104
|
})));
|
|
1107
1105
|
app.get('/api/devices/:deviceRef/start-circulo-encoder-configuration', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1108
|
-
var
|
|
1106
|
+
var _79, _80, _81, _82;
|
|
1109
1107
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1110
1108
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
1111
|
-
const encoderOrdinal = parseInt(((
|
|
1112
|
-
const batteryModeMaxAcceleration = parseInt(((
|
|
1113
|
-
const externalCirculoType = parseInt(((
|
|
1114
|
-
const requestTimeout = parseInt(((
|
|
1109
|
+
const encoderOrdinal = parseInt(((_79 = req.query['encoder-ordinal']) !== null && _79 !== void 0 ? _79 : '1'));
|
|
1110
|
+
const batteryModeMaxAcceleration = parseInt(((_80 = req.query['battery-mode-max-acceleration']) !== null && _80 !== void 0 ? _80 : '0'));
|
|
1111
|
+
const externalCirculoType = parseInt(((_81 = req.query['external-circulo-type']) !== null && _81 !== void 0 ? _81 : '0'));
|
|
1112
|
+
const requestTimeout = parseInt(((_82 = req.query['request-timeout']) !== null && _82 !== void 0 ? _82 : '30000'));
|
|
1115
1113
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.startCirculoEncoderConfiguration(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, batteryModeMaxAcceleration, externalCirculoType }), requestTimeout));
|
|
1116
1114
|
if (status.request === 'succeeded') {
|
|
1117
1115
|
res.send();
|
|
@@ -1121,9 +1119,9 @@ app.get('/api/devices/:deviceRef/start-circulo-encoder-configuration', asyncHand
|
|
|
1121
1119
|
}
|
|
1122
1120
|
})));
|
|
1123
1121
|
app.get('/api/devices/:deviceRef/check-circulo-encoder-errors', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1124
|
-
var
|
|
1122
|
+
var _83;
|
|
1125
1123
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1126
|
-
const encoderOrdinal = parseInt(((
|
|
1124
|
+
const encoderOrdinal = parseInt(((_83 = req.query['encoder-ordinal']) !== null && _83 !== void 0 ? _83 : '1'));
|
|
1127
1125
|
const result = yield (0, rxjs_1.lastValueFrom)(client.request.checkCirculoEncoderErrors(deviceRef, encoderOrdinal));
|
|
1128
1126
|
res.send(result);
|
|
1129
1127
|
})));
|
|
@@ -1133,12 +1131,12 @@ app.get('/api/devices/:deviceRef/start-integro-encoder-calibration', asyncHandle
|
|
|
1133
1131
|
res.send();
|
|
1134
1132
|
})));
|
|
1135
1133
|
app.get('/api/devices/:deviceRef/circulo-encoder-magnet-distance', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1136
|
-
var
|
|
1134
|
+
var _84, _85, _86;
|
|
1137
1135
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1138
1136
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
1139
|
-
const encoderOrdinal = parseInt(((
|
|
1140
|
-
const ringRevision = parseInt(((
|
|
1141
|
-
const requestTimeout = parseInt(((
|
|
1137
|
+
const encoderOrdinal = parseInt(((_84 = req.query['encoder-ordinal']) !== null && _84 !== void 0 ? _84 : '1'));
|
|
1138
|
+
const ringRevision = parseInt(((_85 = req.query['ring-revision']) !== null && _85 !== void 0 ? _85 : '0'));
|
|
1139
|
+
const requestTimeout = parseInt(((_86 = req.query['request-timeout']) !== null && _86 !== void 0 ? _86 : '5000'));
|
|
1142
1140
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.getCirculoEncoderMagnetDistance(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, ringRevision }), requestTimeout));
|
|
1143
1141
|
if (status.request === 'succeeded') {
|
|
1144
1142
|
res.send({ distance: status.distance, position: status.position });
|
|
@@ -1148,7 +1146,7 @@ app.get('/api/devices/:deviceRef/circulo-encoder-magnet-distance', asyncHandler(
|
|
|
1148
1146
|
}
|
|
1149
1147
|
})));
|
|
1150
1148
|
app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1151
|
-
var
|
|
1149
|
+
var _87, _88, _89, _90;
|
|
1152
1150
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1153
1151
|
const commandQuery = req.query['command'];
|
|
1154
1152
|
if (!commandQuery) {
|
|
@@ -1163,12 +1161,12 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
|
|
|
1163
1161
|
return;
|
|
1164
1162
|
}
|
|
1165
1163
|
const commandArray = new Uint8Array(command);
|
|
1166
|
-
const commandTimeout = parseInt(((
|
|
1167
|
-
const responsePollingInterval = parseInt(((
|
|
1164
|
+
const commandTimeout = parseInt(((_87 = req.query['command-timeout']) !== null && _87 !== void 0 ? _87 : '10000'));
|
|
1165
|
+
const responsePollingInterval = parseInt(((_88 = req.query['response-polling-interval']) !== null && _88 !== void 0 ? _88 : '1000'));
|
|
1168
1166
|
const osCommandModeQuery = req.query['os-command-mode'];
|
|
1169
1167
|
const osCommandMode = osCommandModeQuery !== undefined && asBoolean(osCommandModeQuery)
|
|
1170
1168
|
? true
|
|
1171
|
-
: (
|
|
1169
|
+
: (_89 = os_command_1.OsCommandMode[osCommandModeQuery === null || osCommandModeQuery === void 0 ? void 0 : osCommandModeQuery.toUpperCase()]) !== null && _89 !== void 0 ? _89 : false;
|
|
1172
1170
|
const readFsBuffer = asBoolean(req.query['read-fs-buffer']);
|
|
1173
1171
|
const fsBufferContent = req.body;
|
|
1174
1172
|
let fsBufferContentArray = undefined;
|
|
@@ -1176,7 +1174,7 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
|
|
|
1176
1174
|
fsBufferContentArray = new Uint8Array(fsBufferContent);
|
|
1177
1175
|
}
|
|
1178
1176
|
const fsBuffer = fsBufferContentArray !== null && fsBufferContentArray !== void 0 ? fsBufferContentArray : readFsBuffer;
|
|
1179
|
-
const fsBufferReadWriteTimeout = parseInt(((
|
|
1177
|
+
const fsBufferReadWriteTimeout = parseInt(((_90 = req.query['fs-buffer-read-write-timeout']) !== null && _90 !== void 0 ? _90 : '30000'));
|
|
1180
1178
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.runOsCommand(deviceRef, commandArray, commandTimeout, responsePollingInterval, osCommandMode, fsBuffer, fsBufferReadWriteTimeout));
|
|
1181
1179
|
if (status.request === 'succeeded') {
|
|
1182
1180
|
res.send(status);
|
|
@@ -1191,10 +1189,10 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
|
|
|
1191
1189
|
* @example curl -X POST "http://localhost:63526/api/devices/0/os-command/abort?command-timeout=10000&response-polling-interval=250"
|
|
1192
1190
|
*/
|
|
1193
1191
|
app.post('/api/devices/:deviceRef/os-command/abort', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1194
|
-
var
|
|
1192
|
+
var _91, _92;
|
|
1195
1193
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1196
|
-
const commandTimeout = parseInt(((
|
|
1197
|
-
const responsePollingInterval = parseInt(((
|
|
1194
|
+
const commandTimeout = parseInt(((_91 = req.query['command-timeout']) !== null && _91 !== void 0 ? _91 : '10000'));
|
|
1195
|
+
const responsePollingInterval = parseInt(((_92 = req.query['response-polling-interval']) !== null && _92 !== void 0 ? _92 : '250'));
|
|
1198
1196
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.abortOsCommand(deviceRef, commandTimeout, responsePollingInterval));
|
|
1199
1197
|
if (status.request === 'succeeded') {
|
|
1200
1198
|
res.send(status);
|
|
@@ -1204,10 +1202,10 @@ app.post('/api/devices/:deviceRef/os-command/abort', asyncHandler((req, res) =>
|
|
|
1204
1202
|
}
|
|
1205
1203
|
})));
|
|
1206
1204
|
app.post('/api/devices/:deviceRef/configure-smm', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1207
|
-
var
|
|
1205
|
+
var _93, _94, _95;
|
|
1208
1206
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1209
|
-
const username = (
|
|
1210
|
-
const password = (
|
|
1207
|
+
const username = (_93 = req.query['username']) !== null && _93 !== void 0 ? _93 : 'Test';
|
|
1208
|
+
const password = (_94 = req.query['password']) !== null && _94 !== void 0 ? _94 : 'SomanetSMM';
|
|
1211
1209
|
let configString;
|
|
1212
1210
|
if (Buffer.isBuffer(req.body)) {
|
|
1213
1211
|
// application/octet-stream (or express.raw)
|
|
@@ -1218,49 +1216,49 @@ app.post('/api/devices/:deviceRef/configure-smm', asyncHandler((req, res) => tsl
|
|
|
1218
1216
|
configString = req.body;
|
|
1219
1217
|
}
|
|
1220
1218
|
else {
|
|
1221
|
-
const contentType = (
|
|
1219
|
+
const contentType = (_95 = req.headers['content-type']) !== null && _95 !== void 0 ? _95 : '';
|
|
1222
1220
|
throw new Error(`Unsupported body type for configure-smm: ${typeof req.body} (Content-Type: ${contentType})`);
|
|
1223
1221
|
}
|
|
1224
1222
|
const safetyParametersReport = yield (0, rxjs_1.lastValueFrom)(client.request.configureSmmFromFile(deviceRef, username, password, configString));
|
|
1225
1223
|
res.send(safetyParametersReport);
|
|
1226
1224
|
})));
|
|
1227
1225
|
app.post('/api/devices/:deviceRef/update-smm-software', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1228
|
-
var
|
|
1226
|
+
var _96, _97, _98, _99, _100, _101, _102;
|
|
1229
1227
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1230
|
-
const username = (
|
|
1231
|
-
const password = (
|
|
1232
|
-
const crc = parseInt(((
|
|
1228
|
+
const username = (_96 = req.query['username']) !== null && _96 !== void 0 ? _96 : 'Test';
|
|
1229
|
+
const password = (_97 = req.query['password']) !== null && _97 !== void 0 ? _97 : 'SomanetSMM';
|
|
1230
|
+
const crc = parseInt(((_98 = req.query['crc']) !== null && _98 !== void 0 ? _98 : ''), 16);
|
|
1233
1231
|
// Validate CRC
|
|
1234
1232
|
if (Number.isNaN(crc)) {
|
|
1235
1233
|
res.status(400).send('Invalid CRC format. Expected hexadecimal string.');
|
|
1236
1234
|
return;
|
|
1237
1235
|
}
|
|
1238
1236
|
// Get optional parameters from query string
|
|
1239
|
-
const chunkSize = parseInt(((
|
|
1240
|
-
const commandTimeout = parseInt(((
|
|
1241
|
-
const responsePollingInterval = parseInt(((
|
|
1242
|
-
const fsBufferReadWriteTimeout = parseInt(((
|
|
1237
|
+
const chunkSize = parseInt(((_99 = req.query['chunkSize']) !== null && _99 !== void 0 ? _99 : '1000'));
|
|
1238
|
+
const commandTimeout = parseInt(((_100 = req.query['commandTimeout']) !== null && _100 !== void 0 ? _100 : '30000'));
|
|
1239
|
+
const responsePollingInterval = parseInt(((_101 = req.query['responsePollingInterval']) !== null && _101 !== void 0 ? _101 : '1000'));
|
|
1240
|
+
const fsBufferReadWriteTimeout = parseInt(((_102 = req.query['fsBufferReadWriteTimeout']) !== null && _102 !== void 0 ? _102 : '120000'));
|
|
1243
1241
|
// Create buffer from request body
|
|
1244
1242
|
const buffer = new Uint8Array(req.body);
|
|
1245
1243
|
yield (0, rxjs_1.lastValueFrom)(client.request.updateSmmSoftware(deviceRef, username, password, buffer, crc, chunkSize, commandTimeout, responsePollingInterval, fsBufferReadWriteTimeout));
|
|
1246
1244
|
res.send();
|
|
1247
1245
|
})));
|
|
1248
1246
|
app.post('/api/devices/:deviceRef/update-smm-software-to-encrypted', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1249
|
-
var
|
|
1247
|
+
var _103, _104, _105, _106, _107, _108, _109;
|
|
1250
1248
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1251
|
-
const username = (
|
|
1252
|
-
const password = (
|
|
1253
|
-
const crc = parseInt(((
|
|
1249
|
+
const username = (_103 = req.query['username']) !== null && _103 !== void 0 ? _103 : 'Test';
|
|
1250
|
+
const password = (_104 = req.query['password']) !== null && _104 !== void 0 ? _104 : 'SomanetSMM';
|
|
1251
|
+
const crc = parseInt(((_105 = req.query['crc']) !== null && _105 !== void 0 ? _105 : ''), 16);
|
|
1254
1252
|
// Validate CRC
|
|
1255
1253
|
if (Number.isNaN(crc)) {
|
|
1256
1254
|
res.status(400).send('Invalid CRC format. Expected hexadecimal string.');
|
|
1257
1255
|
return;
|
|
1258
1256
|
}
|
|
1259
1257
|
// Get optional parameters from query string
|
|
1260
|
-
const chunkSize = parseInt(((
|
|
1261
|
-
const commandTimeout = parseInt(((
|
|
1262
|
-
const responsePollingInterval = parseInt(((
|
|
1263
|
-
const fsBufferReadWriteTimeout = parseInt(((
|
|
1258
|
+
const chunkSize = parseInt(((_106 = req.query['chunkSize']) !== null && _106 !== void 0 ? _106 : '1000'));
|
|
1259
|
+
const commandTimeout = parseInt(((_107 = req.query['commandTimeout']) !== null && _107 !== void 0 ? _107 : '30000'));
|
|
1260
|
+
const responsePollingInterval = parseInt(((_108 = req.query['responsePollingInterval']) !== null && _108 !== void 0 ? _108 : '1000'));
|
|
1261
|
+
const fsBufferReadWriteTimeout = parseInt(((_109 = req.query['fsBufferReadWriteTimeout']) !== null && _109 !== void 0 ? _109 : '120000'));
|
|
1264
1262
|
// Create buffer from request body
|
|
1265
1263
|
const buffer = new Uint8Array(req.body);
|
|
1266
1264
|
yield (0, rxjs_1.lastValueFrom)(client.request.updateSmmSoftwareToEncrypted(deviceRef, username, password, buffer, crc, chunkSize, commandTimeout, responsePollingInterval, fsBufferReadWriteTimeout));
|
|
@@ -1273,16 +1271,16 @@ app.get('/api/devices/:deviceRef/write-circulo-integrated-encoder-config-bin-fil
|
|
|
1273
1271
|
res.send(status);
|
|
1274
1272
|
})));
|
|
1275
1273
|
app.get('/api/devices/:deviceRef/run-chirp-signal', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1276
|
-
var
|
|
1277
|
-
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1278
|
-
const hrdStreamingDuration = parseInt(((
|
|
1279
|
-
const modesOfOperation = parseInt(((
|
|
1280
|
-
const signalType = parseInt(((
|
|
1281
|
-
const startFrequency = parseInt(((
|
|
1282
|
-
const startProcedure = parseInt(((
|
|
1283
|
-
const targetAmplitude = parseInt(((
|
|
1284
|
-
const targetFrequency = parseInt(((
|
|
1285
|
-
const transitionTime = parseInt(((
|
|
1274
|
+
var _110, _111, _112, _113, _114, _115, _116, _117;
|
|
1275
|
+
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1276
|
+
const hrdStreamingDuration = parseInt(((_110 = req.query['hrd-streaming-duration']) !== null && _110 !== void 0 ? _110 : '4000'));
|
|
1277
|
+
const modesOfOperation = parseInt(((_111 = req.query['modes-of-operation']) !== null && _111 !== void 0 ? _111 : '10'));
|
|
1278
|
+
const signalType = parseInt(((_112 = req.query['signal-type']) !== null && _112 !== void 0 ? _112 : '0'));
|
|
1279
|
+
const startFrequency = parseInt(((_113 = req.query['start-frequency']) !== null && _113 !== void 0 ? _113 : '2000'));
|
|
1280
|
+
const startProcedure = parseInt(((_114 = req.query['start-procedure']) !== null && _114 !== void 0 ? _114 : '2'));
|
|
1281
|
+
const targetAmplitude = parseInt(((_115 = req.query['target-amplitude']) !== null && _115 !== void 0 ? _115 : '300'));
|
|
1282
|
+
const targetFrequency = parseInt(((_116 = req.query['target-frequency']) !== null && _116 !== void 0 ? _116 : '100000'));
|
|
1283
|
+
const transitionTime = parseInt(((_117 = req.query['transition-time']) !== null && _117 !== void 0 ? _117 : '3000'));
|
|
1286
1284
|
const options = {
|
|
1287
1285
|
hrdStreamingDuration,
|
|
1288
1286
|
modesOfOperation,
|
|
@@ -1303,18 +1301,18 @@ app.get('/api/devices/:deviceRef/run-chirp-signal', asyncHandler((req, res) => t
|
|
|
1303
1301
|
}
|
|
1304
1302
|
})));
|
|
1305
1303
|
app.get('/api/devices/:deviceRef/start-limited-range-system-identification', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1306
|
-
var
|
|
1304
|
+
var _118, _119, _120, _121, _122, _123, _124;
|
|
1307
1305
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1308
|
-
const hrdStreamingDuration = parseInt(((
|
|
1306
|
+
const hrdStreamingDuration = parseInt(((_118 = req.query['hrd-streaming-duration']) !== null && _118 !== void 0 ? _118 : '3200'));
|
|
1309
1307
|
const modesOfOperation = cia402_1.ModesOfOperation.CYCLIC_SYNC_POSITION_MODE;
|
|
1310
|
-
const rangeLimit = parseInt(((
|
|
1311
|
-
const rangeLimitMin = parseInt(((
|
|
1308
|
+
const rangeLimit = parseInt(((_119 = req.query['range-limit']) !== null && _119 !== void 0 ? _119 : '10000'));
|
|
1309
|
+
const rangeLimitMin = parseInt(((_120 = req.query['range-limit-min']) !== null && _120 !== void 0 ? _120 : '1000'));
|
|
1312
1310
|
const signalType = os_command_1.SystemIdentificationOsCommandSignalType.LINEAR_WITH_CONSTANT_AMPLITUDE;
|
|
1313
|
-
const startFrequency = parseInt(((
|
|
1311
|
+
const startFrequency = parseInt(((_121 = req.query['start-frequency']) !== null && _121 !== void 0 ? _121 : '1000'));
|
|
1314
1312
|
const startProcedure = os_command_1.SystemIdentificationOsCommandStartProcedure.WAIT_FOR_HRD_STREAMING_TO_START;
|
|
1315
|
-
const targetAmplitude = parseInt(((
|
|
1316
|
-
const targetFrequency = parseInt(((
|
|
1317
|
-
const transitionTime = parseInt(((
|
|
1313
|
+
const targetAmplitude = parseInt(((_122 = req.query['target-amplitude']) !== null && _122 !== void 0 ? _122 : '300'));
|
|
1314
|
+
const targetFrequency = parseInt(((_123 = req.query['target-frequency']) !== null && _123 !== void 0 ? _123 : '10000'));
|
|
1315
|
+
const transitionTime = parseInt(((_124 = req.query['transition-time']) !== null && _124 !== void 0 ? _124 : '3000'));
|
|
1318
1316
|
const options = {
|
|
1319
1317
|
hrdStreamingDuration,
|
|
1320
1318
|
modesOfOperation,
|
|
@@ -1357,15 +1355,15 @@ app.get('/api/motion-composer/stop', asyncHandler((_req, res) => tslib_1.__await
|
|
|
1357
1355
|
res.send();
|
|
1358
1356
|
})));
|
|
1359
1357
|
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* () {
|
|
1360
|
-
var
|
|
1361
|
-
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1362
|
-
const rw = parseInt(((
|
|
1363
|
-
const registerAddress = parseInt(((
|
|
1364
|
-
const registerLength = parseInt(((
|
|
1365
|
-
const registerWriteValue = parseInt(((
|
|
1366
|
-
const commandTimeout = parseInt(((
|
|
1367
|
-
const responsePollingInterval = parseInt(((
|
|
1368
|
-
const osCommandMode = asBoolean(((
|
|
1358
|
+
var _125, _126, _127, _128, _129, _130, _131;
|
|
1359
|
+
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1360
|
+
const rw = parseInt(((_125 = req.query['rw']) !== null && _125 !== void 0 ? _125 : '0'));
|
|
1361
|
+
const registerAddress = parseInt(((_126 = req.query['register-address']) !== null && _126 !== void 0 ? _126 : '0'));
|
|
1362
|
+
const registerLength = parseInt(((_127 = req.query['register-length']) !== null && _127 !== void 0 ? _127 : '0'));
|
|
1363
|
+
const registerWriteValue = parseInt(((_128 = req.query['register-write-value']) !== null && _128 !== void 0 ? _128 : '0'));
|
|
1364
|
+
const commandTimeout = parseInt(((_129 = req.query['command-timeout']) !== null && _129 !== void 0 ? _129 : '10000'));
|
|
1365
|
+
const responsePollingInterval = parseInt(((_130 = req.query['response-polling-interval']) !== null && _130 !== void 0 ? _130 : '1000'));
|
|
1366
|
+
const osCommandMode = asBoolean(((_131 = req.query['os-command-mode']) !== null && _131 !== void 0 ? _131 : 'false'));
|
|
1369
1367
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.runKublerEncoderRegisterCommunicationOsCommand(deviceRef, rw, registerAddress, registerLength, registerWriteValue, commandTimeout, responsePollingInterval, osCommandMode));
|
|
1370
1368
|
if (status.request === 'succeeded') {
|
|
1371
1369
|
res.send(status);
|
|
@@ -1414,28 +1412,28 @@ app.get('/api/devices/:deviceRef/factory-reset', asyncHandler((req, res) => tsli
|
|
|
1414
1412
|
}
|
|
1415
1413
|
})));
|
|
1416
1414
|
app.get('/api/devices/:deviceRef/monitoring/start', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1417
|
-
var
|
|
1415
|
+
var _132;
|
|
1418
1416
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1419
1417
|
const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
|
|
1420
1418
|
const monitoringParameterIds = yield createDefaultDataMonitoringParameterIds(deviceRef);
|
|
1421
|
-
(
|
|
1419
|
+
(_132 = dataMonitoringMap.get(device.id)) === null || _132 === void 0 ? void 0 : _132.stop();
|
|
1422
1420
|
const dataMonitoring = client.createDataMonitoring(monitoringParameterIds, 1000);
|
|
1423
1421
|
dataMonitoring.start();
|
|
1424
1422
|
dataMonitoringMap.set(device.id, dataMonitoring);
|
|
1425
1423
|
res.send();
|
|
1426
1424
|
})));
|
|
1427
1425
|
app.get('/api/devices/:deviceRef/monitoring/data', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1428
|
-
var
|
|
1426
|
+
var _133;
|
|
1429
1427
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1430
1428
|
const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
|
|
1431
1429
|
const dataMonitoring = dataMonitoringMap.get(device.id);
|
|
1432
|
-
res.type('text/csv').send((
|
|
1430
|
+
res.type('text/csv').send((_133 = dataMonitoring === null || dataMonitoring === void 0 ? void 0 : dataMonitoring.csv) !== null && _133 !== void 0 ? _133 : '');
|
|
1433
1431
|
})));
|
|
1434
1432
|
app.get('/api/devices/:deviceRef/monitoring/stop', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1435
|
-
var
|
|
1433
|
+
var _134;
|
|
1436
1434
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1437
1435
|
const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
|
|
1438
|
-
(
|
|
1436
|
+
(_134 = dataMonitoringMap.get(device.id)) === null || _134 === void 0 ? void 0 : _134.stop();
|
|
1439
1437
|
res.send();
|
|
1440
1438
|
})));
|
|
1441
1439
|
app.listen(port, () => {
|