Click or drag to resize

Device Class

Contains information about a single device and handles the acquisition of images from that device.

Inheritance Hierarchy
System.Object
  Atalasoft.Twain.Device

Namespace:  Atalasoft.Twain
Assembly:  Atalasoft.DotTwain (in Atalasoft.DotTwain.dll) Version: 11.5.0.0.0.156 (.NET 4.6.2, x86)
Syntax
public sealed class Device : IMessageFilter, 
	IDisposable

The Device type exposes the following members.

Properties
  NameDescription
Public propertyAlarms
Gets or sets a value which indicates if specific audible alarms are on or off.
Public propertyAlarmVolume
Gets or sets the volume of alarms.
Public propertyAuthor
Gets or sets the name or other identifying information about the Author of the image.
Public propertyAutoBrightness
Gets or sets a value indicating if the AutoBrightness feature of the Source will be used.
Public propertyCode exampleAutoDiscardBlankPages
Gets or sets a value indicating whether the driver will automatically discard blank pages.
Public propertyAutomaticBorderDetection
Gets or sets a value to indicate if the automatic border detection feature of the source should be used.
Public propertyAutomaticDeskew
Gets or sets a value indicating if the automatic deskew feature of the source should be used.
Public propertyAutomaticRotate
Gets or sets a value indicating if the automatic rotate feature of the source should be used.
Public propertyAutoScan
Gets or sets a value to indicate if the device should automatically acquire one image after another.
Public propertyAutoSize
Gets or sets the ICAP_AUTOSIZE capability which determines whether the driver is forced to output image dimensions to match the FrameSize or its closest supported frame size.
Public propertyBarCode
Gets the TwainBarCode object used to control barcode features of the device.
Public propertyBatteryMinutes
Gets the number of battery minutes remaining in the device.
Public propertyBatteryPercentage
Gets the percentage of remaining battery power.
Public propertyBitDepth
Gets or sets the bit depth for the acquisition.
Public propertyBitDepthReduction
Gets or sets the BitDepthReductionMode the Source should use to reduce the bit depth of the data.
Public propertyBrightness
Gets or sets the amount of brightness the Source will add to the image.
Public propertyCameraPreviewInterface
Gets a value indicating if the device supports a preview interface.
Public propertyCaption
Gets or sets a general note about the acquired image.
Public propertyCcittKFactor
Gets or sets the K factor indicating how often the new compression baseline should be re-established.
Public propertyColorFilter
Gets or sets the color characteristic of the subtractive filter applied to the image data.
Public propertyCompression

Gets or sets the compression used during a file or memory transfer.

Public propertyContrast
Gets or sets the amount of contrast the Source will add to the image.
Public propertyController
Gets the TwainController used by the Device class.
Public propertyCustomDataSupported
Gets a value indicating whether the device supported functionality used by the LoadParameters(Stream) and SaveParameters(Stream) methods.
Public propertyDateTime
Gets or sets the date and time of the device's clock.
Public propertyDeviceEvents
Gets or sets the device events you want to receive.
Public propertyDisplayProgressIndicator
Gets or sets a value to indicate if the source will display a progress bar during an acquisition.
Public propertyDocumentFeeder
Gets the DocumentFeeder object for the device if supported.
Public propertyDuplex
Gets the duplex mode supported by this device.
Public propertyDuplexEnabled
Gets or sets a value indicating if the duplex feature is enabled.
Public propertyEnableInterfaceOnly

Gets a value indicating if the source will allow you to display the source interface without acquiring an image.

If the device does support this feature, you can use the ShowUserInterface() method to display the device interface and allow the user to select their options without acquiring an image.

Public propertyEndorserNumber
Gets or sets the starting endorser / imprinter number.
Public propertyExposureTime

Gets or sets the exposure time used to capture the image in seconds.

Public propertyCode exampleFileFormat

Gets or sets the file format used when saving the acquired image directly to a file.

Public propertyFileSystem

Gets the FileSystem for the device if supported.

The FileSystem is used for navigating through the folders and files of some cameras and scanners.

Public propertyFilter
Gets or sets the algorithm used to improve the quality of the image.
Public propertyFlashUsed
Gets or sets the type of flash, if any, is used.
Public propertyFlipRotation
Gets or sets a value which is used to properly orient images that flip orientation every other image.
Public propertyFrame

