List of usage examples for android.bluetooth BluetoothGattCharacteristic PROPERTY_WRITE_NO_RESPONSE
int PROPERTY_WRITE_NO_RESPONSE
To view the source code for android.bluetooth BluetoothGattCharacteristic PROPERTY_WRITE_NO_RESPONSE.
Click Source Link
From source file:Main.java
public static JSONArray decodeProperties(BluetoothGattCharacteristic characteristic) { // NOTE: props strings need to be consistent across iOS and Android JSONArray props = new JSONArray(); int properties = characteristic.getProperties(); if ((properties & BluetoothGattCharacteristic.PROPERTY_BROADCAST) != 0x0) { props.put("Broadcast"); }//from w ww .j av a 2s . c o m if ((properties & BluetoothGattCharacteristic.PROPERTY_READ) != 0x0) { props.put("Read"); } if ((properties & BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE) != 0x0) { props.put("WriteWithoutResponse"); } if ((properties & BluetoothGattCharacteristic.PROPERTY_WRITE) != 0x0) { props.put("Write"); } if ((properties & BluetoothGattCharacteristic.PROPERTY_NOTIFY) != 0x0) { props.put("Notify"); } if ((properties & BluetoothGattCharacteristic.PROPERTY_INDICATE) != 0x0) { props.put("Indicate"); } if ((properties & BluetoothGattCharacteristic.PROPERTY_SIGNED_WRITE) != 0x0) { // Android calls this "write with signature", using iOS name for now props.put("AuthenticateSignedWrites"); } if ((properties & BluetoothGattCharacteristic.PROPERTY_EXTENDED_PROPS) != 0x0) { props.put("ExtendedProperties"); } // iOS only? // // if ((p & CBCharacteristicPropertyNotifyEncryptionRequired) != 0x0) { // 0x100 // [props addObject:@"NotifyEncryptionRequired"]; // } // // if ((p & CBCharacteristicPropertyIndicateEncryptionRequired) != 0x0) { // 0x200 // [props addObject:@"IndicateEncryptionRequired"]; // } return props; }
From source file:ti.android.ble.devicemonitor.ServiceView.java
private String getPropertyDescription(int prop) { String str = new String(); if ((prop & BluetoothGattCharacteristic.PROPERTY_READ) > 0) str += "R"; if ((prop & BluetoothGattCharacteristic.PROPERTY_WRITE) > 0) str += "W"; if ((prop & BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) str += "N"; if ((prop & BluetoothGattCharacteristic.PROPERTY_INDICATE) > 0) str += "I"; if ((prop & BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE) > 0) str += "*"; if ((prop & BluetoothGattCharacteristic.PROPERTY_BROADCAST) > 0) str += "B"; if ((prop & BluetoothGattCharacteristic.PROPERTY_EXTENDED_PROPS) > 0) str += "E"; if ((prop & BluetoothGattCharacteristic.PROPERTY_SIGNED_WRITE) > 0) str += "S"; return str;//from w w w. j ava 2 s . c om }
From source file:com.cypress.cysmart.GATTDBFragments.GattDetailsFragment.java
/** * Method to make the Buttons visible to the user *//* ww w . jav a 2 s .c o m*/ private void UIbuttonvisibility() { // Getting the properties of each characteristics boolean read = false, write = false, notify = false, indicate = false; if (getGattCharacteristicsPropertices(mReadCharacteristic.getProperties(), BluetoothGattCharacteristic.PROPERTY_READ)) { // Read property available read = true; mBtnread.setVisibility(View.VISIBLE); } if (getGattCharacteristicsPropertices(mReadCharacteristic.getProperties(), BluetoothGattCharacteristic.PROPERTY_WRITE) | getGattCharacteristicsPropertices(mReadCharacteristic.getProperties(), BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE)) { // Write property available write = true; mBtnwrite.setVisibility(View.VISIBLE); } if (getGattCharacteristicsPropertices(mReadCharacteristic.getProperties(), BluetoothGattCharacteristic.PROPERTY_NOTIFY)) { // Notify property available notify = true; mBtnnotify.setVisibility(View.VISIBLE); BluetoothGattDescriptor descriptor = mReadCharacteristic .getDescriptor(UUIDDatabase.UUID_CLIENT_CHARACTERISTIC_CONFIG); if (descriptor != null) { BluetoothLeService.readDescriptor(descriptor); } } if (getGattCharacteristicsPropertices(mReadCharacteristic.getProperties(), BluetoothGattCharacteristic.PROPERTY_INDICATE)) { // Indicate property available indicate = true; mBtnIndicate.setVisibility(View.VISIBLE); BluetoothGattDescriptor descriptor = mReadCharacteristic .getDescriptor(UUIDDatabase.UUID_CLIENT_CHARACTERISTIC_CONFIG); if (descriptor != null) { BluetoothLeService.readDescriptor(descriptor); } } }
From source file:com.megster.cordova.ble.central.Peripheral.java
private BluetoothGattCharacteristic findWritableCharacteristic(BluetoothGattService service, UUID characteristicUUID, int writeType) { BluetoothGattCharacteristic characteristic = null; // get write property int writeProperty = BluetoothGattCharacteristic.PROPERTY_WRITE; if (writeType == BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE) { writeProperty = BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE; }//from www.j a v a 2 s . c om List<BluetoothGattCharacteristic> characteristics = service.getCharacteristics(); for (BluetoothGattCharacteristic c : characteristics) { if ((c.getProperties() & writeProperty) != 0 && characteristicUUID.equals(c.getUuid())) { characteristic = c; break; } } // As a last resort, try and find ANY characteristic with this UUID, even if it doesn't have the correct properties if (characteristic == null) { characteristic = service.getCharacteristic(characteristicUUID); } return characteristic; }
From source file:org.bcsphere.bluetooth.tools.Tools.java
public static JSONArray decodeProperty(int property) { JSONArray properties = new JSONArray(); String strProperty = null;/*www.j av a 2 s . 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; }