Package com.abc.bluetoothTerminalfactory
Class AbCircleBluetoothTerminalManager
java.lang.Object
com.abc.bluetoothTerminalfactory.AbCircleBluetoothTerminalManager
The
AbCircleBluetoothTerminalManager class manages AB Circle Bluetooth card terminals and is passed as a parameter to obtain a terminalFactory-
Constructor Summary
ConstructorsConstructorDescriptionAbCircleBluetoothTerminalManager(Context context) TheBluetoothTerminalManagerclass manages card getTerminals and uses as a parameter to initialize AB Circle Bluetooth provider. -
Method Summary
Modifier and TypeMethodDescriptionvoidConnectByMacAddress(String address) Attempt to connect to ABC reader by MAC addressstatic voiddisablePPS(boolean disable) This function is used to disable the PPS featurevoidDisconnect(CardTerminal cardTerminal) Disconnect Bluetooth Card TerminalvoidDiscover Surrounding Bluetooth Readersprotected voidfinalize()booleanFlag indicating if the ACK protocol is enabled or not for connected readers that support it.This function returns a list of discovered readersprotected voidonResume()This method re-initializes bluetooth after activity resume from stopprotected voidonStop()This method disconnects bluetooth terminals when the activity stopsvoidScan for bluetooth devices, stops after 10 secondsvoidScanBluetooth(long scanDuration) Scan for bluetooth devices, stops afterscanDurationmilliseconds (10 second = 10000ms)voidScanBluetooth(long scanDuration, String name) Scan for bluetooth devices, stops afterscanDurationmilliseconds (10 second = 10000ms), Filter by name (case insensitive)voidScanBluetooth(String name) Scan for bluetooth devices, filters by reader name stops after 10 seconds Filter by name (case insensitive)voidsetACKProtocolEnabledForReaders(boolean enable) Flag indicating if the ACK protocol should be enabled or not for connected readers that support it.voidSetBluetoothRssiFilter(int rssiValue) Set RssiFiltervoidSetEncryptionKey(byte[] bytes) This MethodSetEncryptionKeyallows Encryption key customisation:
null = default standard key
Custom key should be 16 bytes long
e.g.voidStartReaderDiscovery(int scanDuration) Discover bluetooth devices, stops afterscanDurationmilliseconds (10 second = 10000ms).voidStartReaderDiscovery(int scanDuration, ReaderDiscoveredCallback callback) Start the bluetooth devices discovery process, stops afterscanDurationmilliseconds (10 second = 10000ms).voidStop Reader Discovery
-
Constructor Details
-
AbCircleBluetoothTerminalManager
public AbCircleBluetoothTerminalManager(Context context) TheBluetoothTerminalManagerclass manages card getTerminals and uses as a parameter to initialize AB Circle Bluetooth provider.
-
-
Method Details
-
setACKProtocolEnabledForReaders
public void setACKProtocolEnabledForReaders(boolean enable) Flag indicating if the ACK protocol should be enabled or not for connected readers that support it. The ACK protocol uses ACK and NAK packets to try to further stabilise communication and enables the possibility to recover communication errors in most cases.
Notes:
- The setting will only be applied to newly connected readers
- The ACK protocol is only supported for readers with firmware version 109.00 or above
- Default is disabled (false)- Parameters:
enable- true to enable the setting or false to disable it.
-
getACKProtocolEnabledForReaders
public boolean getACKProtocolEnabledForReaders()Flag indicating if the ACK protocol is enabled or not for connected readers that support it. The ACK protocol uses ACK and NAK packets to try to further stabilise communication and enables the possibility to recover communication errors in most cases.
Notes:
- The setting is only valid for newly connected readers
- The ACK protocol is only supported for readers with firmware version 109.00 or above -
SetEncryptionKey
This MethodSetEncryptionKeyallows Encryption key customisation:
null = default standard key
Custom key should be 16 bytes long
e.g. new byte[]{0x41, 0x52, 0x62, 0x65, 0x63, 0x61, 0x31, 0x64, 0x35, 0x65, 0x33, 0x72, 0x38, 0x43, 0x4d, 0x4b}- Parameters:
bytes- 16 byte encryption key- Throws:
IllegalArgumentException
-
StartReaderDiscovery
Start the bluetooth devices discovery process, stops afterscanDurationmilliseconds (10 second = 10000ms).- Parameters:
scanDuration- Scan Duration in millisecondscallback- Callback when a reader is discovered
-
StartReaderDiscovery
public void StartReaderDiscovery(int scanDuration) Discover bluetooth devices, stops afterscanDurationmilliseconds (10 second = 10000ms).- Parameters:
scanDuration- Scan Duration in milliseconds
-
StopReaderDiscovery
public void StopReaderDiscovery()Stop Reader Discovery -
GetReaderDiscoveryList
This function returns a list of discovered readers- Returns:
- A list of discovered readers.
-
ScanBluetooth
public void ScanBluetooth()Scan for bluetooth devices, stops after 10 seconds -
ScanBluetooth
public void ScanBluetooth(long scanDuration) Scan for bluetooth devices, stops afterscanDurationmilliseconds (10 second = 10000ms)- Parameters:
scanDuration- Scan Duration in milliseconds
-
ConnectByMacAddress
Attempt to connect to ABC reader by MAC address- Parameters:
address- Valid Bluetooth hardware addresses must be upper case, in a format such as "00:11:22:33:AA:BB".
-
DiscoverBluetoothDevices
Discover Surrounding Bluetooth Readers- Parameters:
name- Filter reader by name
-
ScanBluetooth
Scan for bluetooth devices, filters by reader name stops after 10 seconds Filter by name (case insensitive)- Parameters:
name- Filter reader by name
-
SetBluetoothRssiFilter
public void SetBluetoothRssiFilter(int rssiValue) Set RssiFilter- Parameters:
rssiValue- Filter reader by rssi strength e.g. -50 for (~0.5m) -60 for (~1.0m)
-
ScanBluetooth
Scan for bluetooth devices, stops afterscanDurationmilliseconds (10 second = 10000ms), Filter by name (case insensitive)- Parameters:
scanDuration- Scan Duration in millisecondsname- Filter reader by name
-
Disconnect
Disconnect Bluetooth Card Terminal- Parameters:
cardTerminal- terminal to disconnect
-
disablePPS
public static void disablePPS(boolean disable) This function is used to disable the PPS feature- Parameters:
disable- If set to true, the PPS feature will be disabled.
-
onStop
protected void onStop()This method disconnects bluetooth terminals when the activity stops -
onResume
protected void onResume()This method re-initializes bluetooth after activity resume from stop -
finalize
protected void finalize()
-