Logo
Developer SDK
Version 1.9.632.913d652c-152450467.
Scanner Class Reference
Inheritance diagram for Scanner:
Peripheral

Public Member Functions

void readFromParcel (Parcel in)
 
int describeContents ()
 
void writeToParcel (Parcel dest, int flags)
 
String initiateScan (HashMap< String, Object > attributes)
 
List< String > getSupportedBarcodeFormats ()
 
boolean isBuiltinCamera ()
 
String getId ()
 
String getName ()
 
String getModel ()
 
String getHardwareId ()
 
String getPeripheralType ()
 
String getStatus ()
 
String getConnectionType ()
 
boolean startSession ()
 
boolean endSession ()
 
boolean isCapable (String capability)
 
HashMap< String, Object > getAttributes ()
 
- Public Member Functions inherited from Peripheral
abstract String getId ()
 
abstract String getName ()
 
abstract String getModel ()
 
abstract String getHardwareId ()
 
abstract String getPeripheralType ()
 
abstract String getStatus ()
 
abstract String getConnectionType ()
 
abstract boolean startSession ()
 
abstract boolean endSession ()
 
abstract boolean isCapable (String capability)
 
abstract HashMap< String, Object > getAttributes ()
 

Static Public Attributes

static final String PERIPHERAL_TYPE = "SCANNER"
 
static final String STATUS_SUSPENDED = "com.verifone.peripherals.STATUS_SUSPENDED"
 
static final String STATUS_SCANNING = "com.verifone.peripherals.STATUS_SCANNING"
 
static final String STATUS_BARCODE_DETECTED
 
static final String ATTRIBUTE_BARCODE = "com.verifone.peripherals.ATTRIBUTE_BARCODE"
 
static final String ATTRIBUTE_BARCODE_FORMAT
 
static final String ATTRIBUTE_CONTINUOUS_SCAN
 
static final String ATTRIBUTE_DISPLAY_FEED_PARENT
 
static final String ATTRIBUTE_SCAN_AREA_LIMIT
 
static final String ATTRIBUTE_PLAY_SOUND
 
static final String ATTRIBUTE_SET_DIRECTION
 
static final String ATTRIBUTE_ACTIVATE_LIGHT
 
static final String CAPABILITY_CONTINUOUS_SCANNING
 
static final String CAPABILITY_DISPLAY_SCAN_FEED
 
static final String CAPABILITY_LIMIT_SCAN_AREA
 
static final String ATTRIBUTE_VIEW_GRAVITY
 
static final String CAPABILITY_PLAY_SCAN_SOUND
 
static final String CAPABILITY_SET_SCAN_DIRECTION
 
static final String CAPABILITY_ACTIVATE_LIGHT = "com.verifone.peripherals.CAPABILITY_LIGHT"
 
static final String GRAVITY_EXTRA = "gravity"
 
static final String BROADCAST_SCANNER_STATUS = "ScannerStatus"
 
static final String SINGLESCAN_EXTRA = "SingleScan"
 
static final String XPOS_EXTRA = "xpos"
 
static final String YPOS_EXTRA = "ypos"
 
static final String WIDTH_EXTRA = "width"
 
static final String HEIGHT_EXTRA = "height"
 
static final String FACING_EXTRA = "facing"
 
static final String LEDSTATE_EXTRA = "ledState"
 
static final String SWITCH_CAMERA_EXTRA = "switchcamera"
 
static final String BEEP_EXTRA = "beep"
 
static final String INTENT_SCANDATA = "com.swordfish.scandata"
 
static final String INTENT_SCANSTATUS = "com.swordfish.scanstatus"
 
static final String BARCODE_EXTRA = "barcode"
 
static final String FORMAT_EXTRA = "format"
 
static final String TIME_EXTRA = "time"
 
static final int FRONT_CAMERA = Camera.CameraInfo.CAMERA_FACING_FRONT
 
static final int REAR_CAMERA = Camera.CameraInfo.CAMERA_FACING_BACK
 
static final int CAMERA_NOT_SET = -1
 
