Redundant code optimization for GattService event 06/129106/1
authorInjun Yang <injun.yang@samsung.com>
Mon, 15 May 2017 02:15:27 +0000 (11:15 +0900)
committerInjun Yang <injun.yang@samsung.com>
Mon, 15 May 2017 04:42:34 +0000 (13:42 +0900)
[Model] All
[BinType] AP
[Customer] OPEN

[Issue#] N/A
[Request] Internal
[Occurrence Version] N/A

[Problem] When below interface removed, check the unnecessary condition
org.bluez.GattDescriptor1
org.bluez.GattCharacteristic1
[Cause & Measure] When Characteristic or Descriptor is removed,
    checking watcher list is not required.
    Just check it for org.bluez.GattService1 interface
[Checking Method] Connection with iOS GM

[Team] Basic Connection
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change

Change-Id: Id587ffe489526c75cdfd9192c721a03a3eebcd9d

bt-api/bt-event-handler.c

index b08466e..c20a310 100644 (file)
@@ -3413,19 +3413,19 @@ static void __bt_manager_event_filter(GDBusConnection *connection,
                        return;
                }
 
-               _bt_convert_device_path_to_address(path, address);
-               _bt_convert_addr_string_to_type(change.device_addr.addr, address);
-               _bt_convert_addr_string_to_secure_string(secure_address, address);
-
-               if (_bluetooth_gatt_check_service_change_watcher_address(&change.device_addr)
-                       == FALSE) {
-                       BT_INFO("GATT Service [%s] removed, but no watcher for %s",
-                                       path, secure_address);
-                       return;
-               }
-
                while (g_variant_iter_loop(interface_iter, "s", &interface_str)) {
                        if (g_strcmp0(interface_str, GATT_SERV_INTERFACE) == 0) {
+                               _bt_convert_device_path_to_address(path, address);
+                               _bt_convert_addr_string_to_type(change.device_addr.addr, address);
+                               _bt_convert_addr_string_to_secure_string(secure_address, address);
+
+                               if (_bluetooth_gatt_check_service_change_watcher_address(&change.device_addr)
+                                       == FALSE) {
+                                       BT_INFO("GATT Service [%s] removed, but no watcher for %s",
+                                                       path, secure_address);
+                                       return;
+                               }
+
                                change.svc_path = g_strdup(path);
                                change.change_type = BLUETOOTH_GATT_SERVICE_CHANGE_TYPE_REMOVE;