Class AbCircleBluetoothTerminalManager

java.lang.Object
com.abc.bluetoothTerminalfactory.AbCircleBluetoothTerminalManager

public class AbCircleBluetoothTerminalManager extends Object
The AbCircleBluetoothTerminalManager class manages AB Circle Bluetooth card terminals and is passed as a parameter to obtain a terminalFactory
  • Constructor Summary

    Constructors
    Constructor
    Description
    The BluetoothTerminalManager class manages card getTerminals and uses as a parameter to initialize AB Circle Bluetooth provider.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Attempt to connect to ABC reader by MAC address
    static void
    disablePPS(boolean disable)
    This function is used to disable the PPS feature
    void
    Disconnect(CardTerminal cardTerminal)
    Disconnect Bluetooth Card Terminal
    void
    Discover Surrounding Bluetooth Readers
    protected void
     
    boolean
    Flag indicating if the ACK protocol is enabled or not for connected readers that support it.
    This function returns a list of discovered readers
    protected void
    This method re-initializes bluetooth after activity resume from stop
    protected void
    This method disconnects bluetooth terminals when the activity stops
    void
    Scan for bluetooth devices, stops after 10 seconds
    void
    ScanBluetooth(long scanDuration)
    Scan for bluetooth devices, stops after scanDuration milliseconds (10 second = 10000ms)
    void
    ScanBluetooth(long scanDuration, String name)
    Scan for bluetooth devices, stops after scanDuration milliseconds (10 second = 10000ms), Filter by name (case insensitive)
    void
    Scan for bluetooth devices, filters by reader name stops after 10 seconds Filter by name (case insensitive)
    void
    Flag indicating if the ACK protocol should be enabled or not for connected readers that support it.
    void
    SetBluetoothRssiFilter(int rssiValue)
    Set RssiFilter
    void
    SetEncryptionKey(byte[] bytes)
    This Method SetEncryptionKey allows Encryption key customisation:
    null = default standard key
    Custom key should be 16 bytes long
    e.g.
    void
    StartReaderDiscovery(int scanDuration)
    Discover bluetooth devices, stops after scanDuration milliseconds (10 second = 10000ms).
    void
    StartReaderDiscovery(int scanDuration, ReaderDiscoveredCallback callback)
    Start the bluetooth devices discovery process, stops after scanDuration milliseconds (10 second = 10000ms).
    void
    Stop Reader Discovery

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbCircleBluetoothTerminalManager

      public AbCircleBluetoothTerminalManager(Context context)
      The BluetoothTerminalManager class 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

      public void SetEncryptionKey(byte[] bytes) throws IllegalArgumentException
      This Method SetEncryptionKey allows 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

      public void StartReaderDiscovery(int scanDuration, ReaderDiscoveredCallback callback)
      Start the bluetooth devices discovery process, stops after scanDuration milliseconds (10 second = 10000ms).
      Parameters:
      scanDuration - Scan Duration in milliseconds
      callback - Callback when a reader is discovered
    • StartReaderDiscovery

      public void StartReaderDiscovery(int scanDuration)
      Discover bluetooth devices, stops after scanDuration milliseconds (10 second = 10000ms).
      Parameters:
      scanDuration - Scan Duration in milliseconds
    • StopReaderDiscovery

      public void StopReaderDiscovery()
      Stop Reader Discovery
    • GetReaderDiscoveryList

      public List<DiscoveredReader> 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 after scanDuration milliseconds (10 second = 10000ms)
      Parameters:
      scanDuration - Scan Duration in milliseconds
    • ConnectByMacAddress

      public void ConnectByMacAddress(String address)
      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

      public void DiscoverBluetoothDevices(String name)
      Discover Surrounding Bluetooth Readers
      Parameters:
      name - Filter reader by name
    • ScanBluetooth

      public void ScanBluetooth(String name)
      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

      public void ScanBluetooth(long scanDuration, String name)
      Scan for bluetooth devices, stops after scanDuration milliseconds (10 second = 10000ms), Filter by name (case insensitive)
      Parameters:
      scanDuration - Scan Duration in milliseconds
      name - Filter reader by name
    • Disconnect

      public void Disconnect(CardTerminal cardTerminal)
      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()
      Overrides:
      finalize in class Object