Skip to content

Commit

Permalink
feat: set button step over tcp/udp #1520
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Aug 13, 2023
1 parent dfe848c commit 9596be5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/Service/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,20 @@ class ServiceApi extends CoreBase {
}
})

this.#router.addPath('bank-step :page(\\d+) :bank(\\d+) :step(\\d+)', (match) => {
const controlId = CreateBankControlId(parseInt(match.page), parseInt(match.bank))
const step = parseInt(match.step)

this.logger.info(`Got bank-step (trigger) ${controlId} ${step}`)

if (isNaN(step) || step <= 0) throw new ApiMessageError('Step out of range')

const control = this.controls.getControl(controlId)
if (!control || typeof control.stepMakeCurrent !== 'function') throw new ApiMessageError('Invalid control')

if (!control.stepMakeCurrent(step)) throw new ApiMessageError('Step out of range')
})

this.#router.addPath('style bank :page(\\d+) :bank(\\d+) text{ :text}?', (match) => {
const controlId = CreateBankControlId(parseInt(match.page), parseInt(match.bank))

Expand Down

0 comments on commit 9596be5

Please sign in to comment.