Class BoardClient

A gRPC-web client for the Board component.

Implements

Constructors

Properties

callOptions: CallOptions = ...
client: PromiseClient<{
    methods: {
        doCommand: {
            I: typeof DoCommandRequest;
            O: typeof DoCommandResponse;
            kind: Unary;
            name: "DoCommand";
        };
        getDigitalInterruptValue: {
            I: typeof GetDigitalInterruptValueRequest;
            O: typeof GetDigitalInterruptValueResponse;
            kind: Unary;
            name: "GetDigitalInterruptValue";
        };
        getGPIO: {
            I: typeof GetGPIORequest;
            O: typeof GetGPIOResponse;
            kind: Unary;
            name: "GetGPIO";
        };
        getGeometries: {
            I: typeof GetGeometriesRequest;
            O: typeof GetGeometriesResponse;
            kind: Unary;
            name: "GetGeometries";
        };
        pWM: {
            I: typeof PWMRequest;
            O: typeof PWMResponse;
            kind: Unary;
            name: "PWM";
        };
        pWMFrequency: {
            I: typeof PWMFrequencyRequest;
            O: typeof PWMFrequencyResponse;
            kind: Unary;
            name: "PWMFrequency";
        };
        readAnalogReader: {
            I: typeof ReadAnalogReaderRequest;
            O: typeof ReadAnalogReaderResponse;
            kind: Unary;
            name: "ReadAnalogReader";
        };
        setGPIO: {
            I: typeof SetGPIORequest;
            O: typeof SetGPIOResponse;
            kind: Unary;
            name: "SetGPIO";
        };
        setPWM: {
            I: typeof SetPWMRequest;
            O: typeof SetPWMResponse;
            kind: Unary;
            name: "SetPWM";
        };
        setPWMFrequency: {
            I: typeof SetPWMFrequencyRequest;
            O: typeof SetPWMFrequencyResponse;
            kind: Unary;
            name: "SetPWMFrequency";
        };
        setPowerMode: {
            I: typeof SetPowerModeRequest;
            O: typeof SetPowerModeResponse;
            kind: Unary;
            name: "SetPowerMode";
        };
        streamTicks: {
            I: typeof StreamTicksRequest;
            O: typeof StreamTicksResponse;
            kind: ServerStreaming;
            name: "StreamTicks";
        };
        writeAnalog: {
            I: typeof WriteAnalogRequest;
            O: typeof WriteAnalogResponse;
            kind: Unary;
            name: "WriteAnalog";
        };
    };
    typeName: "viam.component.board.v1.BoardService";
}>

