Java Code Examples for android.bluetooth.BluetoothGattCharacteristic#PERMISSION_READ

The following examples show how to use android.bluetooth.BluetoothGattCharacteristic#PERMISSION_READ . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HealthThermometerServiceFragment.java    From ble-test-peripheral-android with Apache License 2.0 7 votes vote down vote up
public HealthThermometerServiceFragment() {
  mTemperatureMeasurementCharacteristic =
      new BluetoothGattCharacteristic(TEMPERATURE_MEASUREMENT_UUID,
          BluetoothGattCharacteristic.PROPERTY_INDICATE,
          /* No permissions */ 0);

  mTemperatureMeasurementCharacteristic.addDescriptor(
      Peripheral.getClientCharacteristicConfigurationDescriptor());

  mTemperatureMeasurementCharacteristic.addDescriptor(
      Peripheral.getCharacteristicUserDescriptionDescriptor(TEMPERATURE_MEASUREMENT_DESCRIPTION));

  mMeasurementIntervalCharacteristic =
      new BluetoothGattCharacteristic(
          MEASUREMENT_INTERVAL_UUID,
          (BluetoothGattCharacteristic.PROPERTY_READ |
              BluetoothGattCharacteristic.PROPERTY_WRITE |
              BluetoothGattCharacteristic.PROPERTY_INDICATE),
          (BluetoothGattCharacteristic.PERMISSION_READ |
              BluetoothGattCharacteristic.PERMISSION_WRITE));

  mMeasurementIntervalCCCDescriptor = Peripheral.getClientCharacteristicConfigurationDescriptor();
  mMeasurementIntervalCharacteristic.addDescriptor(mMeasurementIntervalCCCDescriptor);

  mMeasurementIntervalCharacteristic.addDescriptor(
      Peripheral.getCharacteristicUserDescriptionDescriptor(MEASUREMENT_INTERVAL_DESCRIPTION));

  mHealthThermometerService = new BluetoothGattService(HEALTH_THERMOMETER_SERVICE_UUID,
      BluetoothGattService.SERVICE_TYPE_PRIMARY);
  mHealthThermometerService.addCharacteristic(mTemperatureMeasurementCharacteristic);
  mHealthThermometerService.addCharacteristic(mMeasurementIntervalCharacteristic);
}
 
Example 2
Source File: GattUtilsTest.java    From bitgatt with Mozilla Public License 2.0 6 votes vote down vote up
@Test
public void testCopyServiceFull() {
    BluetoothGattService service = new BluetoothGattService(UUID.randomUUID(), BluetoothGattService.SERVICE_TYPE_PRIMARY);
    service.addService(new BluetoothGattService(UUID.randomUUID(), BluetoothGattService.SERVICE_TYPE_SECONDARY));
    service.addService(new BluetoothGattService(UUID.randomUUID(), BluetoothGattService.SERVICE_TYPE_SECONDARY));
    service.addService(service);
    BluetoothGattCharacteristic characteristic = new BluetoothGattCharacteristic(UUID.randomUUID(), BluetoothGattCharacteristic.PERMISSION_READ, BluetoothGattCharacteristic.PROPERTY_NOTIFY);
    BluetoothGattDescriptor descriptor = new BluetoothGattDescriptor(UUID.randomUUID(), BluetoothGattDescriptor.PERMISSION_WRITE);
    descriptor.setValue(new byte[]{0x01, 0x02, 0x04, 0x21});
    characteristic.addDescriptor(descriptor);
    service.addCharacteristic(characteristic);
    BluetoothGattServiceCopy copyOfservice = new GattUtils().copyService(service);
    Assert.assertNotNull(copyOfservice);
    Assert.assertEquals(service.getIncludedServices().size(), copyOfservice.getIncludedServices().size());
    Assert.assertEquals(service.getCharacteristics().size(), copyOfservice.getCharacteristics().size());
    Assert.assertTrue(Arrays.equals(descriptor.getValue(),
        copyOfservice.getCharacteristic(characteristic.getUuid()).getDescriptor(descriptor.getUuid()).getValue()));
}
 