static final Creator< ScannerCREATOR
 
- Static Public Attributes inherited from Peripheral
static final String STATUS_CONNECTED = "com.verifone.peripherals.STATUS_CONNECTED"
 
static final String STATUS_READY = "com.verifone.peripherals.STATUS_READY"
 
static final String STATUS_BUSY = "com.verifone.peripherals.STATUS_BUSY"
 
static final String STATUS_DISCONNECTED = "com.verifone.peripherals.STATUS_DISCONNECTED"
 
static final String STATUS_DISCONNECTED_BY_UNDOCK
 
static final String STATUS_ERROR = "com.verifone.peripherals.STATUS_ERROR"
 
static final String STATUS_UNKNOWN = "com.verifone.peripherals.STATUS_UNKNOWN"
 
static final String USB_CONNECTION = "com.verifone.peripherals.USB_CONNECTION_TYPE"
 
static final String BLUETOOTH_CONNECTION
 
static final String WIFI_CONNECTION = "com.verifone.peripherals.WIFI_CONNECTION_TYPE"
 
static final String NETWORK_CONNECTION
 
static final String SERIAL_CONNECTION
 
static final String BUILTIN_CONNECTION
 
static final String UNKNOWN_CONNECTION
 

Detailed Description

The logical representation of the physical scanner.

Definition at line 24 of file Scanner.java.

Member Function Documentation

◆ endSession()

boolean endSession ( )

Releases the peripheral, allowing other applications to start using it.

Definition at line 402 of file Scanner.java.

◆ getAttributes()

HashMap<String, Object> getAttributes ( )

Returns the current mAttributes, or null if this peripheral does not support mAttributes, or an empty HashMap if none are applied and there are no defaults.

Definition at line 430 of file Scanner.java.

◆ getConnectionType()

String getConnectionType ( )

Returns the manner in which the Android peripheral service connects to the peripheral. The type of connection may change, as some peripherals may dock/undock, while other peripherals will be constant.

Definition at line 383 of file Scanner.java.

◆ getHardwareId()

String getHardwareId ( )

Generally returns the serial number or some other unique hardware identifier for the peripheral, or null if not available.

Definition at line 358 of file Scanner.java.

◆ getId()

String getId ( )

Returns a unique ID to identify this peripheral. This ID will be consistent across device disconnect/reconnect, restarts, and across all applications for this device, but may change during factory resets or if the peripheral is reset.

Definition at line 336 of file Scanner.java.

◆ getModel()

String getModel ( )

Returns the model as provided by the manufacturer, or null if not available.

Definition at line 350 of file Scanner.java.

◆ getName()

String getName ( )

Returns the name as assigned by the merchant, or getModel if the name is not set.

Definition at line 343 of file Scanner.java.

◆ getPeripheralType()

String getPeripheralType ( )

Returns the type of peripheral based on the constant

defined in the respective class.

Definition at line 366 of file Scanner.java.

◆ getStatus()

String getStatus ( )

Returns the current status of the peripheral. This may return one of the statuses listed above, or a peripheral-specific status.

Definition at line 374 of file Scanner.java.

◆ getSupportedBarcodeFormats()

List<String> getSupportedBarcodeFormats ( )

Get the list of supported barcode formats

Definition at line 314 of file Scanner.java.

◆ initiateScan()

String initiateScan ( HashMap< String, Object >  attributes)

API to initiate the scan

Parameters
attributesA HashMap of the attributes listed above.
Returns
The status of the scanner, generally STATUS_SCANNING or STATUS_READY, but can return other statuses in case of an error or another problem.

Definition at line 222 of file Scanner.java.

◆ isBuiltinCamera()

boolean isBuiltinCamera ( )

A convenience method to check if this scanner represents the tablet camera.

Definition at line 327 of file Scanner.java.

◆ isCapable()

boolean isCapable ( String  capability)

A method to check on peripheral-specific capabilities.

Definition at line 417 of file Scanner.java.

◆ startSession()

boolean startSession ( )

Starts a session with the peripheral, reserving it for use by this application.