Type declaration

  • Readonly methods: {
        doCommand: {
            I: typeof DoCommandRequest;
            O: typeof DoCommandResponse;
            kind: Unary;
            name: "DoCommand";
        };
        getDigitalInterruptValue: {
            I: typeof GetDigitalInterruptValueRequest;
            O: typeof GetDigitalInterruptValueResponse;
            kind: Unary;
            name: "GetDigitalInterruptValue";
        };
        getGPIO: {
            I: typeof GetGPIORequest;
            O: typeof GetGPIOResponse;
            kind: Unary;
            name: "GetGPIO";
        };
        getGeometries: {
            I: typeof GetGeometriesRequest;
            O: typeof GetGeometriesResponse;
            kind: Unary;
            name: "GetGeometries";
        };
        pWM: {
            I: typeof PWMRequest;
            O: typeof PWMResponse;
            kind: Unary;
            name: "PWM";
        };
        pWMFrequency: {
            I: typeof PWMFrequencyRequest;
            O: typeof PWMFrequencyResponse;
            kind: Unary;
            name: "PWMFrequency";
        };
        readAnalogReader: {
            I: typeof ReadAnalogReaderRequest;
            O: typeof ReadAnalogReaderResponse;
            kind: Unary;
            name: "ReadAnalogReader";
        };
        setGPIO: {
            I: typeof SetGPIORequest;
            O: typeof SetGPIOResponse;
            kind: Unary;
            name: "SetGPIO";
        };
        setPWM: {
            I: typeof SetPWMRequest;
            O: typeof SetPWMResponse;
            kind: Unary;
            name: "SetPWM";
        };
        setPWMFrequency: {
            I: typeof SetPWMFrequencyRequest;
            O: typeof SetPWMFrequencyResponse;
            kind: Unary;
            name: "SetPWMFrequency";
        };
        setPowerMode: {
            I: typeof SetPowerModeRequest;
            O: typeof SetPowerModeResponse;
            kind: Unary;
            name: "SetPowerMode";
        };
        streamTicks: {
            I: typeof StreamTicksRequest;
            O: typeof StreamTicksResponse;
            kind: ServerStreaming;
            name: "StreamTicks";
        };
        writeAnalog: {
            I: typeof WriteAnalogRequest;
            O: typeof WriteAnalogResponse;
            kind: Unary;
            name: "WriteAnalog";
        };
    }
    • Readonly doCommand: {
          I: typeof DoCommandRequest;
          O: typeof DoCommandResponse;
          kind: Unary;
          name: "DoCommand";
      }

      DoCommand sends/receives arbitrary commands

      Generated

      from rpc viam.component.board.v1.BoardService.DoCommand

    • Readonly getDigitalInterruptValue: {
          I: typeof GetDigitalInterruptValueRequest;
          O: typeof GetDigitalInterruptValueResponse;
          kind: Unary;
          name: "GetDigitalInterruptValue";
      }

      GetDigitalInterruptValue returns the current value of the interrupt which is based on the type of interrupt.

      Generated

      from rpc viam.component.board.v1.BoardService.GetDigitalInterruptValue

    • Readonly getGPIO: {
          I: typeof GetGPIORequest;
          O: typeof GetGPIOResponse;
          kind: Unary;
          name: "GetGPIO";
      }

      GetGPIO gets the high/low state of the given pin of a board of the underlying robot.

      Generated

      from rpc viam.component.board.v1.BoardService.GetGPIO

    • Readonly getGeometries: {
          I: typeof GetGeometriesRequest;
          O: typeof GetGeometriesResponse;
          kind: Unary;
          name: "GetGeometries";
      }

      GetGeometries returns the geometries of the component in their current configuration.

      Generated

      from rpc viam.component.board.v1.BoardService.GetGeometries

    • Readonly pWM: {
          I: typeof PWMRequest;
          O: typeof PWMResponse;
          kind: Unary;
          name: "PWM";
      }

      PWM gets the duty cycle of the given pin of a board of the underlying robot.

      Generated

      from rpc viam.component.board.v1.BoardService.PWM

    • Readonly pWMFrequency: {
          I: typeof PWMFrequencyRequest;
          O: typeof PWMFrequencyResponse;
          kind: Unary;
          name: "PWMFrequency";
      }

      PWMFrequency gets the PWM frequency of the given pin of a board of the underlying robot.

      Generated

      from rpc viam.component.board.v1.BoardService.PWMFrequency

    • Readonly readAnalogReader: {
          I: typeof ReadAnalogReaderRequest;
          O: typeof ReadAnalogReaderResponse;
          kind: Unary;
          name: "ReadAnalogReader";
      }

      ReadAnalogReader reads off the current value of an analog reader of a board of the underlying robot.

      Generated

      from rpc viam.component.board.v1.BoardService.ReadAnalogReader

    • Readonly setGPIO: {
          I: typeof SetGPIORequest;
          O: typeof SetGPIOResponse;
          kind: Unary;
          name: "SetGPIO";
      }

      Generated

      from rpc viam.component.board.v1.BoardService.SetGPIO

    • Readonly setPWM: {
          I: typeof SetPWMRequest;
          O: typeof SetPWMResponse;
          kind: Unary;
          name: "SetPWM";
      }

      SetPWM sets the given pin of a board of the underlying robot to the given duty cycle.

      Generated

      from rpc viam.component.board.v1.BoardService.SetPWM

    • Readonly setPWMFrequency: {
          I: typeof SetPWMFrequencyRequest;
          O: typeof SetPWMFrequencyResponse;
          kind: Unary;
          name: "SetPWMFrequency";
      }

      SetPWMFrequency sets the given pin of a board of the underlying robot to the given PWM frequency. 0 will use the board's default PWM frequency.

      Generated

      from rpc viam.component.board.v1.BoardService.SetPWMFrequency

    • Readonly setPowerMode: {
          I: typeof SetPowerModeRequest;
          O: typeof SetPowerModeResponse;
          kind: Unary;
          name: "SetPowerMode";
      }

      SetPowerMode sets the power consumption mode of the board to the requested setting for the given duration.

      Generated

      from rpc viam.component.board.v1.BoardService.SetPowerMode

    • Readonly streamTicks: {
          I: typeof StreamTicksRequest;
          O: typeof StreamTicksResponse;
          kind: ServerStreaming;
          name: "StreamTicks";
      }

      StreamTicks starts a stream of ticks for the given digital interrupts.

      Generated

      from rpc viam.component.board.v1.BoardService.StreamTicks

    • Readonly writeAnalog: {
          I: typeof WriteAnalogRequest;
          O: typeof WriteAnalogResponse;
          kind: Unary;
          name: "WriteAnalog";
      }

      WriteAnalog writes the value to the analog writer of the board.

      Generated

      from rpc viam.component.board.v1.BoardService.WriteAnalog

  • Readonly typeName: "viam.component.board.v1.BoardService"
