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

Description

Provides access to button states of connected Grabba devices.

This API provides access to the driver's button functionality, which is present on all Grabba devices.

Current hardware models have two buttons - one on the left side of the device, the other on the right. This API may be expanded if future models have additional buttons.

Callbacks to user-provided code may be triggered when the user presses or releases a button on a connected device. Refer to the ButtonListener class for details of these callbacks and how to enable or disable them.

In addition, each button may be configured to control barcode or proxcard scanning. The default behaviour is to only trigger callbacks, but the setLeftButtonBehaviour() and setRightButtonBehaviour() functions allow for enabling or disabling press-to-scan functionality.

Calls to this class will not succeed until a connection to a Grabba device has been established. Refer to the CoreAPI class for details of how to establish or query this connection.

Thread safety: This class is fully thread-safe.

Note
This class has no non-static methods or data; consequently, object creation is disabled.

Classes

enum  ButtonBehaviour
 Enumeration of supported button behaviours. More...
 

Static Public Member Functions

static ButtonBehaviour leftButtonBehaviour ()
 Query the current behaviour of the left button. More...
 
static boolean leftButtonState ()
 Query the left button state of a connected Grabba device. More...
 
static ButtonBehaviour rightButtonBehaviour ()
 Query the current behaviour of the right button. More...
 
static boolean rightButtonState ()
 Query the right button state of a connected Grabba device. More...
 
static void setLeftButtonBehaviour (ButtonBehaviour behaviour)
 Set new behaviour for the left button. More...
 
static void setRightButtonBehaviour (ButtonBehaviour behaviour)
 Set new behaviour for the right button. More...
 

Member Function Documentation

◆ leftButtonBehaviour()

static ButtonBehaviour leftButtonBehaviour ( )
static

Query the current behaviour of the left button.

Returns
Currently-configured behaviour of the left button; default is ButtonBehaviour.CALLBACK_ONLY

◆ leftButtonState()

static boolean leftButtonState ( )
static

Query the left button state of a connected Grabba device.

This is a non-blocking call; the button states are cached internally by the driver.

Returns
True if a device is connected and its left button is currently being pressed; false otherwise.

◆ rightButtonBehaviour()

static ButtonBehaviour rightButtonBehaviour ( )
static

Query the current behaviour of the right button.

Returns
Currently-configured behaviour of the right button; default is ButtonBehaviour.CALLBACK_ONLY

◆ rightButtonState()

static boolean rightButtonState ( )
static

Query the right button state of a connected Grabba device.

This is a non-blocking call; the button states are cached internally by the driver.

Returns
True if a device is connected and its right button is currently being pressed; false otherwise.

◆ setLeftButtonBehaviour()

static void setLeftButtonBehaviour ( ButtonBehaviour  behaviour)
static

Set new behaviour for the left button.

Parameters
behaviourNew behaviour for the left button. ButtonBehaviour.CALLBACK_ONLY is the initial value.

◆ setRightButtonBehaviour()

static void setRightButtonBehaviour ( ButtonBehaviour  behaviour)
static

Set new behaviour for the right button.

Parameters
behaviourNew behaviour for the right button. ButtonBehaviour.CALLBACK_ONLY is the initial value.