const GSList *l = NULL;
bt_gatt_client_s *client = NULL;
bt_gatt_service_s *svc = NULL;
+ int ret;
BT_INFO("BLUETOOTH_EVENT_GATT_CLIENT_SERVICE_CHANGED");
== BLUETOOTH_GATT_SERVICE_CHANGE_TYPE_ADD) {
for (l = client->services; l; l = g_slist_next(l)) {
svc = l->data;
+#ifdef TIZEN_GATT_CLIENT
+ if (!g_strcmp0(svc->uuid, service_change->uuid))
+ break;
+#else
if (!g_strcmp0(svc->path, service_change->svc_path))
break;
+#endif
}
if (l) {
BT_INFO("already added service : %s", svc->path);
break;
}
#ifdef TIZEN_GATT_CLIENT
- BT_INFO("TODO this task");
+ BT_INFO("Service(%s) is added", service_change->uuid);
+ client->services_discovered = false;
+ ret = _bt_gatt_client_update_services(client);
+ if (ret != BT_ERROR_NONE) {
+ BT_ERR("_bt_gatt_client_update_services is failed");
+ break;
+ }
#else
svc = _bt_gatt_client_add_service(client,
service_change->svc_path);
-#endif
if (svc == NULL) {
BT_ERR("_bt_gatt_client_add_service is failed");
break;
}
+#endif
if (client->connected && client->service_changed_cb)
client->service_changed_cb(client,
BT_GATT_CLIENT_SERVICE_ADDED,
- svc->uuid,
+ service_change->uuid,
client->service_changed_user_data);
} else {
char *removed_uuid = NULL;
for (l = client->services; l; l = g_slist_next(l)) {
svc = l->data;
+#ifdef TIZEN_GATT_CLIENT
+ if (!g_strcmp0(svc->uuid, service_change->uuid))
+ break;
+#else
if (!g_strcmp0(svc->path, service_change->svc_path))
break;
+#endif
}
if (!l) {
BT_ERR("There is NO matched service");
break;
}
+ BT_INFO("Service(%s) is removed", svc->uuid);
removed_uuid = g_strdup(svc->uuid);
bt_gatt_service_destroy((bt_gatt_h)svc);
ret = bt_get_uuid_name(uuid, &svc);
if (ret != BT_ERROR_NONE)
- TC_PRT("Remote device [%s] : %s is %s", addr, svc,
+ svc = g_strdup(uuid);
+
+ TC_PRT("Remote device [%s] : %s is %s", addr, svc,
type == BT_GATT_CLIENT_SERVICE_ADDED ?
"Added" : "Removed");
g_free(svc);