Options
All
  • Public
  • Public/Protected
  • All
Menu

It represents a serial port resource at the client side.

Hierarchy

  • SerialComm

Index

Constructors

constructor

  • Creates an instance of the SerialComm class wiht the specified information.

    Parameters

    • portName: string

      The serial port name, for example COM1.

    • baudRate: number

      The serial port baud rate in bits per second.

    • parity: Parity

      The serial port parity-checking protocol.

    • stopBits: StopBits

      The serial port standard number of stopbits per byte.

    • dataBits: DataBits

      The serial port standard length of data bits per byte.

    • flowControl: Handshake

      The handshaking protocol for serial port transmission of data.

    Returns SerialComm

Accessors

baudRate

baudRate:

Gets or sets the serial port baud rate in bits per second. Default value is 9600

dataBits

dataBits:

Gets or sets the serial port standard length of data bits per byte. Default value is Serial.DataBits.Eight

flowControl

flowControl:

Gets or sets the handshaking protocol for serial port transmission of data. Default value is Serial.Handshake.XOnXOff

isOpen

isOpen:

parity

parity:

Gets or sets the serial port parity-checking protocol. Default value is Serial.Parity.None

portName

portName:

Gets or sets the serial port name, for example COM1. Default value is "COM1"

stopBits

stopBits:

Gets or sets the serial port standard number of stopbits per byte. Default value is Serial.StopBits.One

Methods

close

  • close(): void
  • Closes the port connection

    Returns void

onClose

  • onClose(data: any): void
  • Occurs when communication is close.

    Parameters

    • data: any

      The callback function

    Returns void

onDataReceived

  • onDataReceived(data: any): void
  • Occurs when data is received.

    Parameters

    • data: any

      The callback function

    Returns void

onError

  • onError(data: any, critical: any): void
  • Occurs when an error is thrown.

    Parameters

    • data: any

      The callback function

    • critical: any

    Returns void

open

  • open(): Promise<Object>
  • Opens a new serial port connection

    Returns Promise<Object>

propertiesJSON

  • propertiesJSON(): object
  • Returns object

    • type: string

send

  • send(utf8string: string): void
  • Sends the specified string to the serial port.

    Parameters

    • utf8string: string

      The string to send to the serial port.

    Returns void