HALCON Reference Manual 10.0.2
Table of Contents / System / Serial ClassesClassesClasses | | | Operators

open_serialopen_serialopen_serialOpenSerialOpenSerial (Operator)

Name

open_serialopen_serialopen_serialOpenSerialOpenSerial — Open a serial device.

Signature

open_serial( : : PortName : SerialHandle)

Herror open_serial(const char* PortName, Hlong* SerialHandle)

Herror T_open_serial(const Htuple PortName, Htuple* SerialHandle)

Herror open_serial(const HTuple& PortName, Hlong* SerialHandle)

void HSerial::OpenSerial(const HTuple& PortName)

void HOperatorSetX.OpenSerial(
[in] VARIANT PortName, [out] VARIANT* SerialHandle)

void HSerialX.OpenSerial([in] BSTR PortName)

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

public HSerial(string portName)

void HSerial.OpenSerial(string portName)

Description

open_serialopen_serialopen_serialOpenSerialOpenSerial opens a serial device. The name of the device is determined by the parameter PortNamePortNamePortNamePortNameportName and is operating system specific. On Windows machines, 'COM1'"COM1""COM1""COM1""COM1"-'COM4'"COM4""COM4""COM4""COM4" is typically used, while on Unix systems the serial devices usually are named '/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_paramset_serial_paramSetSerialParamSetSerialParam.

Parallelization

Parameters

PortNamePortNamePortNamePortNameportName (input_control)  filename HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Name of the serial port.

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

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

SerialHandleSerialHandleSerialHandleSerialHandleserialHandle (output_control)  serial_id HSerial, HTupleHSerial, HTupleHSerialX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Serial interface handle.

Result

If the parameters are correct and the device could be opened, the operator open_serialopen_serialopen_serialOpenSerialOpenSerial returns the value 2 (H_MSG_TRUE). Otherwise an exception is raised.

Possible Successors

set_serial_paramset_serial_paramset_serial_paramSetSerialParamSetSerialParam, read_serialread_serialread_serialReadSerialReadSerial, write_serialwrite_serialwrite_serialWriteSerialWriteSerial, close_serialclose_serialclose_serialCloseSerialCloseSerial

See also

set_serial_paramset_serial_paramset_serial_paramSetSerialParamSetSerialParam, get_serial_paramget_serial_paramget_serial_paramGetSerialParamGetSerialParam, open_fileopen_fileopen_fileOpenFileOpenFile

Module

Foundation


Table of Contents / System / Serial ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH