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

read_serialread_serialread_serialReadSerialReadSerial (Operator)

Name

read_serialread_serialread_serialReadSerialReadSerial — Read from a serial device.

Signature

read_serial( : : SerialHandle, NumCharacters : Data)

Herror read_serial(const Hlong SerialHandle, const Hlong NumCharacters, Hlong* Data)

Herror T_read_serial(const Htuple SerialHandle, const Htuple NumCharacters, Htuple* Data)

Herror read_serial(const HTuple& SerialHandle, const HTuple& NumCharacters, Hlong* Data)

Herror read_serial(const HTuple& SerialHandle, const HTuple& NumCharacters, HTuple* Data)

HTuple HSerial::ReadSerial(const HTuple& NumCharacters) const

void HOperatorSetX.ReadSerial(
[in] VARIANT SerialHandle, [in] VARIANT NumCharacters, [out] VARIANT* Data)

VARIANT HSerialX.ReadSerial([in] Hlong NumCharacters)

static void HOperatorSet.ReadSerial(HTuple serialHandle, HTuple numCharacters, out HTuple data)

HTuple HSerial.ReadSerial(int numCharacters)

Description

read_serialread_serialread_serialReadSerialReadSerial tries to read NumCharactersNumCharactersNumCharactersNumCharactersnumCharacters from the serial device given in SerialHandleSerialHandleSerialHandleSerialHandleserialHandle. The read characters are returned in DataDataDataDatadata as a tuple of integers. This allows to read NUL characters, which would otherwise be interpreted as the end of a string. If the timeout of the serial device has been set to a value greater than 0 with set_serial_paramset_serial_paramset_serial_paramSetSerialParamSetSerialParam, read_serialread_serialread_serialReadSerialReadSerial waits at most as long for the arrival of the first character as indicated by the timeout. Otherwise, the operator returns immediately. In any case, the number of characters available at the time of return are passed back to the caller, i.e., fewer characters than requested can be returned. This can be checked by the length of the tuple DataDataDataDatadata.

Parallelization

Parameters

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

Serial interface handle.

NumCharactersNumCharactersNumCharactersNumCharactersnumCharacters (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Number of characters to read.

Default value: 1

Suggested values: 1, 2, 3, 4, 5, 10, 20, 40, 100

DataDataDataDatadata (output_control)  integer(-array) HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Read characters (as tuple of integers).

Result

If the parameters are correct and the read from the device was successful, the operator read_serialread_serialread_serialReadSerialReadSerial returns the value 2 (H_MSG_TRUE). Otherwise an exception is raised.

Possible Predecessors

open_serialopen_serialopen_serialOpenSerialOpenSerial

See also

write_serialwrite_serialwrite_serialWriteSerialWriteSerial

Module

Foundation


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