mirror of
https://github.com/stagehacks/Cue-View.git
synced 2026-08-08 15:23:38 +00:00
add support for multiple PSN servers
This commit is contained in:
@@ -10,43 +10,50 @@ exports.config = {
|
||||
heartbeatTimeout: 15000,
|
||||
searchOptions: {
|
||||
type: 'multicast',
|
||||
address: getMulticastGroup(1),
|
||||
address: `236.10.10.10`,
|
||||
port: 56565,
|
||||
validateResponse(msg, info) {
|
||||
// TODO(jwetzell): find a way to check that this is a posistagenet message
|
||||
return true;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
exports.ready = function ready(_device) {
|
||||
console.log('posistagenet is ready');
|
||||
const device = _device;
|
||||
device.psn = new Decoder();
|
||||
|
||||
device.data = {};
|
||||
const networkInterfaces = device.getNetworkInterfaces();
|
||||
|
||||
Object.keys(networkInterfaces).forEach((networkInterfaceID) => {
|
||||
const networkInterface = networkInterfaces[networkInterfaceID];
|
||||
device.connection.addMembership(getMulticastGroup(1), networkInterface[0].address);
|
||||
device.connection.addMembership(`236.10.10.10`, networkInterface[0].address);
|
||||
});
|
||||
};
|
||||
|
||||
exports.data = function data(_device, buf) {
|
||||
exports.data = function data(_device, buf, info) {
|
||||
const device = _device;
|
||||
if (device.psn) {
|
||||
device.psn.decode(buf);
|
||||
device.data = {
|
||||
data: device.psn.data,
|
||||
info: device.psn.info,
|
||||
};
|
||||
device.draw();
|
||||
|
||||
if (!device.decoders) {
|
||||
device.decoders = {};
|
||||
}
|
||||
|
||||
if (!device.decoders[info.address]) {
|
||||
device.decoders[info.address] = new Decoder();
|
||||
}
|
||||
|
||||
device.decoders[info.address].decode(buf);
|
||||
|
||||
Object.keys(device.decoders).forEach((address) => {
|
||||
if (!device.data[address]) {
|
||||
device.data[address] = {
|
||||
data: device.decoders[address].data,
|
||||
info: device.decoders[address].info,
|
||||
};
|
||||
}
|
||||
});
|
||||
device.draw();
|
||||
};
|
||||
|
||||
exports.heartbeat = function heartbeat(device) {};
|
||||
|
||||
exports.update = function update(_device, doc, updateType, updateData) {};
|
||||
|
||||
function getMulticastGroup(universe) {
|
||||
return `236.10.10.10`;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
</header>
|
||||
|
||||
<div>
|
||||
<h2>Tracker Count: <%= Object.keys(data.data.trackers).length %></h2>
|
||||
<% Object.keys(data).forEach((address) => {
|
||||
const instanceData = data[address]
|
||||
%>
|
||||
<h2>Server: <%= instanceData.info.system_name ? instanceData.info.system_name : ''%> (<%= address %>)</h2>
|
||||
<h3>Tracker Count: <%= Object.keys(instanceData.data.trackers).length %></h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
@@ -15,43 +19,40 @@
|
||||
<th></th>
|
||||
<th colspan="3">ACCEL</th>
|
||||
<th colspan="3">TRGTPOS</th>
|
||||
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>x</th>
|
||||
<th>y</th>
|
||||
<th>z</th>
|
||||
|
||||
<th>x</th>
|
||||
<th>y</th>
|
||||
<th>z</th>
|
||||
|
||||
<th>x</th>
|
||||
<th>y</th>
|
||||
<th>z</th>
|
||||
|
||||
<th>validity</th>
|
||||
|
||||
<th>x</th>
|
||||
<th>y</th>
|
||||
<th>z</th>
|
||||
|
||||
<th>x</th>
|
||||
<th>y</th>
|
||||
<th>z</th>
|
||||
|
||||
<th>tracker_timestamp</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>x</th>
|
||||
<th>y</th>
|
||||
<th>z</th>
|
||||
|
||||
<th>x</th>
|
||||
<th>y</th>
|
||||
<th>z</th>
|
||||
|
||||
<th>x</th>
|
||||
<th>y</th>
|
||||
<th>z</th>
|
||||
|
||||
<th>validity</th>
|
||||
|
||||
<th>x</th>
|
||||
<th>y</th>
|
||||
<th>z</th>
|
||||
|
||||
<th>x</th>
|
||||
<th>y</th>
|
||||
<th>z</th>
|
||||
|
||||
<th>tracker_timestamp</th>
|
||||
</tr>
|
||||
|
||||
<% Object.entries(data.info.trackers).forEach(([trackerId,trackerInfo]) => {
|
||||
const trackerData = data.data.trackers[trackerId]
|
||||
<% Object.entries(instanceData.info.trackers).forEach(([trackerId,trackerInfo]) => {
|
||||
const trackerData = instanceData.data.trackers[trackerId]
|
||||
%>
|
||||
|
||||
<tr>
|
||||
|
||||
<tr>
|
||||
<td><%= trackerId %></td>
|
||||
<td><%= trackerInfo.name %></td>
|
||||
|
||||
@@ -84,12 +85,12 @@
|
||||
|
||||
<!-- pos -->
|
||||
<td><%= trackerData.tracker_timestamp %></td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
<% }); %>
|
||||
|
||||
</table>
|
||||
<%
|
||||
});
|
||||
%>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user