name: string
options: Options

Methods

  • Send/Receive arbitrary commands to the resource.

    Parameters

    • command: Struct

      The command to execute.

    • callOptions: CallOptions = ...

    Returns Promise<JsonValue>

  • Return the current value of the interrupt which is based on the type of interrupt.

    Parameters

    • digitalInterruptName: string

      The name of the digital interrupt.

    • extra: {} = {}
      • callOptions: CallOptions = ...

      Returns Promise<number>

    • Parameters

      • pin: string
      • extra: {} = {}
        • callOptions: CallOptions = ...

        Returns Promise<boolean>

      • Get the duty cycle of the given pin of a board.

        Parameters

        • pin: string

          The pin.

        • extra: {} = {}
          • callOptions: CallOptions = ...

          Returns Promise<number>

          The duty cycle, which is a value from 0 to 1.

        • Get the PWM frequency of the given pin of a board.

          Parameters

          • pin: string

            The pin.

          • extra: {} = {}
            • callOptions: CallOptions = ...

            Returns Promise<number>

          • Set the high/low state of the given pin of a board.

            Parameters

            • pin: string

              The pin.

            • high: boolean

              When true, set the given pin to high. When false, set the given pin to low.

            • extra: {} = {}
              • callOptions: CallOptions = ...

              Returns Promise<void>

            • Set the duty cycle of the given pin of a board.

              Parameters

              • pin: string

                The pin.

              • dutyCyle: number

                A value from 0 to 1.

              • extra: {} = {}
                • callOptions: CallOptions = ...

                Returns Promise<void>

              • Set the PWM frequency of the given pin of a board.

                Parameters

                • pin: string

                  The pin.

                • frequencyHz: number

                  The PWM frequency, in hertz. 0 will use the board's default PWM frequency.

                • extra: {} = {}
                  • callOptions: CallOptions = ...

                  Returns Promise<void>

                • Set power mode of the board.

                  Parameters

                  • powerMode: boardApi.PowerMode

                    The requested power mode.

                  • Optional duration: Duration

                    The requested duration to stay in power mode.

                  • extra: {} = {}
                    • callOptions: CallOptions = ...

                    Returns Promise<void>

                  • Stream digital interrupt ticks on the board.

                    Parameters

                    • interrupts: string[]

                      Names of the interrupts to stream.

                    • queue: Tick[]

                      Array to put the ticks in.

                    • extra: {} = {}
                      • callOptions: CallOptions = ...

                      Returns Promise<void>

                    • Write an analog value to a pin on the board.

                      Parameters

                      • pin: string

                        The pin name.

                      • value: number

                        An integer value to write.

                      • extra: {} = {}
                        • callOptions: CallOptions = ...

                        Returns Promise<void>

                      Generated using TypeDoc