A Command Service API of a CSW component. This model provides method based APIs for command interactions with a component.

interface CommandService {
    oneway(command: ControlCommand): Promise<OnewayResponse>;
    query(runId: string): Promise<SubmitResponse>;
    queryFinal(
        runId: string,
        timeoutInSeconds: number,
    ): Promise<SubmitResponse>;
    submit(command: ControlCommand): Promise<SubmitResponse>;
    submitAllAndWait(
        commands: ControlCommand[],
        timeoutInSeconds: number,
    ): Promise<SubmitResponse[]>;
    submitAndWait(
        command: ControlCommand,
        timeoutInSeconds: number,
    ): Promise<SubmitResponse>;
    subscribeCurrentState(
        stateNames: Set<string>,
    ): (
        onStateChange: (state: CurrentState) => void,
        onError?: (error: ServiceError) => void,
        onClose?: () => void,
    ) => Subscription;
    validate(command: ControlCommand): Promise<ValidateResponse>;
}

Methods

  • This api is used to get the result of a long running command which was submitted and returns a promise of SubmitResponse.

    Parameters

    • runId: string

      The runId of the command for which response is required

    Returns Promise<SubmitResponse>

    SubmitResponse as Promise

  • This api is used to get the final result of a long running command which was submitted and returns a promise of SubmitResponse.

    Parameters

    • runId: string

      The runId of the command for which response is required

    • timeoutInSeconds: number

      time to wait for a final response

    Returns Promise<SubmitResponse>

    SubmitResponse as Promise

  • Subscribe to the current state of a component corresponding to the PekkoLocation of the component

    Parameters

    • stateNames: Set<string>

      Subscribe to the set of currentStates. If no states are provided, all the current states will be received.

    Returns (
        onStateChange: (state: CurrentState) => void,
        onError?: (error: ServiceError) => void,
        onClose?: () => void,
    ) => Subscription

    Subscription which can be used to cancel to the subscription in future.