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 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h" | 5 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 return service_; | 105 return service_; |
106 } | 106 } |
107 | 107 |
108 device::BluetoothGattCharacteristic::Properties | 108 device::BluetoothGattCharacteristic::Properties |
109 BluetoothRemoteGattCharacteristicChromeOS::GetProperties() const { | 109 BluetoothRemoteGattCharacteristicChromeOS::GetProperties() const { |
110 BluetoothGattCharacteristicClient::Properties* properties = | 110 BluetoothGattCharacteristicClient::Properties* properties = |
111 DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()-> | 111 DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()-> |
112 GetProperties(object_path_); | 112 GetProperties(object_path_); |
113 DCHECK(properties); | 113 DCHECK(properties); |
114 | 114 |
115 Properties props = kPropertyNone; | 115 Properties props = PROPERTY_NONE; |
116 const std::vector<std::string>& flags = properties->flags.value(); | 116 const std::vector<std::string>& flags = properties->flags.value(); |
117 for (std::vector<std::string>::const_iterator iter = flags.begin(); | 117 for (std::vector<std::string>::const_iterator iter = flags.begin(); |
118 iter != flags.end(); | 118 iter != flags.end(); |
119 ++iter) { | 119 ++iter) { |
120 if (*iter == bluetooth_gatt_characteristic::kFlagBroadcast) | 120 if (*iter == bluetooth_gatt_characteristic::kFlagBroadcast) |
121 props |= kPropertyBroadcast; | 121 props |= PROPERTY_BROADCAST; |
122 if (*iter == bluetooth_gatt_characteristic::kFlagRead) | 122 if (*iter == bluetooth_gatt_characteristic::kFlagRead) |
123 props |= kPropertyRead; | 123 props |= PROPERTY_READ; |
124 if (*iter == bluetooth_gatt_characteristic::kFlagWriteWithoutResponse) | 124 if (*iter == bluetooth_gatt_characteristic::kFlagWriteWithoutResponse) |
125 props |= kPropertyWriteWithoutResponse; | 125 props |= PROPERTY_WRITE_WITHOUT_RESPONSE; |
126 if (*iter == bluetooth_gatt_characteristic::kFlagWrite) | 126 if (*iter == bluetooth_gatt_characteristic::kFlagWrite) |
127 props |= kPropertyWrite; | 127 props |= PROPERTY_WRITE; |
128 if (*iter == bluetooth_gatt_characteristic::kFlagNotify) | 128 if (*iter == bluetooth_gatt_characteristic::kFlagNotify) |
129 props |= kPropertyNotify; | 129 props |= PROPERTY_NOTIFY; |
130 if (*iter == bluetooth_gatt_characteristic::kFlagIndicate) | 130 if (*iter == bluetooth_gatt_characteristic::kFlagIndicate) |
131 props |= kPropertyIndicate; | 131 props |= PROPERTY_INDICATE; |
132 if (*iter == bluetooth_gatt_characteristic::kFlagAuthenticatedSignedWrites) | 132 if (*iter == bluetooth_gatt_characteristic::kFlagAuthenticatedSignedWrites) |
133 props |= kPropertyAuthenticatedSignedWrites; | 133 props |= PROPERTY_AUTHENTICATED_SIGNED_WRITES; |
134 if (*iter == bluetooth_gatt_characteristic::kFlagExtendedProperties) | 134 if (*iter == bluetooth_gatt_characteristic::kFlagExtendedProperties) |
135 props |= kPropertyExtendedProperties; | 135 props |= PROPERTY_EXTENDED_PROPERTIES; |
136 if (*iter == bluetooth_gatt_characteristic::kFlagReliableWrite) | 136 if (*iter == bluetooth_gatt_characteristic::kFlagReliableWrite) |
137 props |= kPropertyReliableWrite; | 137 props |= PROPERTY_RELIABLE_WRITE; |
138 if (*iter == bluetooth_gatt_characteristic::kFlagWritableAuxiliaries) | 138 if (*iter == bluetooth_gatt_characteristic::kFlagWritableAuxiliaries) |
139 props |= kPropertyWritableAuxiliaries; | 139 props |= PROPERTY_WRITABLE_AUXILIARIES; |
140 } | 140 } |
141 | 141 |
142 return props; | 142 return props; |
143 } | 143 } |
144 | 144 |
145 device::BluetoothGattCharacteristic::Permissions | 145 device::BluetoothGattCharacteristic::Permissions |
146 BluetoothRemoteGattCharacteristicChromeOS::GetPermissions() const { | 146 BluetoothRemoteGattCharacteristicChromeOS::GetPermissions() const { |
147 // TODO(armansito): Once BlueZ defines the permissions, return the correct | 147 // TODO(armansito): Once BlueZ defines the permissions, return the correct |
148 // values here. | 148 // values here. |
149 return kPermissionNone; | 149 return PERMISSION_NONE; |
150 } | 150 } |
151 | 151 |
152 bool BluetoothRemoteGattCharacteristicChromeOS::IsNotifying() const { | 152 bool BluetoothRemoteGattCharacteristicChromeOS::IsNotifying() const { |
153 BluetoothGattCharacteristicClient::Properties* properties = | 153 BluetoothGattCharacteristicClient::Properties* properties = |
154 DBusThreadManager::Get() | 154 DBusThreadManager::Get() |
155 ->GetBluetoothGattCharacteristicClient() | 155 ->GetBluetoothGattCharacteristicClient() |
156 ->GetProperties(object_path_); | 156 ->GetProperties(object_path_); |
157 DCHECK(properties); | 157 DCHECK(properties); |
158 | 158 |
159 return properties->notifying.value(); | 159 return properties->notifying.value(); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 | 471 |
472 void BluetoothRemoteGattCharacteristicChromeOS::ProcessStartNotifyQueue() { | 472 void BluetoothRemoteGattCharacteristicChromeOS::ProcessStartNotifyQueue() { |
473 while (!pending_start_notify_calls_.empty()) { | 473 while (!pending_start_notify_calls_.empty()) { |
474 PendingStartNotifyCall callbacks = pending_start_notify_calls_.front(); | 474 PendingStartNotifyCall callbacks = pending_start_notify_calls_.front(); |
475 pending_start_notify_calls_.pop(); | 475 pending_start_notify_calls_.pop(); |
476 StartNotifySession(callbacks.first, callbacks.second); | 476 StartNotifySession(callbacks.first, callbacks.second); |
477 } | 477 } |
478 } | 478 } |
479 | 479 |
480 } // namespace chromeos | 480 } // namespace chromeos |
OLD | NEW |