Example 3
Source File: GattUtilsTest.java    From bitgatt with Mozilla Public License 2.0 6 votes vote down vote up
@Test
public void testCopyServiceInfiniteRecursion() {
    BluetoothGattService service = new BluetoothGattService(UUID.randomUUID(), BluetoothGattService.SERVICE_TYPE_PRIMARY);
    service.addService(new BluetoothGattService(UUID.randomUUID(), BluetoothGattService.SERVICE_TYPE_SECONDARY));
    service.addService(new BluetoothGattService(UUID.randomUUID(), BluetoothGattService.SERVICE_TYPE_SECONDARY));
    service.addService(service);
    BluetoothGattCharacteristic characteristic = new BluetoothGattCharacteristic(UUID.randomUUID(), BluetoothGattCharacteristic.PERMISSION_READ, BluetoothGattCharacteristic.PROPERTY_NOTIFY);
    BluetoothGattDescriptor descriptor = new BluetoothGattDescriptor(UUID.randomUUID(), BluetoothGattDescriptor.PERMISSION_WRITE);
    descriptor.setValue(new byte[]{0x01, 0x02, 0x04, 0x21});
    characteristic.addDescriptor(descriptor);
    service.addCharacteristic(characteristic);
    BluetoothGattServiceCopy copyOfservice = new GattUtils().copyService(service);
    Assert.assertNotNull(copyOfservice);
    Assert.assertEquals(service.getIncludedServices().size(), copyOfservice.getIncludedServices().size());
    Assert.assertEquals(service.getCharacteristics().size(), copyOfservice.getCharacteristics().size());
    Assert.assertTrue(Arrays.equals(descriptor.getValue(),
        copyOfservice.getCharacteristic(characteristic.getUuid()).getDescriptor(descriptor.getUuid()).getValue()));
}
 
Example 4
Source File: BatteryServiceFragment.java    From ble-test-peripheral-android with Apache License 2.0 6 votes vote down vote up
public BatteryServiceFragment() {
  mBatteryLevelCharacteristic =
      new BluetoothGattCharacteristic(BATTERY_LEVEL_UUID,
          BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY,
          BluetoothGattCharacteristic.PERMISSION_READ);

  mBatteryLevelCharacteristic.addDescriptor(
      Peripheral.getClientCharacteristicConfigurationDescriptor());

  mBatteryLevelCharacteristic.addDescriptor(
      Peripheral.getCharacteristicUserDescriptionDescriptor(BATTERY_LEVEL_DESCRIPTION));

  mBatteryService = new BluetoothGattService(BATTERY_SERVICE_UUID,
      BluetoothGattService.SERVICE_TYPE_PRIMARY);
  mBatteryService.addCharacteristic(mBatteryLevelCharacteristic);
}
 
Example 5
Source File: TimeProfile.java    From sample-bluetooth-le-gattserver with Apache License 2.0 6 votes vote down vote up
/**
 * Return a configured {@link BluetoothGattService} instance for the
 * Current Time Service.
 */
public static BluetoothGattService createTimeService() {
    BluetoothGattService service = new BluetoothGattService(TIME_SERVICE,
            BluetoothGattService.SERVICE_TYPE_PRIMARY);

    // Current Time characteristic
    BluetoothGattCharacteristic currentTime = new BluetoothGattCharacteristic(CURRENT_TIME,
            //Read-only characteristic, supports notifications
            BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY,
            BluetoothGattCharacteristic.PERMISSION_READ);
    BluetoothGattDescriptor configDescriptor = new BluetoothGattDescriptor(CLIENT_CONFIG,
            //Read/write descriptor
            BluetoothGattDescriptor.PERMISSION_READ | BluetoothGattDescriptor.PERMISSION_WRITE);
    currentTime.addDescriptor(configDescriptor);

    // Local Time Information characteristic
    BluetoothGattCharacteristic localTime = new BluetoothGattCharacteristic(LOCAL_TIME_INFO,
            //Read-only characteristic
            BluetoothGattCharacteristic.PROPERTY_READ,
            BluetoothGattCharacteristic.PERMISSION_READ);

    service.addCharacteristic(currentTime);
    service.addCharacteristic(localTime);

    return service;
}
 
