Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: device/bluetooth/bluetooth_gatt_characteristic.h

Issue 643213002: Update constants to MACRO_STYLE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_gatt_chromeos_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 21 matching lines...) Expand all
32 // BluetoothGattCharacteristic directly and add it to the desired 32 // BluetoothGattCharacteristic directly and add it to the desired
33 // BluetoothGattService instance that represents a local service. 33 // BluetoothGattService instance that represents a local service.
34 class BluetoothGattCharacteristic { 34 class BluetoothGattCharacteristic {
35 public: 35 public:
36 // TODO(jamuraa): per chromium.org/developers/coding-style these should 36 // TODO(jamuraa): per chromium.org/developers/coding-style these should
37 // be MACRO_STYLE instead of kCamelCase. (crbug.com/418696) 37 // be MACRO_STYLE instead of kCamelCase. (crbug.com/418696)
38 38
39 // Values representing the possible properties of a characteristic, which 39 // Values representing the possible properties of a characteristic, which
40 // define how the characteristic can be used. Each of these properties serve 40 // define how the characteristic can be used. Each of these properties serve
41 // a role as defined in the Bluetooth Specification. 41 // a role as defined in the Bluetooth Specification.
42 // |kPropertyExtendedProperties| is a special property that, if present, 42 // |PROPERTY_EXTENDED_PROPERTIES| is a special property that, if present,
43 // indicates that there is a characteristic descriptor (namely the 43 // indicates that there is a characteristic descriptor (namely the
44 // "Characteristic Extended Properties Descriptor" with UUID 0x2900) that 44 // "Characteristic Extended Properties Descriptor" with UUID 0x2900) that
45 // contains additional properties pertaining to the characteristic. 45 // contains additional properties pertaining to the characteristic.
46 // The properties "ReliableWrite| and |WriteAuxiliaries| are retrieved from 46 // The properties "ReliableWrite| and |WriteAuxiliaries| are retrieved from
47 // that characteristic. 47 // that characteristic.
48 enum Property { 48 enum Property {
49 kPropertyNone = 0, 49 PROPERTY_NONE = 0,
50 kPropertyBroadcast = 1 << 0, 50 PROPERTY_BROADCAST = 1 << 0,
51 kPropertyRead = 1 << 1, 51 PROPERTY_READ = 1 << 1,
52 kPropertyWriteWithoutResponse = 1 << 2, 52 PROPERTY_WRITE_WITHOUT_RESPONSE = 1 << 2,
53 kPropertyWrite = 1 << 3, 53 PROPERTY_WRITE = 1 << 3,
54 kPropertyNotify = 1 << 4, 54 PROPERTY_NOTIFY = 1 << 4,
55 kPropertyIndicate = 1 << 5, 55 PROPERTY_INDICATE = 1 << 5,
56 kPropertyAuthenticatedSignedWrites = 1 << 6, 56 PROPERTY_AUTHENTICATED_SIGNED_WRITES = 1 << 6,
57 kPropertyExtendedProperties = 1 << 7, 57 PROPERTY_EXTENDED_PROPERTIES = 1 << 7,
58 kPropertyReliableWrite = 1 << 8, 58 PROPERTY_RELIABLE_WRITE = 1 << 8,
59 kPropertyWritableAuxiliaries = 1 << 9 59 PROPERTY_WRITABLE_AUXILIARIES = 1 << 9
60 }; 60 };
61 typedef uint32 Properties; 61 typedef uint32 Properties;
62 62
63 // Values representing read, write, and encryption permissions for a 63 // Values representing read, write, and encryption permissions for a
64 // characteristic's value. While attribute permissions for all GATT 64 // characteristic's value. While attribute permissions for all GATT
65 // definitions have been set by the Bluetooth specification, characteristic 65 // definitions have been set by the Bluetooth specification, characteristic
66 // value permissions are left up to the higher-level profile. 66 // value permissions are left up to the higher-level profile.
67 // 67 //
68 // Attribute permissions are distinct from the characteristic properties. For 68 // Attribute permissions are distinct from the characteristic properties. For
69 // example, a characteristic may have the property |kPropertyRead| to make 69 // example, a characteristic may have the property |PROPERTY_READ| to make
70 // clients know that it is possible to read the characteristic value and have 70 // clients know that it is possible to read the characteristic value and have
71 // the permission |kPermissionReadEncrypted| to require a secure connection. 71 // the permission |PERMISSION_READ_ENCRYPTED| to require a secure connection.
72 // It is up to the application to properly specify the permissions and 72 // It is up to the application to properly specify the permissions and
73 // properties for a local characteristic. 73 // properties for a local characteristic.
74 enum Permission { 74 enum Permission {
75 kPermissionNone = 0, 75 PERMISSION_NONE = 0,
76 kPermissionRead = 1 << 0, 76 PERMISSION_READ = 1 << 0,
77 kPermissionWrite = 1 << 1, 77 PERMISSION_WRITE = 1 << 1,
78 kPermissionReadEncrypted = 1 << 2, 78 PERMISSION_READ_ENCRYPTED = 1 << 2,
79 kPermissionWriteEncrypted = 1 << 3 79 PERMISSION_WRITE_ENCRYPTED = 1 << 3
80 }; 80 };
81 typedef uint32 Permissions; 81 typedef uint32 Permissions;
82 82
83 // The ErrorCallback is used by methods to asynchronously report errors. 83 // The ErrorCallback is used by methods to asynchronously report errors.
84 typedef base::Callback<void(BluetoothGattService::GattErrorCode)> 84 typedef base::Callback<void(BluetoothGattService::GattErrorCode)>
85 ErrorCallback; 85 ErrorCallback;
86 86
87 // The ValueCallback is used to return the value of a remote characteristic 87 // The ValueCallback is used to return the value of a remote characteristic
88 // upon a read request. 88 // upon a read request.
89 typedef base::Callback<void(const std::vector<uint8>&)> ValueCallback; 89 typedef base::Callback<void(const std::vector<uint8>&)> ValueCallback;
90 90
91 // The NotifySessionCallback is used to return sessions after they have 91 // The NotifySessionCallback is used to return sessions after they have
92 // been successfully started. 92 // been successfully started.
93 typedef base::Callback<void(scoped_ptr<BluetoothGattNotifySession>)> 93 typedef base::Callback<void(scoped_ptr<BluetoothGattNotifySession>)>
94 NotifySessionCallback; 94 NotifySessionCallback;
95 95
96 // Constructs a BluetoothGattCharacteristic that can be associated with a 96 // Constructs a BluetoothGattCharacteristic that can be associated with a
97 // local GATT service when the adapter is in the peripheral role. To 97 // local GATT service when the adapter is in the peripheral role. To
98 // associate the returned characteristic with a service, add it to a local 98 // associate the returned characteristic with a service, add it to a local
99 // service by calling BluetoothGattService::AddCharacteristic. 99 // service by calling BluetoothGattService::AddCharacteristic.
100 // 100 //
101 // This method constructs a characteristic with UUID |uuid|, initial cached 101 // This method constructs a characteristic with UUID |uuid|, initial cached
102 // value |value|, properties |properties|, and permissions |permissions|. 102 // value |value|, properties |properties|, and permissions |permissions|.
103 // |value| will be cached and returned for read requests and automatically set 103 // |value| will be cached and returned for read requests and automatically set
104 // for write requests by default, unless an instance of 104 // for write requests by default, unless an instance of
105 // BluetoothGattService::Delegate has been provided to the associated 105 // BluetoothGattService::Delegate has been provided to the associated
106 // BluetoothGattService instance, in which case the delegate will handle read 106 // BluetoothGattService instance, in which case the delegate will handle read
107 // and write requests. 107 // and write requests.
108 // 108 //
109 // NOTE: Don't explicitly set |kPropertyExtendedProperties| in |properties|. 109 // NOTE: Don't explicitly set |PROPERTY_EXTENDED_PROPERTIES| in |properties|.
110 // Instead, create and add a BluetoothGattDescriptor that represents the 110 // Instead, create and add a BluetoothGattDescriptor that represents the
111 // "Characteristic Extended Properties" descriptor and this will automatically 111 // "Characteristic Extended Properties" descriptor and this will automatically
112 // set the correspoding bit in the characteristic's properties field. If 112 // set the correspoding bit in the characteristic's properties field. If
113 // |properties| has |kPropertyExtendedProperties| set, it will be ignored. 113 // |properties| has |PROPERTY_EXTENDED_PROPERTIES| set, it will be ignored.
114 static BluetoothGattCharacteristic* Create(const BluetoothUUID& uuid, 114 static BluetoothGattCharacteristic* Create(const BluetoothUUID& uuid,
115 const std::vector<uint8>& value, 115 const std::vector<uint8>& value,
116 Properties properties, 116 Properties properties,
117 Permissions permissions); 117 Permissions permissions);
118 118
119 // Identifier used to uniquely identify a GATT characteristic object. This is 119 // Identifier used to uniquely identify a GATT characteristic object. This is
120 // different from the characteristic UUID: while multiple characteristics with 120 // different from the characteristic UUID: while multiple characteristics with
121 // the same UUID can exist on a Bluetooth device, the identifier returned from 121 // the same UUID can exist on a Bluetooth device, the identifier returned from
122 // this method is unique among all characteristics of a device. The contents 122 // this method is unique among all characteristics of a device. The contents
123 // of the identifier are platform specific. 123 // of the identifier are platform specific.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 BluetoothGattCharacteristic(); 205 BluetoothGattCharacteristic();
206 virtual ~BluetoothGattCharacteristic(); 206 virtual ~BluetoothGattCharacteristic();
207 207
208 private: 208 private:
209 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristic); 209 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristic);
210 }; 210 };
211 211
212 } // namespace device 212 } // namespace device
213 213
214 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_ 214 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_gatt_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698