Public Member Functions | |
void | didInitializeScanCase (ScanCase scanCase) |
int | didScan (ScanCase scanCase, ScanCaseSession session) |
int | didProcess (byte[] imageBuffer, int width, int height, ScanCaseSession session) |
void | didChangeState (ScanCase scanCase, int state, int reason) |
Public Attributes | |
Possible reasons why the scan case state has changed. | |
int | STATE_CHANGE_REASON_MANUAL |
int | STATE_CHANGE_REASON_TIMEOUT |
int | STATE_CHANGE_REASON_VOLUME_BUTTON |
int | STATE_CHANGE_REASON_HARDWARE_BUTTON |
Detailed Description
Callback interface for events fired by ScanCase, e.g.
when new codes are scanned.
Classes implementing the ScanCaseListener receive barcode/2D code scan events whenever a new code has been scanned. The classes implementing the listener also get notified when ScanCase has completed initialization, and when its state has been changed via ScanCase.setState method.
- Since
- 5.6.0
Member Function Documentation
void didInitializeScanCase | ( | ScanCase | scanCase | ) |
Method invoked when ScanCase has finished the initialization.
This method is called on the ScanCaseListener as soon as ScanCase has completed the initialization process and the scanner is ready to be used. At this point the state of ScanCase is ScanCase.STATE_STANDBY.
- Parameters
-
scanCase The scan case initialized.
- Since
- 5.6.0
int didScan | ( | ScanCase | scanCase, |
ScanCaseSession | session | ||
) |
Method invoked whenever a new code is scanned.
This method is called on the ScanCaseListener whenever the barcode scanner has recognized new barcodes/2D codes. The newly recognized codes can be retrieved from the scan session's ScanCaseSession.getNewlyRecognizedCodes() method.
- Parameters
-
scanCase The scan case on which codes were scanned. session The current scan session containing the state of the recognition process, e.g. the list of codes recognized in the last processed frame. The scan session can only be accessed from within this method. It is however possible to use codes returned by ScanCaseSession.getNewlyRecognizedCodes() outside this method.
- Returns
- The new state for the scan case; e.g. return ScanCase.STATE_ACTIVE if you want to keep scanning, or return ScanCase.STATE_STANDBY if you want to pause the scanner or ScanCase.STATE_OFF to turn it off entirely. If something other than ScanCase.STATE_ACTIVE is returned by didProcess() after the call to this function then the state returned by didProcess() will take precedence.
- Since
- 5.6.0
int didProcess | ( | byte[] | imageBuffer, |
int | width, | ||
int | height, | ||
ScanCaseSession | session | ||
) |
Invoked every time a frame has been processed by the barcode recognition engine.
In contrast to didScan, the didProcess callback is invoked after every frame, regardless whether a code could be successfully decoded or not. If your are only interested in fully decoded codes, use didScan instead.
The didProcess callback is invoked in the thread that runs the recognition engine and blocks further processing. In case codes have been recognized in the same frame, the didProcess callback is invoked after didScan.
- Parameters
-
imageBuffer the raw image data that was processed in NV21 format width width of the image buffer in pixels height height of the image buffer in pixels session contains information on the current recognition process. It is only valid to access the scan session from within the callback. If part of the information is required outside the callback it must be copied first.
- Returns
- The new state for the scan case; e.g. return ScanCase.STATE_ACTIVE if you want to keep scanning, or return ScanCase.STATE_STANDBY if you want to pause the scanner or ScanCase.STATE_OFF to turn it off entirely. If ScanCase.STATE_ACTIVE is returned but didScan() returned ScanCase.STATE_STANDBY or ScanCase.STATE_OFF then the state returned by didScan() will take precedence.
- Since
- 5.7.0
void didChangeState | ( | ScanCase | scanCase, |
int | state, | ||
int | reason | ||
) |
Method invoked whenever the state of ScanCase is changed.
This method is called on the ScanCaseListener whenever the state of ScanCase is changed.
- Parameters
-
scanCase The scan case on which codes were scanned. state The new state of the scan case. reason The reason for the state change.
- Since
- 5.6.0
Member Data Documentation
int STATE_CHANGE_REASON_MANUAL |
The state was changed directly.
int STATE_CHANGE_REASON_TIMEOUT |
The change of state was driven by a timeout.
int STATE_CHANGE_REASON_VOLUME_BUTTON |
The change of state was driven by the volume button.
int STATE_CHANGE_REASON_HARDWARE_BUTTON |
The change of state was driven by a special hardware button (not all phones have one)
The documentation for this interface was generated from the following file:
- ScanCaseListener.java