motion-master-client 0.0.11 → 0.0.13
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/.babelrc +3 -0
- package/.eslintrc.json +18 -0
- package/jest.config.ts +15 -0
- package/motion-master.proto +1822 -0
- package/package.json +2 -17
- package/project.json +41 -0
- package/src/lib/cia402.ts +112 -0
- package/src/lib/device-log-line.ts +5 -0
- package/src/lib/device-parameter.spec.ts +85 -0
- package/src/lib/device-parameter.ts +79 -0
- package/src/lib/device.ts +10 -0
- package/src/lib/examples/get-firmware-version-for-all-devices.ts +18 -0
- package/src/lib/hardware-description.spec.ts +253 -0
- package/src/lib/hardware-description.ts +84 -0
- package/src/lib/logger.ts +5 -0
- package/src/lib/monitoring-config.ts +6 -0
- package/src/lib/{monitoring-entry.d.ts → monitoring-entry.ts} +5 -4
- package/src/lib/motion-master-client.ts +126 -0
- package/src/lib/motion-master-pub-sub-client.ts +94 -0
- package/src/lib/motion-master-pub-sub-socket.ts +33 -0
- package/src/lib/motion-master-pub-sub-web-socket.ts +71 -0
- package/src/lib/motion-master-pub-sub-worker-socket.ts +46 -0
- package/src/lib/motion-master-req-res-client.spec.ts +740 -0
- package/src/lib/motion-master-req-res-client.ts +1974 -0
- package/src/lib/motion-master-req-res-socket.ts +55 -0
- package/src/lib/motion-master-req-res-web-socket.ts +131 -0
- package/src/lib/motion-master-req-res-worker-socket.ts +75 -0
- package/src/lib/operators.ts +93 -0
- package/src/lib/options.ts +38 -0
- package/src/lib/parameter.spec.ts +81 -0
- package/src/lib/parameter.ts +123 -0
- package/src/lib/product-id-range.ts +8 -0
- package/src/lib/request-status-resolver.ts +403 -0
- package/src/lib/system-log-line.ts +8 -0
- package/src/lib/types.ts +123 -0
- package/src/lib/urls.ts +6 -0
- package/src/lib/util.ts +267 -0
- package/tsconfig.json +23 -0
- package/tsconfig.lib.json +10 -0
- package/tsconfig.spec.json +20 -0
- package/typedoc.json +10 -0
- package/src/index.js +0 -27
- package/src/index.js.map +0 -1
- package/src/lib/cia402.d.ts +0 -30
- package/src/lib/cia402.js +0 -112
- package/src/lib/cia402.js.map +0 -1
- package/src/lib/device-log-line.d.ts +0 -5
- package/src/lib/device-log-line.js +0 -3
- package/src/lib/device-log-line.js.map +0 -1
- package/src/lib/device-parameter.d.ts +0 -56
- package/src/lib/device-parameter.js +0 -39
- package/src/lib/device-parameter.js.map +0 -1
- package/src/lib/device.d.ts +0 -9
- package/src/lib/device.js +0 -3
- package/src/lib/device.js.map +0 -1
- package/src/lib/examples/get-firmware-version-for-all-devices.d.ts +0 -1
- package/src/lib/examples/get-firmware-version-for-all-devices.js +0 -15
- package/src/lib/examples/get-firmware-version-for-all-devices.js.map +0 -1
- package/src/lib/hardware-description.d.ts +0 -37
- package/src/lib/hardware-description.js +0 -48
- package/src/lib/hardware-description.js.map +0 -1
- package/src/lib/logger.d.ts +0 -1
- package/src/lib/logger.js +0 -8
- package/src/lib/logger.js.map +0 -1
- package/src/lib/monitoring-config.d.ts +0 -6
- package/src/lib/monitoring-config.js +0 -3
- package/src/lib/monitoring-config.js.map +0 -1
- package/src/lib/monitoring-entry.js +0 -3
- package/src/lib/monitoring-entry.js.map +0 -1
- package/src/lib/motion-master-client.d.ts +0 -18
- package/src/lib/motion-master-client.js +0 -73
- package/src/lib/motion-master-client.js.map +0 -1
- package/src/lib/motion-master-pub-sub-client.d.ts +0 -16
- package/src/lib/motion-master-pub-sub-client.js +0 -68
- package/src/lib/motion-master-pub-sub-client.js.map +0 -1
- package/src/lib/motion-master-pub-sub-socket.d.ts +0 -28
- package/src/lib/motion-master-pub-sub-socket.js +0 -3
- package/src/lib/motion-master-pub-sub-socket.js.map +0 -1
- package/src/lib/motion-master-pub-sub-web-socket.d.ts +0 -13
- package/src/lib/motion-master-pub-sub-web-socket.js +0 -61
- package/src/lib/motion-master-pub-sub-web-socket.js.map +0 -1
- package/src/lib/motion-master-pub-sub-worker-socket.d.ts +0 -13
- package/src/lib/motion-master-pub-sub-worker-socket.js +0 -37
- package/src/lib/motion-master-pub-sub-worker-socket.js.map +0 -1
- package/src/lib/motion-master-req-res-client.d.ts +0 -956
- package/src/lib/motion-master-req-res-client.js +0 -1525
- package/src/lib/motion-master-req-res-client.js.map +0 -1
- package/src/lib/motion-master-req-res-socket.d.ts +0 -38
- package/src/lib/motion-master-req-res-socket.js +0 -3
- package/src/lib/motion-master-req-res-socket.js.map +0 -1
- package/src/lib/motion-master-req-res-web-socket.d.ts +0 -20
- package/src/lib/motion-master-req-res-web-socket.js +0 -100
- package/src/lib/motion-master-req-res-web-socket.js.map +0 -1
- package/src/lib/motion-master-req-res-worker-socket.d.ts +0 -15
- package/src/lib/motion-master-req-res-worker-socket.js +0 -53
- package/src/lib/motion-master-req-res-worker-socket.js.map +0 -1
- package/src/lib/operators.d.ts +0 -21
- package/src/lib/operators.js +0 -71
- package/src/lib/operators.js.map +0 -1
- package/src/lib/options.d.ts +0 -34
- package/src/lib/options.js +0 -38
- package/src/lib/options.js.map +0 -1
- package/src/lib/parameter.d.ts +0 -65
- package/src/lib/parameter.js +0 -70
- package/src/lib/parameter.js.map +0 -1
- package/src/lib/request-status-resolver.d.ts +0 -4
- package/src/lib/request-status-resolver.js +0 -345
- package/src/lib/request-status-resolver.js.map +0 -1
- package/src/lib/system-log-line.d.ts +0 -8
- package/src/lib/system-log-line.js +0 -3
- package/src/lib/system-log-line.js.map +0 -1
- package/src/lib/types.d.ts +0 -51
- package/src/lib/types.js +0 -23
- package/src/lib/types.js.map +0 -1
- package/src/lib/urls.d.ts +0 -3
- package/src/lib/urls.js +0 -10
- package/src/lib/urls.js.map +0 -1
- package/src/lib/util.d.ts +0 -30
- package/src/lib/util.js +0 -279
- package/src/lib/util.js.map +0 -1
- /package/src/{index.d.ts → index.ts} +0 -0
package/src/lib/util.ts
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { inRange } from "lodash";
|
|
2
|
+
import { DeviceLogLine } from "./device-log-line";
|
|
3
|
+
import { Parameter, ParameterIndexSubindex } from "./parameter";
|
|
4
|
+
import { SystemLogLine } from "./system-log-line";
|
|
5
|
+
import { DeviceRef, DeviceRefObj, MotionMasterMessage, ParameterAddressValue, ParameterTypeValue, ParameterTypeValueKey, ParameterValueType, ValueType } from "./types";
|
|
6
|
+
|
|
7
|
+
export function getParameterTypeValueDefault(key: ParameterTypeValueKey) {
|
|
8
|
+
if (key === 'floatValue' || key === 'intValue' || key === 'uintValue') {
|
|
9
|
+
return 0;
|
|
10
|
+
} else if (key === 'rawValue') {
|
|
11
|
+
return Uint8Array.from([]);
|
|
12
|
+
} else if (key === 'stringValue') {
|
|
13
|
+
return '';
|
|
14
|
+
} else {
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function getParameterTypeValue(parameter: MotionMasterMessage.Status.DeviceParameterValues.IParameterValue): ParameterTypeValueKey | undefined {
|
|
20
|
+
return (MotionMasterMessage.Status.DeviceParameterValues.ParameterValue.create(parameter)).typeValue;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getParameterValue(parameter: MotionMasterMessage.Status.DeviceParameterValues.IParameterValue): ParameterValueType {
|
|
24
|
+
const key = getParameterTypeValue(parameter);
|
|
25
|
+
if (key && key in parameter) {
|
|
26
|
+
return parameter[key] ?? getParameterTypeValueDefault(key);
|
|
27
|
+
}
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function makeDeviceRefObj(deviceRef: DeviceRef): DeviceRefObj {
|
|
32
|
+
if (typeof deviceRef === 'number') {
|
|
33
|
+
if (deviceRef <= 0xFFFF) {
|
|
34
|
+
return { devicePosition: deviceRef };
|
|
35
|
+
} else {
|
|
36
|
+
return { deviceAddress: deviceRef };
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
return { deviceSerialNumber: deviceRef };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function parseSystemLogLine(line: string): SystemLogLine | undefined {
|
|
44
|
+
const re = /(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d+)\s\((.*)\)\s\[(.*)\]\s(.*:\d+)\s(.*)\|(.*)$/gm;
|
|
45
|
+
const result = re.exec(line);
|
|
46
|
+
if (result) {
|
|
47
|
+
return {
|
|
48
|
+
date: new Date(result[1]),
|
|
49
|
+
uptime: result[2].trim(),
|
|
50
|
+
id: result[3].trim(),
|
|
51
|
+
file: result[4].trim(),
|
|
52
|
+
level: result[5].trim(),
|
|
53
|
+
message: result[6].trim(),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function parseSystemLogContent(content: string): SystemLogLine[] {
|
|
60
|
+
return content.split('\n')
|
|
61
|
+
.map((v) => parseSystemLogLine(v))
|
|
62
|
+
.filter((l): l is SystemLogLine => l !== undefined);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function parseDeviceLog(line: string): DeviceLogLine | undefined {
|
|
66
|
+
const re = /^(\d{2}:\d{2}:\d{2}\.\d+)\s(.*)\|(.*)$/gm;
|
|
67
|
+
const result = re.exec(line);
|
|
68
|
+
if (result) {
|
|
69
|
+
return {
|
|
70
|
+
time: result[1].trim(),
|
|
71
|
+
level: result[2].trim(),
|
|
72
|
+
message: result[3].trim(),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function parseDeviceLogContent(content: string): DeviceLogLine[] {
|
|
79
|
+
return content.split('\n')
|
|
80
|
+
.map((v) => parseDeviceLog(v))
|
|
81
|
+
.filter((l): l is DeviceLogLine => l !== undefined);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function mapParameterTypeValueToObject(type: keyof ParameterTypeValue, value: number | string): ParameterTypeValue {
|
|
85
|
+
const p: ParameterTypeValue = {};
|
|
86
|
+
if (type === 'floatValue') {
|
|
87
|
+
p['floatValue'] = typeof value === 'number' ? value : parseFloat(value);
|
|
88
|
+
} else if (type === 'intValue') {
|
|
89
|
+
p['intValue'] = typeof value === 'number' ? value : parseInt(value, 10);
|
|
90
|
+
} else if (type === 'rawValue') {
|
|
91
|
+
if (typeof value === 'number') {
|
|
92
|
+
p['rawValue'] = Uint8Array.from([value]);
|
|
93
|
+
} else {
|
|
94
|
+
let bytes: number[] = [];
|
|
95
|
+
if (value.startsWith('0x')) {
|
|
96
|
+
bytes = value.slice(2).match(/.{1,2}/g)?.map((h) => parseInt(h, 16)) ?? [];
|
|
97
|
+
} else {
|
|
98
|
+
bytes = value.split(',').map((c) => c.trim()).map((c) => parseInt(c, 10));
|
|
99
|
+
}
|
|
100
|
+
p['rawValue'] = Uint8Array.from(bytes);
|
|
101
|
+
}
|
|
102
|
+
} else if (type === 'stringValue') {
|
|
103
|
+
p['stringValue'] = typeof value === 'string' ? value : value.toString();
|
|
104
|
+
} else if (type === 'uintValue') {
|
|
105
|
+
p['uintValue'] = typeof value === 'number' ? value : parseInt(value, 10);
|
|
106
|
+
}
|
|
107
|
+
return p;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Using bytes fixes: ERROR TypeError: Cannot freeze array buffer views with elements in NgRx
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
112
|
+
export function createPlainObjectFromMotionMasterMessage(motionMasterMessage: MotionMasterMessage): any {
|
|
113
|
+
return MotionMasterMessage.toObject(motionMasterMessage, {
|
|
114
|
+
arrays: true, // populates empty arrays (repeated fields) even if defaults=false
|
|
115
|
+
bytes: Array, // bytes as array of numbers
|
|
116
|
+
defaults: true, // includes default values
|
|
117
|
+
objects: true, // populates empty objects (map fields) even if defaults=false
|
|
118
|
+
oneofs: true, // includes virtual oneof fields set to the present field's name
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function decodeTextContent(content: Uint8Array): string {
|
|
123
|
+
const decoder = new TextDecoder();
|
|
124
|
+
const buffer = Uint8Array.from(content);
|
|
125
|
+
return decoder.decode(buffer);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function isRxPdoIndex(index: number): boolean {
|
|
129
|
+
return inRange(index, 0x1600, 0x1800);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function isTxPdoIndex(index: number): boolean {
|
|
133
|
+
return inRange(index, 0x1A00, 0x1C00);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function filterRxPdoParameters<T extends ParameterIndexSubindex>(parameters: T[], excludeSubIndex000 = false): T[] {
|
|
137
|
+
return parameters.filter((p) => isRxPdoIndex(p.index) && (excludeSubIndex000 ? p.subindex > 0 : true)); // RxPDOs: Index area 0x1600 to 0x17FF
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function filterTxPdoParameters<T extends ParameterIndexSubindex>(parameters: T[], excludeSubIndex000 = false): T[] {
|
|
141
|
+
return parameters.filter((p) => isTxPdoIndex(p.index) && (excludeSubIndex000 ? p.subindex > 0 : true)); // TxPDOs: Index area 0x1A00 to 0x1BFF
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function fillPdoParametersWithMappingEntries(parameters: Parameter[], entriesPerPdo = 10): Parameter[] {
|
|
145
|
+
const output: Parameter[] = [];
|
|
146
|
+
let i = 0;
|
|
147
|
+
while (i < parameters.length) {
|
|
148
|
+
if (parameters[i].subindex === 0) {
|
|
149
|
+
let j = i;
|
|
150
|
+
while (parameters[j] && (parameters[j].index === parameters[i].index)) {
|
|
151
|
+
output.push(parameters[j]);
|
|
152
|
+
j++;
|
|
153
|
+
}
|
|
154
|
+
let d = j - i;
|
|
155
|
+
while (d <= entriesPerPdo) {
|
|
156
|
+
output.push({
|
|
157
|
+
index: parameters[i].index,
|
|
158
|
+
subindex: d,
|
|
159
|
+
name: parameters[i].name,
|
|
160
|
+
uintValue: 0,
|
|
161
|
+
value: 0,
|
|
162
|
+
valueType: ValueType.UNSIGNED32,
|
|
163
|
+
group: parameters[i].group,
|
|
164
|
+
typeValue: "uintValue",
|
|
165
|
+
readAccess: true,
|
|
166
|
+
writeAccess: true,
|
|
167
|
+
});
|
|
168
|
+
d++;
|
|
169
|
+
}
|
|
170
|
+
i = j;
|
|
171
|
+
} else {
|
|
172
|
+
i++;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return output;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function mapParameterToPdoSubItemValue(parameter: Parameter): number {
|
|
179
|
+
const { index, subindex } = parameter;
|
|
180
|
+
if (parameter.valueType && parameter.valueType < ValueType.VISIBLE_STRING) {
|
|
181
|
+
const buffer = new ArrayBuffer(4);
|
|
182
|
+
const view = new DataView(buffer);
|
|
183
|
+
const bitSize = mapValueTypeToBitSize(parameter.valueType);
|
|
184
|
+
view.setUint16(0, index);
|
|
185
|
+
view.setUint8(2, subindex);
|
|
186
|
+
view.setUint8(3, bitSize);
|
|
187
|
+
return view.getUint32(0);
|
|
188
|
+
}
|
|
189
|
+
return 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export function mapValueTypeToBitSize(valueType: ValueType): number {
|
|
193
|
+
switch (valueType) {
|
|
194
|
+
case ValueType.UNSPECIFIED:
|
|
195
|
+
return 0;
|
|
196
|
+
case ValueType.BOOLEAN:
|
|
197
|
+
return 1;
|
|
198
|
+
case ValueType.INTEGER8:
|
|
199
|
+
case ValueType.UNSIGNED8:
|
|
200
|
+
return 8;
|
|
201
|
+
case ValueType.INTEGER16:
|
|
202
|
+
case ValueType.UNSIGNED16:
|
|
203
|
+
return 16;
|
|
204
|
+
case ValueType.INTEGER32:
|
|
205
|
+
case ValueType.UNSIGNED32:
|
|
206
|
+
case ValueType.REAL32:
|
|
207
|
+
return 32;
|
|
208
|
+
}
|
|
209
|
+
throw new Error(`Non-numeric value type "${valueType}" (data types with variable length) cannot be mapped to bit size. You will have to get this info from ESI.`);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export const valueTypeToParameterTypeValueKeyMap = new Map<ValueType, keyof Required<ParameterTypeValue>>([
|
|
213
|
+
[ValueType.BOOLEAN, 'uintValue'],
|
|
214
|
+
[ValueType.INTEGER8, 'intValue'],
|
|
215
|
+
[ValueType.INTEGER16, 'intValue'],
|
|
216
|
+
[ValueType.INTEGER32, 'intValue'],
|
|
217
|
+
[ValueType.UNSIGNED8, 'uintValue'],
|
|
218
|
+
[ValueType.UNSIGNED16, 'uintValue'],
|
|
219
|
+
[ValueType.UNSIGNED32, 'uintValue'],
|
|
220
|
+
[ValueType.REAL32, 'floatValue'],
|
|
221
|
+
[ValueType.VISIBLE_STRING, 'stringValue'],
|
|
222
|
+
[ValueType.OCTET_STRING, 'stringValue'],
|
|
223
|
+
[ValueType.UNICODE_STRING, 'stringValue'],
|
|
224
|
+
]);
|
|
225
|
+
|
|
226
|
+
export function isValidDeviceRefObj(obj: DeviceRefObj): boolean {
|
|
227
|
+
return Number.isFinite(Number(obj.deviceAddress))
|
|
228
|
+
|| (typeof obj.devicePosition === 'number' && obj.devicePosition >= 0)
|
|
229
|
+
|| typeof obj.deviceSerialNumber === 'string';
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export function createPdoParameterValues(parameters: Array<{ index: number, subindex: number, typeValue?: ParameterTypeValueKey }>, values: Array<ParameterValueType>) {
|
|
233
|
+
const output = parameters.map((parameter, i, arr) => {
|
|
234
|
+
const { index, subindex, typeValue } = parameter;
|
|
235
|
+
let value = values[i];
|
|
236
|
+
if (subindex === 0) {
|
|
237
|
+
value = arr.reduce((n, p, j) => (p.index === index && p.subindex > 0 && values[j]) ? n + 1 : n, 0);
|
|
238
|
+
}
|
|
239
|
+
return [index, subindex, value, typeValue];
|
|
240
|
+
}) as ParameterAddressValue[];
|
|
241
|
+
|
|
242
|
+
for (let i = 0; i < output.length - 1; i++) {
|
|
243
|
+
const [, subindex1, value1] = output[i];
|
|
244
|
+
if (subindex1 > 0 && value1 === 0) {
|
|
245
|
+
let j = i + 1;
|
|
246
|
+
let [, subindex2, value2] = output[j];
|
|
247
|
+
while (subindex2 > subindex1 && output[j]) {
|
|
248
|
+
if (value2 > 0) {
|
|
249
|
+
output[i][2] = value2;
|
|
250
|
+
output[j][2] = 0;
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
if (output[++j]) {
|
|
254
|
+
[, subindex2, value2] = output[j];
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return output;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export function resolveAfter(ms: number, value?: unknown) {
|
|
264
|
+
return new Promise(function (resolve) {
|
|
265
|
+
setTimeout(resolve.bind(null, value), ms);
|
|
266
|
+
});
|
|
267
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"forceConsistentCasingInFileNames": true,
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noImplicitOverride": true,
|
|
8
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
9
|
+
"noImplicitReturns": true,
|
|
10
|
+
"noFallthroughCasesInSwitch": true,
|
|
11
|
+
"allowJs": true
|
|
12
|
+
},
|
|
13
|
+
"files": [],
|
|
14
|
+
"include": [],
|
|
15
|
+
"references": [
|
|
16
|
+
{
|
|
17
|
+
"path": "./tsconfig.lib.json"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"path": "./tsconfig.spec.json"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"types": ["jest", "node"]
|
|
7
|
+
},
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*.test.ts",
|
|
10
|
+
"**/*.spec.ts",
|
|
11
|
+
"**/*.test.tsx",
|
|
12
|
+
"**/*.spec.tsx",
|
|
13
|
+
"**/*.test.js",
|
|
14
|
+
"**/*.spec.js",
|
|
15
|
+
"**/*.test.jsx",
|
|
16
|
+
"**/*.spec.jsx",
|
|
17
|
+
"**/*.d.ts",
|
|
18
|
+
"jest.config.ts"
|
|
19
|
+
]
|
|
20
|
+
}
|
package/typedoc.json
ADDED
package/src/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./lib/cia402"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./lib/device-log-line"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./lib/device-parameter"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./lib/hardware-description"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./lib/monitoring-config"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./lib/monitoring-entry"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./lib/motion-master-client"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./lib/motion-master-pub-sub-client"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./lib/motion-master-pub-sub-socket"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./lib/motion-master-pub-sub-web-socket"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./lib/motion-master-pub-sub-worker-socket"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./lib/motion-master-req-res-client"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./lib/motion-master-req-res-socket"), exports);
|
|
17
|
-
tslib_1.__exportStar(require("./lib/motion-master-req-res-web-socket"), exports);
|
|
18
|
-
tslib_1.__exportStar(require("./lib/motion-master-req-res-worker-socket"), exports);
|
|
19
|
-
tslib_1.__exportStar(require("./lib/operators"), exports);
|
|
20
|
-
tslib_1.__exportStar(require("./lib/options"), exports);
|
|
21
|
-
tslib_1.__exportStar(require("./lib/parameter"), exports);
|
|
22
|
-
tslib_1.__exportStar(require("./lib/request-status-resolver"), exports);
|
|
23
|
-
tslib_1.__exportStar(require("./lib/system-log-line"), exports);
|
|
24
|
-
tslib_1.__exportStar(require("./lib/types"), exports);
|
|
25
|
-
tslib_1.__exportStar(require("./lib/urls"), exports);
|
|
26
|
-
tslib_1.__exportStar(require("./lib/util"), exports);
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/motion-master-client/src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,gEAAsC;AACtC,iEAAuC;AACvC,qEAA2C;AAC3C,kEAAwC;AACxC,iEAAuC;AACvC,qEAA2C;AAC3C,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,0DAAgC;AAChC,wDAA8B;AAC9B,0DAAgC;AAChC,wEAA8C;AAC9C,gEAAsC;AACtC,sDAA4B;AAC5B,qDAA2B;AAC3B,qDAA2B"}
|
package/src/lib/cia402.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export declare enum CiA402State {
|
|
2
|
-
NOT_READY_TO_SWITCH_ON = 0,
|
|
3
|
-
SWITCH_ON_DISABLED = 1,
|
|
4
|
-
READY_TO_SWITCH_ON = 2,
|
|
5
|
-
SWITCHED_ON = 3,
|
|
6
|
-
OPERATION_ENABLED = 4,
|
|
7
|
-
QUICK_STOP_ACTIVE = 5,
|
|
8
|
-
FAULT_REACTION_ACTIVE = 6,
|
|
9
|
-
FAULT = 7
|
|
10
|
-
}
|
|
11
|
-
export declare const cia402StateLabels: string[];
|
|
12
|
-
export declare const statuswordToCia402StateMap: Map<number, CiA402State>;
|
|
13
|
-
export declare function getCia402StateFromStatusword(statusword: number): CiA402State | undefined;
|
|
14
|
-
export declare function isInternalLimitActive(statusword: number): boolean;
|
|
15
|
-
export declare enum ModesOfOperation {
|
|
16
|
-
OPEN_LOOP_FIELD_MODE = -3,
|
|
17
|
-
DIAGNOSTICS_MODE = -2,
|
|
18
|
-
COGGING_COMPENSATION_RECORDING_MODE = -1,
|
|
19
|
-
NO_MODE_ASSIGNED = 0,
|
|
20
|
-
PROFILE_POSITION_MODE = 1,
|
|
21
|
-
PROFILE_VELOCITY_MODE = 3,
|
|
22
|
-
TORQUE_PROFILE_MODE = 4,
|
|
23
|
-
HOMING_MODE = 6,
|
|
24
|
-
CYCLIC_SYNC_POSITION_MODE = 8,
|
|
25
|
-
CYCLIC_SYNC_VELOCITY_MODE = 9,
|
|
26
|
-
CYCLIC_SYNC_TORQUE_MODE = 10
|
|
27
|
-
}
|
|
28
|
-
export declare const controlwordBits: string[];
|
|
29
|
-
export declare const statuswordBits: string[];
|
|
30
|
-
export declare const supportedDriveModesBits: string[];
|
package/src/lib/cia402.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.supportedDriveModesBits = exports.statuswordBits = exports.controlwordBits = exports.ModesOfOperation = exports.isInternalLimitActive = exports.getCia402StateFromStatusword = exports.statuswordToCia402StateMap = exports.cia402StateLabels = exports.CiA402State = void 0;
|
|
4
|
-
var CiA402State;
|
|
5
|
-
(function (CiA402State) {
|
|
6
|
-
CiA402State[CiA402State["NOT_READY_TO_SWITCH_ON"] = 0] = "NOT_READY_TO_SWITCH_ON";
|
|
7
|
-
CiA402State[CiA402State["SWITCH_ON_DISABLED"] = 1] = "SWITCH_ON_DISABLED";
|
|
8
|
-
CiA402State[CiA402State["READY_TO_SWITCH_ON"] = 2] = "READY_TO_SWITCH_ON";
|
|
9
|
-
CiA402State[CiA402State["SWITCHED_ON"] = 3] = "SWITCHED_ON";
|
|
10
|
-
CiA402State[CiA402State["OPERATION_ENABLED"] = 4] = "OPERATION_ENABLED";
|
|
11
|
-
CiA402State[CiA402State["QUICK_STOP_ACTIVE"] = 5] = "QUICK_STOP_ACTIVE";
|
|
12
|
-
CiA402State[CiA402State["FAULT_REACTION_ACTIVE"] = 6] = "FAULT_REACTION_ACTIVE";
|
|
13
|
-
CiA402State[CiA402State["FAULT"] = 7] = "FAULT";
|
|
14
|
-
})(CiA402State = exports.CiA402State || (exports.CiA402State = {}));
|
|
15
|
-
exports.cia402StateLabels = [
|
|
16
|
-
'NOT READY TO SWITCH ON',
|
|
17
|
-
'SWITCH ON DISABLED',
|
|
18
|
-
'READY TO SWITCH ON',
|
|
19
|
-
'SWITCHED ON',
|
|
20
|
-
'OPERATION ENABLED',
|
|
21
|
-
'QUICK STOP ACTIVE',
|
|
22
|
-
'FAULT REACTION ACTIVE',
|
|
23
|
-
'FAULT',
|
|
24
|
-
];
|
|
25
|
-
exports.statuswordToCia402StateMap = new Map([
|
|
26
|
-
[0b00000000, CiA402State.NOT_READY_TO_SWITCH_ON],
|
|
27
|
-
[0b01000000, CiA402State.SWITCH_ON_DISABLED],
|
|
28
|
-
[0b00100001, CiA402State.READY_TO_SWITCH_ON],
|
|
29
|
-
[0b00100011, CiA402State.SWITCHED_ON],
|
|
30
|
-
[0b00100111, CiA402State.OPERATION_ENABLED],
|
|
31
|
-
[0b00000111, CiA402State.QUICK_STOP_ACTIVE],
|
|
32
|
-
[0b00001111, CiA402State.FAULT_REACTION_ACTIVE],
|
|
33
|
-
[0b00001000, CiA402State.FAULT],
|
|
34
|
-
]);
|
|
35
|
-
function getCia402StateFromStatusword(statusword) {
|
|
36
|
-
return exports.statuswordToCia402StateMap.get(statusword & 0b01101111)
|
|
37
|
-
|| exports.statuswordToCia402StateMap.get(statusword & 0b01001111);
|
|
38
|
-
}
|
|
39
|
-
exports.getCia402StateFromStatusword = getCia402StateFromStatusword;
|
|
40
|
-
function isInternalLimitActive(statusword) {
|
|
41
|
-
return (0x800 & statusword) === 0x800;
|
|
42
|
-
}
|
|
43
|
-
exports.isInternalLimitActive = isInternalLimitActive;
|
|
44
|
-
var ModesOfOperation;
|
|
45
|
-
(function (ModesOfOperation) {
|
|
46
|
-
ModesOfOperation[ModesOfOperation["OPEN_LOOP_FIELD_MODE"] = -3] = "OPEN_LOOP_FIELD_MODE";
|
|
47
|
-
ModesOfOperation[ModesOfOperation["DIAGNOSTICS_MODE"] = -2] = "DIAGNOSTICS_MODE";
|
|
48
|
-
ModesOfOperation[ModesOfOperation["COGGING_COMPENSATION_RECORDING_MODE"] = -1] = "COGGING_COMPENSATION_RECORDING_MODE";
|
|
49
|
-
ModesOfOperation[ModesOfOperation["NO_MODE_ASSIGNED"] = 0] = "NO_MODE_ASSIGNED";
|
|
50
|
-
ModesOfOperation[ModesOfOperation["PROFILE_POSITION_MODE"] = 1] = "PROFILE_POSITION_MODE";
|
|
51
|
-
ModesOfOperation[ModesOfOperation["PROFILE_VELOCITY_MODE"] = 3] = "PROFILE_VELOCITY_MODE";
|
|
52
|
-
ModesOfOperation[ModesOfOperation["TORQUE_PROFILE_MODE"] = 4] = "TORQUE_PROFILE_MODE";
|
|
53
|
-
ModesOfOperation[ModesOfOperation["HOMING_MODE"] = 6] = "HOMING_MODE";
|
|
54
|
-
ModesOfOperation[ModesOfOperation["CYCLIC_SYNC_POSITION_MODE"] = 8] = "CYCLIC_SYNC_POSITION_MODE";
|
|
55
|
-
ModesOfOperation[ModesOfOperation["CYCLIC_SYNC_VELOCITY_MODE"] = 9] = "CYCLIC_SYNC_VELOCITY_MODE";
|
|
56
|
-
ModesOfOperation[ModesOfOperation["CYCLIC_SYNC_TORQUE_MODE"] = 10] = "CYCLIC_SYNC_TORQUE_MODE";
|
|
57
|
-
})(ModesOfOperation = exports.ModesOfOperation || (exports.ModesOfOperation = {}));
|
|
58
|
-
exports.controlwordBits = [
|
|
59
|
-
'so = switch on',
|
|
60
|
-
'ev = enable voltage',
|
|
61
|
-
'qs = quick stop',
|
|
62
|
-
'eo = enable operation',
|
|
63
|
-
'oms = operation mode specific',
|
|
64
|
-
'oms = operation mode specific',
|
|
65
|
-
'oms = operation mode specific',
|
|
66
|
-
'fr = fault reset',
|
|
67
|
-
'h = halt',
|
|
68
|
-
'oms = operation mode specific',
|
|
69
|
-
'r = reserved',
|
|
70
|
-
'ms = manufacturer-specific',
|
|
71
|
-
'ms = manufacturer-specific',
|
|
72
|
-
'ms = manufacturer-specific',
|
|
73
|
-
'ms = manufacturer-specific',
|
|
74
|
-
'ms = manufacturer-specific',
|
|
75
|
-
];
|
|
76
|
-
exports.statuswordBits = [
|
|
77
|
-
'rtso = ready to switch on',
|
|
78
|
-
'so = switched on',
|
|
79
|
-
'oe = operation enabled',
|
|
80
|
-
'f = fault',
|
|
81
|
-
've = voltage enabled',
|
|
82
|
-
'qs = quick stop',
|
|
83
|
-
'sod = switch on disabled',
|
|
84
|
-
'w = warning',
|
|
85
|
-
'ms = manufacturer-specific',
|
|
86
|
-
'rm = remote',
|
|
87
|
-
'tr = target reached',
|
|
88
|
-
'ila = internal limit active',
|
|
89
|
-
'oms = operation-mode-specific',
|
|
90
|
-
'oms = operation-mode-specific',
|
|
91
|
-
'ms = manufacturer-specific',
|
|
92
|
-
'ms = manufacturer-specific',
|
|
93
|
-
];
|
|
94
|
-
exports.supportedDriveModesBits = [
|
|
95
|
-
'pp = profile position mode',
|
|
96
|
-
'vl = velocity mode',
|
|
97
|
-
'pv = profile velocity mode',
|
|
98
|
-
'tq = torque mode',
|
|
99
|
-
'r = reserved',
|
|
100
|
-
'hm = homing mode',
|
|
101
|
-
'ip = interpolated position mode',
|
|
102
|
-
'csp = cyclic synchronous position mode',
|
|
103
|
-
'csv = cyclic synchronous velocity mode',
|
|
104
|
-
'cst = cyclic synchronous torque mode',
|
|
105
|
-
'r = reserved',
|
|
106
|
-
'r = reserved',
|
|
107
|
-
'r = reserved',
|
|
108
|
-
'r = reserved',
|
|
109
|
-
'r = reserved',
|
|
110
|
-
'r = reserved',
|
|
111
|
-
];
|
|
112
|
-
//# sourceMappingURL=cia402.js.map
|
package/src/lib/cia402.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cia402.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/cia402.ts"],"names":[],"mappings":";;;AAAA,IAAY,WASX;AATD,WAAY,WAAW;IACrB,iFAAsB,CAAA;IACtB,yEAAkB,CAAA;IAClB,yEAAkB,CAAA;IAClB,2DAAW,CAAA;IACX,uEAAiB,CAAA;IACjB,uEAAiB,CAAA;IACjB,+EAAqB,CAAA;IACrB,+CAAK,CAAA;AACP,CAAC,EATW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAStB;AAEY,QAAA,iBAAiB,GAAG;IAC/B,wBAAwB;IACxB,oBAAoB;IACpB,oBAAoB;IACpB,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,uBAAuB;IACvB,OAAO;CACR,CAAC;AAEW,QAAA,0BAA0B,GAAG,IAAI,GAAG,CAAC;IAChD,CAAC,UAAU,EAAE,WAAW,CAAC,sBAAsB,CAAC;IAChD,CAAC,UAAU,EAAE,WAAW,CAAC,kBAAkB,CAAC;IAC5C,CAAC,UAAU,EAAE,WAAW,CAAC,kBAAkB,CAAC;IAC5C,CAAC,UAAU,EAAE,WAAW,CAAC,WAAW,CAAC;IACrC,CAAC,UAAU,EAAE,WAAW,CAAC,iBAAiB,CAAC;IAC3C,CAAC,UAAU,EAAE,WAAW,CAAC,iBAAiB,CAAC;IAC3C,CAAC,UAAU,EAAE,WAAW,CAAC,qBAAqB,CAAC;IAC/C,CAAC,UAAU,EAAE,WAAW,CAAC,KAAK,CAAC;CAChC,CAAC,CAAC;AAEH,SAAgB,4BAA4B,CAAC,UAAkB;IAC7D,OAAO,kCAA0B,CAAC,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC;WACzD,kCAA0B,CAAC,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC;AAC/D,CAAC;AAHD,oEAGC;AAED,SAAgB,qBAAqB,CAAC,UAAkB;IACtD,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,KAAK,CAAC;AACxC,CAAC;AAFD,sDAEC;AAED,IAAY,gBAYX;AAZD,WAAY,gBAAgB;IAC1B,wFAAyB,CAAA;IACzB,gFAAqB,CAAA;IACrB,sHAAwC,CAAA;IACxC,+EAAoB,CAAA;IACpB,yFAAyB,CAAA;IACzB,yFAAyB,CAAA;IACzB,qFAAuB,CAAA;IACvB,qEAAe,CAAA;IACf,iGAA6B,CAAA;IAC7B,iGAA6B,CAAA;IAC7B,8FAA4B,CAAA;AAC9B,CAAC,EAZW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAY3B;AAEY,QAAA,eAAe,GAAG;IAC7B,gBAAgB;IAChB,qBAAqB;IACrB,iBAAiB;IACjB,uBAAuB;IACvB,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,kBAAkB;IAClB,UAAU;IACV,+BAA+B;IAC/B,cAAc;IACd,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;CAC7B,CAAC;AAEW,QAAA,cAAc,GAAG;IAC5B,2BAA2B;IAC3B,kBAAkB;IAClB,wBAAwB;IACxB,WAAW;IACX,sBAAsB;IACtB,iBAAiB;IACjB,0BAA0B;IAC1B,aAAa;IACb,4BAA4B;IAC5B,aAAa;IACb,qBAAqB;IACrB,6BAA6B;IAC7B,+BAA+B;IAC/B,+BAA+B;IAC/B,4BAA4B;IAC5B,4BAA4B;CAC7B,CAAC;AAEW,QAAA,uBAAuB,GAAG;IACrC,4BAA4B;IAC5B,oBAAoB;IACpB,4BAA4B;IAC5B,kBAAkB;IAClB,cAAc;IACd,kBAAkB;IAClB,iCAAiC;IACjC,wCAAwC;IACxC,wCAAwC;IACxC,sCAAsC;IACtC,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;CACf,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"device-log-line.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/device-log-line.ts"],"names":[],"mappings":""}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Parameter } from "./parameter";
|
|
2
|
-
export interface DeviceParameter extends Parameter {
|
|
3
|
-
id: string;
|
|
4
|
-
flags?: {
|
|
5
|
-
access?: 'ro' | 'rw' | 'wo';
|
|
6
|
-
category?: 'm' | 'o' | 'c';
|
|
7
|
-
pdoMapping?: 't' | 'r' | 'tr';
|
|
8
|
-
safetyMapping?: 'si' | 'so' | 'sio' | 'sp';
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Make device parameter id by providing a device serial number and tuple of index and subindex.
|
|
13
|
-
*
|
|
14
|
-
* @param serialNumber - device serial number from the hardware description file
|
|
15
|
-
* @param tuple - an array of index and subindex
|
|
16
|
-
* @throws {Error} if index or subindex are less than 0
|
|
17
|
-
* @returns combined index and subindex in uppercase hexadecimal format, e.g. "0x60FE:02"
|
|
18
|
-
*/
|
|
19
|
-
export declare function makeDeviceParameterId(serialNumber: string, tuple: [(number | null | undefined), (number | null | undefined)]): string;
|
|
20
|
-
/**
|
|
21
|
-
* Make device parameter id by providing a device serial number and object which has index and subindex properties.
|
|
22
|
-
*
|
|
23
|
-
* @param serialNumber - device serial number from the hardware description file
|
|
24
|
-
* @param parameter - an object with optional index and subindex properties
|
|
25
|
-
* @throws {Error} if index or subindex are less than 0
|
|
26
|
-
* @returns combined index and subindex in uppercase hexadecimal format, e.g. "0x60FE:02"
|
|
27
|
-
*/
|
|
28
|
-
export declare function makeDeviceParameterId(serialNumber: string, parameter: {
|
|
29
|
-
index?: (number | null);
|
|
30
|
-
subindex?: (number | null);
|
|
31
|
-
}): string;
|
|
32
|
-
/**
|
|
33
|
-
* Make parameter id by providing a device serial number and index and subindex.
|
|
34
|
-
*
|
|
35
|
-
* @param serialNumber - device serial number from the hardware description file
|
|
36
|
-
* @param index - from 0x0000 to 0xFFFF for objects defined in ESI and >0xFFFF for custom object
|
|
37
|
-
* @param subindex - defaults to 0 if not provided
|
|
38
|
-
* @throws {Error} if index or subindex are less than 0
|
|
39
|
-
* @returns combined index and subindex in uppercase hexadecimal format, e.g. "0x60FE:02"
|
|
40
|
-
*/
|
|
41
|
-
export declare function makeDeviceParameterId(serialNumber: string, index?: (number | null), subindex?: (number | null)): string;
|
|
42
|
-
/**
|
|
43
|
-
* Example of device parameter id is "0x2110:1A.8502-03-0001353-2115" where:
|
|
44
|
-
* - 0x2110 is object index in hexadecimal format
|
|
45
|
-
* - 1A is subindex in hexadecimal format
|
|
46
|
-
* - 8502-03-0001353-2115 is device serial number from hardware description file
|
|
47
|
-
*/
|
|
48
|
-
export declare const deviceParameterIdRegExp: RegExp;
|
|
49
|
-
/**
|
|
50
|
-
* Split device parameter id into parts.
|
|
51
|
-
*
|
|
52
|
-
* @param id - device parameter id like "0x2110:1A.8502-03-0001353-2115"
|
|
53
|
-
* @returns tuple of device serial number, index, and subindex
|
|
54
|
-
*/
|
|
55
|
-
export declare function splitDeviceParameterId(id: string): [string, number, number];
|
|
56
|
-
export declare function isDeviceParameterId(id: string): boolean;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isDeviceParameterId = exports.splitDeviceParameterId = exports.deviceParameterIdRegExp = exports.makeDeviceParameterId = void 0;
|
|
4
|
-
const parameter_1 = require("./parameter");
|
|
5
|
-
function makeDeviceParameterId(serialNumber, a, b) {
|
|
6
|
-
const parameterId = (0, parameter_1.makeParameterId)(a, b);
|
|
7
|
-
return `${parameterId}.${serialNumber}`;
|
|
8
|
-
}
|
|
9
|
-
exports.makeDeviceParameterId = makeDeviceParameterId;
|
|
10
|
-
/**
|
|
11
|
-
* Example of device parameter id is "0x2110:1A.8502-03-0001353-2115" where:
|
|
12
|
-
* - 0x2110 is object index in hexadecimal format
|
|
13
|
-
* - 1A is subindex in hexadecimal format
|
|
14
|
-
* - 8502-03-0001353-2115 is device serial number from hardware description file
|
|
15
|
-
*/
|
|
16
|
-
exports.deviceParameterIdRegExp = /^0x([0-9a-fA-F]{4,}):([0-9a-fA-F]{2})\.([\d-]+)$/;
|
|
17
|
-
/**
|
|
18
|
-
* Split device parameter id into parts.
|
|
19
|
-
*
|
|
20
|
-
* @param id - device parameter id like "0x2110:1A.8502-03-0001353-2115"
|
|
21
|
-
* @returns tuple of device serial number, index, and subindex
|
|
22
|
-
*/
|
|
23
|
-
function splitDeviceParameterId(id) {
|
|
24
|
-
const match = id.match(exports.deviceParameterIdRegExp);
|
|
25
|
-
if (!match) {
|
|
26
|
-
throw new Error(`Device parameter id "${id}" doesn't match the regular expression: ${exports.deviceParameterIdRegExp}`);
|
|
27
|
-
}
|
|
28
|
-
return [
|
|
29
|
-
match[3],
|
|
30
|
-
parseInt(match[1], 16),
|
|
31
|
-
parseInt(match[2], 16), // subindex
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
exports.splitDeviceParameterId = splitDeviceParameterId;
|
|
35
|
-
function isDeviceParameterId(id) {
|
|
36
|
-
return exports.deviceParameterIdRegExp.test(id);
|
|
37
|
-
}
|
|
38
|
-
exports.isDeviceParameterId = isDeviceParameterId;
|
|
39
|
-
//# sourceMappingURL=device-parameter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"device-parameter.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/device-parameter.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;AA2CzD,SAAgB,qBAAqB,CAAC,YAAoB,EAAE,CAA0I,EAAE,CAAmB;IACzN,MAAM,WAAW,GAAG,IAAA,2BAAe,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1C,OAAO,GAAG,WAAW,IAAI,YAAY,EAAE,CAAC;AAC1C,CAAC;AAHD,sDAGC;AAED;;;;;GAKG;AACU,QAAA,uBAAuB,GAAG,kDAAkD,CAAC;AAE1F;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,EAAU;IAC/C,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,+BAAuB,CAAC,CAAC;IAEhD,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,wBAAwB,EAAE,2CAA2C,+BAAuB,EAAE,CAAC,CAAC;KACjH;IAED,OAAO;QACL,KAAK,CAAC,CAAC,CAAC;QACR,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACtB,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,WAAW;KACpC,CAAC;AACJ,CAAC;AAZD,wDAYC;AAED,SAAgB,mBAAmB,CAAC,EAAU;IAC5C,OAAO,+BAAuB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC;AAFD,kDAEC"}
|
package/src/lib/device.d.ts
DELETED
package/src/lib/device.js
DELETED
package/src/lib/device.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/device.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|