bool chrcs_ready;
struct queue *pending_ext_props;
guint idle_id;
-#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
- guint idle_id2;
-#endif
};
struct characteristic {
if (service->idle_id)
g_source_remove(service->idle_id);
-#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
- if (service->idle_id2)
- g_source_remove(service->idle_id2);
-#endif
-
queue_remove_all(service->chrcs, NULL, NULL, unregister_characteristic);
g_dbus_unregister_interface(btd_get_dbus_connection(), service->path,
GATT_SERVICE_IFACE);
}
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+static void notify_service_added(struct service *service)
+{
+ char *svc_path;
+
+ if (service == NULL) {
+ error("service is NULL");
+ return;
+ }
+
+ if (service->path == NULL) {
+ error("service->path is NULL");
+ return;
+ }
+ if (!service->chrcs_ready) {
+ error("service is not ready");
+ return;
+ }
+
+ svc_path = g_strdup(service->path);
+
+ g_dbus_emit_signal(btd_get_dbus_connection(), service->path,
+ GATT_SERVICE_IFACE, "GattServiceAdded",
+ DBUS_TYPE_STRING, &svc_path,
+ DBUS_TYPE_INVALID);
+
+ g_free(svc_path);
+
+ return;
+}
+#endif
+
static void notify_chrcs(struct service *service)
{
g_dbus_emit_property_changed(btd_get_dbus_connection(), service->path,
GATT_SERVICE_IFACE,
"Characteristics");
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ if (service->primary == true) {
+ DBG("Notify Service Added");
+ notify_service_added(service);
+ }
+#endif
}
struct export_data {
return FALSE;
}
-#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
-static gboolean notify_service_added_complete(gpointer user_data)
-{
- struct service *service = user_data;
- char *svc_path;
-
- if (service == NULL || service->path == NULL)
- return FALSE;
-
- svc_path = g_strdup(service->path);
-
- g_dbus_emit_signal(btd_get_dbus_connection(), service->path,
- GATT_SERVICE_IFACE, "GattServiceAdded",
- DBUS_TYPE_STRING, &svc_path,
- DBUS_TYPE_INVALID);
-
- g_free(svc_path);
-
- return FALSE;
-}
-#endif
-
static void export_service(struct gatt_db_attribute *attr, void *user_data)
{
struct btd_gatt_client *client = user_data;
*/
if (!service->chrcs_ready && queue_isempty(service->pending_ext_props))
service->idle_id = g_idle_add(set_chrcs_ready, service);
-
-#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
- if (service->primary == true)
- service->idle_id2 = g_idle_add(notify_service_added_complete, service);
-#endif
}
static void create_services(struct btd_gatt_client *client)