Skip to content

open_io_deviceOpenIoDeviceOpenIoDeviceopen_io_deviceT_open_io_deviceπŸ”—

Short descriptionπŸ”—

open_io_deviceOpenIoDeviceOpenIoDeviceopen_io_deviceT_open_io_device β€” Open and configure an I/O device.

SignatureπŸ”—

open_io_device( string IOInterfaceName, tuple IODeviceName, string GenParamName, string GenParamValue, out io_device IODeviceHandle )void OpenIoDevice( const HTuple& IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* IODeviceHandle )static void HOperatorSet.OpenIoDevice( HTuple IOInterfaceName, HTuple IODeviceName, HTuple genParamName, HTuple genParamValue, out HTuple IODeviceHandle )def open_io_device( iointerface_name: str, iodevice_name: str, gen_param_name: Sequence[str], gen_param_value: Sequence[Union[int, float, str]] ) -> HHandle

Herror T_open_io_device( 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::HIODevice( const wchar_t* IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue ) (Windows only)

public HIODevice( string IOInterfaceName, HTuple IODeviceName, HTuple genParamName, 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 HIODevice::OpenIoDevice( const wchar_t* IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue ) (Windows only)

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

DescriptionπŸ”—

The operator open_io_deviceOpenIoDevice 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 IOInterfaceNameIOInterfaceNameiointerface_name. 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 IODeviceNameIODeviceNameiodevice_name. Available names can be queried by query_io_interfaceQueryIoInterface. The device can be configured by the parameters GenParamNamegenParamNamegen_param_name and GenParamValuegenParamValuegen_param_value. A reference to the device instance is returned in IODeviceHandleIODeviceHandleiodevice_handle. If the instance of the device is not needed any more, it should be released and closed via the operator close_io_deviceCloseIoDevice.

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

An opened device instance can be reconfigured by using the operators set_io_device_paramSetIoDeviceParam and get_io_device_paramGetIoDeviceParam.

Please check the directory 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.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without 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πŸ”—

IOInterfaceNameIOInterfaceNameiointerface_name (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

HALCON I/O interface name.

Default: [][]
Suggested values: 'ADLINK-DAQPilot', 'ADLINK-EOS', 'Advantech', 'Contec', 'Hilscher-cifX', 'Interface', 'Linux-GPIO', 'NIDAQmx', 'OPC_Classic', 'OPC_UA'"ADLINK-DAQPilot", "ADLINK-EOS", "Advantech", "Contec", "Hilscher-cifX", "Interface", "Linux-GPIO", "NIDAQmx", "OPC_Classic", "OPC_UA"

IODeviceNameIODeviceNameiodevice_name (input_control) tuple β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

I/O device name.

Default: [][]

GenParamNamegenParamNamegen_param_name (input_control) string-array β†’ (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

Dynamic parameter names.

Default: [][]

GenParamValuegenParamValuegen_param_value (input_control) string-array β†’ (string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)Sequence[Union[int, float, str]]Htuple (char* / Hlong / double)

Dynamic parameter values.

Default: [][]

IODeviceHandleIODeviceHandleiodevice_handle (output_control) io_device β†’ (handle)HTuple (HHandle)HIODevice, HTuple (IntPtr)HHandleHtuple (handle)

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_deviceOpenIoDevice 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_infoGetExtendedErrorInfo.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

query_io_interfaceQueryIoInterface

Possible successors

set_io_device_paramSetIoDeviceParam, get_io_device_paramGetIoDeviceParam, open_io_channelOpenIoChannel

ModuleπŸ”—

Foundation