Example 6
Source File: GattServer.java    From blefun-androidthings with Apache License 2.0 6 votes vote down vote up
private BluetoothGattService createAwesomenessService() {
    BluetoothGattService service = new BluetoothGattService(SERVICE_UUID, BluetoothGattService.SERVICE_TYPE_PRIMARY);

    // Counter characteristic (read-only, supports notifications)
    BluetoothGattCharacteristic counter = new BluetoothGattCharacteristic(CHARACTERISTIC_COUNTER_UUID,
            BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY,
            BluetoothGattCharacteristic.PERMISSION_READ);
    BluetoothGattDescriptor counterConfig = new BluetoothGattDescriptor(DESCRIPTOR_CONFIG, BluetoothGattDescriptor.PERMISSION_READ | BluetoothGattDescriptor.PERMISSION_WRITE);
    counter.addDescriptor(counterConfig);
    BluetoothGattDescriptor counterDescription = new BluetoothGattDescriptor(DESCRIPTOR_USER_DESC, BluetoothGattDescriptor.PERMISSION_READ);
    counter.addDescriptor(counterDescription);

    // Interactor characteristic
    BluetoothGattCharacteristic interactor = new BluetoothGattCharacteristic(CHARACTERISTIC_INTERACTOR_UUID,
            BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE, BluetoothGattCharacteristic.PERMISSION_WRITE);
    BluetoothGattDescriptor interactorDescription = new BluetoothGattDescriptor(DESCRIPTOR_USER_DESC, BluetoothGattDescriptor.PERMISSION_READ);
    interactor.addDescriptor(interactorDescription);

    service.addCharacteristic(counter);
    service.addCharacteristic(interactor);

    return service;
}
 
Example 7
Source File: GattServerTests.java    From bitgatt with Mozilla Public License 2.0 5 votes vote down vote up
@BeforeClass
public static void before() {
    Timber.plant(new Timber.DebugTree());
    mockContext = InstrumentationRegistry.getInstrumentation().getContext();
    main = new BluetoothGattService(UUID.fromString("adabfb00-6e7d-4601-bda2-bffaa68956ba"), BluetoothGattService.SERVICE_TYPE_PRIMARY);
    BluetoothGattCharacteristic txChar = new BluetoothGattCharacteristic(UUID.fromString("ADABFB01-6E7D-4601-BDA2-BFFAA68956BA"),
        BluetoothGattCharacteristic.PROPERTY_WRITE | BluetoothGattCharacteristic.PROPERTY_NOTIFY,
        BluetoothGattCharacteristic.PERMISSION_WRITE | BluetoothGattCharacteristic.PERMISSION_WRITE_ENCRYPTED);
    main.addCharacteristic(txChar);
    BluetoothGattCharacteristic rxChar = new BluetoothGattCharacteristic(UUID.fromString("ADABFB02-6E7D-4601-BDA2-BFFAA68956BA"),
        BluetoothGattCharacteristic.PROPERTY_INDICATE | BluetoothGattCharacteristic.PROPERTY_NOTIFY | BluetoothGattCharacteristic.PROPERTY_READ,
        BluetoothGattCharacteristic.PERMISSION_READ | BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED);
    main.addCharacteristic(rxChar);
    liveData = new BluetoothGattService(UUID.fromString("558dfa00-4fa8-4105-9f02-4eaa93e62980"), BluetoothGattService.SERVICE_TYPE_PRIMARY);
    BluetoothGattCharacteristic ldChar = new BluetoothGattCharacteristic(UUID.fromString("558DFA01-4FA8-4105-9F02-4EAA93E62980"),
        BluetoothGattCharacteristic.PROPERTY_INDICATE | BluetoothGattCharacteristic.PROPERTY_READ,
        BluetoothGattCharacteristic.PERMISSION_READ | BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED);
    liveData.addCharacteristic(ldChar);
    dncs = new BluetoothGattService(UUID.fromString("16bcfd00-253f-c348-e831-0db3e334d580"), BluetoothGattService.SERVICE_TYPE_PRIMARY);
    BluetoothGattCharacteristic notifChar = new BluetoothGattCharacteristic(UUID.fromString("16BCFD02-253F-C348-E831-0DB3E334D580"),
        BluetoothGattCharacteristic.PROPERTY_NOTIFY | BluetoothGattCharacteristic.PROPERTY_READ,
        BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED | BluetoothGattCharacteristic.PERMISSION_WRITE);
    dncs.addCharacteristic(notifChar);
    cpChar = new BluetoothGattCharacteristic(UUID.fromString("16BCFD01-253F-C348-E831-0DB3E334D580"),
        BluetoothGattCharacteristic.PROPERTY_WRITE | BluetoothGattCharacteristic.PROPERTY_READ,
        BluetoothGattCharacteristic.PERMISSION_READ | BluetoothGattCharacteristic.PERMISSION_WRITE);
    dncs.addCharacteristic(cpChar);
    BluetoothGattCharacteristic flsChar = new BluetoothGattCharacteristic(UUID.fromString("16BCFD04-253F-C348-E831-0DB3E334D580"),
        BluetoothGattCharacteristic.PROPERTY_WRITE | BluetoothGattCharacteristic.PROPERTY_READ,
        BluetoothGattCharacteristic.PERMISSION_READ | BluetoothGattCharacteristic.PERMISSION_WRITE);
    dncs.addCharacteristic(flsChar);
}
 
