//========================================================================================== /// <summary> /// Gets the current value for a camera attribute. /// </summary> /// <returns> /// The value of the specified attribute. The value is returned as an <see cref="System.Object" crefType="Unqualified"/>. /// </returns> /// <exception cref="System.ObjectDisposedException"> /// The session has been disposed. /// </exception> /// <exception cref="System.InvalidOperationException"> /// The type of the attribute is invalid or not supported. /// </exception> //========================================================================================== public object GetValue() { _session.ValidateSessionHandle(); object value; switch (_type) { case ImaqdxAttributeType.UInt32: uint uintValue; ImaqdxAttributeManager.GetAttribute(_session.Handle, _name, out uintValue); value = uintValue; break; case ImaqdxAttributeType.Int64: long longValue; ImaqdxAttributeManager.GetAttribute(_session.Handle, _name, out longValue); value = longValue; break; case ImaqdxAttributeType.Double: double doubleValue; ImaqdxAttributeManager.GetAttribute(_session.Handle, _name, out doubleValue); value = doubleValue; break; case ImaqdxAttributeType.String: string stringValue; ImaqdxAttributeManager.GetAttribute(_session.Handle, _name, out stringValue); value = stringValue; break; case ImaqdxAttributeType.Enum: ImaqdxEnumAttributeItem enumValue; ImaqdxAttributeManager.GetAttribute(_session.Handle, _name, out enumValue); value = enumValue; break; case ImaqdxAttributeType.Boolean: bool boolValue; ImaqdxAttributeManager.GetAttribute(_session.Handle, _name, out boolValue); value = boolValue; break; case ImaqdxAttributeType.Command: throw ExceptionBuilder.CommandAttributesNotReadable(); default: throw ExceptionBuilder.UnknownDataType(); } return(value); }
//========================================================================================== /// <summary> /// Gets the <see cref="NationalInstruments.Vision.Acquisition.Imaqdx.ImaqdxAttribute" crefType="Unqualified"/> with the specified name. /// </summary> /// <value> /// The <see cref="NationalInstruments.Vision.Acquisition.Imaqdx.ImaqdxAttribute" crefType="Unqualified"/> with the specified name; <see langword="null"/> if an <see cref="NationalInstruments.Vision.Acquisition.Imaqdx.ImaqdxAttribute" crefType="Unqualified"/> with the specified name does not exist in the collection. /// /// </value> /// <param name="name"> /// The name of the entry to locate in the collection. /// /// </param> /// <exception cref="System.ArgumentNullException"> /// <paramref name="name"/> is <see langword="null"/>. /// </exception> /// <exception cref="System.ArgumentException"> /// <paramref name="name"/> is an empty string. /// </exception> //========================================================================================== public ImaqdxAttribute this[string name] { get { _session.ValidateSessionHandle(); if (name == null) { throw ExceptionBuilder.ArgumentNull("name"); } if (name.Length == 0) { throw ExceptionBuilder.EmptyString("name"); } string fullName = ImaqdxSessionManager.GetFullAttributeName(_session.Handle, name); if (_attributeLookupTable.ContainsKey(fullName)) { int index = _attributeLookupTable[fullName]; return(Items[index]); } return(null); } }
//========================================================================================== /// <summary> /// Configures a low-level acquisition. /// </summary> /// <param name="acquisitionType"> /// Specifies whether the acquisition is <see cref="NationalInstruments.Vision.Acquisition.Imaqdx.ImaqdxAcquisitionType.Continuous" crefType="Unqualified"/> or <see cref="NationalInstruments.Vision.Acquisition.Imaqdx.ImaqdxAcquisitionType.SingleShot" crefType="Unqualified"/>. /// </param> /// <param name="bufferCount"> /// For a <see cref="NationalInstruments.Vision.Acquisition.Imaqdx.ImaqdxAcquisitionType.SingleShot" crefType="Unqualified"/>, this parameter specifies the number of images to acquire. For a continuous acquisition, this parameter specifies the number of buffers the driver uses internally. /// </param> /// <exception cref="System.ObjectDisposedException"> /// The session has been disposed. /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="bufferCount"/> is less than or equal to zero. /// </exception> //========================================================================================== public void Configure(ImaqdxAcquisitionType acquisitionType, int bufferCount) { _session.ValidateSessionHandle(); if (!Enum.IsDefined(typeof(ImaqdxAcquisitionType), acquisitionType)) { throw ExceptionBuilder.InvalidEnumArgument("acquisitionType", (int)acquisitionType, typeof(ImaqdxAcquisitionType)); } if (bufferCount <= 0) { throw ExceptionBuilder.ArgumentOutOfRange("bufferCount"); } ImaqdxSessionManager.ConfigureAcquisition(_session.Handle, acquisitionType, bufferCount); }