Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CommandService

A service that runs commands based on changes in the detection status.

Hierarchy

  • CommandServiceBase
    • CommandService

Index

Constructors

constructor

Properties

Protected detection

detection: DetectionService

Detection service to monitor for changes.

Protected resources

resources: AppResources

Common application resources.

Methods

AddCommand

  • AddCommand(inputCommandType: string | Constructible<CommandTypeBase>, runConditions: RunCondition[], name: string, data?: any): Promise<Command>
  • Adds a command that will run when conditions are met to the database.

    Parameters

    • inputCommandType: string | Constructible<CommandTypeBase>

      Either the command type class constructor or the name of the class.

    • runConditions: RunCondition[]

      Conditions needed for the command to run.

    • name: string

      Friendly name of the command.

    • Optional data: any

      Arbitrary data to accompany the command.

    Returns Promise<Command>

CommandTypeFromName

  • CommandTypeFromName(name: string): Constructible<CommandTypeBase>
  • Retrieves a CommandType based on the its class-name.

    Parameters

    • name: string

      Class name of the command type to retrieve.

    Returns Constructible<CommandTypeBase>

GetCommand

  • GetCommand(id: number): Promise<Command>
  • Retrieves a command from the database by its ID.

    Parameters

    • id: number

      ID of the command to retrieve.

    Returns Promise<Command>

GetCommandTypeNames

  • GetCommandTypeNames(): string[]
  • Retrieves the class name of all available command types.

    Returns string[]

GetCommandTypes

  • GetCommandTypes(): Constructible<CommandTypeBase>[]
  • Retrieves all of the command types available. Paths to the command type should be added to the "commandTypes" config property.

    Returns Constructible<CommandTypeBase>[]

GetCommands

  • GetCommands(): Promise<Command[]>
  • Retrieves all commands from the database.

    Returns Promise<Command[]>

OnStatusChange

  • OnStatusChange(status: Status, lastStatus: Status): Promise<void>
  • Is called when a status change occurs.

    Parameters

    • status: Status

      The new status.

    • lastStatus: Status

      The status that occured immediately before it, if any.

    Returns Promise<void>

RPC_AddCommand

  • RPC_AddCommand(commandTypeName: string, runConditions: any[], name: string, data?: any): Promise<Command>
  • Is equivalent to CommandService.AddCommand execpt the elements in the facesToRecognize property of elements in the runConditions argument are face IDs instead of Face objects.

    Parameters

    • commandTypeName: string

      Class name of the command type.

    • runConditions: any[]

      Array of conditions that need to be met for the command to run

    • name: string

      Friendly name for the command.

    • Optional data: any

      Arbitrary data to accompany the command.

    Returns Promise<Command>

RPC_GetCommand

  • RPC_GetCommand(id: number): Promise<Command>
  • Retrieves a command from the database, but ensures the type returned is a string.

    Parameters

    • id: number

      ID of the command to retrieve.

    Returns Promise<Command>

RPC_GetCommands

  • RPC_GetCommands(): Promise<Command[]>
  • Retrieves all commands from the database , but ensures the types returned are strings.

    Returns Promise<Command[]>

RemoveCommand

  • RemoveCommand(id: number): Promise<void>
  • Removes a command from the database by its ID.

    Parameters

    • id: number

      ID of the command to remove

    Returns Promise<void>

RunCommand

  • RunCommand(command: Command, status: Status): Promise<any>
  • Executes a command.

    Parameters

    • command: Command

      Command to execute.

    • status: Status

      Status that caused the command to be executed.

    Returns Promise<any>

UpdateCommand

  • UpdateCommand(commandDelta: Command): Promise<Command>
  • Updates an existing command with inputted properties.

    Parameters

    • commandDelta: Command

      Properties to update the command with.

    Returns Promise<Command>

Generated using TypeDoc