Definition at line 390 of file Scanner.java.

Member Data Documentation

◆ ATTRIBUTE_ACTIVATE_LIGHT

final String ATTRIBUTE_ACTIVATE_LIGHT
static
Initial value:
= "com.verifone.peripherals" +
".ATTRIBUTE_ACTIVATE_LIGHT"

Use this attribute to enable/disable a light by setting it to a Boolean value.

Definition at line 93 of file Scanner.java.

◆ ATTRIBUTE_BARCODE

final String ATTRIBUTE_BARCODE = "com.verifone.peripherals.ATTRIBUTE_BARCODE"
static

Returns the barcode data as a String for a STATUS_BARCODE_DETECTED event.

Definition at line 52 of file Scanner.java.

◆ ATTRIBUTE_BARCODE_FORMAT

final String ATTRIBUTE_BARCODE_FORMAT
static
Initial value:
= "com.verifone.peripherals" +
".ATTRIBUTE_BARCODE_FORMAT"

Returns the detected barcode format as an Integer for a STATUS_BARCODE_DETECTED event.

Definition at line 56 of file Scanner.java.

◆ ATTRIBUTE_CONTINUOUS_SCAN

final String ATTRIBUTE_CONTINUOUS_SCAN
static
Initial value:
= "com.verifone.peripherals" +
".ATTRIBUTE_CONTINUOUS_SCAN"

Use this attribute to enable/disable continuous scanning by setting it to a Boolean value

Definition at line 62 of file Scanner.java.

◆ ATTRIBUTE_DISPLAY_FEED_PARENT

final String ATTRIBUTE_DISPLAY_FEED_PARENT
static
Initial value:
= "com.verifone.peripherals" +
".ATTRIBUTE_DISPLAY_FEED_PARENT"

Use this attribute to pass an Activity or Fragment which will contain the view from the scanner.

Definition at line 68 of file Scanner.java.

◆ ATTRIBUTE_PLAY_SOUND

final String ATTRIBUTE_PLAY_SOUND
static
Initial value:
= "com.verifone.peripherals" +
".ATTRIBUTE_PLAY_SOUND"

Use this attribute to enable/disable playing a sound when a barcode is scanned by setting it to a Boolean value.

Definition at line 79 of file Scanner.java.

◆ ATTRIBUTE_SCAN_AREA_LIMIT

final String ATTRIBUTE_SCAN_AREA_LIMIT
static
Initial value:
= "com.verifone.peripherals" +
".ATTRIBUTE_SCAN_AREA_LIMIT"

Use this attribute to pass a Rect object to limit the scanning area to a specific region.

Definition at line 73 of file Scanner.java.

◆ ATTRIBUTE_SET_DIRECTION

final String ATTRIBUTE_SET_DIRECTION
static
Initial value:
= "com.verifone.peripherals" +
".ATTRIBUTE_SET_DIRECTION"

Use this attribute to set the direction of the scanner, and receive the direction of the scanner for a STATUS_BARCODE_DETECTED event. When using for the camera, this is an Integer with the following values: 1 - Rear facing, no option to change. 2 - Rear facing, but the user can change direction. 3 - Forward facing, no option to change. 4 - Forward facing, but the user can change direction.

Definition at line 88 of file Scanner.java.

◆ ATTRIBUTE_VIEW_GRAVITY

final String ATTRIBUTE_VIEW_GRAVITY
static
Initial value:
= "com.verifone.peripherals" +
".ATTRIBUTE_VIEW_GRAVITY"

The capability to set viewfinder's gravity.

Definition at line 119 of file Scanner.java.

◆ CAPABILITY_ACTIVATE_LIGHT

final String CAPABILITY_ACTIVATE_LIGHT = "com.verifone.peripherals.CAPABILITY_LIGHT"
static

The capability to turn on a light for the scanning area. Generally only applicable to the built-in camera.

Definition at line 137 of file Scanner.java.

◆ CAPABILITY_CONTINUOUS_SCANNING

