Skip to content

Commit

Permalink
feat: Let an automation system ping sisyfos, to verify connectivity s…
Browse files Browse the repository at this point in the history
…tatus.

An OSC-command "/ping/1234" will make sisyfos return "/pong" with the same value "1234"
  • Loading branch information
nytamin committed Aug 5, 2019
1 parent 9d28fcb commit b3a1a46
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/constants/AutomationPresets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ export interface IAutomationProtocol {
STATE_CHANNEL_PST: string,
STATE_CHANNEL_FADER_LEVEL: string,
STATE_FULL: string
PING: string
},
toAutomation: {
STATE_CHANNEL_PGM: string,
STATE_CHANNEL_PST: string,
STATE_CHANNEL_FADER_LEVEL: string,
STATE_FULL: string
STATE_FULL: string,
PONG: string
},
fader: {
min: number,
Expand Down Expand Up @@ -75,13 +77,15 @@ export const AutomationPresets: { [key: string]: IAutomationProtocol } = {
STATE_CHANNEL_PGM: '/state/ch/{value1}/pgm',
STATE_CHANNEL_PST: '/state/ch/{value1}/pst',
STATE_CHANNEL_FADER_LEVEL: '/state/ch/{value1}/faderlevel',
STATE_FULL: '/state/full'
STATE_FULL: '/state/full',
PING: '/ping/{value1}'
},
toAutomation: {
STATE_CHANNEL_PGM: '/state/ch/{value1}/pgm',
STATE_CHANNEL_PST: '/state/ch/{value1}/pst',
STATE_CHANNEL_FADER_LEVEL: '/state/ch/{value1}/faderlevel',
STATE_FULL: '/state/full'
STATE_FULL: '/state/full',
PONG: '/pong'
},
fader: {
min: 0,
Expand Down
11 changes: 11 additions & 0 deletions src/utils/AutomationConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ export class AutomationConnection {
"f",
info
);
} else if (this.checkOscCommand(message.address, this.automationProtocol.fromAutomation
.PING)) {
let pingValue = message.address.split("/")[2];

this.sendOutMessage(
this.automationProtocol.toAutomation.PONG,
0,
pingValue,
"s",
info
)
}
})
.on('error', (error: any) => {
Expand Down

0 comments on commit b3a1a46

Please sign in to comment.