aes70 1.5.4 → 1.5.5
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/bin/printDevice.js +24 -5
- package/package.json +1 -1
package/bin/printDevice.js
CHANGED
|
@@ -36,7 +36,24 @@ const port = parseInt(rest[1]);
|
|
|
36
36
|
|
|
37
37
|
if (!(port > 0 && port <= 0xffff)) badArguments();
|
|
38
38
|
|
|
39
|
-
function
|
|
39
|
+
function formatValue(value) {
|
|
40
|
+
if (typeof value === 'object') {
|
|
41
|
+
if (value instanceof Uint8Array) {
|
|
42
|
+
return Array.from(value);
|
|
43
|
+
} else if (value !== null && value.isEnum) {
|
|
44
|
+
return value.name;
|
|
45
|
+
} else {
|
|
46
|
+
for (const name in value) {
|
|
47
|
+
value[name] = formatValue(value[name]);
|
|
48
|
+
}
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function formatReturnValue(name, value) {
|
|
40
57
|
if (typeof value === 'object') {
|
|
41
58
|
if (value instanceof Arguments) {
|
|
42
59
|
return {
|
|
@@ -44,8 +61,8 @@ function formatPropertyValue(name, value) {
|
|
|
44
61
|
['min' + name]: value.item(1),
|
|
45
62
|
['max' + name]: value.item(2),
|
|
46
63
|
};
|
|
47
|
-
} else
|
|
48
|
-
value = value
|
|
64
|
+
} else {
|
|
65
|
+
value = formatValue(value);
|
|
49
66
|
}
|
|
50
67
|
}
|
|
51
68
|
|
|
@@ -66,6 +83,7 @@ TCPConnection.connect({
|
|
|
66
83
|
async function fetchObjectInfo(o) {
|
|
67
84
|
const info = {
|
|
68
85
|
type: o.ClassName,
|
|
86
|
+
ono: o.ObjectNumber,
|
|
69
87
|
};
|
|
70
88
|
|
|
71
89
|
const classIdentification = await o.GetClassIdentification();
|
|
@@ -75,14 +93,15 @@ async function fetchObjectInfo(o) {
|
|
|
75
93
|
await Promise.all(
|
|
76
94
|
o.get_properties().forEach(async (p) => {
|
|
77
95
|
const { name } = p;
|
|
78
|
-
if (name === 'ClassID' || name === 'ClassVersion')
|
|
96
|
+
if (name === 'ClassID' || name === 'ClassVersion' || name === 'Owner')
|
|
97
|
+
return;
|
|
79
98
|
if (o instanceof OcaBlock && name === 'Members') return;
|
|
80
99
|
const getter = p.getter(o);
|
|
81
100
|
if (!getter) return;
|
|
82
101
|
try {
|
|
83
102
|
const currentValue = await getter();
|
|
84
103
|
|
|
85
|
-
Object.assign(info,
|
|
104
|
+
Object.assign(info, formatReturnValue(name, currentValue));
|
|
86
105
|
} catch (err) {
|
|
87
106
|
if (err.status != 8)
|
|
88
107
|
console.error(
|