adapter: Rename watch_client to discovery_client
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 11 Jun 2020 20:23:06 +0000 (13:23 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 12 Apr 2021 09:00:49 +0000 (14:30 +0530)
watch term is quite vague so this replace it with discovery which is
what is used for the filter as well.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/adapter.c

index cc97d61..6da1865 100644 (file)
@@ -208,7 +208,7 @@ struct discovery_filter {
        bool discoverable;
 };
 
-struct watch_client {
+struct discovery_client {
        struct btd_adapter *adapter;
        DBusMessage *msg;
        char *owner;
@@ -318,7 +318,7 @@ struct btd_adapter {
        struct mgmt_cp_start_service_discovery *current_discovery_filter;
 
 #ifndef TIZEN_FEATURE_BLUEZ_MODIFY
-       struct watch_client *client;    /* active discovery client */
+       struct discovery_client *client;        /* active discovery client */
 #endif
 
        GSList *discovery_found;        /* list of found devices */
@@ -2091,7 +2091,7 @@ static void discovery_cleanup(struct btd_adapter *adapter)
 
 static void discovery_free(void *user_data)
 {
-       struct watch_client *client = user_data;
+       struct discovery_client *client = user_data;
 
 #ifndef TIZEN_FEATURE_BLUEZ_MODIFY
        DBG("%p", client);
@@ -2112,9 +2112,9 @@ static void discovery_free(void *user_data)
 }
 
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
-static void discovery_remove(struct watch_client *client, bool exit)
+static void discovery_remove(struct discovery_client *client, bool exit)
 #else
-static void discovery_remove(struct watch_client *client)
+static void discovery_remove(struct discovery_client *client)
 #endif
 
 {
@@ -2154,14 +2154,14 @@ static void discovery_remove(struct watch_client *client)
 static void trigger_start_discovery(struct btd_adapter *adapter, guint delay);
 
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
-static void discovery_reply(struct watch_client *client, uint8_t status)
+static void discovery_reply(struct discovery_client *client, uint8_t status)
 #else
-static struct watch_client *discovery_complete(struct btd_adapter *adapter,
+static struct discovery_client *discovery_complete(struct btd_adapter *adapter,
                                                uint8_t status)
 #endif
 {
 #ifndef TIZEN_FEATURE_BLUEZ_MODIFY
-       struct watch_client *client = adapter->client;
+       struct discovery_client *client = adapter->client;
 #endif
        DBusMessage *reply;
 #ifndef TIZEN_FEATURE_BLUEZ_MODIFY
@@ -2196,7 +2196,7 @@ static void start_discovery_complete(uint8_t status, uint16_t length,
                                        const void *param, void *user_data)
 {
        struct btd_adapter *adapter = user_data;
-       struct watch_client *client;
+       struct discovery_client *client;
        const struct mgmt_cp_start_discovery *rp = param;
 
        DBG("status 0x%02x", status);
@@ -2646,7 +2646,7 @@ static void discovering_callback(uint16_t index, uint16_t length,
 
                        if (adapter->le_discovering == true) {
                                if (adapter->le_discovery_list) {
-                                       struct watch_client *client;
+                                       struct discovery_client *client;
 
                                        client = adapter->le_discovery_list->data;
                                        g_dbus_remove_watch(dbus_conn, client->watch);
@@ -2731,7 +2731,7 @@ static bool set_discovery_discoverable(struct btd_adapter *adapter, bool enable)
 static void stop_discovery_complete(uint8_t status, uint16_t length,
                                        const void *param, void *user_data)
 {
-       struct watch_client *client = user_data;
+       struct discovery_client *client = user_data;
        struct btd_adapter *adapter = client->adapter;
        DBusMessage *reply;
 
@@ -2773,7 +2773,7 @@ static void stop_le_discovery_complete(uint8_t status, uint16_t length,
                                        const void *param, void *user_data)
 {
        struct btd_adapter *adapter = user_data;
-       struct watch_client *client;
+       struct discovery_client *client;
        DBusMessage *reply;
 
        DBG("status 0x%02x", status);
@@ -2827,7 +2827,7 @@ static void stop_discovery_complete(uint8_t status, uint16_t length,
                                        const void *param, void *user_data)
 {
        struct btd_adapter *adapter = user_data;
-       struct watch_client *client;
+       struct discovery_client *client;
 
        DBG("status 0x%02x", status);
 
@@ -2849,7 +2849,7 @@ static void stop_discovery_complete(uint8_t status, uint16_t length,
 
 static int compare_sender(gconstpointer a, gconstpointer b)
 {
-       const struct watch_client *client = a;
+       const struct discovery_client *client = a;
        const char *sender = b;
 
        return g_strcmp0(client->owner, sender);
@@ -2882,7 +2882,7 @@ static int merge_discovery_filters(struct btd_adapter *adapter, int *rssi,
        bool has_filtered_discovery = false;
 
        for (l = adapter->discovery_list; l != NULL; l = g_slist_next(l)) {
-               struct watch_client *client = l->data;
+               struct discovery_client *client = l->data;
                struct discovery_filter *item = client->discovery_filter;
 
                if (!item) {
@@ -3049,7 +3049,7 @@ static int update_discovery_filter(struct btd_adapter *adapter)
        }
 
        for (l = adapter->discovery_list; l; l = g_slist_next(l)) {
-               struct watch_client *client = l->data;
+               struct discovery_client *client = l->data;
 
                if (!client->discovery_filter)
                        continue;
@@ -3080,9 +3080,9 @@ static int update_discovery_filter(struct btd_adapter *adapter)
 }
 
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
-static int discovery_stop(struct watch_client *client, bool exit)
+static int discovery_stop(struct discovery_client *client, bool exit)
 #else
-static int discovery_stop(struct watch_client *client)
+static int discovery_stop(struct discovery_client *client)
 #endif
 {
        struct btd_adapter *adapter = client->adapter;
@@ -3143,7 +3143,7 @@ static int discovery_stop(struct watch_client *client)
 
 static void discovery_destroy(void *user_data)
 {
-       struct watch_client *client = user_data;
+       struct discovery_client *client = user_data;
        struct btd_adapter *adapter = client->adapter;
 
        DBG("owner %s", client->owner);
@@ -3193,7 +3193,7 @@ static void discovery_destroy(void *user_data)
 
 static void discovery_disconnect(DBusConnection *conn, void *user_data)
 {
-       struct watch_client *client = user_data;
+       struct discovery_client *client = user_data;
 
        DBG("owner %s", client->owner);
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
@@ -3211,7 +3211,7 @@ static void discovery_disconnect(DBusConnection *conn, void *user_data)
  */
 static bool get_discovery_client(struct btd_adapter *adapter,
                                                const char *owner,
-                                               struct watch_client **client)
+                                               struct discovery_client **client)
 {
        GSList *list = g_slist_find_custom(adapter->discovery_list, owner,
                                                                compare_sender);
@@ -3234,7 +3234,7 @@ static bool get_discovery_client(struct btd_adapter *adapter,
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
 static void le_discovery_destroy(void *user_data)
 {
-       struct watch_client *client = user_data;
+       struct discovery_client *client = user_data;
        struct btd_adapter *adapter = client->adapter;
 
        DBG("owner %s", client->owner);
@@ -3273,7 +3273,7 @@ static void le_discovery_destroy(void *user_data)
 
 static void le_discovery_disconnect(DBusConnection *conn, void *user_data)
 {
-       struct watch_client *client = user_data;
+       struct discovery_client *client = user_data;
        struct btd_adapter *adapter = client->adapter;
        struct mgmt_cp_stop_le_discovery cp;
 
@@ -4363,7 +4363,7 @@ static DBusMessage *adapter_start_custom_discovery(DBusConnection *conn,
 {
        struct btd_adapter *adapter = user_data;
        const char *sender = dbus_message_get_sender(msg);
-       struct watch_client *client;
+       struct discovery_client *client;
        GSList *list;
        const gchar *disc_type;
 
@@ -4398,7 +4398,7 @@ static DBusMessage *adapter_start_custom_discovery(DBusConnection *conn,
        if (list)
                return btd_error_busy(msg);
 
-       client = g_new0(struct watch_client, 1);
+       client = g_new0(struct discovery_client, 1);
 
        client->adapter = adapter;
        client->owner = g_strdup(sender);
@@ -4424,7 +4424,7 @@ static DBusMessage *adapter_start_le_discovery(DBusConnection *conn,
 {
        struct btd_adapter *adapter = user_data;
        const char *sender = dbus_message_get_sender(msg);
-       struct watch_client *client;
+       struct discovery_client *client;
        GSList *list;
 
        DBG("sender %s", sender);
@@ -4446,7 +4446,7 @@ static DBusMessage *adapter_start_le_discovery(DBusConnection *conn,
        if (list)
                return btd_error_busy(msg);
 
-       client = g_new0(struct watch_client, 1);
+       client = g_new0(struct discovery_client, 1);
 
        client->adapter = adapter;
        client->owner = g_strdup(sender);
@@ -4473,7 +4473,7 @@ static DBusMessage *adapter_stop_le_discovery(DBusConnection *conn,
        struct btd_adapter *adapter = user_data;
        const char *sender = dbus_message_get_sender(msg);
        struct mgmt_cp_stop_le_discovery cp;
-       struct watch_client *client;
+       struct discovery_client *client;
        GSList *list;
 
        DBG("sender %s", sender);
@@ -6354,7 +6354,7 @@ static DBusMessage *start_discovery(DBusConnection *conn,
 {
        struct btd_adapter *adapter = user_data;
        const char *sender = dbus_message_get_sender(msg);
-       struct watch_client *client;
+       struct discovery_client *client;
        bool is_discovering;
        int err;
 
@@ -6388,7 +6388,7 @@ static DBusMessage *start_discovery(DBusConnection *conn,
                goto done;
        }
 
-       client = g_new0(struct watch_client, 1);
+       client = g_new0(struct discovery_client, 1);
 
        client->adapter = adapter;
        client->owner = g_strdup(sender);
@@ -6656,7 +6656,7 @@ static DBusMessage *set_discovery_filter(DBusConnection *conn,
                                        DBusMessage *msg, void *user_data)
 {
        struct btd_adapter *adapter = user_data;
-       struct watch_client *client;
+       struct discovery_client *client;
        struct discovery_filter *discovery_filter;
        const char *sender = dbus_message_get_sender(msg);
        bool is_discovering;
@@ -6693,7 +6693,7 @@ static DBusMessage *set_discovery_filter(DBusConnection *conn,
                DBG("successfully cleared pre-set filter");
        } else if (discovery_filter) {
                /* Client pre-setting his filter for first time */
-               client = g_new0(struct watch_client, 1);
+               client = g_new0(struct discovery_client, 1);
                client->adapter = adapter;
                client->owner = g_strdup(sender);
                client->discovery_filter = discovery_filter;
@@ -6714,7 +6714,7 @@ static DBusMessage *stop_discovery(DBusConnection *conn,
 {
        struct btd_adapter *adapter = user_data;
        const char *sender = dbus_message_get_sender(msg);
-       struct watch_client *client;
+       struct discovery_client *client;
        GSList *list;
        int err;
 
@@ -11483,7 +11483,7 @@ static bool is_filter_match(GSList *discovery_filter, struct eir_data *eir_data,
 
        for (l = discovery_filter; l != NULL && got_match != true;
                                                        l = g_slist_next(l)) {
-               struct watch_client *client = l->data;
+               struct discovery_client *client = l->data;
                struct discovery_filter *item = client->discovery_filter;
 
                /*
@@ -11531,7 +11531,7 @@ static bool is_filter_match(GSList *discovery_filter, struct eir_data *eir_data,
 
 static void filter_duplicate_data(void *data, void *user_data)
 {
-       struct watch_client *client = data;
+       struct discovery_client *client = data;
        bool *duplicate = user_data;
 
        if (*duplicate || !client->discovery_filter)
@@ -11562,7 +11562,7 @@ static bool device_is_discoverable(struct btd_adapter *adapter,
 
        /* Do a prefix match for both address and name if pattern is set */
        for (l = adapter->discovery_list; l; l = g_slist_next(l)) {
-               struct watch_client *client = l->data;
+               struct dicovery_client *client = l->data;
                struct discovery_filter *filter = client->discovery_filter;
                size_t pattern_len;