Example usage for android.bluetooth BluetoothGattCharacteristic getWriteType

List of usage examples for android.bluetooth BluetoothGattCharacteristic getWriteType

Introduction

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

Prototype

public int getWriteType() 

Source Link

Document

Gets the write type for this characteristic.

Usage

From source file:com.evothings.BLE.java

private void characteristics(final CordovaArgs args, final CallbackContext callbackContext)
        throws JSONException {
    final GattHandler gh = mGatt.get(args.getInt(0));
    JSONArray a = new JSONArray();
    for (BluetoothGattCharacteristic c : gh.mServices.get(args.getInt(1)).getCharacteristics()) {
        if (gh.mCharacteristics == null)
            gh.mCharacteristics = new HashMap<Integer, BluetoothGattCharacteristic>();
        Object res = gh.mCharacteristics.put(gh.mNextHandle, c);
        assert (res == null);

        JSONObject o = new JSONObject();
        o.put("handle", gh.mNextHandle);
        o.put("uuid", c.getUuid().toString());
        o.put("permissions", c.getPermissions());
        o.put("properties", c.getProperties());
        o.put("writeType", c.getWriteType());

        gh.mNextHandle++;/*from w  w  w  .j a v  a2 s .c  o  m*/
        a.put(o);
    }
    callbackContext.success(a);
}