Class AndroidBleService

java.lang.Object
com.gluonhq.attach.ble.impl.AndroidBleService
All Implemented Interfaces:
BleService

public class AndroidBleService extends Object implements BleService
Android implementation of BleService
  • Constructor Details

    • AndroidBleService

      public AndroidBleService()
  • Method Details

    • startScanning

      public void startScanning(Configuration region, Consumer<ScanDetection> callback)
      Description copied from interface: BleService
      Start scanning for BLE beacons. When such a device is discovered, the callback will be called with the detailed information on the detected beacon. Note that this method can be called multiple times. In order to stop receiving notifications, the stopScanning method should be used.
      Specified by:
      startScanning in interface BleService
      Parameters:
      region - provide setting options to filter the beacons to be scanned
      callback - provided function that will be called once a beacon is detected
    • stopScanning

      public void stopScanning()
      Description copied from interface: BleService
      Stops the last called startScanning operation.
      Specified by:
      stopScanning in interface BleService
    • startBroadcasting

      public void startBroadcasting(UUID beaconUUID, int major, int minor, String identifier)
      Description copied from interface: BleService
      Configure the current device as a Bluetooth beacon, and start advertising with a given UUID
      Specified by:
      startBroadcasting in interface BleService
      Parameters:
      beaconUUID - the UUID of the beacon that will be advertised
      major - the most significant value
      minor - the least significant value
      identifier - a string to identify the beacon
    • stopBroadcasting

      public void stopBroadcasting()
      Description copied from interface: BleService
      Stop advertising the current iOS device as a Bluetooth beacon
      Specified by:
      stopBroadcasting in interface BleService
    • startScanningDevices

      public javafx.collections.ObservableList<BleDevice> startScanningDevices()
      Description copied from interface: BleService
      Start scanning for BLE Devices.
      Specified by:
      startScanningDevices in interface BleService
      Returns:
      an observable list of BleDevice found
    • stopScanningDevices

      public void stopScanningDevices()
      Description copied from interface: BleService
      Stops scanning for BLE devices
      Specified by:
      stopScanningDevices in interface BleService
    • connect

      public void connect(BleDevice device)
      Description copied from interface: BleService
      Connects to a given BLE device
      Specified by:
      connect in interface BleService
      Parameters:
      device - The BleDevice to connect to
    • disconnect

      public void disconnect(BleDevice device)
      Description copied from interface: BleService
      Disconnects from a given BLE device
      Specified by:
      disconnect in interface BleService
      Parameters:
      device - The BleDevice to disconnect from
    • readCharacteristic

      public void readCharacteristic(BleDevice device, UUID uuidProfile, UUID uuidCharacteristic)
      Description copied from interface: BleService
      Given a BleDevice, with a given BleProfile and a given BleCharacteristic, reads its value
      Specified by:
      readCharacteristic in interface BleService
      Parameters:
      device - The connected BleDevice
      uuidProfile - The UUID that identifies the BLE Profile
      uuidCharacteristic - The UUID that identifies the BLE Characteristic
    • writeCharacteristic

      public void writeCharacteristic(BleDevice device, UUID uuidProfile, UUID uuidCharacteristic, byte[] value)
      Description copied from interface: BleService
      Given a BleDevice, with a given BleProfile and a given BleCharacteristic, writes its value
      Specified by:
      writeCharacteristic in interface BleService
      Parameters:
      device - The connected BleDevice
      uuidProfile - The UUID that identifies the BLE Profile
      uuidCharacteristic - The UUID that identifies the BLE Characteristic
      value - a new value for the Ble Characteristic
    • subscribeCharacteristic

      public void subscribeCharacteristic(BleDevice device, UUID uuidProfile, UUID uuidCharacteristic)
      Description copied from interface: BleService
      Given a BleDevice, with a given BleProfile and a given BleCharacteristic, subscribes to listen to changes in its value
      Specified by:
      subscribeCharacteristic in interface BleService
      Parameters:
      device - The connected BleDevice
      uuidProfile - The UUID that identifies the BLE Profile
      uuidCharacteristic - The UUID that identifies the BLE Characteristic
    • unsubscribeCharacteristic

      public void unsubscribeCharacteristic(BleDevice device, UUID uuidProfile, UUID uuidCharacteristic)
      Description copied from interface: BleService
      Given a BleDevice, with a given BleProfile and a given BleCharacteristic, unsubscribes and stop listening to changes in its value
      Specified by:
      unsubscribeCharacteristic in interface BleService
      Parameters:
      device - The connected BleDevice
      uuidProfile - The UUID that identifies the BLE Profile
      uuidCharacteristic - The UUID that identifies the BLE Characteristic