final String CAPABILITY_CONTINUOUS_SCANNING
static
Initial value:
= "com.verifone.peripherals" +
".CAPABILITY_CONTINUOUS_SCANNING"

The capability to continuously scan for barcodes and fire events for each barcode detected, or only scan one barcode at a time.

Definition at line 100 of file Scanner.java.

◆ CAPABILITY_DISPLAY_SCAN_FEED

final String CAPABILITY_DISPLAY_SCAN_FEED
static
Initial value:
= "com.verifone.peripherals" +
".CAPABILITY_DISPLAY_SCAN_FEED"

The capability to display in Android the view of the scanner. Generally only applicable to the built-in camera.

Definition at line 106 of file Scanner.java.

◆ CAPABILITY_LIMIT_SCAN_AREA

final String CAPABILITY_LIMIT_SCAN_AREA
static
Initial value:
= "com.verifone.peripherals" +
".CAPABILITY_LIMIT_SCAN_AREA"

The capability to reduce the scan area to a smaller subset of valid ranges. Generally only applicable to the built-in camera.

Definition at line 114 of file Scanner.java.

◆ CAPABILITY_PLAY_SCAN_SOUND

final String CAPABILITY_PLAY_SCAN_SOUND
static
Initial value:
= "com.verifone.peripherals" +
".CAPABILITY_PLAY_SCAN_SOUND"

The capability to play a sound or chime when a barcode is scanned.

Definition at line 125 of file Scanner.java.

◆ CAPABILITY_SET_SCAN_DIRECTION

final String CAPABILITY_SET_SCAN_DIRECTION
static
Initial value:
= "com.verifone.peripherals" +
".CAPABILITY_SET_SCAN_DIRECTION"

The capability to set the direction of the scanner. Generally only applicable to the built-in camera to switch between rear and forward facing.

Definition at line 131 of file Scanner.java.

◆ CREATOR

final Creator<Scanner> CREATOR
static
Initial value:
= new Creator<Scanner>() {
@Override
public Scanner createFromParcel(Parcel in) {
return new Scanner(in);
}
@Override
public Scanner[] newArray(int size) {
return new Scanner[size];
}
}

Definition at line 167 of file Scanner.java.

◆ PERIPHERAL_TYPE

final String PERIPHERAL_TYPE = "SCANNER"
static

The peripheral type used in Peripheral#getPeripheralType() getType()} and

Definition at line 30 of file Scanner.java.

◆ STATUS_BARCODE_DETECTED

final String STATUS_BARCODE_DETECTED
static
Initial value:
= "com.verifone.peripherals" +
".STATUS_BARCODE_DETECTED"

The scanner has found a barcode, and will include the relevant mAttributes. This status is never returned from getStatus, but can only be received by a listener.

Definition at line 46 of file Scanner.java.

◆ STATUS_SCANNING

final String STATUS_SCANNING = "com.verifone.peripherals.STATUS_SCANNING"
static

The scanner is looking for barcodes. As an example, in the case of the built-in camera, the camera is actively scanning the view area.

Definition at line 41 of file Scanner.java.

◆ STATUS_SUSPENDED

final String STATUS_SUSPENDED = "com.verifone.peripherals.STATUS_SUSPENDED"
static

An external scanner that is waiting to be activated, but is connected. This only applies to scanners that have a suspend/sleep mode, and is specific to the scanner hardware.

Definition at line 36 of file Scanner.java.


The documentation for this class was generated from the following file:

This document is the confidential property of Verifone, Inc. Any reproduction or distribution of this document, in whole or in part, or the disclosure of any of the information contained herein, without the prior written consent of Verifone, Inc. is prohibited. This document and any supplemental material supplied as part of any review must be returned to Verifone, Inc. upon request. Notice: This document may go through material revisions over time. While the Company will make every effort to keep readers updated as changes occur, care must be taken by the reader to make sure they are reading the latest version. Version numbers appear in the title page and revision history page of this document. All rights reserved. Verifone, the Verifone logo are either trademarks or registered trademarks of Verifone in the United States and/or other countries. All other trademarks or brand names are properties of their respective holders.