motion-master-client 0.0.419 → 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 +80 -85
- 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,19 +1048,14 @@ 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
|
-
// The percentage is the measured phase error expressed against what the measured ring tolerates,
|
|
1060
|
-
// which differs per ring size, so resolve the limit from the device (or from the external ring
|
|
1061
|
-
// the caller named) exactly like the OBLAC Drives calibration page does.
|
|
1062
|
-
const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
|
|
1063
|
-
const maxPermissiblePhaseError = (0, circulo_1.getCirculoEncoderMaxPermissiblePhaseError)(((_77 = device.hardwareDescription) === null || _77 === void 0 ? void 0 : _77.device.serialNumber) ? device.hardwareDescription : device.serialNumber, externalEncoderType);
|
|
1058
|
+
const requestTimeout = parseInt(((_76 = req.query['request-timeout']) !== null && _76 !== void 0 ? _76 : '600000'));
|
|
1064
1059
|
const statuses = yield (0, rxjs_1.lastValueFrom)(client.request
|
|
1065
1060
|
.startCirculoEncoderNarrowAngleCalibrationProcedure(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, activateHealthMonitoring, measurementOnly, externalEncoderType }), requestTimeout)
|
|
1066
1061
|
.pipe((0, rxjs_1.toArray)()));
|
|
@@ -1068,12 +1063,12 @@ app.get('/api/devices/:deviceRef/start-circulo-encoder-narrow-angle-calibration'
|
|
|
1068
1063
|
// calibrated encoder; the earlier ones measure an encoder that is still being calibrated, so
|
|
1069
1064
|
// their percentage is not the quality of the calibration.
|
|
1070
1065
|
const result = statuses.reduce((acc, status) => {
|
|
1071
|
-
var _a, _b, _c
|
|
1072
|
-
const computed = (0, circulo_1.
|
|
1066
|
+
var _a, _b, _c;
|
|
1067
|
+
const computed = (0, circulo_1.computeCirculoEncoderCalibrationProgressResult)(status.progress);
|
|
1073
1068
|
if (computed) {
|
|
1074
1069
|
acc.push({
|
|
1075
|
-
iteration: (
|
|
1076
|
-
final: ((
|
|
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,
|
|
1077
1072
|
data: computed.data,
|
|
1078
1073
|
result: {
|
|
1079
1074
|
value: computed.value,
|
|
@@ -1099,22 +1094,22 @@ app.get('/api/devices/:deviceRef/start-circulo-encoder-narrow-angle-calibration'
|
|
|
1099
1094
|
// code (4) collides numerically with Error TIMED_OUT (4), so we omit it on a stop rather than report an
|
|
1100
1095
|
// ambiguous code — the message still explains what happened. The per-iteration robustness verdict from
|
|
1101
1096
|
// `result` is intentionally omitted too: it labels a *successful* calibration, which this was not.
|
|
1102
|
-
const failure = (
|
|
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;
|
|
1103
1098
|
res.status(500).json({
|
|
1104
|
-
code: (
|
|
1099
|
+
code: (_78 = finalStatus === null || finalStatus === void 0 ? void 0 : finalStatus.error) === null || _78 === void 0 ? void 0 : _78.code,
|
|
1105
1100
|
message: failure === null || failure === void 0 ? void 0 : failure.message,
|
|
1106
1101
|
data: result.map((iteration) => iteration.data),
|
|
1107
1102
|
});
|
|
1108
1103
|
}
|
|
1109
1104
|
})));
|
|
1110
1105
|
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
|
|
1106
|
+
var _79, _80, _81, _82;
|
|
1112
1107
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1113
1108
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
1114
|
-
const encoderOrdinal = parseInt(((
|
|
1115
|
-
const batteryModeMaxAcceleration = parseInt(((
|
|
1116
|
-
const externalCirculoType = parseInt(((
|
|
1117
|
-
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'));
|
|
1118
1113
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.startCirculoEncoderConfiguration(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, batteryModeMaxAcceleration, externalCirculoType }), requestTimeout));
|
|
1119
1114
|
if (status.request === 'succeeded') {
|
|
1120
1115
|
res.send();
|
|
@@ -1124,9 +1119,9 @@ app.get('/api/devices/:deviceRef/start-circulo-encoder-configuration', asyncHand
|
|
|
1124
1119
|
}
|
|
1125
1120
|
})));
|
|
1126
1121
|
app.get('/api/devices/:deviceRef/check-circulo-encoder-errors', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1127
|
-
var
|
|
1122
|
+
var _83;
|
|
1128
1123
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1129
|
-
const encoderOrdinal = parseInt(((
|
|
1124
|
+
const encoderOrdinal = parseInt(((_83 = req.query['encoder-ordinal']) !== null && _83 !== void 0 ? _83 : '1'));
|
|
1130
1125
|
const result = yield (0, rxjs_1.lastValueFrom)(client.request.checkCirculoEncoderErrors(deviceRef, encoderOrdinal));
|
|
1131
1126
|
res.send(result);
|
|
1132
1127
|
})));
|
|
@@ -1136,12 +1131,12 @@ app.get('/api/devices/:deviceRef/start-integro-encoder-calibration', asyncHandle
|
|
|
1136
1131
|
res.send();
|
|
1137
1132
|
})));
|
|
1138
1133
|
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
|
|
1134
|
+
var _84, _85, _86;
|
|
1140
1135
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1141
1136
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
1142
|
-
const encoderOrdinal = parseInt(((
|
|
1143
|
-
const ringRevision = parseInt(((
|
|
1144
|
-
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'));
|
|
1145
1140
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.getCirculoEncoderMagnetDistance(Object.assign(Object.assign({}, deviceRefObj), { encoderOrdinal, ringRevision }), requestTimeout));
|
|
1146
1141
|
if (status.request === 'succeeded') {
|
|
1147
1142
|
res.send({ distance: status.distance, position: status.position });
|
|
@@ -1151,7 +1146,7 @@ app.get('/api/devices/:deviceRef/circulo-encoder-magnet-distance', asyncHandler(
|
|
|
1151
1146
|
}
|
|
1152
1147
|
})));
|
|
1153
1148
|
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
|
|
1149
|
+
var _87, _88, _89, _90;
|
|
1155
1150
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1156
1151
|
const commandQuery = req.query['command'];
|
|
1157
1152
|
if (!commandQuery) {
|
|
@@ -1166,12 +1161,12 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
|
|
|
1166
1161
|
return;
|
|
1167
1162
|
}
|
|
1168
1163
|
const commandArray = new Uint8Array(command);
|
|
1169
|
-
const commandTimeout = parseInt(((
|
|
1170
|
-
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'));
|
|
1171
1166
|
const osCommandModeQuery = req.query['os-command-mode'];
|
|
1172
1167
|
const osCommandMode = osCommandModeQuery !== undefined && asBoolean(osCommandModeQuery)
|
|
1173
1168
|
? true
|
|
1174
|
-
: (
|
|
1169
|
+
: (_89 = os_command_1.OsCommandMode[osCommandModeQuery === null || osCommandModeQuery === void 0 ? void 0 : osCommandModeQuery.toUpperCase()]) !== null && _89 !== void 0 ? _89 : false;
|
|
1175
1170
|
const readFsBuffer = asBoolean(req.query['read-fs-buffer']);
|
|
1176
1171
|
const fsBufferContent = req.body;
|
|
1177
1172
|
let fsBufferContentArray = undefined;
|
|
@@ -1179,7 +1174,7 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
|
|
|
1179
1174
|
fsBufferContentArray = new Uint8Array(fsBufferContent);
|
|
1180
1175
|
}
|
|
1181
1176
|
const fsBuffer = fsBufferContentArray !== null && fsBufferContentArray !== void 0 ? fsBufferContentArray : readFsBuffer;
|
|
1182
|
-
const fsBufferReadWriteTimeout = parseInt(((
|
|
1177
|
+
const fsBufferReadWriteTimeout = parseInt(((_90 = req.query['fs-buffer-read-write-timeout']) !== null && _90 !== void 0 ? _90 : '30000'));
|
|
1183
1178
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.runOsCommand(deviceRef, commandArray, commandTimeout, responsePollingInterval, osCommandMode, fsBuffer, fsBufferReadWriteTimeout));
|
|
1184
1179
|
if (status.request === 'succeeded') {
|
|
1185
1180
|
res.send(status);
|
|
@@ -1194,10 +1189,10 @@ app.post('/api/devices/:deviceRef/run-os-command', asyncHandler((req, res) => ts
|
|
|
1194
1189
|
* @example curl -X POST "http://localhost:63526/api/devices/0/os-command/abort?command-timeout=10000&response-polling-interval=250"
|
|
1195
1190
|
*/
|
|
1196
1191
|
app.post('/api/devices/:deviceRef/os-command/abort', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1197
|
-
var
|
|
1192
|
+
var _91, _92;
|
|
1198
1193
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1199
|
-
const commandTimeout = parseInt(((
|
|
1200
|
-
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'));
|
|
1201
1196
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.abortOsCommand(deviceRef, commandTimeout, responsePollingInterval));
|
|
1202
1197
|
if (status.request === 'succeeded') {
|
|
1203
1198
|
res.send(status);
|
|
@@ -1207,10 +1202,10 @@ app.post('/api/devices/:deviceRef/os-command/abort', asyncHandler((req, res) =>
|
|
|
1207
1202
|
}
|
|
1208
1203
|
})));
|
|
1209
1204
|
app.post('/api/devices/:deviceRef/configure-smm', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1210
|
-
var _94, _95
|
|
1205
|
+
var _93, _94, _95;
|
|
1211
1206
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1212
|
-
const username = (
|
|
1213
|
-
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';
|
|
1214
1209
|
let configString;
|
|
1215
1210
|
if (Buffer.isBuffer(req.body)) {
|
|
1216
1211
|
// application/octet-stream (or express.raw)
|
|
@@ -1221,49 +1216,49 @@ app.post('/api/devices/:deviceRef/configure-smm', asyncHandler((req, res) => tsl
|
|
|
1221
1216
|
configString = req.body;
|
|
1222
1217
|
}
|
|
1223
1218
|
else {
|
|
1224
|
-
const contentType = (
|
|
1219
|
+
const contentType = (_95 = req.headers['content-type']) !== null && _95 !== void 0 ? _95 : '';
|
|
1225
1220
|
throw new Error(`Unsupported body type for configure-smm: ${typeof req.body} (Content-Type: ${contentType})`);
|
|
1226
1221
|
}
|
|
1227
1222
|
const safetyParametersReport = yield (0, rxjs_1.lastValueFrom)(client.request.configureSmmFromFile(deviceRef, username, password, configString));
|
|
1228
1223
|
res.send(safetyParametersReport);
|
|
1229
1224
|
})));
|
|
1230
1225
|
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
|
|
1226
|
+
var _96, _97, _98, _99, _100, _101, _102;
|
|
1232
1227
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1233
|
-
const username = (
|
|
1234
|
-
const password = (
|
|
1235
|
-
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);
|
|
1236
1231
|
// Validate CRC
|
|
1237
1232
|
if (Number.isNaN(crc)) {
|
|
1238
1233
|
res.status(400).send('Invalid CRC format. Expected hexadecimal string.');
|
|
1239
1234
|
return;
|
|
1240
1235
|
}
|
|
1241
1236
|
// Get optional parameters from query string
|
|
1242
|
-
const chunkSize = parseInt(((
|
|
1243
|
-
const commandTimeout = parseInt(((
|
|
1244
|
-
const responsePollingInterval = parseInt(((
|
|
1245
|
-
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'));
|
|
1246
1241
|
// Create buffer from request body
|
|
1247
1242
|
const buffer = new Uint8Array(req.body);
|
|
1248
1243
|
yield (0, rxjs_1.lastValueFrom)(client.request.updateSmmSoftware(deviceRef, username, password, buffer, crc, chunkSize, commandTimeout, responsePollingInterval, fsBufferReadWriteTimeout));
|
|
1249
1244
|
res.send();
|
|
1250
1245
|
})));
|
|
1251
1246
|
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
|
|
1247
|
+
var _103, _104, _105, _106, _107, _108, _109;
|
|
1253
1248
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1254
|
-
const username = (
|
|
1255
|
-
const password = (
|
|
1256
|
-
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);
|
|
1257
1252
|
// Validate CRC
|
|
1258
1253
|
if (Number.isNaN(crc)) {
|
|
1259
1254
|
res.status(400).send('Invalid CRC format. Expected hexadecimal string.');
|
|
1260
1255
|
return;
|
|
1261
1256
|
}
|
|
1262
1257
|
// Get optional parameters from query string
|
|
1263
|
-
const chunkSize = parseInt(((
|
|
1264
|
-
const commandTimeout = parseInt(((
|
|
1265
|
-
const responsePollingInterval = parseInt(((
|
|
1266
|
-
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'));
|
|
1267
1262
|
// Create buffer from request body
|
|
1268
1263
|
const buffer = new Uint8Array(req.body);
|
|
1269
1264
|
yield (0, rxjs_1.lastValueFrom)(client.request.updateSmmSoftwareToEncrypted(deviceRef, username, password, buffer, crc, chunkSize, commandTimeout, responsePollingInterval, fsBufferReadWriteTimeout));
|
|
@@ -1276,16 +1271,16 @@ app.get('/api/devices/:deviceRef/write-circulo-integrated-encoder-config-bin-fil
|
|
|
1276
1271
|
res.send(status);
|
|
1277
1272
|
})));
|
|
1278
1273
|
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(((
|
|
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'));
|
|
1289
1284
|
const options = {
|
|
1290
1285
|
hrdStreamingDuration,
|
|
1291
1286
|
modesOfOperation,
|
|
@@ -1306,18 +1301,18 @@ app.get('/api/devices/:deviceRef/run-chirp-signal', asyncHandler((req, res) => t
|
|
|
1306
1301
|
}
|
|
1307
1302
|
})));
|
|
1308
1303
|
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
|
|
1304
|
+
var _118, _119, _120, _121, _122, _123, _124;
|
|
1310
1305
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1311
|
-
const hrdStreamingDuration = parseInt(((
|
|
1306
|
+
const hrdStreamingDuration = parseInt(((_118 = req.query['hrd-streaming-duration']) !== null && _118 !== void 0 ? _118 : '3200'));
|
|
1312
1307
|
const modesOfOperation = cia402_1.ModesOfOperation.CYCLIC_SYNC_POSITION_MODE;
|
|
1313
|
-
const rangeLimit = parseInt(((
|
|
1314
|
-
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'));
|
|
1315
1310
|
const signalType = os_command_1.SystemIdentificationOsCommandSignalType.LINEAR_WITH_CONSTANT_AMPLITUDE;
|
|
1316
|
-
const startFrequency = parseInt(((
|
|
1311
|
+
const startFrequency = parseInt(((_121 = req.query['start-frequency']) !== null && _121 !== void 0 ? _121 : '1000'));
|
|
1317
1312
|
const startProcedure = os_command_1.SystemIdentificationOsCommandStartProcedure.WAIT_FOR_HRD_STREAMING_TO_START;
|
|
1318
|
-
const targetAmplitude = parseInt(((
|
|
1319
|
-
const targetFrequency = parseInt(((
|
|
1320
|
-
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'));
|
|
1321
1316
|
const options = {
|
|
1322
1317
|
hrdStreamingDuration,
|
|
1323
1318
|
modesOfOperation,
|
|
@@ -1360,15 +1355,15 @@ app.get('/api/motion-composer/stop', asyncHandler((_req, res) => tslib_1.__await
|
|
|
1360
1355
|
res.send();
|
|
1361
1356
|
})));
|
|
1362
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* () {
|
|
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(((
|
|
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'));
|
|
1372
1367
|
const status = yield (0, rxjs_1.lastValueFrom)(client.request.runKublerEncoderRegisterCommunicationOsCommand(deviceRef, rw, registerAddress, registerLength, registerWriteValue, commandTimeout, responsePollingInterval, osCommandMode));
|
|
1373
1368
|
if (status.request === 'succeeded') {
|
|
1374
1369
|
res.send(status);
|
|
@@ -1417,28 +1412,28 @@ app.get('/api/devices/:deviceRef/factory-reset', asyncHandler((req, res) => tsli
|
|
|
1417
1412
|
}
|
|
1418
1413
|
})));
|
|
1419
1414
|
app.get('/api/devices/:deviceRef/monitoring/start', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1420
|
-
var
|
|
1415
|
+
var _132;
|
|
1421
1416
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1422
1417
|
const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
|
|
1423
1418
|
const monitoringParameterIds = yield createDefaultDataMonitoringParameterIds(deviceRef);
|
|
1424
|
-
(
|
|
1419
|
+
(_132 = dataMonitoringMap.get(device.id)) === null || _132 === void 0 ? void 0 : _132.stop();
|
|
1425
1420
|
const dataMonitoring = client.createDataMonitoring(monitoringParameterIds, 1000);
|
|
1426
1421
|
dataMonitoring.start();
|
|
1427
1422
|
dataMonitoringMap.set(device.id, dataMonitoring);
|
|
1428
1423
|
res.send();
|
|
1429
1424
|
})));
|
|
1430
1425
|
app.get('/api/devices/:deviceRef/monitoring/data', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1431
|
-
var
|
|
1426
|
+
var _133;
|
|
1432
1427
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1433
1428
|
const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
|
|
1434
1429
|
const dataMonitoring = dataMonitoringMap.get(device.id);
|
|
1435
|
-
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 : '');
|
|
1436
1431
|
})));
|
|
1437
1432
|
app.get('/api/devices/:deviceRef/monitoring/stop', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1438
|
-
var
|
|
1433
|
+
var _134;
|
|
1439
1434
|
const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
|
|
1440
1435
|
const device = yield (0, rxjs_1.lastValueFrom)(client.request.resolveDevice(deviceRef));
|
|
1441
|
-
(
|
|
1436
|
+
(_134 = dataMonitoringMap.get(device.id)) === null || _134 === void 0 ? void 0 : _134.stop();
|
|
1442
1437
|
res.send();
|
|
1443
1438
|
})));
|
|
1444
1439
|
app.listen(port, () => {
|