Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / device / bluetooth / bluetooth_gatt_descriptor.cc
blob5d3673b5ea36e9a886741270e530b4162ecc3b09
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
3 // found in the LICENSE file.
5 #include "device/bluetooth/bluetooth_gatt_descriptor.h"
7 #include <vector>
9 #include "base/lazy_instance.h"
10 #include "base/logging.h"
11 #include "base/macros.h"
13 namespace device {
14 namespace {
16 struct UUIDs {
17 UUIDs() : uuids_(MakeUUIDVector()) {}
19 const std::vector<BluetoothUUID> uuids_;
21 private:
22 static std::vector<BluetoothUUID> MakeUUIDVector() {
23 std::vector<BluetoothUUID> uuids;
24 static const char* const strings[] = {
25 "0x2900", "0x2901", "0x2902", "0x2903", "0x2904", "0x2905"
28 for (size_t i = 0; i < arraysize(strings); ++i)
29 uuids.push_back(BluetoothUUID(strings[i]));
31 return uuids;
35 base::LazyInstance<const UUIDs>::Leaky g_uuids = LAZY_INSTANCE_INITIALIZER;
37 } // namespace
39 // static
40 const BluetoothUUID&
41 BluetoothGattDescriptor::CharacteristicExtendedPropertiesUuid() {
42 return g_uuids.Get().uuids_[0];
45 // static
46 const BluetoothUUID&
47 BluetoothGattDescriptor::CharacteristicUserDescriptionUuid() {
48 return g_uuids.Get().uuids_[1];
51 // static
52 const BluetoothUUID&
53 BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid() {
54 return g_uuids.Get().uuids_[2];
57 // static
58 const BluetoothUUID&
59 BluetoothGattDescriptor::ServerCharacteristicConfigurationUuid() {
60 return g_uuids.Get().uuids_[3];
63 // static
64 const BluetoothUUID&
65 BluetoothGattDescriptor::CharacteristicPresentationFormatUuid() {
66 return g_uuids.Get().uuids_[4];
69 // static
70 const BluetoothUUID&
71 BluetoothGattDescriptor::CharacteristicAggregateFormatUuid() {
72 return g_uuids.Get().uuids_[5];
75 BluetoothGattDescriptor::BluetoothGattDescriptor() {
78 BluetoothGattDescriptor::~BluetoothGattDescriptor() {
81 // static
82 BluetoothGattDescriptor* BluetoothGattDescriptor::Create(
83 const BluetoothUUID& uuid,
84 const std::vector<uint8>& value,
85 BluetoothGattCharacteristic::Permissions permissions) {
86 LOG(ERROR) << "Creating local GATT characteristic descriptors currently not "
87 << "supported.";
88 return NULL;
91 } // namespace device