Gets or sets the rectangular area of the scanning bed to acquire.

If you know ahead of time the location and size of the object to scan, and the device supports this feature, you can decrease the amount of scanning time by setting this property.

Public propertyFrameSize

Gets or sets the static frame size for the acquire.

Public propertyGamma
Gets or sets the Source gamma correction value for the image data.
Public propertyHalftone
Gets or sets the halftone used by the device during the acquisition.
Public propertyHideInterface
Gets or sets a value indicating whether the device interface is shown when acquiring.
Public propertyHighlight
Gets or sets which value in an image should be interpreted as the lightest highlight.
Public propertyIccProfile
Gets or sets the ICAP_ICCPROFILE capability which determines if the device will link or embed an ICC profile with the image.
Public propertyIdentity
Gets the device identity information.
Public propertyImageCount

Gets the number of available images.

This is only valid for devices which contain an internal buffer. You can find out if there are any pending images during an acquisition by checking the PendingImages property of the AcquireEventArgs class.

Public propertyImageLayout
Gets or sets the layout used when acquiring image data.
Public propertyInterfaceControllable
Gets a value indicating if the interface can be hidden during an acquire. If supported, you can hide the interface by setting the hideInterface parameter of the Acquire() method.
Public propertyJobControl
Gets or sets the type of batch acquisition job to perform.
Public propertyJpegPixelType
Gets or sets the pixel type used when Jpeg data is acquired.
Public propertyJpegQuality
Gets or sets the Jpeg quality used during a file or memory transfer.
Public propertyLampState
Gets or sets a value indicating if the lamp is currently, or should be to ON.
Public propertyLanguage
Gets or sets the language to use for the source device.
Public propertyLastReturnCode
Gets the last TwainReturnCode from getting or setting a property.
Public propertyLightPath
Gets or sets a value which describes whether the image was captured transmissively or reflectively.
Public propertyLightSource
Gets or sets a value that describes the general color characteristic of the light source used to acquire the image.
Public propertyMaxBatchBuffers
Gets or sets the number of pages that the scanner can buffer when AutoScan is enabled.
Public propertyMaxFrames
Gets or sets the maximum number of frames the device or application can accept.
Public propertyMicrEnabled
Gets or sets the CAP_MICRENABLED capability which indicates if the scanner is enabled for MICR check scanning.
Public propertyMinimumHeight
Gets the minimum height the source can acquire in Units.
Public propertyMinimumWidth
Gets the minimum width the source can acquire in Units.
Public propertyModalAcquire
Gets or sets a value indicating whether the Acquire() method is synchronous or asynchronous.
Public propertyNativeResolution
Gets the native optical resolution of the device.
Public propertyNoiseFilter
Gets or sets the noise filter the source will use.
Public propertyOnline
Gets a value indicating if the device is powered up and ready to use.
Public propertyOrientation
Gets or sets the orientation of the acquired image.
Public propertyOverscan
Gets or sets a value indicating the type of overscan the source should perform.
Public propertyPaperDetectable
Gets a value indicating if the device has a paper sensor.
Public propertyPatchCode
Gets the TwainBarCode object used to control patchcode features of the device.
Public propertyPhysicalHeight
Gets the maximum height in Units the source can acquire.
Public propertyPhysicalWidth
Gets the maximum width in Units the source can acquire.
Public propertyPixelFlavor
Gets or sets a value indicating whether the image data uses the value 0 for the darkest color or the lightest color.
Public propertyPixelType

Gets or sets the pixel format to acquire.

You should set this property before setting BitDepth.

