motion-master-client 0.0.419 → 0.0.421
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 +95 -86
- package/src/api.js.map +1 -1
- package/src/lib/circulo.d.ts +24 -12
- package/src/lib/circulo.js +32 -13
- 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,32 +1048,41 @@ 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, _77, _78
|
|
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 : '
|
|
1059
|
-
//
|
|
1060
|
-
//
|
|
1061
|
-
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1058
|
+
const requestTimeout = parseInt(((_76 = req.query['request-timeout']) !== null && _76 !== void 0 ? _76 : '600000'));
|
|
1059
|
+
// Motion Master uses any non-zero value as is, negative included, and takes 0 as "use the default",
|
|
1060
|
+
// so reject what it would not catch and leave the field unset when the parameter is omitted or empty.
|
|
1061
|
+
const velocityBaseValueRpmQuery = req.query['velocity-base-value-rpm'] || undefined;
|
|
1062
|
+
const velocityBaseValueRpm = velocityBaseValueRpmQuery === undefined ? undefined : parseInt(velocityBaseValueRpmQuery);
|
|
1063
|
+
if (velocityBaseValueRpm !== undefined &&
|
|
1064
|
+
(!Number.isInteger(velocityBaseValueRpm) || velocityBaseValueRpm < 1 || velocityBaseValueRpm > 2147483647)) {
|
|
1065
|
+
res.status(400).send({
|
|
1066
|
+
message: `velocity-base-value-rpm must be an integer from 1 to 2147483647, received "${velocityBaseValueRpmQuery}".`,
|
|
1067
|
+
});
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1064
1070
|
const statuses = yield (0, rxjs_1.lastValueFrom)(client.request
|
|
1065
|
-
.startCirculoEncoderNarrowAngleCalibrationProcedure(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal,
|
|
1071
|
+
.startCirculoEncoderNarrowAngleCalibrationProcedure(Object.assign(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal,
|
|
1072
|
+
activateHealthMonitoring,
|
|
1073
|
+
measurementOnly,
|
|
1074
|
+
externalEncoderType }), (velocityBaseValueRpm !== undefined && { velocityBaseValueRpm })), requestTimeout)
|
|
1066
1075
|
.pipe((0, rxjs_1.toArray)()));
|
|
1067
1076
|
// One entry per calibration iteration. Only the iteration flagged `final` measures an already
|
|
1068
1077
|
// calibrated encoder; the earlier ones measure an encoder that is still being calibrated, so
|
|
1069
1078
|
// their percentage is not the quality of the calibration.
|
|
1070
1079
|
const result = statuses.reduce((acc, status) => {
|
|
1071
|
-
var _a, _b, _c
|
|
1072
|
-
const computed = (0, circulo_1.
|
|
1080
|
+
var _a, _b, _c;
|
|
1081
|
+
const computed = (0, circulo_1.computeCirculoEncoderCalibrationProgressResult)(status.progress);
|
|
1073
1082
|
if (computed) {
|
|
1074
1083
|
acc.push({
|
|
1075
|
-
iteration: (
|
|
1076
|
-
final: ((
|
|
1084
|
+
iteration: (_b = (_a = status.progress) === null || _a === void 0 ? void 0 : _a.iteration) !== null && _b !== void 0 ? _b : 0,
|
|
1085
|
+
final: ((_c = status.progress) === null || _c === void 0 ? void 0 : _c.final) === true,
|
|
1077
1086
|
data: computed.data,
|
|
1078
1087
|
result: {
|
|
1079
1088
|
value: computed.value,
|
|
@@ -1099,22 +1108,22 @@ app.get('/api/devices/:deviceRef/start-circulo-encoder-narrow-angle-calibration'
|
|
|
1099
1108
|
// code (4) collides numerically with Error TIMED_OUT (4), so we omit it on a stop rather than report an
|
|
1100
1109
|
// ambiguous code — the message still explains what happened. The per-iteration robustness verdict from
|
|
1101
1110
|
// `result` is intentionally omitted too: it labels a *successful* calibration, which this was not.
|
|
1102
|
-
const failure = (
|
|
1111
|
+
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;
|
|
1103
1112
|
res.status(500).json({
|
|
1104
|
-
code: (
|
|
1113
|
+
code: (_78 = finalStatus === null || finalStatus === void 0 ? void 0 : finalStatus.error) === null || _78 === void 0 ? void 0 : _78.code,
|
|
1105
1114
|
message: failure === null || failure === void 0 ? void 0 : failure.message,
|
|
1106
1115
|
data: result.map((iteration) => iteration.data),
|
|
1107
1116
|
});
|
|
1108
1117
|
}
|
|
1109
1118
|
})));
|
|
1110
1119
|
app.get('/api/devices/:deviceRef/start-circulo-encoder-configuration', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1111
|
-
var _80, _81, _82
|
|
1120
|
+
var _79, _80, _81, _82;
|
|
1112
1121
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1113
1122
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
1114
|
-
const encoderOrdinal = parseInt(((
|
|
1115
|
-
const batteryModeMaxAcceleration = parseInt(((
|
|
1116
|
-
const externalCirculoType = parseInt(((
|
|
1117
|
-
const requestTimeout = parseInt(((
|
|
1123
|
+
const encoderOrdinal = parseInt(((_79 = req.query['encoder-ordinal']) !== null && _79 !== void 0 ? _79 : '1'));
|
|
1124
|
+
const batteryModeMaxAcceleration = parseInt(((_80 = req.query['battery-mode-max-acceleration']) !== null && _80 !== void 0 ? _80 : '0'));
|
|
1125
|
+
const externalCirculoType = parseInt(((_81 = req.query['external-circulo-type']) !== null && _81 !== void 0 ? _81 : '0'));
|
|
1126
|
+
const requestTimeout = parseInt(((_82 = req.query['request-timeout']) !== null && _82 !== void 0 ? _82 : '30000'));
|
|
1118
1127
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.startCirculoEncoderConfiguration(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, batteryModeMaxAcceleration, externalCirculoType }), requestTimeout));
|
|
1119
1128
|
if (status.request === 'succeeded') {
|
|
1120
1129
|
res.send();
|
|
@@ -1124,9 +1133,9 @@ app.get('/api/devices/:deviceRef/start-circulo-encoder-configuration', asyncHand
|
|
|
1124
1133
|
}
|
|
1125
1134
|
})));
|
|
1126
1135
|
app.get('/api/devices/:deviceRef/check-circulo-encoder-errors', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1127
|
-
var
|
|
1136
|
+
var _83;
|
|
1128
1137
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1129
|
-
const encoderOrdinal = parseInt(((
|
|
1138
|
+
const encoderOrdinal = parseInt(((_83 = req.query['encoder-ordinal']) !== null && _83 !== void 0 ? _83 : '1'));
|
|
1130
1139
|
const result = yield (0, rxjs_1.lastValueFrom)(client.request.checkCirculoEncoderErrors(deviceRef, encoderOrdinal));
|
|
1131
1140
|
res.send(result);
|
|
1132
1141
|
})));
|
|
@@ -1136,12 +1145,12 @@ app.get('/api/devices/:deviceRef/start-integro-encoder-calibration', asyncHandle
|
|
|
1136
1145
|
res.send();
|
|
1137
1146
|
})));
|
|
1138
1147
|
app.get('/api/devices/:deviceRef/circulo-encoder-magnet-distance', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1139
|
-
var _85, _86
|
|
1148
|
+
var _84, _85, _86;
|
|
1140
1149
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1141
1150
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
1142
|
-
const encoderOrdinal = parseInt(((
|
|
1143
|
-
const ringRevision = parseInt(((
|
|
1144
|
-
const requestTimeout = parseInt(((
|
|
1151
|
+
const encoderOrdinal = parseInt(((_84 = req.query['encoder-ordinal']) !== null && _84 !== void 0 ? _84 : '1'));
|
|
1152
|
+
const ringRevision = parseInt(((_85 = req.query['ring-revision']) !== null && _85 !== void 0 ? _85 : '0'));
|
|
1153
|
+
const requestTimeout = parseInt(((_86 = req.query['request-timeout']) !== null && _86 !== void 0 ? _86 : '5000'));
|
|
1145
1154
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.getCirculoEncoderMagnetDistance(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, ringRevision }), requestTimeout));
|
|
1146
1155
|
if (status.request === 'succeeded') {
|
|
1147
1156
|
res.send({ distance: status.distance, position: status.position });
|
|
@@ -1151,7 +1160,7 @@ app.get('/api/devices/:deviceRef/circulo-encoder-magnet-distance', asyncHandler(
|
|
|
1151
1160
|
}
|
|
1152
1161
|
})));
|
|
1153
1162
|
app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1154
|
-
var _88, _89, _90
|
|
1163
|
+
var _87, _88, _89, _90;
|
|
1155
1164
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1156
1165
|
const commandQuery = req.query['command'];
|
|
1157
1166
|
if (!commandQuery) {
|
|
@@ -1166,12 +1175,12 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
|
|
|
1166
1175
|
return;
|
|
1167
1176
|
}
|
|
1168
1177
|
const commandArray = new Uint8Array(command);
|
|
1169
|
-
const commandTimeout = parseInt(((
|
|
1170
|
-
const responsePollingInterval = parseInt(((
|
|
1178
|
+
const commandTimeout = parseInt(((_87 = req.query['command-timeout']) !== null && _87 !== void 0 ? _87 : '10000'));
|
|
1179
|
+
const responsePollingInterval = parseInt(((_88 = req.query['response-polling-interval']) !== null && _88 !== void 0 ? _88 : '1000'));
|
|
1171
1180
|
const osCommandModeQuery = req.query['os-command-mode'];
|
|
1172
1181
|
const osCommandMode = osCommandModeQuery !== undefined && asBoolean(osCommandModeQuery)
|
|
1173
1182
|
? true
|
|
1174
|
-
: (
|
|
1183
|
+
: (_89 = os_command_1.OsCommandMode[osCommandModeQuery === null || osCommandModeQuery === void 0 ? void 0 : osCommandModeQuery.toUpperCase()]) !== null && _89 !== void 0 ? _89 : false;
|
|
1175
1184
|
const readFsBuffer = asBoolean(req.query['read-fs-buffer']);
|
|
1176
1185
|
const fsBufferContent = req.body;
|
|
1177
1186
|
let fsBufferContentArray = undefined;
|
|
@@ -1179,7 +1188,7 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
|
|
|
1179
1188
|
fsBufferContentArray = new Uint8Array(fsBufferContent);
|
|
1180
1189
|
}
|
|
1181
1190
|
const fsBuffer = fsBufferContentArray !== null && fsBufferContentArray !== void 0 ? fsBufferContentArray : readFsBuffer;
|
|
1182
|
-
const fsBufferReadWriteTimeout = parseInt(((
|
|
1191
|
+
const fsBufferReadWriteTimeout = parseInt(((_90 = req.query['fs-buffer-read-write-timeout']) !== null && _90 !== void 0 ? _90 : '30000'));
|
|
1183
1192
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.runOsCommand(deviceRef, commandArray, commandTimeout, responsePollingInterval, osCommandMode, fsBuffer, fsBufferReadWriteTimeout));
|
|
1184
1193
|
if (status.request === 'succeeded') {
|
|
1185
1194
|
res.send(status);
|
|
@@ -1194,10 +1203,10 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
|
|
|
1194
1203
|
* @example curl -X POST "http://localhost:63526/api/devices/0/os-command/abort?command-timeout=10000&response-polling-interval=250"
|
|
1195
1204
|
*/
|
|
1196
1205
|
app.post('/api/devices/:deviceRef/os-command/abort', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1197
|
-
var
|
|
1206
|
+
var _91, _92;
|
|
1198
1207
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1199
|
-
const commandTimeout = parseInt(((
|
|
1200
|
-
const responsePollingInterval = parseInt(((
|
|
1208
|
+
const commandTimeout = parseInt(((_91 = req.query['command-timeout']) !== null && _91 !== void 0 ? _91 : '10000'));
|
|
1209
|
+
const responsePollingInterval = parseInt(((_92 = req.query['response-polling-interval']) !== null && _92 !== void 0 ? _92 : '250'));
|
|
1201
1210
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.abortOsCommand(deviceRef, commandTimeout, responsePollingInterval));
|
|
1202
1211
|
if (status.request === 'succeeded') {
|
|
1203
1212
|
res.send(status);
|
|
@@ -1207,10 +1216,10 @@ app.post('/api/devices/:deviceRef/os-command/abort', asyncHandler((req, res) =>
|
|
|
1207
1216
|
}
|
|
1208
1217
|
})));
|
|
1209
1218
|
app.post('/api/devices/:deviceRef/configure-smm', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1210
|
-
var _94, _95
|
|
1219
|
+
var _93, _94, _95;
|
|
1211
1220
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1212
|
-
const username = (
|
|
1213
|
-
const password = (
|
|
1221
|
+
const username = (_93 = req.query['username']) !== null && _93 !== void 0 ? _93 : 'Test';
|
|
1222
|
+
const password = (_94 = req.query['password']) !== null && _94 !== void 0 ? _94 : 'SomanetSMM';
|
|
1214
1223
|
let configString;
|
|
1215
1224
|
if (Buffer.isBuffer(req.body)) {
|
|
1216
1225
|
// application/octet-stream (or express.raw)
|
|
@@ -1221,49 +1230,49 @@ app.post('/api/devices/:deviceRef/configure-smm', asyncHandler((req, res) => tsl
|
|
|
1221
1230
|
configString = req.body;
|
|
1222
1231
|
}
|
|
1223
1232
|
else {
|
|
1224
|
-
const contentType = (
|
|
1233
|
+
const contentType = (_95 = req.headers['content-type']) !== null && _95 !== void 0 ? _95 : '';
|
|
1225
1234
|
throw new Error(`Unsupported body type for configure-smm: ${typeof req.body} (Content-Type: ${contentType})`);
|
|
1226
1235
|
}
|
|
1227
1236
|
const safetyParametersReport = yield (0, rxjs_1.lastValueFrom)(client.request.configureSmmFromFile(deviceRef, username, password, configString));
|
|
1228
1237
|
res.send(safetyParametersReport);
|
|
1229
1238
|
})));
|
|
1230
1239
|
app.post('/api/devices/:deviceRef/update-smm-software', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1231
|
-
var _97, _98, _99, _100, _101, _102
|
|
1240
|
+
var _96, _97, _98, _99, _100, _101, _102;
|
|
1232
1241
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1233
|
-
const username = (
|
|
1234
|
-
const password = (
|
|
1235
|
-
const crc = parseInt(((
|
|
1242
|
+
const username = (_96 = req.query['username']) !== null && _96 !== void 0 ? _96 : 'Test';
|
|
1243
|
+
const password = (_97 = req.query['password']) !== null && _97 !== void 0 ? _97 : 'SomanetSMM';
|
|
1244
|
+
const crc = parseInt(((_98 = req.query['crc']) !== null && _98 !== void 0 ? _98 : ''), 16);
|
|
1236
1245
|
// Validate CRC
|
|
1237
1246
|
if (Number.isNaN(crc)) {
|
|
1238
1247
|
res.status(400).send('Invalid CRC format. Expected hexadecimal string.');
|
|
1239
1248
|
return;
|
|
1240
1249
|
}
|
|
1241
1250
|
// Get optional parameters from query string
|
|
1242
|
-
const chunkSize = parseInt(((
|
|
1243
|
-
const commandTimeout = parseInt(((
|
|
1244
|
-
const responsePollingInterval = parseInt(((
|
|
1245
|
-
const fsBufferReadWriteTimeout = parseInt(((
|
|
1251
|
+
const chunkSize = parseInt(((_99 = req.query['chunkSize']) !== null && _99 !== void 0 ? _99 : '1000'));
|
|
1252
|
+
const commandTimeout = parseInt(((_100 = req.query['commandTimeout']) !== null && _100 !== void 0 ? _100 : '30000'));
|
|
1253
|
+
const responsePollingInterval = parseInt(((_101 = req.query['responsePollingInterval']) !== null && _101 !== void 0 ? _101 : '1000'));
|
|
1254
|
+
const fsBufferReadWriteTimeout = parseInt(((_102 = req.query['fsBufferReadWriteTimeout']) !== null && _102 !== void 0 ? _102 : '120000'));
|
|
1246
1255
|
// Create buffer from request body
|
|
1247
1256
|
const buffer = new Uint8Array(req.body);
|
|
1248
1257
|
yield (0, rxjs_1.lastValueFrom)(client.request.updateSmmSoftware(deviceRef, username, password, buffer, crc, chunkSize, commandTimeout, responsePollingInterval, fsBufferReadWriteTimeout));
|
|
1249
1258
|
res.send();
|
|
1250
1259
|
})));
|
|
1251
1260
|
app.post('/api/devices/:deviceRef/update-smm-software-to-encrypted', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1252
|
-
var _104, _105, _106, _107, _108, _109
|
|
1261
|
+
var _103, _104, _105, _106, _107, _108, _109;
|
|
1253
1262
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1254
|
-
const username = (
|
|
1255
|
-
const password = (
|
|
1256
|
-
const crc = parseInt(((
|
|
1263
|
+
const username = (_103 = req.query['username']) !== null && _103 !== void 0 ? _103 : 'Test';
|
|
1264
|
+
const password = (_104 = req.query['password']) !== null && _104 !== void 0 ? _104 : 'SomanetSMM';
|
|
1265
|
+
const crc = parseInt(((_105 = req.query['crc']) !== null && _105 !== void 0 ? _105 : ''), 16);
|
|
1257
1266
|
// Validate CRC
|
|
1258
1267
|
if (Number.isNaN(crc)) {
|
|
1259
1268
|
res.status(400).send('Invalid CRC format. Expected hexadecimal string.');
|
|
1260
1269
|
return;
|
|
1261
1270
|
}
|
|
1262
1271
|
// Get optional parameters from query string
|
|
1263
|
-
const chunkSize = parseInt(((
|
|
1264
|
-
const commandTimeout = parseInt(((
|
|
1265
|
-
const responsePollingInterval = parseInt(((
|
|
1266
|
-
const fsBufferReadWriteTimeout = parseInt(((
|
|
1272
|
+
const chunkSize = parseInt(((_106 = req.query['chunkSize']) !== null && _106 !== void 0 ? _106 : '1000'));
|
|
1273
|
+
const commandTimeout = parseInt(((_107 = req.query['commandTimeout']) !== null && _107 !== void 0 ? _107 : '30000'));
|
|
1274
|
+
const responsePollingInterval = parseInt(((_108 = req.query['responsePollingInterval']) !== null && _108 !== void 0 ? _108 : '1000'));
|
|
1275
|
+
const fsBufferReadWriteTimeout = parseInt(((_109 = req.query['fsBufferReadWriteTimeout']) !== null && _109 !== void 0 ? _109 : '120000'));
|
|
1267
1276
|
// Create buffer from request body
|
|
1268
1277
|
const buffer = new Uint8Array(req.body);
|
|
1269
1278
|
yield (0, rxjs_1.lastValueFrom)(client.request.updateSmmSoftwareToEncrypted(deviceRef, username, password, buffer, crc, chunkSize, commandTimeout, responsePollingInterval, fsBufferReadWriteTimeout));
|
|
@@ -1276,16 +1285,16 @@ app.get('/api/devices/:deviceRef/write-circulo-integrated-encoder-config-bin-fil
|
|
|
1276
1285
|
res.send(status);
|
|
1277
1286
|
})));
|
|
1278
1287
|
app.get('/api/devices/:deviceRef/run-chirp-signal', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1279
|
-
var _111, _112, _113, _114, _115, _116, _117
|
|
1280
|
-
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1281
|
-
const hrdStreamingDuration = parseInt(((
|
|
1282
|
-
const modesOfOperation = parseInt(((
|
|
1283
|
-
const signalType = parseInt(((
|
|
1284
|
-
const startFrequency = parseInt(((
|
|
1285
|
-
const startProcedure = parseInt(((
|
|
1286
|
-
const targetAmplitude = parseInt(((
|
|
1287
|
-
const targetFrequency = parseInt(((
|
|
1288
|
-
const transitionTime = parseInt(((
|
|
1288
|
+
var _110, _111, _112, _113, _114, _115, _116, _117;
|
|
1289
|
+
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1290
|
+
const hrdStreamingDuration = parseInt(((_110 = req.query['hrd-streaming-duration']) !== null && _110 !== void 0 ? _110 : '4000'));
|
|
1291
|
+
const modesOfOperation = parseInt(((_111 = req.query['modes-of-operation']) !== null && _111 !== void 0 ? _111 : '10'));
|
|
1292
|
+
const signalType = parseInt(((_112 = req.query['signal-type']) !== null && _112 !== void 0 ? _112 : '0'));
|
|
1293
|
+
const startFrequency = parseInt(((_113 = req.query['start-frequency']) !== null && _113 !== void 0 ? _113 : '2000'));
|
|
1294
|
+
const startProcedure = parseInt(((_114 = req.query['start-procedure']) !== null && _114 !== void 0 ? _114 : '2'));
|
|
1295
|
+
const targetAmplitude = parseInt(((_115 = req.query['target-amplitude']) !== null && _115 !== void 0 ? _115 : '300'));
|
|
1296
|
+
const targetFrequency = parseInt(((_116 = req.query['target-frequency']) !== null && _116 !== void 0 ? _116 : '100000'));
|
|
1297
|
+
const transitionTime = parseInt(((_117 = req.query['transition-time']) !== null && _117 !== void 0 ? _117 : '3000'));
|
|
1289
1298
|
const options = {
|
|
1290
1299
|
hrdStreamingDuration,
|
|
1291
1300
|
modesOfOperation,
|
|
@@ -1306,18 +1315,18 @@ app.get('/api/devices/:deviceRef/run-chirp-signal', asyncHandler((req, res) => t
|
|
|
1306
1315
|
}
|
|
1307
1316
|
})));
|
|
1308
1317
|
app.get('/api/devices/:deviceRef/start-limited-range-system-identification', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1309
|
-
var _119, _120, _121, _122, _123, _124
|
|
1318
|
+
var _118, _119, _120, _121, _122, _123, _124;
|
|
1310
1319
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1311
|
-
const hrdStreamingDuration = parseInt(((
|
|
1320
|
+
const hrdStreamingDuration = parseInt(((_118 = req.query['hrd-streaming-duration']) !== null && _118 !== void 0 ? _118 : '3200'));
|
|
1312
1321
|
const modesOfOperation = cia402_1.ModesOfOperation.CYCLIC_SYNC_POSITION_MODE;
|
|
1313
|
-
const rangeLimit = parseInt(((
|
|
1314
|
-
const rangeLimitMin = parseInt(((
|
|
1322
|
+
const rangeLimit = parseInt(((_119 = req.query['range-limit']) !== null && _119 !== void 0 ? _119 : '10000'));
|
|
1323
|
+
const rangeLimitMin = parseInt(((_120 = req.query['range-limit-min']) !== null && _120 !== void 0 ? _120 : '1000'));
|
|
1315
1324
|
const signalType = os_command_1.SystemIdentificationOsCommandSignalType.LINEAR_WITH_CONSTANT_AMPLITUDE;
|
|
1316
|
-
const startFrequency = parseInt(((
|
|
1325
|
+
const startFrequency = parseInt(((_121 = req.query['start-frequency']) !== null && _121 !== void 0 ? _121 : '1000'));
|
|
1317
1326
|
const startProcedure = os_command_1.SystemIdentificationOsCommandStartProcedure.WAIT_FOR_HRD_STREAMING_TO_START;
|
|
1318
|
-
const targetAmplitude = parseInt(((
|
|
1319
|
-
const targetFrequency = parseInt(((
|
|
1320
|
-
const transitionTime = parseInt(((
|
|
1327
|
+
const targetAmplitude = parseInt(((_122 = req.query['target-amplitude']) !== null && _122 !== void 0 ? _122 : '300'));
|
|
1328
|
+
const targetFrequency = parseInt(((_123 = req.query['target-frequency']) !== null && _123 !== void 0 ? _123 : '10000'));
|
|
1329
|
+
const transitionTime = parseInt(((_124 = req.query['transition-time']) !== null && _124 !== void 0 ? _124 : '3000'));
|
|
1321
1330
|
const options = {
|
|
1322
1331
|
hrdStreamingDuration,
|
|
1323
1332
|
modesOfOperation,
|
|
@@ -1360,15 +1369,15 @@ app.get('/api/motion-composer/stop', asyncHandler((_req, res) => tslib_1.__await
|
|
|
1360
1369
|
res.send();
|
|
1361
1370
|
})));
|
|
1362
1371
|
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* () {
|
|
1363
|
-
var _126, _127, _128, _129, _130, _131
|
|
1364
|
-
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1365
|
-
const rw = parseInt(((
|
|
1366
|
-
const registerAddress = parseInt(((
|
|
1367
|
-
const registerLength = parseInt(((
|
|
1368
|
-
const registerWriteValue = parseInt(((
|
|
1369
|
-
const commandTimeout = parseInt(((
|
|
1370
|
-
const responsePollingInterval = parseInt(((
|
|
1371
|
-
const osCommandMode = asBoolean(((
|
|
1372
|
+
var _125, _126, _127, _128, _129, _130, _131;
|
|
1373
|
+
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1374
|
+
const rw = parseInt(((_125 = req.query['rw']) !== null && _125 !== void 0 ? _125 : '0'));
|
|
1375
|
+
const registerAddress = parseInt(((_126 = req.query['register-address']) !== null && _126 !== void 0 ? _126 : '0'));
|
|
1376
|
+
const registerLength = parseInt(((_127 = req.query['register-length']) !== null && _127 !== void 0 ? _127 : '0'));
|
|
1377
|
+
const registerWriteValue = parseInt(((_128 = req.query['register-write-value']) !== null && _128 !== void 0 ? _128 : '0'));
|
|
1378
|
+
const commandTimeout = parseInt(((_129 = req.query['command-timeout']) !== null && _129 !== void 0 ? _129 : '10000'));
|
|
1379
|
+
const responsePollingInterval = parseInt(((_130 = req.query['response-polling-interval']) !== null && _130 !== void 0 ? _130 : '1000'));
|
|
1380
|
+
const osCommandMode = asBoolean(((_131 = req.query['os-command-mode']) !== null && _131 !== void 0 ? _131 : 'false'));
|
|
1372
1381
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.runKublerEncoderRegisterCommunicationOsCommand(deviceRef, rw, registerAddress, registerLength, registerWriteValue, commandTimeout, responsePollingInterval, osCommandMode));
|
|
1373
1382
|
if (status.request === 'succeeded') {
|
|
1374
1383
|
res.send(status);
|
|
@@ -1417,28 +1426,28 @@ app.get('/api/devices/:deviceRef/factory-reset', asyncHandler((req, res) => tsli
|
|
|
1417
1426
|
}
|
|
1418
1427
|
})));
|
|
1419
1428
|
app.get('/api/devices/:deviceRef/monitoring/start', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1420
|
-
var
|
|
1429
|
+
var _132;
|
|
1421
1430
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1422
1431
|
const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
|
|
1423
1432
|
const monitoringParameterIds = yield createDefaultDataMonitoringParameterIds(deviceRef);
|
|
1424
|
-
(
|
|
1433
|
+
(_132 = dataMonitoringMap.get(device.id)) === null || _132 === void 0 ? void 0 : _132.stop();
|
|
1425
1434
|
const dataMonitoring = client.createDataMonitoring(monitoringParameterIds, 1000);
|
|
1426
1435
|
dataMonitoring.start();
|
|
1427
1436
|
dataMonitoringMap.set(device.id, dataMonitoring);
|
|
1428
1437
|
res.send();
|
|
1429
1438
|
})));
|
|
1430
1439
|
app.get('/api/devices/:deviceRef/monitoring/data', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1431
|
-
var
|
|
1440
|
+
var _133;
|
|
1432
1441
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1433
1442
|
const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
|
|
1434
1443
|
const dataMonitoring = dataMonitoringMap.get(device.id);
|
|
1435
|
-
res.type('text/csv').send((
|
|
1444
|
+
res.type('text/csv').send((_133 = dataMonitoring === null || dataMonitoring === void 0 ? void 0 : dataMonitoring.csv) !== null && _133 !== void 0 ? _133 : '');
|
|
1436
1445
|
})));
|
|
1437
1446
|
app.get('/api/devices/:deviceRef/monitoring/stop', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1438
|
-
var
|
|
1447
|
+
var _134;
|
|
1439
1448
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1440
1449
|
const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
|
|
1441
|
-
(
|
|
1450
|
+
(_134 = dataMonitoringMap.get(device.id)) === null || _134 === void 0 ? void 0 : _134.stop();
|
|
1442
1451
|
res.send();
|
|
1443
1452
|
})));
|
|
1444
1453
|
app.listen(port, () => {
|