## COMPort(port, baud, bits, parity, stop, flow, addropt, irqopt)

Constructor

#### # new COMPort(port, baud, bits, parity, stop, flow, addropt, irqopt)

open a COM port.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`port` | number |  | one of COM.PORT: COM1, COM2, COM3, COM4.
`baud` | number |  | one of COM.BAUD: B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400, B4800, B9600, B19200, B38400, B57600, B115200
`bits` | number |  | one of COM.BIT: BITS_5, BITS_6, BITS_7, BITS_8
`parity` | number |  | one of COM.PARITY: NO_PARITY, ODD_PARITY, EVEN_PARITY, MARK_PARITY, SPACE_PARITY
`stop` | number |  | one of COM.STOP: STOP_1, STOP_2
`flow` | number |  | one of COM.FLOW: NO_CONTROL, XON_XOFF, RTS_CTS
`addr` | number | <optional> | optional: port io address
`irq` | number | <optional> | optional: port IRQ

View Source doc/classes.js, line 400

# Methods

#### # Close()

close port.

View Source doc/classes.js, line 404

#### # FlushInput()

flush input buffer.

View Source doc/classes.js, line 408

#### # FlushOutput()

flush output buffer.

View Source doc/classes.js, line 412

#### # IsInputEmpty() → {boolean}

check state of receive buffer.

View Source doc/classes.js, line 427

Returns:
true if the input buffer is empty.
Type: boolean

#### # IsInputFull() → {boolean}

check state of receive buffer.

View Source doc/classes.js, line 432

Returns:
true if the input buffer is full.
Type: boolean

#### # IsOutputEmpty() → {boolean}

check state of send buffer.

View Source doc/classes.js, line 417

Returns:
true if the output buffer is empty.
Type: boolean

#### # IsOutputFull() → {boolean}

check state of send buffer.

View Source doc/classes.js, line 422

Returns:
true if the output buffer is full.
Type: boolean

#### # ReadBuffer() → {string}

read a string from the receive buffer.

View Source doc/classes.js, line 452

Returns:
contents of the received buffer.
Type: string

#### # ReadByte() → {number}

read a byte from COM port

View Source doc/classes.js, line 447

Returns:
the value of the byte.
Type: number

#### # WriteByte(ch)

Write a single byte to COM port.

##### Parameters:

Name | Type | Description
--- | --- | ---
`ch` | number | the byte to write.

View Source doc/classes.js, line 437

#### # WriteString(txt)

Write a string to COM port.

##### Parameters:

Name | Type | Description
--- | --- | ---
`txt` | string | the string to write.

View Source doc/classes.js, line 442