Class BleBattClient

    • Method Detail

      • processServiceData

         Unit processServiceData(UUID characteristic, ByteArray data, Integer status, Boolean notifying)

        Callback for GATT service characteristic data processing

        Parameters:
        characteristic - characteristic UUID
        data - data in byte array
        status - status code of processed data
        notifying - if true data is notification data from GATT service
      • monitorBatteryStatus

         final Flow<Integer> monitorBatteryStatus(Boolean checkConnection)

        Get flow for monitoring battery status updates on connected device

        Parameters:
        checkConnection - false = connection is not check before observer added, true = connection is check
        Returns:

        Flow stream

      • monitorChargingStatus

         final Flow<ChargeState> monitorChargingStatus(Boolean checkConnection)

        Get flow for monitoring charging status updates on connected device. Requires BLE BAS v1.1

        Parameters:
        checkConnection - false = connection is not check before observer added, true = connection is check
        Returns:

        Flow stream emitting ChargeState

      • monitorPowerSourcesState

         final Flow<PowerSourcesState> monitorPowerSourcesState(Boolean checkConnection)

        Get flow for monitoring power sources updates on connected device. Requires BLE BAS v1.1. Exposes battery present, wired and wireless power source connected statuses.

        Parameters:
        checkConnection - false = connection is not check before observer added, true = connection is check
        Returns:

        Flow stream emitting PowerSourcesState

      • getBatteryLevel

         final Integer getBatteryLevel()

        Get last observed battery status on connected device Requires BLE BAS v1.1

        Returns:

        Returns the last known battery level as a percentage from 0% to 100% or -1 if value is not set

      • getChargerStatus

         final ChargeState getChargerStatus()

        Get last observed charge status on connected device Requires BLE BAS v1.1

        Returns:

        Returns the last known charge status as ChargeState