aes70 1.5.5 → 1.6.0
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 +25 -165
- package/dist/AES70.es5.js +1 -1
- package/package.json +3 -2
- package/src/controller/ControlClasses/OcaDeviceManager.d.ts +5 -5
- package/src/controller/ControlClasses/OcaDeviceManager.js +3 -3
- package/src/controller/ControlClasses/OcaFilterPolynomial.js +26 -2
- package/src/controller/ControlClasses/OcaPhysicalPosition.d.ts +4 -4
- package/src/controller/ControlClasses/OcaPhysicalPosition.js +2 -2
- package/src/controller/PropertyObserver.js +115 -0
- package/src/controller/arguments.js +4 -0
- package/src/controller/client_connection.js +9 -4
- package/src/controller/fetch_device_content.d.ts +5 -0
- package/src/controller/fetch_device_content.js +146 -0
- package/src/controller/observeProperty.js +129 -0
- package/src/controller/property.js +55 -1
- package/src/controller/remote_device.d.ts +5 -0
- package/src/controller/remote_device.js +11 -1
- package/src/controller/remote_error.d.ts +13 -0
- package/src/controller/remote_error.js +4 -8
- package/src/index.default.d.ts +2 -0
- package/src/index.default.js +4 -0
- package/src/types/OcaMediaSinkConnectorChangedEventData.d.ts +5 -8
- package/src/types/OcaMediaSinkConnectorChangedEventData.js +1 -1
- package/src/types/OcaMediaSourceConnectorChangedEventData.d.ts +5 -8
- package/src/types/OcaMediaSourceConnectorChangedEventData.js +1 -1
- package/src/types/OcaPositionDescriptor.d.ts +5 -8
- package/src/types/OcaPositionDescriptor.js +1 -1
- package/src/OCP1/IEncoder.d.ts +0 -26
package/bin/printDevice.js
CHANGED
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
import { argv, exit } from 'process';
|
|
4
4
|
import { RemoteDevice } from '../src/controller/remote_device.js';
|
|
5
5
|
import { TCPConnection } from '../src/controller/tcp_connection.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { UDPConnection } from '../src/controller/udp_connection.js';
|
|
7
|
+
import { fetchDeviceContent } from '../src/controller/fetch_device_content.js';
|
|
8
8
|
|
|
9
9
|
function badArguments() {
|
|
10
|
-
console.log('Usage: node print_tree.js [--json] <ip> <port>');
|
|
10
|
+
console.log('Usage: node print_tree.js [--json] [--udp] <ip> <port>');
|
|
11
11
|
exit(1);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
let jsonMode = false;
|
|
15
|
+
let useUdp = false;
|
|
15
16
|
const rest = [];
|
|
16
17
|
|
|
17
18
|
argv.slice(2).forEach((option) => {
|
|
@@ -23,6 +24,9 @@ argv.slice(2).forEach((option) => {
|
|
|
23
24
|
case '--help':
|
|
24
25
|
badArguments();
|
|
25
26
|
break;
|
|
27
|
+
case '--udp':
|
|
28
|
+
useUdp = true;
|
|
29
|
+
break;
|
|
26
30
|
default:
|
|
27
31
|
rest.push(option);
|
|
28
32
|
break;
|
|
@@ -36,42 +40,9 @@ const port = parseInt(rest[1]);
|
|
|
36
40
|
|
|
37
41
|
if (!(port > 0 && port <= 0xffff)) badArguments();
|
|
38
42
|
|
|
39
|
-
|
|
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) {
|
|
57
|
-
if (typeof value === 'object') {
|
|
58
|
-
if (value instanceof Arguments) {
|
|
59
|
-
return {
|
|
60
|
-
[name]: value.item(0),
|
|
61
|
-
['min' + name]: value.item(1),
|
|
62
|
-
['max' + name]: value.item(2),
|
|
63
|
-
};
|
|
64
|
-
} else {
|
|
65
|
-
value = formatValue(value);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
[name]: value,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
43
|
+
const Connection = useUdp ? UDPConnection : TCPConnection;
|
|
73
44
|
|
|
74
|
-
|
|
45
|
+
Connection.connect({
|
|
75
46
|
host: host,
|
|
76
47
|
port: port,
|
|
77
48
|
})
|
|
@@ -80,150 +51,39 @@ TCPConnection.connect({
|
|
|
80
51
|
})
|
|
81
52
|
.then(printDevice);
|
|
82
53
|
|
|
83
|
-
async function
|
|
84
|
-
const info = {
|
|
85
|
-
type: o.ClassName,
|
|
86
|
-
ono: o.ObjectNumber,
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const classIdentification = await o.GetClassIdentification();
|
|
90
|
-
|
|
91
|
-
Object.assign(info, classIdentification);
|
|
92
|
-
|
|
93
|
-
await Promise.all(
|
|
94
|
-
o.get_properties().forEach(async (p) => {
|
|
95
|
-
const { name } = p;
|
|
96
|
-
if (name === 'ClassID' || name === 'ClassVersion' || name === 'Owner')
|
|
97
|
-
return;
|
|
98
|
-
if (o instanceof OcaBlock && name === 'Members') return;
|
|
99
|
-
const getter = p.getter(o);
|
|
100
|
-
if (!getter) return;
|
|
101
|
-
try {
|
|
102
|
-
const currentValue = await getter();
|
|
103
|
-
|
|
104
|
-
Object.assign(info, formatReturnValue(name, currentValue));
|
|
105
|
-
} catch (err) {
|
|
106
|
-
if (err.status != 8)
|
|
107
|
-
console.error(
|
|
108
|
-
'Fetching property',
|
|
109
|
-
o.ClassName,
|
|
110
|
-
p.name,
|
|
111
|
-
'failed:',
|
|
112
|
-
err
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
return info;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
async function printTree(objects, prefix) {
|
|
54
|
+
async function printTree(content, prefix) {
|
|
122
55
|
if (!prefix) prefix = [];
|
|
123
56
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const o = objects[i];
|
|
128
|
-
|
|
129
|
-
if (Array.isArray(o)) {
|
|
130
|
-
await printTree(o, lastPath);
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const roleName = await o.GetRole();
|
|
135
|
-
|
|
136
|
-
const path = prefix.concat([roleName]);
|
|
137
|
-
|
|
138
|
-
lastPath = path;
|
|
57
|
+
for (const info of content) {
|
|
58
|
+
const { Role, type, Members, ...Rest } = info;
|
|
59
|
+
const path = prefix.concat([Role]);
|
|
139
60
|
|
|
140
61
|
console.log('Path: %s', path.join('/'));
|
|
141
62
|
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
for (const name in info) {
|
|
145
|
-
console.log(' %s: %O ', name, info[name]);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
async function managerExists(manager) {
|
|
151
|
-
try {
|
|
152
|
-
await manager.GetClassIdentification();
|
|
153
|
-
return true;
|
|
154
|
-
} catch (err) {
|
|
155
|
-
if (err.status != 5) {
|
|
156
|
-
throw err;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return false;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
async function generateJson(objects) {
|
|
164
|
-
const result = [];
|
|
165
|
-
|
|
166
|
-
for (let i = 0; i < objects.length; i++) {
|
|
167
|
-
const o = objects[i];
|
|
168
|
-
|
|
169
|
-
if (Array.isArray(o)) {
|
|
170
|
-
await printTreeJson(o, lastPath);
|
|
171
|
-
continue;
|
|
63
|
+
for (const name in Rest) {
|
|
64
|
+
console.log(' %s: %O ', name, Rest[name]);
|
|
172
65
|
}
|
|
173
66
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (o instanceof OcaBlock) {
|
|
177
|
-
const members = objects[i + 1];
|
|
178
|
-
if (!Array.isArray(members)) {
|
|
179
|
-
throw new Error('Member missing for OcaBlock.');
|
|
180
|
-
}
|
|
181
|
-
info.Members = await generateJson(members);
|
|
182
|
-
i++;
|
|
67
|
+
if (Members) {
|
|
68
|
+
printTree(Members, path);
|
|
183
69
|
}
|
|
184
|
-
|
|
185
|
-
result.push(info);
|
|
186
70
|
}
|
|
187
|
-
|
|
188
|
-
return result;
|
|
189
71
|
}
|
|
190
72
|
|
|
191
|
-
|
|
192
|
-
console.log(JSON.stringify(
|
|
73
|
+
function printTreeJson(content) {
|
|
74
|
+
console.log(JSON.stringify(content, undefined, 2));
|
|
193
75
|
}
|
|
194
76
|
|
|
195
77
|
async function printDevice(device) {
|
|
196
|
-
const print = jsonMode ? printTreeJson : printTree;
|
|
197
78
|
try {
|
|
198
|
-
const
|
|
199
|
-
const managers = [
|
|
200
|
-
device.DeviceManager,
|
|
201
|
-
device.SecurityManager,
|
|
202
|
-
device.FirmwareManager,
|
|
203
|
-
device.SubscriptionManager,
|
|
204
|
-
device.PowerManager,
|
|
205
|
-
device.NetworkManager,
|
|
206
|
-
device.MediaClockManager,
|
|
207
|
-
device.LibraryManager,
|
|
208
|
-
device.AudioProcessingManager,
|
|
209
|
-
device.DeviceTimeManager,
|
|
210
|
-
device.TaskManager,
|
|
211
|
-
device.CodingManager,
|
|
212
|
-
device.DiagnosticManager,
|
|
213
|
-
];
|
|
214
|
-
|
|
215
|
-
for (const manager of managers) {
|
|
216
|
-
if (await managerExists(manager)) objects.push(manager);
|
|
217
|
-
}
|
|
79
|
+
const content = await fetchDeviceContent(device);
|
|
218
80
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
} catch (error) {
|
|
222
|
-
if (error.status) {
|
|
223
|
-
console.error('Failure: %s', error.status);
|
|
81
|
+
if (jsonMode) {
|
|
82
|
+
printTreeJson(content);
|
|
224
83
|
} else {
|
|
225
|
-
|
|
84
|
+
printTree(content);
|
|
226
85
|
}
|
|
227
|
-
|
|
86
|
+
} finally {
|
|
87
|
+
device.close();
|
|
228
88
|
}
|
|
229
89
|
}
|