Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BLUEZ_BLUETOOTH_SERVICE_RECORD_BLUEZ_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_SERVICE_RECORD_BLUEZ_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_SERVICE_RECORD_BLUEZ_H_ | 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_SERVICE_RECORD_BLUEZ_H_ |
| 7 | 7 |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 // records. | 25 // records. |
| 26 enum ErrorCode { | 26 enum ErrorCode { |
| 27 ERROR_ADAPTER_NOT_READY, | 27 ERROR_ADAPTER_NOT_READY, |
| 28 ERROR_RECORD_ALREADY_EXISTS, | 28 ERROR_RECORD_ALREADY_EXISTS, |
| 29 ERROR_RECORD_DOES_NOT_EXIST, | 29 ERROR_RECORD_DOES_NOT_EXIST, |
| 30 ERROR_DEVICE_DISCONNECTED, | 30 ERROR_DEVICE_DISCONNECTED, |
| 31 ERROR_INVALID_ARGUMENTS, | 31 ERROR_INVALID_ARGUMENTS, |
| 32 UNKNOWN | 32 UNKNOWN |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 explicit BluetoothServiceRecordBlueZ( | 35 BluetoothServiceRecordBlueZ(); |
|
Miao
2016/06/30 04:55:58
Can we also keep the constructor taking attributes
rkc
2016/06/30 20:02:24
Discussed offline.
| |
| 36 const std::map<uint16_t, BluetoothServiceAttributeValueBlueZ>& | |
| 37 attributes); | |
| 38 BluetoothServiceRecordBlueZ(const BluetoothServiceRecordBlueZ& record); | 36 BluetoothServiceRecordBlueZ(const BluetoothServiceRecordBlueZ& record); |
| 39 ~BluetoothServiceRecordBlueZ(); | 37 ~BluetoothServiceRecordBlueZ(); |
| 40 | 38 |
| 41 // Returns a list of Attribute IDs that exist within this service record. | 39 // Returns a list of Attribute IDs that exist within this service record. |
| 42 const std::vector<uint16_t> GetAttributeIds() const; | 40 const std::vector<uint16_t> GetAttributeIds() const; |
| 43 // Returns the value associated with a given attribute ID in |value|. | 41 // Returns the value associated with a given attribute ID in |value|. |
| 44 const BluetoothServiceAttributeValueBlueZ& GetAttributeValue( | 42 const BluetoothServiceAttributeValueBlueZ& GetAttributeValue( |
| 45 uint16_t attribute_id) const; | 43 uint16_t attribute_id) const; |
| 46 | 44 |
| 45 // Add an an entry to this service record. If a record with the given ID | |
| 46 // already exists, it is replaced. | |
| 47 void AddRecordEntry(uint16_t id, | |
| 48 const BluetoothServiceAttributeValueBlueZ& value); | |
| 49 | |
| 47 private: | 50 private: |
| 48 std::map<uint16_t, BluetoothServiceAttributeValueBlueZ> attributes_; | 51 std::map<uint16_t, BluetoothServiceAttributeValueBlueZ> attributes_; |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 } // namespace bluez | 54 } // namespace bluez |
| 52 | 55 |
| 53 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_SERVICE_RECORD_BLUEZ_H_ | 56 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_SERVICE_RECORD_BLUEZ_H_ |
| OLD | NEW |