Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / device / bluetooth / bluetooth_device.cc
index 6916f8b..e29e34f 100644 (file)
@@ -7,21 +7,17 @@
 #include <string>
 
 #include "base/strings/utf_string_conversions.h"
-#include "device/bluetooth/bluetooth_utils.h"
+#include "device/bluetooth/bluetooth_gatt_service.h"
 #include "grit/device_bluetooth_strings.h"
 #include "ui/base/l10n/l10n_util.h"
 
 namespace device {
 
-// static
-bool BluetoothDevice::IsUUIDValid(const std::string& uuid) {
-  return !bluetooth_utils::CanonicalUuid(uuid).empty();
-}
-
 BluetoothDevice::BluetoothDevice() {
 }
 
 BluetoothDevice::~BluetoothDevice() {
+  STLDeleteValues(&gatt_services_);
 }
 
 base::string16 BluetoothDevice::GetName() const {
@@ -174,4 +170,21 @@ bool BluetoothDevice::IsPairable() const {
   return true;
 }
 
+std::vector<BluetoothGattService*>
+    BluetoothDevice::GetGattServices() const {
+  std::vector<BluetoothGattService*> services;
+  for (GattServiceMap::const_iterator iter = gatt_services_.begin();
+       iter != gatt_services_.end(); ++iter)
+    services.push_back(iter->second);
+  return services;
+}
+
+BluetoothGattService* BluetoothDevice::GetGattService(
+    const std::string& identifier) const {
+  GattServiceMap::const_iterator iter = gatt_services_.find(identifier);
+  if (iter != gatt_services_.end())
+    return iter->second;
+  return NULL;
+}
+
 }  // namespace device