Class DescriptorHelper


  • public class DescriptorHelper
    extends java.lang.Object
    Provides constants and utility methods related to GATT descriptors.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static ej.bluetooth.BluetoothUuid CCC_UUID
      UUID of the Client Characteristic Configuration descriptor.
      static ej.bluetooth.BluetoothUuid CUD_UUID
      UUID of the Characteristic User Description descriptor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean checkIndicationsEnabled​(byte[] value)
      Returns whether indications are enabled in the given CCC descriptor value.
      static boolean checkNotificationsEnabled​(byte[] value)
      Returns whether notifications are enabled in the given CCC descriptor value.
      static byte[] createCccValue​(boolean notificationsEnabled, boolean indicationsEnabled)
      Creates a CCC descriptor value specifying whether or not notifications and indications should be enabled.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CUD_UUID

        public static final ej.bluetooth.BluetoothUuid CUD_UUID
        UUID of the Characteristic User Description descriptor.
      • CCC_UUID

        public static final ej.bluetooth.BluetoothUuid CCC_UUID
        UUID of the Client Characteristic Configuration descriptor.
    • Method Detail

      • createCccValue

        public static byte[] createCccValue​(boolean notificationsEnabled,
                                            boolean indicationsEnabled)
        Creates a CCC descriptor value specifying whether or not notifications and indications should be enabled.
        Parameters:
        notificationsEnabled - whether notifications should be enabled.
        indicationsEnabled - whether indications should be enabled.
        Returns:
        the CCC descriptor value.
      • checkNotificationsEnabled

        public static boolean checkNotificationsEnabled​(byte[] value)
        Returns whether notifications are enabled in the given CCC descriptor value.
        Parameters:
        value - the value of the CCC descriptor.
        Returns:
        true if notifications are enabled, false otherwise.
      • checkIndicationsEnabled

        public static boolean checkIndicationsEnabled​(byte[] value)
        Returns whether indications are enabled in the given CCC descriptor value.
        Parameters:
        value - the value of the CCC descriptor.
        Returns:
        true if indications are enabled, false otherwise.