This emulates application setting their attribute handles.
Change-Id: Ia5e84fbc3ed591856680fb025238b12f451f1e7c
Signed-off-by: himanshu <h.himanshu@samsung.com>
service->path = g_strdup_printf("%s/service%p", APP_PATH, service);
service->primary = primary;
+ if (argc > 2)
+ service->handle = atoi(argv[2]);
+
if (g_dbus_register_interface(conn, service->path,
SERVICE_INTERFACE, NULL, NULL,
service_properties, service,
}
static const GDBusPropertyTable chrc_properties[] = {
- { "Handle", "s", chrc_get_handle, chrc_set_handle, NULL },
+ { "Handle", "q", chrc_get_handle, chrc_set_handle, NULL },
{ "UUID", "s", chrc_get_uuid, NULL, NULL },
{ "Service", "o", chrc_get_service, NULL, NULL },
{ "Value", "ay", chrc_get_value, NULL, NULL },
chrc->flags = g_strsplit(argv[2], ",", -1);
chrc->authorization_req = attr_authorization_flag_exists(chrc->flags);
+ if (argc > 3)
+ chrc->handle = atoi(argv[3]);
+
if (g_dbus_register_interface(conn, chrc->path, CHRC_INTERFACE,
chrc_methods, NULL, chrc_properties,
chrc, chrc_free) == FALSE) {
desc->path = g_strdup_printf("%s/desc%p", desc->chrc->path, desc);
desc->flags = g_strsplit(argv[2], ",", -1);
+ if (argc > 3)
+ desc->handle = atoi(argv[3]);
+
if (g_dbus_register_interface(conn, desc->path, DESC_INTERFACE,
desc_methods, NULL, desc_properties,
desc, desc_free) == FALSE) {
"Register profile to connect" },
{ "unregister-application", NULL, cmd_unregister_app,
"Unregister profile" },
- { "register-service", "<UUID>", cmd_register_service,
+ { "register-service", "<UUID> [handle]", cmd_register_service,
"Register application service." },
{ "unregister-service", "<UUID/object>", cmd_unregister_service,
"Unregister application service" },
- { "register-includes", "<UUID>", cmd_register_includes,
+ { "register-includes", "<UUID> [handle]", cmd_register_includes,
"Register as Included service in." },
{ "unregister-includes", "<Service-UUID><Inc-UUID>",
cmd_unregister_includes,
"Unregister Included service." },
- { "register-characteristic", "<UUID> <Flags=read,write,notify...> "
- , cmd_register_characteristic,
- "Register application characteristic" },
+ { "register-characteristic",
+ "<UUID> <Flags=read,write,notify...> [handle]",
+ cmd_register_characteristic,
+ "Register application characteristic" },
{ "unregister-characteristic", "<UUID/object>",
cmd_unregister_characteristic,
"Unregister application characteristic" },
- { "register-descriptor", "<UUID> <Flags=read,write...>",
+ { "register-descriptor", "<UUID> <Flags=read,write...> [handle]",
cmd_register_descriptor,
"Register application descriptor" },
{ "unregister-descriptor", "<UUID/object>",
{
DBusMessageIter iter;
+ *handle = 0;
+
/* Handle property is optional */
- if (!g_dbus_proxy_get_property(proxy, "Handle", &iter)) {
- *handle = 0;
+ if (!g_dbus_proxy_get_property(proxy, "Handle", &iter))
return true;
- }
-
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT16)
return false;
- dbus_message_iter_get_basic(&iter, &handle);
+ dbus_message_iter_get_basic(&iter, handle);
return true;
}
{
uint16_t handle;
bt_uuid_t uuid;
+ char str[MAX_LEN_UUID_STR];
if (!parse_handle(desc->proxy, &handle)) {
error("Failed to read \"Handle\" property of descriptor");
write_handle(desc->proxy, handle);
}
+ bt_uuid_to_string(&uuid, str, sizeof(str));
+
+ DBG("handle 0x%04x UUID %s", handle, str);
+
return true;
}
{
uint16_t handle;
bt_uuid_t uuid;
+ char str[MAX_LEN_UUID_STR];
const struct queue_entry *entry;
if (!parse_handle(chrc->proxy, &handle)) {
write_handle(chrc->proxy, handle);
}
+ bt_uuid_to_string(&uuid, str, sizeof(str));
+
+ DBG("handle 0x%04x UUID %s", handle, str);
+
/* Handle the descriptors that belong to this characteristic. */
for (entry = queue_get_entries(service->descs); entry;
entry = entry->next) {
bool primary;
uint16_t handle;
const struct queue_entry *entry;
+ char str[MAX_LEN_UUID_STR];
if (!parse_uuid(service->proxy, &uuid)) {
error("Failed to read \"UUID\" property of service");
write_handle(service->proxy, handle);
}
+ bt_uuid_to_string(&uuid, str, sizeof(str));
+
+ DBG("handle 0x%04x UUID %s", handle, str);
+
database_add_includes(service);
entry = queue_get_entries(service->chrcs);