Example usage for android.bluetooth BluetoothGattCharacteristic PROPERTY_READ

List of usage examples for android.bluetooth BluetoothGattCharacteristic PROPERTY_READ

Introduction

In this page you can find the example usage for android.bluetooth BluetoothGattCharacteristic PROPERTY_READ.

Prototype

int PROPERTY_READ

To view the source code for android.bluetooth BluetoothGattCharacteristic PROPERTY_READ.

Click Source Link

Document

Characteristic property: Characteristic is readable.

Usage

From source file:org.bcsphere.bluetooth.tools.Tools.java

public static JSONArray decodeProperty(int property) {
    JSONArray properties = new JSONArray();
    String strProperty = null;/* www  .  ja  v  a  2s .c o  m*/
    if ((strProperty = lookup(property, BluetoothGattCharacteristic.PROPERTY_BROADCAST)) != null) {
        properties.put(strProperty);
    }
    if ((strProperty = lookup(property, BluetoothGattCharacteristic.PROPERTY_READ)) != null) {
        properties.put(strProperty);
    }
    if ((strProperty = lookup(property, BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE)) != null) {
        properties.put(strProperty);
    }
    if ((strProperty = lookup(property, BluetoothGattCharacteristic.PROPERTY_WRITE)) != null) {
        properties.put(strProperty);
    }
    if ((strProperty = lookup(property, BluetoothGattCharacteristic.PROPERTY_NOTIFY)) != null) {
        properties.put(strProperty);
    }
    if ((strProperty = lookup(property, BluetoothGattCharacteristic.PROPERTY_INDICATE)) != null) {
        properties.put(strProperty);
    }
    if ((strProperty = lookup(property, BluetoothGattCharacteristic.PROPERTY_SIGNED_WRITE)) != null) {
        properties.put(strProperty);
    }
    if ((strProperty = lookup(property, BluetoothGattCharacteristic.PROPERTY_EXTENDED_PROPS)) != null) {
        properties.put(strProperty);
    }
    return properties;
}

From source file:edu.umich.eecs.lab11.camera.CameraFragment.java

private void initServer() {
    BluetoothGattService service = new BluetoothGattService(DeviceProfile.SERVICE_UUID,
            BluetoothGattService.SERVICE_TYPE_PRIMARY);

    BluetoothGattCharacteristic offsetCharacteristic = new BluetoothGattCharacteristic(
            DeviceProfile.CHARACTERISTIC_UUID,
            //Read+write permissions
            BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_WRITE,
            BluetoothGattCharacteristic.PERMISSION_READ | BluetoothGattCharacteristic.PERMISSION_WRITE);

    service.addCharacteristic(offsetCharacteristic);
    mGattServer.addService(service);//from  w  w w. j a  v a  2  s  . c  om
}

From source file:com.cypress.cysmart.BLEServiceFragments.SensorHubService.java

/**
 * Preparing Broadcast receiver to broadcast read characteristics
 *
 * @param gattCharacteristic// w ww  . ja v  a 2 s  .  c  o m
 */
void prepareBroadcastDataRead(BluetoothGattCharacteristic gattCharacteristic) {
    final int charaProp = gattCharacteristic.getProperties();
    if ((charaProp | BluetoothGattCharacteristic.PROPERTY_READ) > 0) {
        BluetoothLeService.readCharacteristic(gattCharacteristic);
    }
}