ClassesClassesClassesClasses | | | | Operators

open_io_deviceT_open_io_deviceOpenIoDeviceopen_io_deviceOpenIoDeviceOpenIoDevice (Operator)

Name

open_io_deviceT_open_io_deviceOpenIoDeviceopen_io_deviceOpenIoDeviceOpenIoDevice — Open and configure an I/O device.

Signature

open_io_device( : : IOInterfaceName, IODeviceName, GenParamName, GenParamValue : IODeviceHandle)

Herror T_open_io_device(const Htuple IOInterfaceName, const Htuple IODeviceName, const Htuple GenParamName, const Htuple GenParamValue, Htuple* IODeviceHandle)

Herror open_io_device(const HTuple& IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue, Hlong* IODeviceHandle)

void HIODevice::OpenIoDevice(const HTuple& IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue)

void OpenIoDevice(const HTuple& IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* IODeviceHandle)

void HIODevice::HIODevice(const HString& IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue)

void HIODevice::HIODevice(const char* IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue)

void HIODevice::OpenIoDevice(const HString& IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue)

void HIODevice::OpenIoDevice(const char* IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue)

void HOperatorSetX.OpenIoDevice(
[in] VARIANT IOInterfaceName, [in] VARIANT IODeviceName, [in] VARIANT GenParamName, [in] VARIANT GenParamValue, [out] VARIANT* IODeviceHandle)

void HIODeviceX.OpenIoDevice(
[in] BSTR IOInterfaceName, [in] VARIANT IODeviceName, [in] VARIANT GenParamName, [in] VARIANT GenParamValue)

static void HOperatorSet.OpenIoDevice(HTuple IOInterfaceName, HTuple IODeviceName, HTuple genParamName, HTuple genParamValue, out HTuple IODeviceHandle)

public HIODevice(string IOInterfaceName, HTuple IODeviceName, HTuple genParamName, HTuple genParamValue)

void HIODevice.OpenIoDevice(string IOInterfaceName, HTuple IODeviceName, HTuple genParamName, HTuple genParamValue)

Description

The operator open_io_deviceopen_io_deviceOpenIoDeviceopen_io_deviceOpenIoDeviceOpenIoDevice opens and configures the chosen I/O device interface for the specific device. The device interface is specified by the base name of the underlying library and passed to IOInterfaceNameIOInterfaceNameIOInterfaceNameIOInterfaceNameIOInterfaceNameIOInterfaceName. The interface library will be loaded dynamically when configuring the first specific device for this device interface. The specific device itself is addressed by a name passed to IODeviceNameIODeviceNameIODeviceNameIODeviceNameIODeviceNameIODeviceName. Available names can be queried by query_io_interfacequery_io_interfaceQueryIoInterfacequery_io_interfaceQueryIoInterfaceQueryIoInterface. The device can be configured by the parameters GenParamNameGenParamNameGenParamNameGenParamNameGenParamNamegenParamName and GenParamValueGenParamValueGenParamValueGenParamValueGenParamValuegenParamValue. A reference to the device instance is returned in IODeviceHandleIODeviceHandleIODeviceHandleIODeviceHandleIODeviceHandleIODeviceHandle. If the instance of the device is not needed any more, it should be released and closed via the operator close_io_deviceclose_io_deviceCloseIoDeviceclose_io_deviceCloseIoDeviceCloseIoDevice.

Having opened a specific device, a transmission channel can be opened by calling open_io_channelopen_io_channelOpenIoChannelopen_io_channelOpenIoChannelOpenIoChannel. Values on the I/O channel can be read and written by the operators read_io_channelread_io_channelReadIoChannelread_io_channelReadIoChannelReadIoChannel and write_io_channelwrite_io_channelWriteIoChannelwrite_io_channelWriteIoChannelWriteIoChannel on an opened transmission channel, afterwards.

