#include "bt-internal-types.h"
#include "bluetooth-ipsp-api.h"
+#ifndef GATT_DIRECT
+#include "bluetooth-gatt-server-api.h"
+#endif
+
#include "bt-common.h"
#include "bt-request-sender.h"
#include "bt-event-handler.h"
user_data);
}
+#ifndef GATT_DIRECT
+void _bt_gatt_server_event_cb(int event, int result, void *param,
+ void *callback, void *user_data)
+{
+ BT_INFO("__bt_gatt_server_event_cb");
+ gatt_server_event_param_t bt_event = { 0, 0, NULL, NULL };
+ bt_event.event = event;
+ bt_event.result = result;
+ bt_event.param_data = param;
+ if (callback) {
+ BT_INFO("GATT Server event callback is registered");
+ ((gatt_server_cb_func_ptr)callback)(bt_event.event, &bt_event,
+ user_data);
+ } else {
+ BT_ERR("GATT Server event callback is not registered!!!");
+ }
+}
+#endif
+
void _bt_divide_device_class(bluetooth_device_class_t *device_class,
unsigned int cod)
{
"</node>";
static void __new_connection_method(GDBusConnection *connection,
- const gchar *sender,
- const gchar *object_path,
- const gchar *interface_name,
- const gchar *method_name,
- GVariant *parameters,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
{
BT_DBG("method %s", method_name);
if (g_strcmp0(method_name, "NewConnection") == 0) {
g_variant_get(ret, "(v)", &value);
uuid_value = (char **)g_variant_get_strv(value, &size);
BT_DBG("Size items %d", size);
- g_variant_unref(value);
- g_variant_unref(ret);
}
if (uuid_value) {
BT_ERR("_bt_discover_service_uuids Error Parameter are NULL..\n");
continue;
} else if (g_ascii_strcasecmp(uuid_value[i], remote_uuid) == 0) {
- result = BLUETOOTH_ERROR_NONE;
- goto done;
+ result = BLUETOOTH_ERROR_NONE;
+ goto done;
}
}
}
if (uuid_value)
g_free(uuid_value);
+ if (value)
+ g_variant_unref(value);
+
+ if (ret)
+ g_variant_unref(ret);
+
BT_DBG("-");
return result;
}
BT_MANAGER_INTERFACE,
NULL, &error);
- if (manager_proxy == NULL && error) {
+ if (error) {
BT_ERR("Unable to create proxy: %s", error->message);
g_clear_error(&error);
+ if (manager_proxy)
+ g_object_unref(manager_proxy);
return NULL;
}
+ if (!manager_proxy)
+ return NULL;
+
result = g_dbus_proxy_call_sync(manager_proxy,
"GetManagedObjects", NULL,
G_DBUS_CALL_FLAGS_NONE, -1,
ret = _bt_register_event(BT_RFCOMM_SERVER_EVENT, (void *)callback_ptr, user_data);
if (ret != BLUETOOTH_ERROR_NONE)
goto fail;
+
+#ifdef GATT_NO_RELAY
ret = _bt_register_event(BT_GATT_BLUEZ_EVENT, (void *)callback_ptr, user_data);
if (ret != BLUETOOTH_ERROR_NONE)
goto fail;
+#endif
ret = _bt_register_event(BT_TDS_EVENT, (void *)callback_ptr, user_data);
if (ret != BLUETOOTH_ERROR_NONE)
goto fail;
ret = _bt_register_event(BT_OTP_EVENT, (void *)callback_ptr, user_data);
if (ret != BLUETOOTH_ERROR_NONE)
goto fail;
+ ret = _bt_register_event(BT_HDP_EVENT, (void *)callback_ptr, user_data);
+ if (ret != BLUETOOTH_ERROR_NONE)
+ goto fail;
}
_bt_register_name_owner_changed();