Public propertyPowerSupply
Gets the type of power supply used for this camera.
Public propertyReacquireAllowed
Gets a value indicating whether the physical hardware is capable of acquiring multiple images of the same page without changes to the physical registration of that page.
Public propertyResolution
Gets or sets the number of pixels per unit as specified by the Units property.
Public propertyRotation
Gets or sets the amount to rotate the image by the Source.
Public propertyScaling
Gets or sets the amount of scaling the Source will perform on the image.
Public propertySerialNumber
Gets a string containing the serial number of this device.
Public propertyShadow
Gets or sets the value in an image which should be interpreted as the darkest shadow.
Public propertyState
Gets a value indicating the current Twain state.
Public propertyThreadingEnabled
Gets or sets a value indicating whether to perform the scanning in a separate thread. See the remarks below for threading limitations.
Public propertyThreshold
Gets or sets the dividing line between black and white for 1-bit acquires.
Public propertyThumbnailEnabled
Gets or sets a value indicating if a thumbnail should be returned instead of the full size image.
Public propertyTransferCount
Gets or sets the number of images your application is willing to accept.
Public propertyTransferMethod
Gets or sets the transfer method used when acquiring data.
Public propertyUnits
Gets or sets a value indicating the units of measure for this acquire.
Public propertyZoomFactor

Gets or sets the zoom factor to use for the acquire.

Valid values for this property are source defined.

Top
Methods
  NameDescription
Public methodCode exampleAcquire
Acquires an image from this device.
Public methodCanOpen Obsolete.

This method may be removed in a future version. New applications should use the TryOpen() method instead.

Returns a value indicating whether or not the Open() method can currently be used on the device.

Public methodClearBuffers

This lets you choose how the device should handle its buffer clearing procedure.

Public methodClose

Closes the connection with the device previously opened.

Calling this method when an image is being acquired will cancel the acquisition and any pending transfers. If you want to close the connection after all images have been transferred, you should do so in the AcquireFinished event.

Public methodDisable
This method will disable and hide the device interface. This only needs to be called if the Enable() method is used to display the interface or invoke scanning.
Public methodDispose
Releases resources used by the device when created from the CreateDeviceSession(String) method. This should not be used for Device objects in the DeviceCollection.
Public methodEnable
This method can be used to display the device interface and invoke an acquisition instead of using Acquire().
Public methodEnableCamera
Use this method to enable or disable cameras used when scanning.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Calls Close()
(Overrides Object.Finalize().)
Public methodGetConditionCode
Returns the condition code from the last Twain operation. This can provide more information about a failure when getting or setting a Device property.
Public methodGetFrames
Returns an array containing the current frames set for a device.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetQueryOperations
Returns the operations supported for a specific capability.
Public methodGetSupportedBarCodes
Returns the barcodes supported by the device.
Public methodGetSupportedBitDepthReductionModes
Returns the BitDepthReductionModes supported by the device.
Public methodGetSupportedBitDepths
Returns the supported bit depth values for the current PixelType.
Public methodGetSupportedBrightnessValues
Returns the brightness values supported by the device.
Public methodGetSupportedCapabilities
Returns a list of all the capabilities for which the Source will answer inquiries.
Public methodGetSupportedCompressionModes
Returns the supported compression modes for this device.
Public methodGetSupportedContrastValues
Returns the contrast values supported by the device.
Public methodGetSupportedExposureTimes
Returns an array of exposure times supported by the device.
Public methodGetSupportedExtendedCapabilities
Returns the extended capabilities supported by the device.
Public methodGetSupportedFlashModes
Returns the flash modes supported by the device.
Public methodGetSupportedFrameSizes
Returns the frame sizes supported by the device.
Public methodGetSupportedHalftones
Returns the halftone values supported by the device.
Public methodGetSupportedHighlightValues
Returns the highlight values supported by the device.
Public methodGetSupportedIccProfileOptions
Returns an array of TwainIccProfileOption values indicating what type of ICC profiles are supported by the device.
Public methodGetSupportedImageFilters
Returns the image filters supported by the device.
Public methodCode exampleGetSupportedImageFormats
Returns a list of the file formats supported by this device.
Public methodGetSupportedJobControls
Returns the job controls supported by the device.
Public methodGetSupportedJpegPixelTypes
Returns the Jpeg pixel types supported by the device.
Public methodGetSupportedJpegQualityValues
Returns the Jpeg quality values supported by the device.
Public methodGetSupportedLanguageTypes
Returns the language types supported by the device.
Public methodGetSupportedLightPathModes
Returns the light path modes supported by the device.
Public methodGetSupportedLightSourceModes
Returns the light source modes supported by the device.
Public methodGetSupportedMaxBatchBuffers
Returns the supported maximum batch buffers for the device.
Public methodGetSupportedNativeResolutions
Returns the native resolution values for the device.
Public methodGetSupportedNoiseFilterModes
Returns the noise filter modes supported by the device.
Public methodGetSupportedOrientationModes
Returns the orientation modes supported by the device.
Public methodGetSupportedOverscanModes
Returns the overscan modes supported by the device.
Public methodGetSupportedPatchCodes
Returns the patchcodes supported by the device.
Public methodGetSupportedPixelTypes
Returns the pixel types supported by the device.
Public methodGetSupportedPowerSupplies
Returns the supported power supplies for the device.
Public methodGetSupportedPrinterModes
Returns the printer modes supported by the device.
Public methodGetSupportedPrinters
Finds the type of imprinter or endorser supported by this device. These can be used to set which imprinter or endorser to use in the SetImprinterEndorser() method.
Public methodGetSupportedResolutions
Returns supported resolution values for the device.
Public methodGetSupportedRotations
Returns the rotations supported by the device.
Public methodGetSupportedScalingValues
Returns scaling values supported by the device.
Public methodGetSupportedShadowValues
Returns the shadow values supported by the device.
Public methodGetSupportedThresholdValues
Returns the threshold values supported by the device.
Public methodGetSupportedTransferMethods
Returns the transfer methods supported by the device.
Public methodGetSupportedUnitTypes
Returns the unit values supported by the device.
Public methodGetSupportedZoomFactors
Returns an array of valid zoom factors for this device.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodLoadParameters
Loads previously saved device parameters into the device.
Public methodLoadXmlParameters
Load device parameter data saved with the SaveXmlParameters(Stream) method.
Public methodOpen

