bool Open(string, string, int, HandShake, bool, Parity, int, StopBits)
Opens a serial port for the specified device.
Parameters
Name | Description |
devName |
string The name of the device in the Configuration Tool. |
portName |
(Optional) string The port to open. This defaults to "COM1". |
baudRate |
(Optional) int The baud rate. This defaults to 9600. |
handshake |
(Optional) HandShake
Specifies the control protocol used in establishing a serial port communication for a System.IO.Ports.SerialPort object. This defaults to Handshake.None. |
rtsDtr |
(Optional) bool Specifies whether the Data Terminal Ready and Request to Send signals are enabled. This defaults to false. |
parity |
(Optional) Parity
Specifies the Parity bit. This defaults to Parity.None. |
dataBits |
(Optional) int Specifies the standard length of data bits per cycle. This defaults to 8. |
stopBits |
(Optional) StopBits
Specifies the standard length of stop bits per cycle. This defaults to StopBits.One. |
Return
True if the port is successfully opened; False otherwise.
Remarks
Information such as baud rate, hand shake, parity, and stop bits should match the device specifications.
The Configuration Tool will allow the user to provide a name for the device and provide a description. This name will be used for all communication between KioWare and the device. It is mandatory to use the identical string when calling into this method.
Examples
//The name of the device will be user defined in the Configuration Tool.
var devName = "rawserialdevice";
if(!KioRawSerialDevice.IsOpen(devName))
{
if(!KioRawSerialDevice.Open(devName)) console.log(devName + " failed to open.");
}
Requirements
KioWare for Windows version 8.11 or greater.