State

State

Class reperesenting a state on the state machine

Constructor

new State(shortName, displayName, btn, btnColor, ishazardous, isFault)

Source:
Creates a state
Parameters:
hazardous
Name Type Description
shortName String code name for the state, no spaces
displayName String Display name for the buttons and console logs, any format
btn Button (Optional) Button to assign to state if button is already made, if creating a button assign null
btnColor String Color to create state button
isHazardus Boolean If the state requires confirmation to transition to
isFault Boolean If the state is a fault state

Methods

(static) getActiveState() → {State}

Source:
Returns the active state
Returns:
The active state or -1 if there is no active state
Type
State

(static) getStateById(id) → {State}

Source:
Finds the state given the IDNumber
Parameters:
Name Type Description
id Number ID of state
Returns:
the state with specified id
Type
State

(static) setActiveState(state, modal, fromPod)

Source:
Sets the active state there should always be one active state
Parameters:
Name Type Description
state State State to set active, either State or idNumber
modal HTMLElement The confirmation Modal
fromPod Boolean If the command is from a pod packet (no confirmation needed)

(static) toggleConfirmationModal(modal)

Source:
Toggles showing/hiding a modal
Parameters:
Name Type Description
modal HTMLElement The modal to toggle

activate(modalTemplate)

Source:
Either prompts the user to confirm activation or sets active state
Parameters:
Name Type Description
modalTemplate HTMLElement The template of the modal to display

confirmActive(modalTemplate)

Source:
Displays a confirmation window before transitioning to state
Parameters:
Name Type Description
modalTemplate HTMLElement The template of the modal to display

setActive()

Source:
Sets the state as the active state

setInactive()

Source:
Sets the state as an inactive state