![]() |
Accusoft USB Scanner SDK
|
The ScanSession class defines the single object used to control scanners connected to an Android device. More...
Inherits Serializable.
Classes | |
class | DoAcquireImages |
The DoAcquireImages class extends AsyncTask to perform page scanning in a background thread. | |
class | DoCalibration |
The DoCalibration class extends AsynTask to perform device calibration in a background thread. | |
class | DoGetSession |
The DoGetSession class extends AsyncTask to perform ScanSession construction in a background thread. | |
class | MsgHandler |
The MsgHandler class receives messages intended for the main application thread during calibration or scanning operations. | |
class | ScanDevice |
The ScanDevice class holds information about a single currently connected scanner. More... | |
class | SessionMsgHandler |
The SessionMsgHandler class receives messages intended for the main application thread during construction of ScanSession objects. | |
Public Member Functions | |
AsyncTask< Void, Void, Void > | acquireImages (IScanMessageHandler inHandler) |
Begin scanning pages, and acquiring images of those scanned pages, using a background thread. | |
void | cancelScan () |
Cancel any scanner operation currently in progress. | |
void | enterSettingsMode () throws ScanException |
Prepare to change the settings of the active scanner by opening it, if necessary. | |
void | exitSettingsMode () |
Exit mode used to change multiple settings in a row. | |
ScanDevice | getActiveDevice () |
Get the ScanDevice that is set as the current active scan device. | |
Integer | getBrightness () throws ScanException |
Get the Brightness value for the active scanner. | |
LinkedHashSet< Integer > | getBrightnessValues () throws ScanException |
Get a LinkedHashSet of all possible valid Brightness values for the active scanner. | |
Integer | getContrast () throws ScanException |
Get the Contrast value for the active scanner. | |
LinkedHashSet< Integer > | getContrastValues () throws ScanException |
Get a LinkedHashSet of all possible valid Contrast values for the active scanner. | |
String | getDepth () throws ScanException |
Get the current Pixel Depth (bits per pixel) for the active scanner. | |
LinkedHashSet< String > | getDepthValues () throws ScanException |
Get a LinkedHashSet of all possible valid Pixel Depth values for the active scanner. | |
List< ScanDevice > | getDevices () |
Obtain a list of the currently connected scan devices for which there are drivers. | |
String | getImageFormat () throws ScanException |
Get the Image Format value for the active scanner. | |
LinkedHashSet< String > | getImageFormatValues () throws ScanException |
Get a LinkedHashSet of all possible valid values for the Image Format used by the scanner. | |
String | getInputSource () throws ScanException |
Get the Input Source value for the active scanner. | |
LinkedHashSet< String > | getInputSourceValues () throws ScanException |
Get a LinkedHashSet of all possible valid values for the Input Source used by the scanner. | |
Integer | getResolution () throws ScanException |
Get the Resolution value for the active scanner. | |
LinkedHashSet< Integer > | getResolutionValues () throws ScanException |
Get a LinkedHashSet of all possible valid values for Resolution for the active scanner. | |
String | getScanArea () throws ScanException |
Get the scan size (area) used by the active scanner. | |
LinkedHashSet< String > | getScanAreaValues () throws ScanException |
Get a LinkedHashSet of all possible valid values for the scan size (area) used by the scanner. | |
boolean | isBrightnessMutable () throws ScanException |
Determine if the Brightness setting's value can be changed. | |
boolean | isContrastMutable () throws ScanException |
Determine if the Contrast setting's value can be changed. | |
boolean | isDepthMutable () throws ScanException |
Determine if the Pixel Depth (bits per pixel) setting's value can be changed. | |
boolean | isImageFormatMutable () throws ScanException |
Determine if the Image Format setting's value can be changed. | |
boolean | isInputSourceMutable () throws ScanException |
Determine if the Input Source setting's value can be changed. | |
boolean | isResolutionMutable () throws ScanException |
Determine if the Resolution setting's value can be changed. | |
boolean | isScanAreaMutable () throws ScanException |
Determine if the Scan Area setting's value can be changed for the active scanner. | |
AsyncTask< Void, Void, Void > | performCalibration (IScanMessageHandler inHandler) |
Perform calibration, if the device supports it, using a background thread. | |
void | registerPermissionIntentReceiver (Context context) |
This function is required to be called whenever the application acquires a new context. | |
void | setActiveDevice (ScanDevice device) |
Set a ScanDevice as the current active scan device. | |
boolean | setBrightness (Integer newVal) throws ScanException |
Set the Brightness value for the active scanner. | |
boolean | setContrast (Integer newVal) throws ScanException |
Set the Contrast value for the active scanner. | |
boolean | setDepth (String newVal) throws ScanException |
Set the number of bits per pixel (Pixel Depth) the scanner will use. | |
boolean | setImageFormat (String newVal) throws ScanException |
Set the Image Format value for the active scanner. | |
boolean | setInputSource (String newVal) throws ScanException |
Set the Input Source the active scanner will use. | |
boolean | setResolution (Integer newVal) throws ScanException |
Set the scan resolution that the active scanner will use. | |
boolean | setScanArea (String newVal) throws ScanException |
Set the scan size (area) the active scanner will use. | |
boolean | supportsCalibration () throws ScanException |
Method that should be used to determine if the scanner supports calibration. | |
void | unregisterPermissionIntentReceiver (Context context) |
This function is required to be called whenever the application's current Context will be lost. | |
Static Public Member Functions | |
static AsyncTask< Void, Void, Void > | requestSession (Context context, ScanLicense license, ISessionCallback inHandler) |
Asynchronously construct a ScanSession object that is used to access scanners connected to an Android device. |
The ScanSession class defines the single object used to control scanners connected to an Android device.
AsyncTask<Void, Void, Void> acquireImages | ( | IScanMessageHandler | inHandler | ) |
Begin scanning pages, and acquiring images of those scanned pages, using a background thread.
The images and status information is communicated via callback methods of the supplied handler object.
inHandler | An object that supports the callback methods defined in the IScanMessageHandler interface. |
void cancelScan | ( | ) |
Cancel any scanner operation currently in progress.
This is an asynchronous operation that purposefully does not synchronize with the other ScanSession operations.
void enterSettingsMode | ( | ) | throws ScanException |
Prepare to change the settings of the active scanner by opening it, if necessary.
By using this method to explicitly open the scanner, and keep it open, a performance advantage is gained when changing the values of multiple settings in a row. A counter is maintained, so this method may be called multiple times. Each call to this method must be balanced by a call to exitSettingsMode().
ScanException | If the active device can not be opened. |
void exitSettingsMode | ( | ) |
Exit mode used to change multiple settings in a row.
A call to this method must balance a corresponding call to enterSettingsMode().
ScanDevice getActiveDevice | ( | ) |
Get the ScanDevice that is set as the current active scan device.
Only one scan device may be active at a time.
Integer getBrightness | ( | ) | throws ScanException |
Get the Brightness value for the active scanner.
LinkedHashSet<Integer> getBrightnessValues | ( | ) | throws ScanException |
Get a LinkedHashSet of all possible valid Brightness values for the active scanner.
Integer getContrast | ( | ) | throws ScanException |
Get the Contrast value for the active scanner.
LinkedHashSet<Integer> getContrastValues | ( | ) | throws ScanException |
Get a LinkedHashSet of all possible valid Contrast values for the active scanner.
String getDepth | ( | ) | throws ScanException |
Get the current Pixel Depth (bits per pixel) for the active scanner.
LinkedHashSet<String> getDepthValues | ( | ) | throws ScanException |
Get a LinkedHashSet of all possible valid Pixel Depth values for the active scanner.
List<ScanDevice> getDevices | ( | ) |
Obtain a list of the currently connected scan devices for which there are drivers.
Each time that this method is called, the previous list of devices, and the ScanDevice objects contained in it, becomes invalid. It is important to note that scan settings are tied to ScanDevice and will also become invalid.
String getImageFormat | ( | ) | throws ScanException |
Get the Image Format value for the active scanner.
LinkedHashSet<String> getImageFormatValues | ( | ) | throws ScanException |
Get a LinkedHashSet of all possible valid values for the Image Format used by the scanner.
String getInputSource | ( | ) | throws ScanException |
Get the Input Source value for the active scanner.
LinkedHashSet<String> getInputSourceValues | ( | ) | throws ScanException |
Get a LinkedHashSet of all possible valid values for the Input Source used by the scanner.
Integer getResolution | ( | ) | throws ScanException |
Get the Resolution value for the active scanner.
LinkedHashSet<Integer> getResolutionValues | ( | ) | throws ScanException |
Get a LinkedHashSet of all possible valid values for Resolution for the active scanner.
String getScanArea | ( | ) | throws ScanException |
Get the scan size (area) used by the active scanner.
LinkedHashSet<String> getScanAreaValues | ( | ) | throws ScanException |
Get a LinkedHashSet of all possible valid values for the scan size (area) used by the scanner.
boolean isBrightnessMutable | ( | ) | throws ScanException |
Determine if the Brightness setting's value can be changed.
boolean isContrastMutable | ( | ) | throws ScanException |
Determine if the Contrast setting's value can be changed.
boolean isDepthMutable | ( | ) | throws ScanException |
Determine if the Pixel Depth (bits per pixel) setting's value can be changed.
boolean isImageFormatMutable | ( | ) | throws ScanException |
Determine if the Image Format setting's value can be changed.
boolean isInputSourceMutable | ( | ) | throws ScanException |
Determine if the Input Source setting's value can be changed.
boolean isResolutionMutable | ( | ) | throws ScanException |
Determine if the Resolution setting's value can be changed.
boolean isScanAreaMutable | ( | ) | throws ScanException |
Determine if the Scan Area setting's value can be changed for the active scanner.
AsyncTask<Void, Void, Void> performCalibration | ( | IScanMessageHandler | inHandler | ) |
Perform calibration, if the device supports it, using a background thread.
Support for calibration is determined by calling the supportsCalibration() method. Every scan device which supports calibration must be calibrated at least once after it is connected to a new Android host before it may be used. Devices which require calibration, but have not yet been calibrated will return a DEVICE BUSY error. Status information is communicated via callback methods of the supplied handler object.
inHandler | An object that supports the callback methods defined in the IScanMessageHandler interface. Note that the onProgress() and onImage() methods are not used during calibration. |
void registerPermissionIntentReceiver | ( | Context | context | ) |
This function is required to be called whenever the application acquires a new context.
(Example: inside onResume())
context | The context that has been changed |
static AsyncTask<Void, Void, Void> requestSession | ( | Context | context, |
ScanLicense | license, | ||
ISessionCallback | inHandler | ||
) | [static] |
Asynchronously construct a ScanSession object that is used to access scanners connected to an Android device.
All access to the scanners is done through the object returned by this method. Each time that this method is called a new session will be asynchronously created, and the old one will become invalid. This method need only be called once, when the application starts.
context | A Context that will be used to determine the location of data directories and to register an Intent Receiver for USB permissions. |
license | A ScanLicense object created from the license key supplied by Accusoft. |
inHandler | An object implementing the ISessionCallback interface. The onSession() method of this object will be called when the ScanSession has been constructed. |
void setActiveDevice | ( | ScanDevice | device | ) |
Set a ScanDevice as the current active scan device.
Only one scan device may be active at a time.
device | The ScanDevice that is set as the current active scan device. |
boolean setBrightness | ( | Integer | newVal | ) | throws ScanException |
Set the Brightness value for the active scanner.
When setting any scanner parameter, other parameters maybe changed as a side effect. Use the return value to determine if the values of any other parameters have been changed.
newVal | is the new brightness value. It must be a value contained in the Set returned by getBrightnessValues(). |
ScanException |
boolean setContrast | ( | Integer | newVal | ) | throws ScanException |
Set the Contrast value for the active scanner.
When setting any scanner parameter, other parameters maybe changed as a side effect. Use the return value to determine if the values of any other parameters have been changed.
newVal | is the new contrast setting. It must be a value contained in the LinkedHashSet returned by getContrastValues(). |
ScanException |
boolean setDepth | ( | String | newVal | ) | throws ScanException |
Set the number of bits per pixel (Pixel Depth) the scanner will use.
When setting any scanner parameter, other parameters maybe changed as a side effect. Use the return value to determine if the values of any other parameters have been changed.
newVal | is the new depth setting. It must be a value contained in the LinkedHashSet returned by getDepthValues(). |
ScanException |
boolean setImageFormat | ( | String | newVal | ) | throws ScanException |
Set the Image Format value for the active scanner.
When setting any scanner parameter, other parameters maybe changed as a side effect. Use the return value to determine if the values of any other parameters have been changed.
newVal | is the new image format setting. It must be a value contained in the LinkedHashSet returned by getImageFormatValues(). |
ScanException |
boolean setInputSource | ( | String | newVal | ) | throws ScanException |
Set the Input Source the active scanner will use.
When setting any scanner parameter, other parameters maybe changed as a side effect. Use the return value to determine if the values of any other parameters have been changed.
newVal | is the new Input Source setting. It must be a value contained in the LinkedHashSet returned by getInputSourceValues(). |
ScanException |
boolean setResolution | ( | Integer | newVal | ) | throws ScanException |
Set the scan resolution that the active scanner will use.
When setting any scanner parameter, other parameters maybe changed as a side effect. Use the return value to determine if the values of any other parameters have been changed.
newVal | is the new resolution setting. It must be a value contained in the LinkedHashSet returned by getResolutionValues(). |
ScanException |
boolean setScanArea | ( | String | newVal | ) | throws ScanException |
Set the scan size (area) the active scanner will use.
When setting any scanner parameter, other parameters maybe changed as a side effect. Use the return value to determine if the values of any other parameters have been changed.
newVal | is the new scan area setting. It must be a value contained in the LinkedHashSet returned by getScanAreaValues(). |
ScanException |
boolean supportsCalibration | ( | ) | throws ScanException |
Method that should be used to determine if the scanner supports calibration.
If it does, the scanner will need to be calibrated at least once for every host device to which it is connected.
void unregisterPermissionIntentReceiver | ( | Context | context | ) |
This function is required to be called whenever the application's current Context will be lost.
(Example: inside onPause())
context | The context that will change |