BankActionItems()

Class used by the action controller to manage either action or release action items

new BankActionItems()

Since:
  • 2.2.0
Author:

Extends

Members

protected controller :BankActionController|BankFeedbackController

The parent controller
Inherited From:

protected dbKey :string

The database to use load/save the items
Inherited From:

debug :debug.Debugger

The debugger for this class

protected definitions :Object.<string, Array.<BankItemDefinition>>

Nested arrays for the definitions from the instances: [instance_id][item_id]
Inherited From:

protected items :Object.<number, Array.<number, Object.<number, BankItem>>>

Nested arrays containing the items in the banks: [page][bank][item] Also is the data that is stored to the DB.
Inherited From:

protected logSource :string

The module name to use in UI logs
Inherited From:

protected registry :Registry

the core registry
Inherited From:

protected system :EventEmitter

the application's event smitter
Inherited From:

Methods

addItem(page, bank, item)

Add an item to a bank
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
item string item information in form: `"instance_id:type"`
Inherited From:

addItemByClient(client, result, page, bank, item)

Add item to a bank via a client socket
Parameters:
Name Type Description
client IO.Socket the client socket sending the request
result string the name of the call to send the results back to the client
page number the bank's page
bank number the bank number
item string item information in form: `"instance_id:type"`
Inherited From:

protected bank() → {BankController}

Returns:
BankController - the core bank controller
Inherited From:

protected checkBankExists(page, bank)

Check if a bank exists and initialize it if it doesn't
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
Inherited From:

checkBankStatus(page, bank, status) → {number}

Check all the actions' instances for their status number and report the highest
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
status number incoming value to update if the value checked is higher
Returns:
number - the final status

checkInstanceStatus(id, type, checkQueuenullable) → {Array.<string, boolean>}

Scan the page/bank array to find items for an instance or just specific types and populate an array with the findings
Parameters:
Name Type Attributes Description
id string the instance ID to check for
type string the item type to check for
checkQueue Array.<string, boolean> <nullable>
array of flagged banks with keys of `[page_bank]`; empty by default but can have a populated version passed to be added to
Returns:
Array.<string, boolean> - the populated `checkQueue`
Inherited From:

protected checkStatus(page, bank, i)

Check an item's status
Parameters:
Name Type Description
page number the item's page
bank number the item's bank
i number the item's index
Inherited From:

protected db() → {Database}

Returns:
Database - the core database library
Inherited From:

deleteInstance(id, checkQueuenullable) → {Array.<string, boolean>}

Scan the page/bank array for items from an instance and delete them
Parameters:
Name Type Attributes Description
id string the instance ID to delete
checkQueue Array.<string, boolean> <nullable>
array of changed banks with keys of `[page_bank]`; empty by default but can have a populated version passed to be added to
Returns:
Array.<string, boolean> - the populated `checkQueue`
Inherited From:

deleteItem(page, bank, index)

Delete an item
Parameters:
Name Type Description
page number the item's page
bank number the item's bank
index number the item's index
Inherited From:

deleteItemByClient(client, result, page, bank, index)

Delete an item from a bank via a client socket
Parameters:
Name Type Description
client IO.Socket the client socket sending the request
result string the name of the call to send the results back to the client
page number the item's page
bank number the item's bank
index string the item's id (`item.id`)
Inherited From:

protected elgatoDM() → {DeviceController}

Returns:
DeviceController - the core device controller
Inherited From:

getAll(clone) → {Object}

Get the entire items array
Parameters:
Name Type Default Description
clone boolean false whether or not the return should be a deep clone
Returns:
Object - the array in the form `[page][bank][item]`
Inherited From:

getBank(page, bank, clone) → {Array.<BankItem>}

Get the items in a bank
Parameters:
Name Type Default Description
page number the bank's page
bank number the bank number
clone boolean false whether or not the return should be a deep clone
Returns:
Array.<BankItem> - the items array
Inherited From:

getBankByClient(client, result, page, bank)

Get the items in a bank via a client socket
Parameters:
Name Type Description
client IO.Socket the client socket sending the request
result string the name of the call to send the results back to the client
page number the bank's page
bank number the bank number
Overrides:

getInstanceItems(id, clone) → {Object}

Get all the items for a specific instance
Parameters:
Name Type Default Description
id string the instance id
clone boolean false whether or not the return should be a deep clone
Returns:
Object - the items array
Overrides:

getPage(page, clone) → {Array.<number, Array.<BankItem>>}

Get the items on a page
Parameters:
Name Type Default Description
page number the page number
clone boolean false whether or not the return should be a deep clone
Returns:
Array.<number, Array.<BankItem>> - the array in the form `[bank][item]`
Inherited From:

protected graphics() → {Graphics}

Returns:
Graphics - the core graphics controller
Inherited From:

importBank(page, bank, items)

Import and subscribe items to a bank
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
items Array.<BankItem> the items to import
Inherited From:

protected instance() → {InstanceController}

Returns:
InstanceController - the core instance controller
Inherited From:

protected io() → {InterfaceClient}

Returns:
InterfaceClient - the core interface client
Inherited From:

protected log(level, message)

Send a log message to the UI
Parameters:
Name Type Description
level string 'debug' | 'info' | 'warn' | 'error'
message atring the message to print
Inherited From:

protected page() → {PageController}

Returns:
PageController - the core page controller
Inherited From:

resetBank(page, bank)

Unsubscribe, clear a bank, and save
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
Inherited From:

save()

Flag the database to save
Inherited From:

protected schedule() → {ScheduleController}

Returns:
ScheduleController - the core schedule controller
Inherited From:

protected services() → {ServiceController}

Returns:
ServiceController - the core service controller
Inherited From:

setDefinitions(definitions)

Set a new definitions array
Parameters:
Name Type Description
definitions Array.<BankItemDefinition> the new definitions
Inherited From:

protected subscribe(item)

Find a subscribe function for an item and execute it
Parameters:
Name Type Description
item BankItem the item object
Inherited From:

subscribeBank(page, bank)

Execute subscribes for all the items in a bank
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
Inherited From:

protected unsubscribe(item)

Find an unsubscribe function for an item and execute it
Parameters:
Name Type Description
item BankItem the item object
Inherited From:

unsubscribeBank(page, bank)

Execute unsubscribes for all the items in a bank
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
Inherited From:

updateItemDelay(page, bank, item, value)

Update the delay for an item and save
Parameters:
Name Type Description
page number the item's page
bank number the item's bank
item string the item's id (`item.id`)
value number the new delay value

updateItemOption(page, bank, item, option, value)

Update an option for an item, subscribe, and save
Parameters:
Name Type Description
page number the item's page
bank number the item's bank
item string the item's id (`item.id`)
option string the option id/key
value string | Array.<string> | number | boolean the new value
Inherited From:

updateItemOrder(page, bank, oldIndex, newIndex)

Update a bank item order by swapping two keys
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
oldIndex number the moving item's index
newIndex number the other index to swap with
Inherited From:

protected userconfig() → {UserConfig}

Returns:
UserConfig - the core user config manager
Inherited From: