summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2006-10-12 15:28:12 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2006-10-12 15:28:12 +0000
commitffd5e5fb837d8ff39dffe17d5c80983b2b82f834 (patch)
tree66d0c2f179fb8d53d2272686d5ee6a7b04cc05a1
parentdc98e542d99dfa603ba21d355d902da2409e7c29 (diff)
Implement SetPeriodicDiscoveryNameResolving and GetPeriodicDiscoveryNameResolving
-rw-r--r--hcid/dbus-adapter.c63
-rw-r--r--hcid/dbus-api.txt14
-rw-r--r--hcid/dbus.h1
3 files changed, 77 insertions, 1 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c
index baf5edf4..fc00a261 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -2273,7 +2273,11 @@ static DBusHandlerResult handle_dev_start_periodic_req(DBusConnection *conn, DBu
}
adapter->pdiscovery_requestor = strdup(dbus_message_get_sender(msg));
- adapter->discover_type = PERIODIC_INQUIRY | RESOLVE_NAME;
+
+ if (adapter->pdiscov_resolve_names)
+ adapter->discover_type = PERIODIC_INQUIRY | RESOLVE_NAME;
+ else
+ adapter->discover_type = PERIODIC_INQUIRY;
reply = dbus_message_new_method_return(msg);
@@ -2333,6 +2337,61 @@ static DBusHandlerResult handle_dev_is_periodic_req(DBusConnection *conn, DBusMe
return send_message_and_unref(conn, reply);
}
+static DBusHandlerResult handle_dev_set_pdiscov_name_resolve(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ DBusMessage *reply;
+ DBusError err;
+ struct adapter *adapter = data;
+ dbus_bool_t resolve;
+
+ dbus_error_init(&err);
+ dbus_message_get_args(msg, &err,
+ DBUS_TYPE_BOOLEAN, &resolve,
+ DBUS_TYPE_INVALID);
+
+ if (dbus_error_is_set(&err)) {
+ error("Can't extract message arguments:%s", err.message);
+ dbus_error_free(&err);
+ return error_invalid_arguments(conn, msg);
+ }
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ adapter->pdiscov_resolve_names = resolve;
+
+ if (adapter->pdisc_active) {
+ if (resolve)
+ adapter->discover_type |= RESOLVE_NAME;
+ else
+ adapter->discover_type &= ~RESOLVE_NAME;
+ }
+
+ return send_message_and_unref(conn, reply);
+}
+
+static DBusHandlerResult handle_dev_get_pdiscov_name_resolve(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ DBusMessage *reply;
+ struct adapter *adapter = data;
+ dbus_bool_t resolve = adapter->pdiscov_resolve_names;
+
+ if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
+ return error_invalid_arguments(conn, msg);
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ dbus_message_append_args(reply, DBUS_TYPE_BOOLEAN, &resolve,
+ DBUS_TYPE_INVALID);
+
+ return send_message_and_unref(conn, reply);
+}
+
static DBusHandlerResult handle_dev_discover_devices_req(DBusConnection *conn, DBusMessage *msg, void *data)
{
DBusMessage *reply;
@@ -2571,6 +2630,8 @@ static struct service_data dev_services[] = {
{ "StartPeriodicDiscovery", handle_dev_start_periodic_req },
{ "StopPeriodicDiscovery", handle_dev_stop_periodic_req },
{ "IsPeriodicDiscovery", handle_dev_is_periodic_req },
+ { "SetPeriodicDiscoveryNameResolving", handle_dev_set_pdiscov_name_resolve },
+ { "GetPeriodicDiscoveryNameResolving", handle_dev_get_pdiscov_name_resolve },
{ "DiscoverDevices", handle_dev_discover_devices_req },
{ "DiscoverDevicesWithoutNameResolving", handle_dev_discover_devices_req },
diff --git a/hcid/dbus-api.txt b/hcid/dbus-api.txt
index 0f103210..2656a838 100644
--- a/hcid/dbus-api.txt
+++ b/hcid/dbus-api.txt
@@ -755,6 +755,20 @@ Methods string GetAddress()
Possible errors: none
+ void SetPeriodicDiscoveryNameResolving(boolean resolve_names)
+
+ Enable or disable automatic remote name resolving for
+ periodic discovery.
+
+ Possible errors: org.bluez.Error.InvalidArguments
+
+ boolean GetPeriodicDiscoveryNameResolving()
+
+ Check if automatic remote name resolving is enabled or not
+ for periodic discovery.
+
+ Possible error: org.bluez.Error.InvalidArguments
+
array{uint32} GetRemoteServiceHandles(string address, string match)
This method will request the SDP database of a remote
diff --git a/hcid/dbus.h b/hcid/dbus.h
index 954e7ab5..561f39b0 100644
--- a/hcid/dbus.h
+++ b/hcid/dbus.h
@@ -117,6 +117,7 @@ struct adapter {
int pdisc_active; /* periodic discovery active */
int pinq_idle; /* tracks the idle time for periodic inquiry */
int discover_type; /* type requested */
+ int pdiscov_resolve_names; /* Resolve names when doing periodic discovery */
struct slist *disc_devices;
struct slist *oor_devices; /* out of range device list */
char *pdiscovery_requestor; /* periodic discovery requestor unique name */