/// <summary>Open and configure I/O channels.</summary> /// <param name="IODeviceHandle">Handle of the opened I/O device.</param> /// <param name="IOChannelName">HALCON I/O channel names of the specified device.</param> /// <param name="genParamName">Parameter names. Default: []</param> /// <param name="genParamValue">Parameter values. Default: []</param> /// <returns>Handles of the opened I/O channel.</returns> public static HIOChannel[] OpenIoChannel( HIODevice IODeviceHandle, HTuple IOChannelName, HTuple genParamName, HTuple genParamValue) { IntPtr proc = HalconAPI.PreCall(2016); HalconAPI.Store(proc, 0, (HTool)IODeviceHandle); HalconAPI.Store(proc, 1, IOChannelName); HalconAPI.Store(proc, 2, genParamName); HalconAPI.Store(proc, 3, genParamValue); HalconAPI.InitOCT(proc, 0); int err = HalconAPI.CallProcedure(proc); HalconAPI.UnpinTuple(IOChannelName); HalconAPI.UnpinTuple(genParamName); HalconAPI.UnpinTuple(genParamValue); HIOChannel[] hioChannelArray; int procResult = HIOChannel.LoadNew(proc, 0, err, out hioChannelArray); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)IODeviceHandle); return(hioChannelArray); }
internal static int LoadNew(IntPtr proc, int parIndex, int err, out HIOChannel[] obj) { HTuple tuple; err = HTuple.LoadNew(proc, parIndex, err, out tuple); obj = new HIOChannel[tuple.Length]; for (int index = 0; index < tuple.Length; ++index) { obj[index] = new HIOChannel(tuple[index].IP); } return(err); }
/// <summary> /// Open and configure I/O channels. /// Instance represents: Handle of the opened I/O device. /// </summary> /// <param name="IOChannelName">HALCON I/O channel names of the specified device.</param> /// <param name="genParamName">Parameter names. Default: []</param> /// <param name="genParamValue">Parameter values. Default: []</param> /// <returns>Handles of the opened I/O channel.</returns> public HIOChannel OpenIoChannel( string IOChannelName, HTuple genParamName, HTuple genParamValue) { IntPtr proc = HalconAPI.PreCall(2016); this.Store(proc, 0); HalconAPI.StoreS(proc, 1, IOChannelName); HalconAPI.Store(proc, 2, genParamName); HalconAPI.Store(proc, 3, genParamValue); HalconAPI.InitOCT(proc, 0); int err = HalconAPI.CallProcedure(proc); HalconAPI.UnpinTuple(genParamName); HalconAPI.UnpinTuple(genParamValue); HIOChannel hioChannel; int procResult = HIOChannel.LoadNew(proc, 0, err, out hioChannel); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); return(hioChannel); }
internal static int LoadNew(IntPtr proc, int parIndex, int err, out HIOChannel obj) { obj = new HIOChannel(HTool.UNDEF); return(obj.Load(proc, parIndex, err)); }