open_io_deviceT_open_io_deviceOpenIoDeviceOpenIoDeviceopen_io_device (算子)

名称

open_io_deviceT_open_io_deviceOpenIoDeviceOpenIoDeviceopen_io_device — 打开并配置输入/输出设备。

签名

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)

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

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)

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)

def open_io_device(iointerface_name: str, iodevice_name: str, gen_param_name: Sequence[str], gen_param_value: Sequence[Union[int, float, str]]) -> HHandle

描述

算子 open_io_deviceopen_io_deviceOpenIoDeviceOpenIoDeviceOpenIoDeviceopen_io_device 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 IOInterfaceNameIOInterfaceNameIOInterfaceNameIOInterfaceNameIOInterfaceNameiointerface_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 IODeviceNameIODeviceNameIODeviceNameIODeviceNameIODeviceNameiodevice_name. Available names can be queried by query_io_interfacequery_io_interfaceQueryIoInterfaceQueryIoInterfaceQueryIoInterfacequery_io_interface。The device can be configured by the parameters GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name and GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value. A reference to the device instance is returned in IODeviceHandleIODeviceHandleIODeviceHandleIODeviceHandleIODeviceHandleiodevice_handle. If the instance of the device is not needed any more, it should be released and closed via the operator close_io_deviceclose_io_deviceCloseIoDeviceCloseIoDeviceCloseIoDeviceclose_io_device

Having opened a specific device, a transmission channel can be opened by calling open_io_channelopen_io_channelOpenIoChannelOpenIoChannelOpenIoChannelopen_io_channel。Values on the I/O channel can be read and written by the operators read_io_channelread_io_channelReadIoChannelReadIoChannelReadIoChannelread_io_channel and write_io_channelwrite_io_channelWriteIoChannelWriteIoChannelWriteIoChannelwrite_io_channel on an opened transmission channel, afterwards.

An opened device instance can be reconfigured by using the operators set_io_device_paramset_io_device_paramSetIoDeviceParamSetIoDeviceParamSetIoDeviceParamset_io_device_param and get_io_device_paramget_io_device_paramGetIoDeviceParamGetIoDeviceParamGetIoDeviceParamget_io_device_param

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.

注意

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.

执行信息

此算子返回一个句柄。请注意,即使该句柄被用作特定算子的输入参数,这些算子仍可能改变此句柄类型的实例状态。

参数

IOInterfaceNameIOInterfaceNameIOInterfaceNameIOInterfaceNameIOInterfaceNameiointerface_name (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

HALCON I/O interface name.

默认值: []

建议值: 'ADLINK-DAQPilot'"ADLINK-DAQPilot""ADLINK-DAQPilot""ADLINK-DAQPilot""ADLINK-DAQPilot""ADLINK-DAQPilot", 'ADLINK-EOS'"ADLINK-EOS""ADLINK-EOS""ADLINK-EOS""ADLINK-EOS""ADLINK-EOS", 'Advantech'"Advantech""Advantech""Advantech""Advantech""Advantech", 'Contec'"Contec""Contec""Contec""Contec""Contec", 'Hilscher-cifX'"Hilscher-cifX""Hilscher-cifX""Hilscher-cifX""Hilscher-cifX""Hilscher-cifX", 'Interface'"Interface""Interface""Interface""Interface""Interface", 'Linux-GPIO'"Linux-GPIO""Linux-GPIO""Linux-GPIO""Linux-GPIO""Linux-GPIO", '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"

IODeviceNameIODeviceNameIODeviceNameIODeviceNameIODeviceNameiodevice_name (输入控制)  tuple HTuplestrHTupleHtuple (string) (string) (HString) (char*)

I/O device name.

默认值: []

GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (输入控制)  string-array HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Dynamic parameter names.

默认值: []

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (输入控制)  string-array HTupleSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

Dynamic parameter values.

默认值: []

IODeviceHandleIODeviceHandleIODeviceHandleIODeviceHandleIODeviceHandleiodevice_handle (输出控制)  io_device HIODevice, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the opened I/O device.

示例(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)

结果

如果参数有效,算子 open_io_deviceopen_io_deviceOpenIoDeviceOpenIoDeviceOpenIoDeviceopen_io_device 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。在这种情况下,可以设置扩展错误信息,并可进行查询通过算子 get_extended_error_infoget_extended_error_infoGetExtendedErrorInfoGetExtendedErrorInfoGetExtendedErrorInfoget_extended_error_info

可能的前趋

query_io_interfacequery_io_interfaceQueryIoInterfaceQueryIoInterfaceQueryIoInterfacequery_io_interface

可能的后继

set_io_device_paramset_io_device_paramSetIoDeviceParamSetIoDeviceParamSetIoDeviceParamset_io_device_param, get_io_device_paramget_io_device_paramGetIoDeviceParamGetIoDeviceParamGetIoDeviceParamget_io_device_param, open_io_channelopen_io_channelOpenIoChannelOpenIoChannelOpenIoChannelopen_io_channel

模块

基础