# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Constants | Inherited Constants | Fields | Ctors | Methods | Inherited Methods

# BluetoothGattCharacteristic

`public class BluetoothGattCharacteristic`
`extends Object` `implements Parcelable`

java.lang.Object
↳ | android.bluetooth.BluetoothGattCharacteristic

Represents a Bluetooth GATT Characteristic

A GATT characteristic is a basic data element used to construct a GATT service, `BluetoothGattService`. The characteristic contains a value as well as additional information and optional GATT descriptors, `BluetoothGattDescriptor`.

## Summary

### Constants
`int` | `FORMAT_FLOAT` Characteristic value format type float (32-bit float)
`int` | `FORMAT_SFLOAT` Characteristic value format type sfloat (16-bit float)
`int` | `FORMAT_SINT16` Characteristic value format type sint16
`int` | `FORMAT_SINT32` Characteristic value format type sint32
`int` | `FORMAT_SINT8` Characteristic value format type sint8
`int` | `FORMAT_UINT16` Characteristic value format type uint16
`int` | `FORMAT_UINT32` Characteristic value format type uint32
`int` | `FORMAT_UINT8` Characteristic value format type uint8
`int` | `PERMISSION_READ` Characteristic read permission
`int` | `PERMISSION_READ_ENCRYPTED` Characteristic permission: Allow encrypted read operations
`int` | `PERMISSION_READ_ENCRYPTED_MITM` Characteristic permission: Allow reading with man-in-the-middle protection
`int` | `PERMISSION_WRITE` Characteristic write permission
`int` | `PERMISSION_WRITE_ENCRYPTED` Characteristic permission: Allow encrypted writes
`int` | `PERMISSION_WRITE_ENCRYPTED_MITM` Characteristic permission: Allow encrypted writes with man-in-the-middle protection
`int` | `PERMISSION_WRITE_SIGNED` Characteristic permission: Allow signed write operations
`int` | `PERMISSION_WRITE_SIGNED_MITM` Characteristic permission: Allow signed write operations with man-in-the-middle protection
`int` | `PROPERTY_BROADCAST` Characteristic proprty: Characteristic is broadcastable.
`int` | `PROPERTY_EXTENDED_PROPS` Characteristic property: Characteristic has extended properties
`int` | `PROPERTY_INDICATE` Characteristic property: Characteristic supports indication
`int` | `PROPERTY_NOTIFY` Characteristic property: Characteristic supports notification
`int` | `PROPERTY_READ` Characteristic property: Characteristic is readable.
`int` | `PROPERTY_SIGNED_WRITE` Characteristic property: Characteristic supports write with signature
`int` | `PROPERTY_WRITE` Characteristic property: Characteristic can be written.
`int` | `PROPERTY_WRITE_NO_RESPONSE` Characteristic property: Characteristic can be written without response.
`int` | `WRITE_TYPE_DEFAULT` Write characteristic, requesting acknoledgement by the remote device
`int` | `WRITE_TYPE_NO_RESPONSE` Write characteristic without requiring a response by the remote device
`int` | `WRITE_TYPE_SIGNED` Write characteristic including authentication signature

