List of usage examples for android.bluetooth BluetoothGattCharacteristic PERMISSION_WRITE
int PERMISSION_WRITE
To view the source code for android.bluetooth BluetoothGattCharacteristic PERMISSION_WRITE.
Click Source Link
From source file:Main.java
public static JSONArray decodePermissions(BluetoothGattCharacteristic characteristic) { // NOTE: props strings need to be consistent across iOS and Android JSONArray props = new JSONArray(); int permissions = characteristic.getPermissions(); if ((permissions & BluetoothGattCharacteristic.PERMISSION_READ) != 0x0) { props.put("Read"); }/*from w w w.j av a 2 s.c om*/ if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE) != 0x0) { props.put("Write"); } if ((permissions & BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED) != 0x0) { props.put("ReadEncrypted"); } if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE_ENCRYPTED) != 0x0) { props.put("WriteEncrypted"); } if ((permissions & BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED_MITM) != 0x0) { props.put("ReadEncryptedMITM"); } if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE_ENCRYPTED_MITM) != 0x0) { props.put("WriteEncryptedMITM"); } if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE_SIGNED) != 0x0) { props.put("WriteSigned"); } if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE_SIGNED_MITM) != 0x0) { props.put("WriteSignedMITM"); } return props; }
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 www . jav a2 s . co m*/ }