Skip to content

Commit

Permalink
fix(InputPropertiesCommand): include the inputId of each source in th…
Browse files Browse the repository at this point in the history
…e state tree
  • Loading branch information
Alex Van Camp committed Apr 30, 2018
1 parent 2199e5c commit 3fdabba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/commands/Inputs/InputPropertiesCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class InputPropertiesCommand extends AbstractCommand {
}

this.properties = {
inputId: rawCommand.readUInt16BE(0),
longName: Util.bufToNullTerminatedString(rawCommand, 2, 20),
shortName: Util.bufToNullTerminatedString(rawCommand, 22, 4),
externalPorts: externalPorts.length > 0 ? externalPorts : null,
Expand All @@ -63,6 +64,9 @@ export class InputPropertiesCommand extends AbstractCommand {
}

applyToState (state: AtemState) {
// @TODO(Lange - 04/30/2018): We may need something to clean up inputs which
// don't exist anymore, which can happen when switching the connection from
// one model of ATEM to another.

This comment has been minimized.

Copy link
@Julusian

Julusian May 1, 2018

Member

When reconnecting, should the whole state not be thrown away? It will be rebuilt exactly the same upon reconnection if connecting back to the same device. It would create a risk of the user trying to use the temporarily incomplete state, but this can be resolved as we know when the initial state building is complete (InCm is received)

If not, then there are various other things that will need cleaning too. Essentially anything where the count is defined in one of https://github.com/LibAtem/LibAtem.DeviceProfile/tree/master/LibAtem.DeviceProfile/Profiles

state.inputs[this.inputId] = {
...this.properties
}
Expand Down
1 change: 1 addition & 0 deletions src/state/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from '../enums'

export interface InputChannel {
readonly inputId: number,
longName: string
shortName: string
isExternal: boolean
Expand Down

0 comments on commit 3fdabba

Please sign in to comment.