mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-12-15 23:14:38 +08:00
client: Allow register-application without any UUID
This means that GattProfile1 should not be registered but there could still be services that needs registered with bluetoothd.
This commit is contained in:
parent
7e19bfdbb6
commit
8dc3d02184
@ -726,16 +726,19 @@ void gatt_register_app(DBusConnection *conn, GDBusProxy *proxy, wordexp_t *w)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_dbus_register_interface(conn, APP_PATH,
|
|
||||||
PROFILE_INTERFACE, methods,
|
|
||||||
NULL, properties, NULL, NULL) == FALSE) {
|
|
||||||
rl_printf("Failed to register application object\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < w->we_wordc; i++)
|
for (i = 0; i < w->we_wordc; i++)
|
||||||
uuids = g_list_append(uuids, g_strdup(w->we_wordv[i]));
|
uuids = g_list_append(uuids, g_strdup(w->we_wordv[i]));
|
||||||
|
|
||||||
|
if (uuids) {
|
||||||
|
if (g_dbus_register_interface(conn, APP_PATH,
|
||||||
|
PROFILE_INTERFACE, methods,
|
||||||
|
NULL, properties, NULL,
|
||||||
|
NULL) == FALSE) {
|
||||||
|
rl_printf("Failed to register application object\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (g_dbus_proxy_method_call(l->data, "RegisterApplication",
|
if (g_dbus_proxy_method_call(l->data, "RegisterApplication",
|
||||||
register_app_setup,
|
register_app_setup,
|
||||||
register_app_reply, w,
|
register_app_reply, w,
|
||||||
@ -759,11 +762,14 @@ static void unregister_app_reply(DBusMessage *message, void *user_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rl_printf("Application unregistered\n");
|
||||||
|
|
||||||
|
if (!uuids)
|
||||||
|
return;
|
||||||
|
|
||||||
g_list_free_full(uuids, g_free);
|
g_list_free_full(uuids, g_free);
|
||||||
uuids = NULL;
|
uuids = NULL;
|
||||||
|
|
||||||
rl_printf("Application unregistered\n");
|
|
||||||
|
|
||||||
g_dbus_unregister_interface(conn, APP_PATH, PROFILE_INTERFACE);
|
g_dbus_unregister_interface(conn, APP_PATH, PROFILE_INTERFACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1826,11 +1826,6 @@ static void cmd_register_app(const char *arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w.we_wordc == 0) {
|
|
||||||
rl_printf("Missing argument\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gatt_register_app(dbus_conn, default_ctrl->proxy, &w);
|
gatt_register_app(dbus_conn, default_ctrl->proxy, &w);
|
||||||
|
|
||||||
wordfree(&w);
|
wordfree(&w);
|
||||||
@ -2142,7 +2137,7 @@ static const struct {
|
|||||||
{ "write", "<data=[xx xx ...]>", cmd_write,
|
{ "write", "<data=[xx xx ...]>", cmd_write,
|
||||||
"Write attribute value" },
|
"Write attribute value" },
|
||||||
{ "notify", "<on/off>", cmd_notify, "Notify attribute value" },
|
{ "notify", "<on/off>", cmd_notify, "Notify attribute value" },
|
||||||
{ "register-application", "<UUID ...>", cmd_register_app,
|
{ "register-application", "[UUID ...]", cmd_register_app,
|
||||||
"Register profile to connect" },
|
"Register profile to connect" },
|
||||||
{ "unregister-application", NULL, cmd_unregister_app,
|
{ "unregister-application", NULL, cmd_unregister_app,
|
||||||
"Unregister profile" },
|
"Unregister profile" },
|
||||||
|
Loading…
Reference in New Issue
Block a user