Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update internalAPI.js #13

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions internalAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ module.exports = {
* @access protected
* @since 1.1.0
*/
getInput(id) {

getInput(id) {

if (this.inputs[id] === undefined) {
this.inputs[id] = {
Expand Down Expand Up @@ -41,7 +42,6 @@ module.exports = {
lock: 'U'
};
}

return this.outputs[id];
},

Expand Down Expand Up @@ -188,6 +188,7 @@ module.exports = {
}
},


/**
* INTERNAL: Updates routing table based on data from the Videohub
*
Expand All @@ -196,19 +197,26 @@ module.exports = {
* @access protected
* @since 1.0.0
*/
updateRouting(labeltype, object) {
updateRouting(labeltype, object, currentRoutingTable) {

for (var key in object) {
var parsethis = object[key];
var a = parsethis.split(/ /);
var dest = parseInt(a.shift());
var src = parseInt(a.join(" "));

// Initialize currentRoutingTable if not already.
// Seems odd to do it here instead of constructor but otherwise outputCount is undefined sometimes. v1.3.0
if(currentRoutingTable.length < this.outputCount) {
currentRoutingTable.length = this.outputCount;
}

switch (labeltype) {
case 'VIDEO MONITORING OUTPUT ROUTING':
dest = dest + this.outputCount;
case 'VIDEO OUTPUT ROUTING':
this.getOutput(dest).route = src;
currentRoutingTable[dest] = src; // keep the local routing table up to date v1.3.0 jla
this.setVariable('output_' + (dest+1) + '_input', this.getInput(src).name);
break;
case 'SERIAL PORT ROUTING':
Expand Down Expand Up @@ -272,4 +280,4 @@ module.exports = {
}
}
}
}
}