Grabba Driver for Android
Unified driver for Grabba devices on the Android operating system
BarcodeData Class Reference

Description

Class encapsulating barcode data plus the ID of the associated symbology.

This structure is used by BarcodeListener to deliver the results of successful barcode scans to the user.

Thread safety:

  • Static functions: safe
  • Concurrent accesses to distinct objects: safe
  • Concurrent accesses to same object: unsafe, unless all accesses are read-only (i.e. query functions)

Public Member Functions

 BarcodeData ()
 Construct with empty barcode data and unknown symbology.
 
 BarcodeData (@NonNull String initBarcode)
 Construct with given barcode data and unknown symbology. More...
 
 BarcodeData (@NonNull String initBarcode, @NonNull BarcodeSymbology initSymbology)
 Constructor - supplied barcode data and symbology. More...
 
String barcode ()
 Retrieve the barcode data as a string. More...
 
void setBarcode (@NonNull String newBarcode)
 Set the barcode data. More...
 
void setSymbologyID (@NonNull BarcodeSymbology newSymbology)
 Set the symbology ID. More...
 
BarcodeSymbology symbologyID ()
 Retrieve the symbology ID used by the barcode. More...
 
String symbologyName ()
 Retrieve the current symbology name as a string. More...
 

Static Public Member Functions

static String symbologyName (@NonNull BarcodeSymbology symb)
 Retrieve the name of a given symbology as a string. More...
 

Constructor & Destructor Documentation

◆ BarcodeData() [1/2]

BarcodeData ( @NonNull String  initBarcode)

Construct with given barcode data and unknown symbology.

Parameters
initBarcodeInitial barcode data, represented as a Java string (UTF-16)

◆ BarcodeData() [2/2]

BarcodeData ( @NonNull String  initBarcode,
@NonNull BarcodeSymbology  initSymbology 
)

Constructor - supplied barcode data and symbology.

Parameters
initBarcodeInitial value of barcode data field, represented as a Java string (UTF-16)
initSymbologyInitial value of symbology field

Member Function Documentation

◆ barcode()

String barcode ( )

Retrieve the barcode data as a string.

Returns
Barcode data in Java string (UTF-16) format

◆ setBarcode()

void setBarcode ( @NonNull String  newBarcode)

Set the barcode data.

Parameters
newBarcodeNew value of barcode data field, represented as a Java string (UTF-16)

◆ setSymbologyID()

void setSymbologyID ( @NonNull BarcodeSymbology  newSymbology)

Set the symbology ID.

Parameters
newSymbologyNew value of barcode symbology field

◆ symbologyID()

BarcodeSymbology symbologyID ( )

Retrieve the symbology ID used by the barcode.

Returns
Barcode symbology ID if known and detected, or BarcodeSymbology.UNKNOWN otherwise

◆ symbologyName() [1/2]

String symbologyName ( )

Retrieve the current symbology name as a string.

Returns
Name of symbology if known and detected, or "Unknown" otherwise

◆ symbologyName() [2/2]

static String symbologyName ( @NonNull BarcodeSymbology  symb)
static

Retrieve the name of a given symbology as a string.

Parameters
symbSymbology ID for which the name is to be retrieved
Returns
Name of the given symbology