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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc

Issue 307453007: device/bluetooth: Implement GATT characteristic properties on Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_gatt_chromeos_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
index bb175e3f375fb2df4f9006dd3ea056aed119443f..3d3e15ccf56ed198081d14c483bdca63186e0ed0 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
@@ -10,6 +10,7 @@
#include "chromeos/dbus/dbus_thread_manager.h"
#include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h"
#include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
+#include "third_party/cros_system_api/dbus/service_constants.h"
namespace chromeos {
@@ -93,9 +94,39 @@ BluetoothRemoteGattCharacteristicChromeOS::GetService() const {
device::BluetoothGattCharacteristic::Properties
BluetoothRemoteGattCharacteristicChromeOS::GetProperties() const {
- // TODO(armansito): Once BlueZ implements properties properly, return those
- // values here.
- return kPropertyNone;
+ BluetoothGattCharacteristicClient::Properties* properties =
+ DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
+ GetProperties(object_path_);
+ DCHECK(properties);
+
+ Properties props = kPropertyNone;
+ const std::vector<std::string>& flags = properties->flags.value();
+ for (std::vector<std::string>::const_iterator iter = flags.begin();
+ iter != flags.end();
+ ++iter) {
+ if (*iter == bluetooth_gatt_characteristic::kFlagBroadcast)
+ props |= kPropertyBroadcast;
+ if (*iter == bluetooth_gatt_characteristic::kFlagRead)
+ props |= kPropertyRead;
+ if (*iter == bluetooth_gatt_characteristic::kFlagWriteWithoutResponse)
+ props |= kPropertyWriteWithoutResponse;
+ if (*iter == bluetooth_gatt_characteristic::kFlagWrite)
+ props |= kPropertyWrite;
+ if (*iter == bluetooth_gatt_characteristic::kFlagNotify)
+ props |= kPropertyNotify;
+ if (*iter == bluetooth_gatt_characteristic::kFlagIndicate)
+ props |= kPropertyIndicate;
+ if (*iter == bluetooth_gatt_characteristic::kFlagAuthenticatedSignedWrites)
+ props |= kPropertyAuthenticatedSignedWrites;
+ if (*iter == bluetooth_gatt_characteristic::kFlagExtendedProperties)
+ props |= kPropertyExtendedProperties;
+ if (*iter == bluetooth_gatt_characteristic::kFlagReliableWrite)
+ props |= kPropertyReliableWrite;
+ if (*iter == bluetooth_gatt_characteristic::kFlagWritableAuxiliaries)
+ props |= kPropertyWritableAuxiliaries;
+ }
+
+ return props;
}
device::BluetoothGattCharacteristic::Permissions
« no previous file with comments | « device/bluetooth/bluetooth_gatt_chromeos_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698