bluetooth: Simpify sending the DeviceFound message
authorVinicius Costa Gomes <vcgomes@gmail.com>
Fri, 16 Aug 2013 17:27:13 +0000 (14:27 -0300)
committerVinicius Costa Gomes <vcgomes@gmail.com>
Fri, 16 Aug 2013 17:29:01 +0000 (14:29 -0300)
This changes the semantics of this message a little, now it will
mean that a device was found during a Discovery, no matter if we
already have a object device representing it (known device) or
not.

bluetooth/bluetooth_context_bluez4.cc

index 37980ac..e0c4b2e 100644 (file)
@@ -352,15 +352,9 @@ void BluetoothContext::DeviceFound(std::string address, GVariantIter* properties
   const gchar* key;
   GVariant* value;
   picojson::value::object o;
-  DeviceMap::iterator it = known_devices_.find(address);
-
-  if (it == known_devices_.end()) { // Found on discovery.
-    o["cmd"] = picojson::value("DeviceFound");
-    o["found_on_discovery"] = picojson::value(true);
-  } else { // Updated during discovery.
-    o["cmd"] = picojson::value("DeviceUpdated");
-    o["found_on_discovery"] = picojson::value(false);
-  }
+
+  o["cmd"] = picojson::value("DeviceFound");
+  o["found_on_discovery"] = picojson::value(true);
 
   while (g_variant_iter_loop(properties, "{sv}", &key, &value))
     getPropertyValue(key, value, o);