Properties

config: any

The device config.

lastData: undefined | SerialPortSensorData

Returns the last data which was generated by the sensor.

name: string

The name of the device.

The device state.

type: string

The type of the device.

Accessors

  • get readTimeout(): number
  • Returns number

  • set readTimeout(value: number): void
  • Parameters

    • value: number

    Returns void

  • get writeTimeout(): number
  • Returns number

  • set writeTimeout(value: number): void
  • Parameters

    • value: number

    Returns void

Methods

  • Discards the input buffer.

    Returns void

  • Discards the output buffer.

    Returns void

  • Reads the next count bytes from the port and returns the result as an array. It is possibly that this call will return less than the provided count of bytes.

    Parameters

    • count: number

    Returns Uint8Array

  • Reads the next count bytes from the port and returns the result as an array. It is possibly that this call will return less than the provided count of bytes. Does not block the execution.

    Parameters

    • count: number

    Returns Promise<Uint8Array>

  • Reads the line from the port and returns the result as string.

    Returns string

  • Reads the line from the port and returns the result as string. Does not block the execution.

    Returns Promise<string>

  • Reads the next count bytes from the port and returns the result as string. It is possibly that this call will return less than the provided count of bytes.

    Parameters

    • count: number

    Returns string

  • Reads the next count bytes from the port and returns the result as string. It is possibly that this call will return less than the provided count of bytes. Does not block the execution.

    Parameters

    • count: number

    Returns Promise<string>

  • Returns a promise which is fulfilled when the device is started.

    Returns Promise<any>

  • Starts the device when needed and returns a promise which is fulfilled when the device is started.

    Returns Promise<any>

  • Stops the device.

    Returns void

  • Writes the data into the port.

    Parameters

    • data: Uint8Array

    Returns void

  • Writes the data and new line symbols into the port.

    Parameters

    • data: string

    Returns void

  • Writes the data into the port.

    Parameters

    • data: string

    Returns void

Events

  • Registers a callback which will be triggered when the device encounters an error.

    Parameters

    • callback: ((error: Error) => void)

      The callback which will be called once the device encountered an error.

        • (error: Error): void
        • Parameters

          • error: Error

          Returns void

    Returns EventSubscription

Generated using TypeDoc