Opens a connection to this device.

You must open a connection to the device before getting or setting any device properties. If you don't need to get or set any properties, you can call the Acquire() method without using the Open or Close() methods.

TryOpen() is the preferred way to open a connection to the device.

Public methodPreFilterMessage
Filters out a message before it is dispatched.
Public methodCode exampleQueryCapability

Determines if a capability is available from the device.

It's unlikely that any one device supports all of the properties and features. You can use this method to find out if a property is get-able and/or set-able. This can also be used to help determine if the device is a camera by checking for camera specific properties, such as FlashUsed or BatteryPercentage.

Public methodSaveParameters
Saves the current device parameters to a stream.
Public methodSaveXmlParameters
Saves device property values into XML format.
Public methodSetCameraPixelOrder
Sets the pixel order for each enabled camera.
Public methodSetExtendedCapabilities
Sets the extended capabilities your application needs to negotiate during states 5 and 6 of a Twain session.
Public methodSetExtendedImageInfoOptions
Sets the extended image information options to obtain after acquiring the data.
Public methodSetFrames
Sets multiple frames to acquire from when scanning.
Public methodSetImageDataset

Sets the indices of the images you want to acquire.

This is useful when you want to acquire multiple images from a camera with a single call to the Acquire() method.

Public methodSetImprinterEndorser(ImprinterEndorserType, Boolean)
Use this method to enable or disable an imprinter or endorser.
Public methodSetImprinterEndorser(ImprinterEndorserType, ImprinterEndorserMode, String, Int32, String)
Use this method to enable an imprinter or endorser and set its parameters.
Public methodShowUserInterface

Displays the device interface.

This operation is used by applications that wish to display the device user interface to allow the user to manipulate the devices current settings for resolution, paper size, etc. but not acquire an image.

Public methodStartAutomaticCapture

Starts an automatic capture process.

This method does not acquire the images. Automatic capture implies that the device is capable of capturing images without the presence of the Application. This means that it must be possible for the Application to close the device and reopen it later, after the images have been captured.

Public methodToString
A string which describes this object.
(Overrides Object.ToString().)
Public methodCode exampleTryOpen

This method will attempt to open a connection to the device and will return true if it was successful. It's preferred to use this method instead of the Open() method.

The Close() method must be called when you are finished using the device.

Top
Remarks

This class controls how the image will be acquired and to learn more about the device and its capabilities. The Open() method must be invoked before gaining access to the device properties and information. The Close() method must be invoked when finished with the device.

To find out which properties you can obtain from the device, invoke the QueryCapability(DeviceCapability, Boolean) method or get a list of property names from the GetSupportedCapabilities() method.
Examples
Acquire() Method
See Also