open_serialT_open_serialOpenSerialOpenSerialopen_serial (Operator)

Name

open_serialT_open_serialOpenSerialOpenSerialopen_serial — Open a serial device.

Signature

open_serial( : : PortName : SerialHandle)

Herror T_open_serial(const Htuple PortName, Htuple* SerialHandle)

void OpenSerial(const HTuple& PortName, HTuple* SerialHandle)

void HSerial::HSerial(const HString& PortName)

void HSerial::HSerial(const char* PortName)

void HSerial::HSerial(const wchar_t* PortName)   (Windows only)

void HSerial::OpenSerial(const HString& PortName)

void HSerial::OpenSerial(const char* PortName)

void HSerial::OpenSerial(const wchar_t* PortName)   (Windows only)

static void HOperatorSet.OpenSerial(HTuple portName, out HTuple serialHandle)

public HSerial(string portName)

void HSerial.OpenSerial(string portName)

def open_serial(port_name: str) -> HHandle

Description

open_serialopen_serialOpenSerialOpenSerialOpenSerialopen_serial opens a serial device. The name of the device is determined by the parameter PortNamePortNamePortNamePortNameportNameport_name and is operating system specific. On Windows machines, 'COM1'"COM1""COM1""COM1""COM1""COM1"-'COM4'"COM4""COM4""COM4""COM4""COM4" is typically used, while on Unix-like systems the serial devices usually are named '/dev/tty*'"/dev/tty*""/dev/tty*""/dev/tty*""/dev/tty*""/dev/tty*". The parameters of the serial device, e.g., its speed or number of data bits, are set to the system default values for the respective device after the device has been opened. They can be set or changed by calling set_serial_paramset_serial_paramSetSerialParamSetSerialParamSetSerialParamset_serial_param.

Execution Information

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters

PortNamePortNamePortNamePortNameportNameport_name (input_control)  filename HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Name of the serial port.

Default value: 'COM1' "COM1" "COM1" "COM1" "COM1" "COM1"

Suggested values: 'COM1'"COM1""COM1""COM1""COM1""COM1", 'COM2'"COM2""COM2""COM2""COM2""COM2", 'COM3'"COM3""COM3""COM3""COM3""COM3", 'COM4'"COM4""COM4""COM4""COM4""COM4", '/dev/ttya'"/dev/ttya""/dev/ttya""/dev/ttya""/dev/ttya""/dev/ttya", '/dev/ttyb'"/dev/ttyb""/dev/ttyb""/dev/ttyb""/dev/ttyb""/dev/ttyb", '/dev/tty00'"/dev/tty00""/dev/tty00""/dev/tty00""/dev/tty00""/dev/tty00", '/dev/tty01'"/dev/tty01""/dev/tty01""/dev/tty01""/dev/tty01""/dev/tty01", '/dev/ttyd1'"/dev/ttyd1""/dev/ttyd1""/dev/ttyd1""/dev/ttyd1""/dev/ttyd1", '/dev/ttyd2'"/dev/ttyd2""/dev/ttyd2""/dev/ttyd2""/dev/ttyd2""/dev/ttyd2", '/dev/cua0'"/dev/cua0""/dev/cua0""/dev/cua0""/dev/cua0""/dev/cua0", '/dev/cua1'"/dev/cua1""/dev/cua1""/dev/cua1""/dev/cua1""/dev/cua1"

SerialHandleSerialHandleSerialHandleSerialHandleserialHandleserial_handle (output_control)  serial HSerial, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Serial interface handle.

Result

If the parameters are correct and the device could be opened, the operator open_serialopen_serialOpenSerialOpenSerialOpenSerialopen_serial returns the value TRUE. Otherwise an exception is raised.

Possible Successors

set_serial_paramset_serial_paramSetSerialParamSetSerialParamSetSerialParamset_serial_param, read_serialread_serialReadSerialReadSerialReadSerialread_serial, write_serialwrite_serialWriteSerialWriteSerialWriteSerialwrite_serial, close_serialclose_serialCloseSerialCloseSerialCloseSerialclose_serial

See also

set_serial_paramset_serial_paramSetSerialParamSetSerialParamSetSerialParamset_serial_param, get_serial_paramget_serial_paramGetSerialParamGetSerialParamGetSerialParamget_serial_param, open_fileopen_fileOpenFileOpenFileOpenFileopen_file

Module

Foundation