g_free(cb_data);
}
-int _bt_register_event_custom(int event_type, const char *path, const char *interface,
- GDBusSignalCallback event_func, void *event_cb, void *user_data)
-{
- GDBusConnection *connection_type;
- bt_event_info_t *cb_data;
-
- retv_if(NULL == path, BLUETOOTH_ERROR_INVALID_PARAM);
- retv_if(NULL == interface, BLUETOOTH_ERROR_INVALID_PARAM);
- retv_if(NULL == event_func, BLUETOOTH_ERROR_INVALID_PARAM);
- retv_if(NULL == event_cb, BLUETOOTH_ERROR_INVALID_PARAM);
-
- if (is_initialized == FALSE)
- _bt_init_event_handler();
-
- if (__bt_event_is_registered(event_type) == TRUE) {
- BT_ERR("The event is already registed");
- return BLUETOOTH_ERROR_ALREADY_INITIALIZED;
- }
-
- connection_type = _bt_gdbus_get_system_gconn();
- if (connection_type == NULL)
- return BLUETOOTH_ERROR_INTERNAL;
-
- cb_data = g_new0(bt_event_info_t, 1);
-
- cb_data->event_type = event_type;
- cb_data->cb = event_cb;
- cb_data->user_data = user_data;
-
- cb_data->id = g_dbus_connection_signal_subscribe(connection_type,
- NULL, interface, NULL, path, NULL, 0,
- event_func, cb_data, NULL);
-
- event_list = g_slist_append(event_list, cb_data);
-
- return BLUETOOTH_ERROR_NONE;
-}
-
#ifndef GATT_DIRECT
static void __bt_gatt_server_event_filter(GDBusConnection *connection,
const gchar *sender_name,
int _bt_register_event(int event_type, void *event_cb, void *user_data)
{
+ GDBusConnection *connection_type;
GDBusSignalCallback event_func;
+ bt_event_info_t *cb_data;
const char *path;
const char *interface = BT_EVENT_SERVICE;
+ if (is_initialized == FALSE)
+ _bt_init_event_handler();
+
if (__bt_event_is_registered(event_type) == TRUE) {
BT_ERR("The event is already registed");
return BLUETOOTH_ERROR_ALREADY_INITIALIZED;
break;
#endif
case BT_HDP_EVENT:
- BT_DBG("BT_HID_DEVICE_EVENT");
+ BT_DBG("BT_HDP_EVENT");
event_func = __bt_hdp_event_filter;
path = BT_HDP_DEVICE_PATH;
break;
return BLUETOOTH_ERROR_INTERNAL;
}
- return _bt_register_event_custom(event_type, path,
- interface, event_func, event_cb, user_data);
+ connection_type = _bt_gdbus_get_system_gconn();
+ if (connection_type == NULL)
+ return BLUETOOTH_ERROR_INTERNAL;
+
+ cb_data = g_new0(bt_event_info_t, 1);
+
+ cb_data->event_type = event_type;
+ cb_data->cb = event_cb;
+ cb_data->user_data = user_data;
+
+ cb_data->id = g_dbus_connection_signal_subscribe(connection_type,
+ NULL, interface, NULL, path, NULL, 0,
+ event_func, cb_data, NULL);
+
+ event_list = g_slist_append(event_list, cb_data);
+
+ return BLUETOOTH_ERROR_NONE;
}
int _bt_unregister_event(int event_type)