bt_gatt_h _bt_gatt_client_add_service(bt_gatt_client_h client, const char *path);
#endif
+int _bt_gatt_client_remove_service(bt_gatt_client_h client, const char *uuid);
+
int _bt_gatt_client_update_services(bt_gatt_client_h client);
int _bt_gatt_client_update_include_services(bt_gatt_h service);
#ifdef TIZEN_GATT_CLIENT
BT_INFO("Service(%s) is added", service_change->uuid);
client->services_discovered = false;
+ // TODO: Update for only added service
ret = _bt_gatt_client_update_services(client);
if (ret != BT_ERROR_NONE) {
BT_ERR("_bt_gatt_client_update_services is failed");
#ifdef TIZEN_GATT_CLIENT
BT_INFO("Service(%s) is removed", svc->uuid);
client->services_discovered = false;
- ret = _bt_gatt_client_update_services(client);
+ ret = _bt_gatt_client_remove_service(client, svc->uuid);
if (ret != BT_ERROR_NONE) {
- BT_ERR("_bt_gatt_client_update_services is failed");
+ BT_ERR("_bt_gatt_client_remove_service is failed");
break;
}
#else
}
#endif
+int _bt_gatt_client_remove_service(bt_gatt_client_h client, const char *uuid)
+{
+ bt_gatt_client_s *client_s = client;
+ bt_gatt_service_s *svc;
+ GSList *l;
+
+ for (l = client_s->services; l != NULL; l = g_slist_next(l)) {
+ svc = (bt_gatt_service_s *)l->data;
+ if (svc == NULL)
+ continue;
+
+ if (!g_ascii_strcasecmp(svc->uuid, uuid)) {
+ BT_DBG("Free removed service");
+ client_s->services = g_slist_remove(client_s->services, svc);
+ __bt_gatt_free_service(svc);
+ break;
+ }
+ }
+
+ return BT_ERROR_NONE;
+}
+
#ifdef TIZEN_GATT_CLIENT
int _bt_gatt_client_update_services(bt_gatt_client_h client)
{