mirror of
https://github.com/stagehacks/Cue-View.git
synced 2026-08-25 23:28:59 +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`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user