static int latest_id = -1;
#define BT_RFCOMM_ID_MAX 245
static gboolean id_used[BT_RFCOMM_ID_MAX];
-GDBusNodeInfo *new_conn_node;
static const gchar rfcomm_agent_xml[] =
"<node name='/'>"
int _bt_register_new_conn(const char *path, bt_new_connection_cb cb)
{
GDBusConnection *gconn;
+ GDBusNodeInfo *node_info;
int id;
GError *error = NULL;
if (gconn == NULL)
return -1;
- if (new_conn_node == NULL)
- new_conn_node = _bt_get_gdbus_node(rfcomm_agent_xml);
-
- if (new_conn_node == NULL)
+ node_info = _bt_get_gdbus_node(rfcomm_agent_xml);
+ if (node_info == NULL)
return -1;
id = g_dbus_connection_register_object(gconn, path,
- new_conn_node->interfaces[0],
+ node_info->interfaces[0],
&method_table,
cb, NULL, &error);
+ g_dbus_node_info_unref(node_info);
if (id == 0) {
BT_ERR("Failed to register: %s", error->message);
g_error_free(error);
int _bt_register_new_conn_ex(const char *path, const char *bus_name, bt_new_connection_cb cb)
{
GDBusConnection *gconn;
+ GDBusNodeInfo *node_info;
int id;
GError *error = NULL;
if (gconn == NULL)
return -1;
- if (new_conn_node == NULL)
- new_conn_node = _bt_get_gdbus_node_ex(rfcomm_agent_xml, bus_name);
+ node_info = _bt_get_gdbus_node_ex(rfcomm_agent_xml, bus_name);
- if (new_conn_node == NULL)
+ if (node_info == NULL)
return -1;
id = g_dbus_connection_register_object(gconn, path,
- new_conn_node->interfaces[0],
+ node_info->interfaces[0],
&method_table,
cb, NULL, &error);
+ g_dbus_node_info_unref(node_info);
if (id == 0) {
BT_ERR("Failed to register: %s", error->message);
g_error_free(error);
NULL, /* GDBusAuthObserver */
NULL,
&err);
+ g_free(address);
if (!g_conn) {
if (err) {
BT_ERR("Unable to connect to dbus: %s", err->message);
NULL, /* GDBusAuthObserver */
NULL,
&err);
-
+ g_free(address);
if (!local_system_gconn) {
BT_ERR("Unable to connect to dbus: %s", err->message);
g_clear_error(&err);
/* Register ObjectManager interface */
node_info = __bt_gatt_create_method_node_info(
manager_introspection_xml);
-
if (node_info == NULL) {
BT_ERR("failed to get node info");
goto failed;
&manager_interface_vtable,
NULL, NULL, &error);
}
-
+ g_dbus_node_info_unref(node_info);
if (manager_id == 0) {
BT_ERR("failed to register: %s", error->message);
g_error_free(error);
node_info = __bt_gatt_create_method_node_info(
service_introspection_xml);
-
if (node_info == NULL)
return BLUETOOTH_ERROR_INTERNAL;
node_info->interfaces[0],
&serv_interface_vtable,
NULL, NULL, &error);
+ g_dbus_node_info_unref(node_info);
if (object_id == 0) {
BT_ERR("failed to register: %s", error->message);
node_info = __bt_gatt_create_method_node_info(
characteristics_introspection_xml);
-
if (node_info == NULL)
return BLUETOOTH_ERROR_INTERNAL;
node_info->interfaces[0],
&char_interface_vtable,
NULL, NULL, &error);
+ g_dbus_node_info_unref(node_info);
if (object_id == 0) {
BT_ERR("failed to register: %s", error->message);
node_info = __bt_gatt_create_method_node_info(
descriptor_introspection_xml);
-
if (node_info == NULL) {
g_strfreev(line_argv);
g_free(serv_path);
node_info->interfaces[0],
&desc_interface_vtable,
NULL, NULL, &error);
+ g_dbus_node_info_unref(node_info);
if (object_id == 0) {
BT_ERR("failed to register: %s", error->message);
node_info = __bt_telephony_create_method_node_info(
bt_telephony_introspection_xml);
-
if (node_info == NULL) {
BT_ERR("node_info NULL");
return BLUETOOTH_TELEPHONY_ERROR_INVALID_PARAM;
if (__bluetooth_telephony_register_object(TRUE, node_info) !=
BLUETOOTH_TELEPHONY_ERROR_NONE) {
BT_ERR("Registation of Method Failed");
+ g_dbus_node_info_unref(node_info);
return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
}
FN_END;
+ g_dbus_node_info_unref(node_info);
return BLUETOOTH_TELEPHONY_ERROR_NONE;
}
static GDBusConnection *conn;
static GDBusConnection *g_conn;
static guint g_owner_id = 0;
-GDBusNodeInfo *hps_node_info = NULL;
char *g_uri = NULL;
char *g_header = NULL;
static void _bt_hps_on_bus_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
{
+ GDBusNodeInfo *node_info = NULL;
guint object_id;
GError *error = NULL;
g_conn = connection;
+ node_info = g_dbus_node_info_new_for_xml(hps_introspection_xml, &error);
+ if (!node_info) {
+ BT_ERR("Failed to install: %s", error->message);
+ g_clear_error(&error);
+ return;
+ }
+
object_id = g_dbus_connection_register_object(connection, BT_HPS_OBJECT_PATH,
- hps_node_info->interfaces[0],
+ node_info->interfaces[0],
&hps_method_table,
NULL, NULL, &error);
+ g_dbus_node_info_unref(node_info);
if (object_id == 0) {
BT_ERR("Failed to register method table: %s", error->message);
g_error_free(error);
- g_dbus_node_info_unref(hps_node_info);
}
return;
BT_DBG("");
g_object_unref(g_conn);
g_conn = NULL;
- g_dbus_node_info_unref(hps_node_info);
g_bus_unown_name(g_owner_id);
return;
int _bt_hps_register_interface(void)
{
- GError *error = NULL;
guint owner_id;
BT_DBG("");
- hps_node_info = g_dbus_node_info_new_for_xml(hps_introspection_xml, &error);
- if (!hps_node_info) {
- BT_ERR("Failed to install: %s", error->message);
- return BLUETOOTH_ERROR_INTERNAL;
- }
-
owner_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
BT_HPS_SERVICE_NAME,
G_BUS_NAME_OWNER_FLAGS_NONE,
g_object_unref(g_conn);
g_conn = NULL;
- g_dbus_node_info_unref(hps_node_info);
g_bus_unown_name(g_owner_id);
return;
" </interface>"
"</node>";
-GDBusNodeInfo *node_info = NULL;
static gboolean name_acquired = FALSE;
static char *current_sender_playing = NULL;
static void __bt_service_bus_acquired_handler(GDBusConnection *connection,
const gchar *name, gpointer user_data)
{
+ GDBusNodeInfo *node_info = NULL;
+
BT_INFO("bus acquired");
ret_if(connection == NULL);
node_info = __bt_service_create_method_node_info(
bt_service_introspection_xml);
-
ret_if(node_info == NULL);
__bt_service_register_object(connection, node_info, TRUE);
g_dbus_node_info_unref(node_info);
- node_info = NULL;
bt_service_conn = connection;
}
g_object_unref(bt_service_conn);
bt_service_conn = NULL;
}
- if (node_info) {
- g_dbus_node_info_unref(node_info);
- node_info = NULL;
- }
if (owner_id > 0) {
g_bus_unown_name(owner_id);
owner_id = 0;