public class GattLocalCharacteristic

  1. Object
  2. GattLocalCharacteristic
A characteristic definition of a local GattLocalService served by this device’s GattServer. Properties use the GattCharacteristic``.PROPERTY_* bits; access permissions use the PERMISSION_* bits defined here.

Fields

public static final int PERMISSION_READ = 1The characteristic may be read (bit 0x01).
public static final int PERMISSION_READ_ENCRYPTED = 2The characteristic may be read over an encrypted link only (bit 0x02).
public static final int PERMISSION_WRITE = 16The characteristic may be written (bit 0x10).
public static final int PERMISSION_WRITE_ENCRYPTED = 32The characteristic may be written over an encrypted link only (bit 0x20).

Constructors

public GattLocalCharacteristic(BluetoothUuid uuid, int properties, int permissions)Creates a characteristic definition.

Methods

public GattLocalCharacteristic setValue(byte[] staticValue)Serves a static value without routing read requests to the GattServerListener.
public GattLocalCharacteristic addDescriptor(GattLocalDescriptor d)Adds a descriptor definition.
public BluetoothUuid getUuid()The UUID identifying this characteristic.
public int getProperties()The GattCharacteristic``.PROPERTY_* bitmask.
public int getPermissions()The PERMISSION_* bitmask.
public byte[] getValue()The static value, or null when reads are served via the GattServerListener.
public List<GattLocalDescriptor> getDescriptors()The descriptor definitions added via addDescriptor(GattLocalDescriptor).
public String toString()Returns a string representation of the object.

Inherited methods

Field details

PERMISSION_READ

public static final int PERMISSION_READ = 1
The characteristic may be read (bit 0x01).

PERMISSION_READ_ENCRYPTED

public static final int PERMISSION_READ_ENCRYPTED = 2
The characteristic may be read over an encrypted link only (bit 0x02).

PERMISSION_WRITE

public static final int PERMISSION_WRITE = 16
The characteristic may be written (bit 0x10).

PERMISSION_WRITE_ENCRYPTED

public static final int PERMISSION_WRITE_ENCRYPTED = 32
The characteristic may be written over an encrypted link only (bit 0x20).

Constructor details

GattLocalCharacteristic

public GattLocalCharacteristic(BluetoothUuid uuid, int properties, int permissions)
Creates a characteristic definition. properties uses GattCharacteristic``.PROPERTY_* bits; permissions uses the PERMISSION_* bits of this class.

Method details

setValue

public GattLocalCharacteristic setValue(byte[] staticValue)
Serves a static value without routing read requests to the GattServerListener. Without a static value, every read arrives as a GattReadRequest.

addDescriptor

public GattLocalCharacteristic addDescriptor(GattLocalDescriptor d)
Adds a descriptor definition.

getUuid

public BluetoothUuid getUuid()
The UUID identifying this characteristic.

getProperties

public int getProperties()
The GattCharacteristic``.PROPERTY_* bitmask.

getPermissions

public int getPermissions()
The PERMISSION_* bitmask.

getValue

public byte[] getValue()
The static value, or null when reads are served via the GattServerListener.

getDescriptors

public List<GattLocalDescriptor> getDescriptors()
The descriptor definitions added via addDescriptor(GattLocalDescriptor).

toString

public String toString()
Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + ‘@’ + Integer.toHexString(hashCode())