### Inherited constants
From interface `android.os.Parcelable`
`int` | `CONTENTS_FILE_DESCRIPTOR` Descriptor bit used with `describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.
`int` | `PARCELABLE_WRITE_RETURN_VALUE` Flag for use with `writeToParcel(Parcel, int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`".

### Fields
`public static final Creator<BluetoothGattCharacteristic>` | `CREATOR`
`protected List<BluetoothGattDescriptor>` | `mDescriptors` List of descriptors included in this characteristic.

### Public constructors
`BluetoothGattCharacteristic(UUID uuid, int properties, int permissions)` Create a new BluetoothGattCharacteristic.

### Public methods
`boolean` | `addDescriptor(BluetoothGattDescriptor descriptor)` Adds a descriptor to this characteristic.
`int` | `describeContents()` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
`BluetoothGattDescriptor` | `getDescriptor(UUID uuid)` Returns a descriptor with a given UUID out of the list of descriptors for this characteristic.
`List<BluetoothGattDescriptor>` | `getDescriptors()` Returns a list of descriptors for this characteristic.
`Float` | `getFloatValue(int formatType, int offset)` Return the stored value of this characteristic.
`int` | `getInstanceId()` Returns the instance ID for this characteristic.
`Integer` | `getIntValue(int formatType, int offset)` Return the stored value of this characteristic.
`int` | `getPermissions()` Returns the permissions for this characteristic.
`int` | `getProperties()` Returns the properties of this characteristic.
`BluetoothGattService` | `getService()` Returns the service this characteristic belongs to.
`String` | `getStringValue(int offset)` Return the stored value of this characteristic.
`UUID` | `getUuid()` Returns the UUID of this characteristic
`byte[]` | `getValue()` Get the stored value for this characteristic.
`int` | `getWriteType()` Gets the write type for this characteristic.
`boolean` | `setValue(String value)` Set the locally stored value of this characteristic.
`boolean` | `setValue(int value, int formatType, int offset)` Set the locally stored value of this characteristic.
`boolean` | `setValue(byte[] value)` Updates the locally stored value of this characteristic.
`boolean` | `setValue(int mantissa, int exponent, int formatType, int offset)` Set the locally stored value of this characteristic.
`void` | `setWriteType(int writeType)` Set the write type for this characteristic Setting the write type of a characteristic determines how the `BluetoothGatt#writeCharacteristic` function write this characteristic.
`void` | `writeToParcel(Parcel out, int flags)` Flatten this object in to a Parcel.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.
From interface `android.os.Parcelable`
`abstract int` | `describeContents()` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
`abstract void` | `writeToParcel(Parcel dest, int flags)` Flatten this object in to a Parcel.

## Constants

### FORMAT_FLOAT

    public static final int FORMAT_FLOAT

Characteristic value format type float (32-bit float)

Constant Value: 52 (0x00000034)

### FORMAT_SFLOAT

    public static final int FORMAT_SFLOAT

Characteristic value format type sfloat (16-bit float)

Constant Value: 50 (0x00000032)

### FORMAT_SINT16

    public static final int FORMAT_SINT16

Characteristic value format type sint16

Constant Value: 34 (0x00000022)

### FORMAT_SINT32

    public static final int FORMAT_SINT32

Characteristic value format type sint32

Constant Value: 36 (0x00000024)

### FORMAT_SINT8

    public static final int FORMAT_SINT8

Characteristic value format type sint8

Constant Value: 33 (0x00000021)

### FORMAT_UINT16

    public static final int FORMAT_UINT16

Characteristic value format type uint16

Constant Value: 18 (0x00000012)

### FORMAT_UINT32

    public static final int FORMAT_UINT32

Characteristic value format type uint32

Constant Value: 20 (0x00000014)

### FORMAT_UINT8

    public static final int FORMAT_UINT8

Characteristic value format type uint8

Constant Value: 17 (0x00000011)

### PERMISSION_READ

    public static final int PERMISSION_READ

Characteristic read permission

Constant Value: 1 (0x00000001)

### PERMISSION_READ_ENCRYPTED

    public static final int PERMISSION_READ_ENCRYPTED

Characteristic permission: Allow encrypted read operations

Constant Value: 2 (0x00000002)

### PERMISSION_READ_ENCRYPTED_MITM

    public static final int PERMISSION_READ_ENCRYPTED_MITM

Characteristic permission: Allow reading with man-in-the-middle protection

Constant Value: 4 (0x00000004)

### PERMISSION_WRITE

    public static final int PERMISSION_WRITE

Characteristic write permission

Constant Value: 16 (0x00000010)

### PERMISSION_WRITE_ENCRYPTED

    public static final int PERMISSION_WRITE_ENCRYPTED

Characteristic permission: Allow encrypted writes

Constant Value: 32 (0x00000020)

### PERMISSION_WRITE_ENCRYPTED_MITM

    public static final int PERMISSION_WRITE_ENCRYPTED_MITM

Characteristic permission: Allow encrypted writes with man-in-the-middle protection

Constant Value: 64 (0x00000040)

### PERMISSION_WRITE_SIGNED

    public static final int PERMISSION_WRITE_SIGNED

Characteristic permission: Allow signed write operations

Constant Value: 128 (0x00000080)

### PERMISSION_WRITE_SIGNED_MITM

    public static final int PERMISSION_WRITE_SIGNED_MITM

Characteristic permission: Allow signed write operations with man-in-the-middle protection

Constant Value: 256 (0x00000100)

### PROPERTY_BROADCAST

    public static final int PROPERTY_BROADCAST

Characteristic proprty: Characteristic is broadcastable.

Constant Value: 1 (0x00000001)

### PROPERTY_EXTENDED_PROPS

    public static final int PROPERTY_EXTENDED_PROPS

Characteristic property: Characteristic has extended properties

Constant Value: 128 (0x00000080)

### PROPERTY_INDICATE

    public static final int PROPERTY_INDICATE

Characteristic property: Characteristic supports indication

Constant Value: 32 (0x00000020)

### PROPERTY_NOTIFY

    public static final int PROPERTY_NOTIFY

Characteristic property: Characteristic supports notification

Constant Value: 16 (0x00000010)

### PROPERTY_READ

    public static final int PROPERTY_READ

Characteristic property: Characteristic is readable.

Constant Value: 2 (0x00000002)

### PROPERTY_SIGNED_WRITE

    public static final int PROPERTY_SIGNED_WRITE

Characteristic property: Characteristic supports write with signature

Constant Value: 64 (0x00000040)

### PROPERTY_WRITE

    public static final int PROPERTY_WRITE

Characteristic property: Characteristic can be written.

Constant Value: 8 (0x00000008)

### PROPERTY_WRITE_NO_RESPONSE

    public static final int PROPERTY_WRITE_NO_RESPONSE

Characteristic property: Characteristic can be written without response.

Constant Value: 4 (0x00000004)

### WRITE_TYPE_DEFAULT

    public static final int WRITE_TYPE_DEFAULT

Write characteristic, requesting acknoledgement by the remote device

Constant Value: 2 (0x00000002)

### WRITE_TYPE_NO_RESPONSE

    public static final int WRITE_TYPE_NO_RESPONSE

Write characteristic without requiring a response by the remote device

Constant Value: 1 (0x00000001)

### WRITE_TYPE_SIGNED

    public static final int WRITE_TYPE_SIGNED

Write characteristic including authentication signature

Constant Value: 4 (0x00000004)

## Fields

### CREATOR

    public static final Creator<BluetoothGattCharacteristic> CREATOR

### mDescriptors

    protected List<BluetoothGattDescriptor> mDescriptors

List of descriptors included in this characteristic.

## Public constructors

### BluetoothGattCharacteristic

    public BluetoothGattCharacteristic (UUID uuid,
                    int properties,
                    int permissions)

Create a new BluetoothGattCharacteristic.

Requires `Manifest.permission.BLUETOOTH` permission.

Parameters
`uuid` | `UUID`: The UUID for this characteristic
`properties` | `int`: Properties of this characteristic
`permissions` | `int`: Permissions for this characteristic

## Public methods

### addDescriptor

    public boolean addDescriptor (BluetoothGattDescriptor descriptor)

Adds a descriptor to this characteristic.

Requires `Manifest.permission.BLUETOOTH` permission.

Parameters
`descriptor` | `BluetoothGattDescriptor`: Descriptor to be added to this characteristic.

Returns
`boolean` | true, if the descriptor was added to the characteristic

### describeContents

    public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of `writeToParcel(android.os.Parcel, int)`, the return value of this method must include the `CONTENTS_FILE_DESCRIPTOR` bit.

Returns
`int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or `CONTENTS_FILE_DESCRIPTOR`

### getDescriptor

    public BluetoothGattDescriptor getDescriptor (UUID uuid)

Returns a descriptor with a given UUID out of the list of descriptors for this characteristic.

Parameters
`uuid` | `UUID`

Returns
`BluetoothGattDescriptor` | GATT descriptor object or null if no descriptor with the given UUID was found.

### getDescriptors

    public List<BluetoothGattDescriptor> getDescriptors ()

Returns a list of descriptors for this characteristic.

Returns
`List<BluetoothGattDescriptor>` | Descriptors for this characteristic

### getFloatValue

    public Float getFloatValue (int formatType,
                    int offset)

Return the stored value of this characteristic.

See `getValue()` for details.

Parameters
`formatType` | `int`: The format type used to interpret the characteristic value.
`offset` | `int`: Offset at which the float value can be found.

Returns
`Float` | Cached value of the characteristic at a given offset or null if the requested offset exceeds the value size.

### getInstanceId

    public int getInstanceId ()

Returns the instance ID for this characteristic.

If a remote device offers multiple characteristics with the same UUID, the instance ID is used to distuinguish between characteristics.

Returns
`int` | Instance ID of this characteristic

### getIntValue

    public Integer getIntValue (int formatType,
                    int offset)

Return the stored value of this characteristic.

The formatType parameter determines how the characteristic value is to be interpreted. For example, settting formatType to `FORMAT_UINT16` specifies that the first two bytes of the characteristic value at the given offset are interpreted to generate the return value.

Parameters
`formatType` | `int`: The format type used to interpret the characteristic value.
`offset` | `int`: Offset at which the integer value can be found.

Returns
`Integer` | Cached value of the characteristic or null of offset exceeds value size.

### getPermissions

    public int getPermissions ()

Returns the permissions for this characteristic.

Returns
`int` | Permissions of this characteristic

### getProperties

    public int getProperties ()

Returns the properties of this characteristic.

The properties contain a bit mask of property flags indicating the features of this characteristic.

Returns
`int` | Properties of this characteristic

### getService

    public BluetoothGattService getService ()

Returns the service this characteristic belongs to.

Returns
`BluetoothGattService` | The asscociated service

### getStringValue

    public String getStringValue (int offset)

Return the stored value of this characteristic.

See `getValue()` for details.

Parameters
`offset` | `int`: Offset at which the string value can be found.

Returns
`String` | Cached value of the characteristic

### getUuid

    public UUID getUuid ()

Returns the UUID of this characteristic

Returns
`UUID` | UUID of this characteristic

### getValue

    public byte[] getValue ()

Get the stored value for this characteristic.

This function returns the stored value for this characteristic as retrieved by calling `BluetoothGatt#readCharacteristic`. The cached value of the characteristic is updated as a result of a read characteristic operation or if a characteristic update notification has been received.

Returns
`byte[]` | Cached value of the characteristic

### getWriteType

    public int getWriteType ()

Gets the write type for this characteristic.

Returns
`int` | Write type for this characteristic

### setValue

    public boolean setValue (String value)

Set the locally stored value of this characteristic.

See `setValue(byte[])` for details.

Parameters
`value` | `String`: New value for this characteristic

Returns
`boolean` | true if the locally stored value has been set

### setValue

    public boolean setValue (int value,
                    int formatType,
                    int offset)

Set the locally stored value of this characteristic.

See `setValue(byte[])` for details.

Parameters
`value` | `int`: New value for this characteristic
`formatType` | `int`: Integer format type used to transform the value parameter
`offset` | `int`: Offset at which the value should be placed

Returns
`boolean` | true if the locally stored value has been set

### setValue

    public boolean setValue (byte[] value)

Updates the locally stored value of this characteristic.

This function modifies the locally stored cached value of this characteristic. To send the value to the remote device, call `BluetoothGatt#writeCharacteristic` to send the value to the remote device.

Parameters
`value` | `byte`: New value for this characteristic

Returns
`boolean` | true if the locally stored value has been set, false if the requested value could not be stored locally.

### setValue

    public boolean setValue (int mantissa,
                    int exponent,
                    int formatType,
                    int offset)

Set the locally stored value of this characteristic.

See `setValue(byte[])` for details.

Parameters
`mantissa` | `int`: Mantissa for this characteristic
`exponent` | `int`: exponent value for this characteristic
`formatType` | `int`: Float format type used to transform the value parameter
`offset` | `int`: Offset at which the value should be placed

Returns
`boolean` | true if the locally stored value has been set

### setWriteType

    public void setWriteType (int writeType)

Set the write type for this characteristic

Setting the write type of a characteristic determines how the `BluetoothGatt#writeCharacteristic` function write this characteristic.

Parameters
`writeType` | `int`: The write type to for this characteristic. Can be one of: `WRITE_TYPE_DEFAULT`, `WRITE_TYPE_NO_RESPONSE` or `WRITE_TYPE_SIGNED`.

### writeToParcel

    public void writeToParcel (Parcel out,
                    int flags)

Flatten this object in to a Parcel.

Parameters
`out` | `Parcel`: The Parcel in which the object should be written.
`flags` | `int`: Additional flags about how the object should be written. May be 0 or `Parcelable.PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of `Parcelable.PARCELABLE_WRITE_RETURN_VALUE`, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*