Example 8
Source File: NodeTest.java    From BlueSTSDK_Android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private BluetoothGattCharacteristic createReadNotifyChar(UUID uuid){
    BluetoothGattCharacteristic temp = new BluetoothGattCharacteristic(uuid,
            BluetoothGattCharacteristic.PROPERTY_READ|BluetoothGattCharacteristic
                    .PROPERTY_NOTIFY,
            BluetoothGattCharacteristic.PERMISSION_READ|
                    BluetoothGattCharacteristic.PERMISSION_WRITE);
    temp.addDescriptor(new BluetoothGattDescriptor(UUID.fromString
            ("00002902-0000-1000-8000-00805f9b34fb"),
            BluetoothGattDescriptor.PERMISSION_READ | BluetoothGattDescriptor.PERMISSION_WRITE));
    return temp;
}
 
Example 9
Source File: HeartRateServiceFragment.java    From ble-test-peripheral-android with Apache License 2.0 5 votes vote down vote up
public HeartRateServiceFragment() {
  mHeartRateMeasurementCharacteristic =
      new BluetoothGattCharacteristic(HEART_RATE_MEASUREMENT_UUID,
          BluetoothGattCharacteristic.PROPERTY_NOTIFY,
          /* No permissions */ 0);

  mHeartRateMeasurementCharacteristic.addDescriptor(
      Peripheral.getClientCharacteristicConfigurationDescriptor());

  mHeartRateMeasurementCharacteristic.addDescriptor(
      Peripheral.getCharacteristicUserDescriptionDescriptor(HEART_RATE_MEASUREMENT_DESCRIPTION));

  mBodySensorLocationCharacteristic =
      new BluetoothGattCharacteristic(BODY_SENSOR_LOCATION_UUID,
          BluetoothGattCharacteristic.PROPERTY_READ,
          BluetoothGattCharacteristic.PERMISSION_READ);

  mHeartRateControlPoint =
      new BluetoothGattCharacteristic(HEART_RATE_CONTROL_POINT_UUID,
          BluetoothGattCharacteristic.PROPERTY_WRITE,
          BluetoothGattCharacteristic.PERMISSION_WRITE);

  mHeartRateService = new BluetoothGattService(HEART_RATE_SERVICE_UUID,
      BluetoothGattService.SERVICE_TYPE_PRIMARY);
  mHeartRateService.addCharacteristic(mHeartRateMeasurementCharacteristic);
  mHeartRateService.addCharacteristic(mBodySensorLocationCharacteristic);
  mHeartRateService.addCharacteristic(mHeartRateControlPoint);
}
 