An opened device instance can be reconfigured by using the operators set_io_device_paramset_io_device_paramSetIoDeviceParamset_io_device_paramSetIoDeviceParamSetIoDeviceParam and get_io_device_paramget_io_device_paramGetIoDeviceParamget_io_device_paramGetIoDeviceParamGetIoDeviceParam.

Please check the directory 'doc/html/reference/io'"doc/html/reference/io""doc/html/reference/io""doc/html/reference/io""doc/html/reference/io""doc/html/reference/io" for documentation about your specific I/O device interface, where all supported device specific parameters are listed.

Attention

On Windows Systems, error dialog boxes from the operating system can occur when dependency modules of the interface are not found, e.g., the according SDK was not installed. The occurrence of the error boxes can be controlled by setting Windows' Error Mode. Please refer to the description of SetErrorMode within the Windows MSDN documentation.

Parallelization

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

IOInterfaceNameIOInterfaceNameIOInterfaceNameIOInterfaceNameIOInterfaceNameIOInterfaceName (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

HALCON I/O interface name.

Default value: []

Suggested values: 'Advantech'"Advantech""Advantech""Advantech""Advantech""Advantech", 'Contec'"Contec""Contec""Contec""Contec""Contec", 'Interface'"Interface""Interface""Interface""Interface""Interface", 'NIDAQmx'"NIDAQmx""NIDAQmx""NIDAQmx""NIDAQmx""NIDAQmx", 'OPC_Classic'"OPC_Classic""OPC_Classic""OPC_Classic""OPC_Classic""OPC_Classic", 'OPC_UA'"OPC_UA""OPC_UA""OPC_UA""OPC_UA""OPC_UA"

IODeviceNameIODeviceNameIODeviceNameIODeviceNameIODeviceNameIODeviceName (input_control)  tuple HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

I/O device name.

Default value: []

GenParamNameGenParamNameGenParamNameGenParamNameGenParamNamegenParamName (input_control)  string-array HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Dynamic parameter names.

Default value: []

GenParamValueGenParamValueGenParamValueGenParamValueGenParamValuegenParamValue (input_control)  string-array HTupleHTupleHTupleVARIANTHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double) (BSTR / Hlong / double) (char* / Hlong / double)

Dynamic parameter values.

Default value: []

IODeviceHandleIODeviceHandleIODeviceHandleIODeviceHandleIODeviceHandleIODeviceHandle (output_control)  io_device HIODevice, HTupleHTupleHIODevice, HTupleHIODeviceX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Handle of the opened I/O device.

Example (HDevelop)

* Select a suitable i/o device interface of name IOInterfaceName
query_io_interface (IOInterfaceName, 'io_device_names', DeviceNames)
open_io_device (IOInterfaceName, DeviceNames[0], [], [], IODeviceHandle)
query_io_device (IODeviceHandle, [], 'io_channel_names.digital_input', ChannelInputNames)
open_io_channel (IODeviceHandle, ChannelInputNames[0], [], [], IOChannelHandle)
read_io_channel (IOChannelHandle, Value, Status)

Result

If the parameters are valid, the operator open_io_deviceopen_io_deviceOpenIoDeviceopen_io_deviceOpenIoDeviceOpenIoDevice returns the value 2 (H_MSG_TRUE). If necessary an exception is raised. In this case, an extended error information may be set and can be queried with the operator get_extended_error_infoget_extended_error_infoGetExtendedErrorInfoget_extended_error_infoGetExtendedErrorInfoGetExtendedErrorInfo.

Possible Predecessors

query_io_interfacequery_io_interfaceQueryIoInterfacequery_io_interfaceQueryIoInterfaceQueryIoInterface

Possible Successors

set_io_device_paramset_io_device_paramSetIoDeviceParamset_io_device_paramSetIoDeviceParamSetIoDeviceParam, get_io_device_paramget_io_device_paramGetIoDeviceParamget_io_device_paramGetIoDeviceParamGetIoDeviceParam, open_io_channelopen_io_channelOpenIoChannelopen_io_channelOpenIoChannelOpenIoChannel

Module

Foundation


ClassesClassesClassesClasses | | | | Operators