| 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 <stdint.h> | 8 #include <cstdint> |
| 9 #include <map> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "device/bluetooth/bluetooth_export.h" | 13 #include "device/bluetooth/bluetooth_export.h" |
| 14 #include "device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h" |
| 13 | 15 |
| 14 namespace base { | 16 namespace base { |
| 15 class Value; | 17 class Value; |
| 16 } | 18 } |
| 17 | 19 |
| 18 namespace bluez { | 20 namespace bluez { |
| 19 | 21 |
| 20 class DEVICE_BLUETOOTH_EXPORT BluetoothServiceRecordBlueZ { | 22 class DEVICE_BLUETOOTH_EXPORT BluetoothServiceRecordBlueZ { |
| 21 public: | 23 public: |
| 22 // Possible types of errors raised when creating, removing or getting service | 24 // Possible types of errors raised when creating, removing or getting service |
| 23 // records. | 25 // records. |
| 24 enum ErrorCode { | 26 enum ErrorCode { |
| 25 ERROR_ADAPTER_NOT_READY, | 27 ERROR_ADAPTER_NOT_READY, |
| 26 ERROR_RECORD_EXISTS, | 28 ERROR_RECORD_ALREADY_EXISTS, |
| 27 ERROR_RECORD_DOES_NOT_EXIST, | 29 ERROR_RECORD_DOES_NOT_EXIST, |
| 28 ERROR_DEVICE_DISCONNECTED, | 30 ERROR_DEVICE_DISCONNECTED, |
| 31 ERROR_INVALID_ARGUMENTS, |
| 29 UNKNOWN | 32 UNKNOWN |
| 30 }; | 33 }; |
| 31 | 34 |
| 32 BluetoothServiceRecordBlueZ(); | 35 explicit BluetoothServiceRecordBlueZ( |
| 36 const std::map<uint16_t, BluetoothServiceAttributeValueBlueZ>& |
| 37 attributes); |
| 38 BluetoothServiceRecordBlueZ(const BluetoothServiceRecordBlueZ& record); |
| 33 ~BluetoothServiceRecordBlueZ(); | 39 ~BluetoothServiceRecordBlueZ(); |
| 34 | 40 |
| 35 // Returns a list of Attribute IDs that exist within this service record. | 41 // Returns a list of Attribute IDs that exist within this service record. |
| 36 std::vector<uint16_t> GetAttributeIds(); | 42 const std::vector<uint16_t> GetAttributeIds() const; |
| 37 // Returns the value associated with a given attribute ID. | 43 // Returns the value associated with a given attribute ID in |value|. |
| 38 base::Value* GetAttributeValue(uint16_t attribute_id); | 44 const BluetoothServiceAttributeValueBlueZ& GetAttributeValue( |
| 45 uint16_t attribute_id) const; |
| 39 | 46 |
| 40 private: | 47 private: |
| 41 DISALLOW_COPY_AND_ASSIGN(BluetoothServiceRecordBlueZ); | 48 std::map<uint16_t, BluetoothServiceAttributeValueBlueZ> attributes_; |
| 42 }; | 49 }; |
| 43 | 50 |
| 44 } // namespace bluez | 51 } // namespace bluez |
| 45 | 52 |
| 46 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_SERVICE_RECORD_BLUEZ_H_ | 53 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_SERVICE_RECORD_BLUEZ_H_ |
| OLD | NEW |