Example 10
Source File: Helper.java    From react-native-ble-manager with Apache License 2.0 5 votes vote down vote up
public static WritableMap decodePermissions(BluetoothGattCharacteristic characteristic) {

		// NOTE: props strings need to be consistent across iOS and Android
		WritableMap props = Arguments.createMap();
		int permissions = characteristic.getPermissions();

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_READ) != 0x0 ) {
			props.putString("Read", "Read");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE) != 0x0 ) {
			props.putString("Write", "Write");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED) != 0x0 ) {
			props.putString("ReadEncrypted", "ReadEncrypted");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE_ENCRYPTED) != 0x0 ) {
			props.putString("WriteEncrypted", "WriteEncrypted");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED_MITM) != 0x0 ) {
			props.putString("ReadEncryptedMITM", "ReadEncryptedMITM");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE_ENCRYPTED_MITM) != 0x0 ) {
			props.putString("WriteEncryptedMITM", "WriteEncryptedMITM");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE_SIGNED) != 0x0 ) {
			props.putString("WriteSigned", "WriteSigned");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE_SIGNED_MITM) != 0x0 ) {
			props.putString("WriteSignedMITM", "WriteSignedMITM");
		}

		return props;
	}
 
Example 11
Source File: BLEServicePeripheral.java    From unity-bluetooth with MIT License 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public BLEServicePeripheral(final Activity activity) {
    super(activity);

    mBtAdvertiser = mBtAdapter.getBluetoothLeAdvertiser();
    mBtGattCharacteristic = new BluetoothGattCharacteristic(
            UUID.fromString(CHARACTERISTIC_UUID),
            BluetoothGattCharacteristic.PROPERTY_NOTIFY | BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_WRITE
            , BluetoothGattDescriptor.PERMISSION_WRITE | BluetoothGattCharacteristic.PERMISSION_READ);
    BluetoothGattDescriptor dataDescriptor = new BluetoothGattDescriptor(
            UUID.fromString(CHARACTERISTIC_CONFIG_UUID),
            BluetoothGattDescriptor.PERMISSION_WRITE | BluetoothGattDescriptor.PERMISSION_READ);
    mBtGattCharacteristic.addDescriptor(dataDescriptor);
}
 
Example 12
Source File: GattTransactionValidatorTest.java    From bitgatt with Mozilla Public License 2.0 5 votes vote down vote up
@Test
public void testSettingTransactionTimeout(){
    conn.resetStates();
    conn.setState(GattState.CONNECTED);
    WriteGattCharacteristicMockTransaction writeGattCharacteristicMockTransaction = new WriteGattCharacteristicMockTransaction(conn, GattState.WRITE_CHARACTERISTIC_SUCCESS, new BluetoothGattCharacteristic(UUID.randomUUID(),
            BluetoothGattCharacteristic.PERMISSION_READ,
            BluetoothGattCharacteristic.PROPERTY_INDICATE),
            new byte[] { 0x12, 0x14},
            false, 100L);
    Assert.assertEquals(100L, writeGattCharacteristicMockTransaction.getTimeout());
}
 
Example 13
Source File: FatBeaconBroadcastService.java    From physical-web with Apache License 2.0 5 votes vote down vote up
private void initGattServer() {
  mGattServer = mBluetoothManager.openGattServer(this, mGattServerCallback);
  BluetoothGattService service = new BluetoothGattService(UUID.fromString(SERVICE_UUID),
      BluetoothGattService.SERVICE_TYPE_PRIMARY);
  BluetoothGattCharacteristic webpage = new BluetoothGattCharacteristic(
      CHARACTERISTIC_WEBPAGE_UUID, BluetoothGattCharacteristic.PROPERTY_READ,
      BluetoothGattCharacteristic.PERMISSION_READ);
  service.addCharacteristic(webpage);
  mGattServer.addService(service);
}
 
