| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 PROPERTY_NONE = 0, | 39 PROPERTY_NONE = 0, |
| 40 PROPERTY_BROADCAST = 1 << 0, | 40 PROPERTY_BROADCAST = 1 << 0, |
| 41 PROPERTY_READ = 1 << 1, | 41 PROPERTY_READ = 1 << 1, |
| 42 PROPERTY_WRITE_WITHOUT_RESPONSE = 1 << 2, | 42 PROPERTY_WRITE_WITHOUT_RESPONSE = 1 << 2, |
| 43 PROPERTY_WRITE = 1 << 3, | 43 PROPERTY_WRITE = 1 << 3, |
| 44 PROPERTY_NOTIFY = 1 << 4, | 44 PROPERTY_NOTIFY = 1 << 4, |
| 45 PROPERTY_INDICATE = 1 << 5, | 45 PROPERTY_INDICATE = 1 << 5, |
| 46 PROPERTY_AUTHENTICATED_SIGNED_WRITES = 1 << 6, | 46 PROPERTY_AUTHENTICATED_SIGNED_WRITES = 1 << 6, |
| 47 PROPERTY_EXTENDED_PROPERTIES = 1 << 7, | 47 PROPERTY_EXTENDED_PROPERTIES = 1 << 7, |
| 48 PROPERTY_RELIABLE_WRITE = 1 << 8, | 48 PROPERTY_RELIABLE_WRITE = 1 << 8, |
| 49 PROPERTY_WRITABLE_AUXILIARIES = 1 << 9 | 49 PROPERTY_WRITABLE_AUXILIARIES = 1 << 9, |
| 50 PROPERTY_READ_ENCRYPTED = 1 << 10, |
| 51 PROPERTY_WRITE_ENCRYPTED = 1 << 11, |
| 52 PROPERTY_READ_ENCRYPTED_AUTHENTICATED = 1 << 12, |
| 53 PROPERTY_WRITE_ENCRYPTED_AUTHENTICATED = 1 << 13, |
| 54 NUM_PROPERTY = 1 << 14, |
| 50 }; | 55 }; |
| 51 typedef uint32_t Properties; | 56 typedef uint32_t Properties; |
| 52 | 57 |
| 53 // Values representing read, write, and encryption permissions for a | 58 // Values representing read, write, and encryption permissions for a |
| 54 // characteristic's value. While attribute permissions for all GATT | 59 // characteristic's value. While attribute permissions for all GATT |
| 55 // definitions have been set by the Bluetooth specification, characteristic | 60 // definitions have been set by the Bluetooth specification, characteristic |
| 56 // value permissions are left up to the higher-level profile. | 61 // value permissions are left up to the higher-level profile. |
| 57 // | 62 // |
| 58 // Attribute permissions are distinct from the characteristic properties. For | 63 // Attribute permissions are distinct from the characteristic properties. For |
| 59 // example, a characteristic may have the property |PROPERTY_READ| to make | 64 // example, a characteristic may have the property |PROPERTY_READ| to make |
| 60 // clients know that it is possible to read the characteristic value and have | 65 // clients know that it is possible to read the characteristic value and have |
| 61 // the permission |PERMISSION_READ_ENCRYPTED| to require a secure connection. | 66 // the permission |PERMISSION_READ_ENCRYPTED| to require a secure connection. |
| 62 // It is up to the application to properly specify the permissions and | 67 // It is up to the application to properly specify the permissions and |
| 63 // properties for a local characteristic. | 68 // properties for a local characteristic. |
| 69 // TODO(rkc): Currently BlueZ infers permissions for characteristics from |
| 70 // the properties. Once this is fixed, we will start sending the permissions |
| 71 // for characteristics to BlueZ. Till then permissions for characteristics |
| 72 // are unimplemented. |
| 64 enum Permission { | 73 enum Permission { |
| 65 PERMISSION_NONE = 0, | 74 PERMISSION_NONE = 0, |
| 66 PERMISSION_READ = 1 << 0, | 75 PERMISSION_READ = 1 << 0, |
| 67 PERMISSION_WRITE = 1 << 1, | 76 PERMISSION_WRITE = 1 << 1, |
| 68 PERMISSION_READ_ENCRYPTED = 1 << 2, | 77 PERMISSION_READ_ENCRYPTED = 1 << 2, |
| 69 PERMISSION_WRITE_ENCRYPTED = 1 << 3 | 78 PERMISSION_WRITE_ENCRYPTED = 1 << 3, |
| 79 PERMISSION_READ_ENCRYPTED_AUTHENTICATED = 1 << 4, |
| 80 PERMISSION_WRITE_ENCRYPTED_AUTHENTICATED = 1 << 5, |
| 81 NUM_PERMISSION = 1 << 6, |
| 70 }; | 82 }; |
| 71 typedef uint32_t Permissions; | 83 typedef uint32_t Permissions; |
| 72 | 84 |
| 73 // The ErrorCallback is used by methods to asynchronously report errors. | 85 // The ErrorCallback is used by methods to asynchronously report errors. |
| 74 typedef base::Callback<void(BluetoothGattService::GattErrorCode)> | 86 typedef base::Callback<void(BluetoothGattService::GattErrorCode)> |
| 75 ErrorCallback; | 87 ErrorCallback; |
| 76 | 88 |
| 77 // Identifier used to uniquely identify a GATT characteristic object. This is | 89 // Identifier used to uniquely identify a GATT characteristic object. This is |
| 78 // different from the characteristic UUID: while multiple characteristics with | 90 // different from the characteristic UUID: while multiple characteristics with |
| 79 // the same UUID can exist on a Bluetooth device, the identifier returned from | 91 // the same UUID can exist on a Bluetooth device, the identifier returned from |
| (...skipping 14 matching lines...) Expand all Loading... |
| 94 BluetoothGattCharacteristic(); | 106 BluetoothGattCharacteristic(); |
| 95 virtual ~BluetoothGattCharacteristic(); | 107 virtual ~BluetoothGattCharacteristic(); |
| 96 | 108 |
| 97 private: | 109 private: |
| 98 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristic); | 110 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristic); |
| 99 }; | 111 }; |
| 100 | 112 |
| 101 } // namespace device | 113 } // namespace device |
| 102 | 114 |
| 103 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_ | 115 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_ |
| OLD | NEW |