Example 14
Source File: ScannedDevicesInvalidationTests.java    From bitgatt with Mozilla Public License 2.0 5 votes vote down vote up
@Test
public void testConnectionTxResetTtl(){
    conn.setState(GattState.CONNECTED);
    conn.setDisconnectedTTL(300);
    final byte[] fakeData = new byte[]{'a','b','c','d','e','f','g','h','i', 'j'};
    BluetoothGattCharacteristic characteristic = new BluetoothGattCharacteristic(UUID.randomUUID(), BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PERMISSION_READ | BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED);
    ReadGattCharacteristicMockTransaction readChar = new ReadGattCharacteristicMockTransaction(conn, GattState.READ_CHARACTERISTIC_SUCCESS, characteristic, fakeData, false);
    conn.runTx(readChar, result -> assertEquals("Tx result was successful", result.resultState, GattState.READ_CHARACTERISTIC_SUCCESS));
    gatt.doDecrementAndInvalidateClosedConnections();
    assertEquals(FitbitGatt.MAX_TTL, conn.getDisconnectedTTL());
}
 
Example 15
Source File: GattReadWriteTests.java    From bitgatt with Mozilla Public License 2.0 5 votes vote down vote up
@Test
public void writeCharacteristicWithBtOffTest() {
    final byte[] fakeData = new byte[]{'a','b','c','d','e','f','g','h','i', 'j'};
    BluetoothGattCharacteristic characteristic = new BluetoothGattCharacteristic(UUID.randomUUID(), BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PERMISSION_READ | BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED);
    WriteGattCharacteristicMockTransaction writeChar = new WriteGattCharacteristicMockTransaction(conn, GattState.WRITE_CHARACTERISTIC_SUCCESS, characteristic, fakeData, false);
    conn.setState(GattState.BT_OFF);
    conn.runTx(writeChar, result -> {
        assert(result.resultStatus.equals(TransactionResult.TransactionResultStatus.FAILURE) && result.resultState.equals(writeChar.getSuccessState()));
    });
}
 
Example 16
Source File: GattReadWriteTests.java    From bitgatt with Mozilla Public License 2.0 5 votes vote down vote up
@Test
public void writeCharacteristicTest() {
    final byte[] fakeData = new byte[]{'a','b','c','d','e','f','g','h','i', 'j'};
    BluetoothGattCharacteristic characteristic = new BluetoothGattCharacteristic(UUID.randomUUID(), BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PERMISSION_READ | BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED);
    WriteGattCharacteristicMockTransaction writeChar = new WriteGattCharacteristicMockTransaction(conn, GattState.WRITE_CHARACTERISTIC_SUCCESS, characteristic, fakeData, false);
    conn.runTx(writeChar, result -> {
        assert(result.resultStatus.equals(TransactionResult.TransactionResultStatus.SUCCESS) && result.resultState.equals(writeChar.getSuccessState()));
    });
}
 
Example 17
Source File: BlePeripheral.java    From Bluefruit_LE_Connect_Android_V2 with MIT License 4 votes vote down vote up
@SuppressWarnings("UnnecessaryLocalVariable")
public static boolean isDescriptorReadable(BluetoothGattService service, String characteristicUUIDString, String descriptorUUIDString) {
    final int permissions = getDescriptorPermissions(service, characteristicUUIDString, descriptorUUIDString);
    final boolean isReadable = (permissions & BluetoothGattCharacteristic.PERMISSION_READ) != 0;
    return isReadable;
}
 
Example 18
Source File: GattDatabase.java    From AsteroidOSSync with GNU General Public License v3.0 4 votes vote down vote up
public final T read()
{
    m_permissions |= BluetoothGattCharacteristic.PERMISSION_READ;
    return (T) this;
}
 
Example 19
Source File: GattDatabase.java    From SweetBlue with GNU General Public License v3.0 4 votes vote down vote up
public final T read()
{
    m_permissions |= BluetoothGattCharacteristic.PERMISSION_READ;
    return (T) this;
}
 
Example 20
Source File: BleManager.java    From Bluefruit_LE_Connect_Android with MIT License 4 votes vote down vote up
public boolean isDescriptorReadable(BluetoothGattService service, String characteristicUUIDString, String descriptorUUIDString) {
    final int permissions = getDescriptorPermissions(service, characteristicUUIDString, descriptorUUIDString);
    final boolean isReadable = (permissions & BluetoothGattCharacteristic.PERMISSION_READ) != 0;
    return isReadable;
}