summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-20 14:54:24 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-20 14:54:24 +0000
commitf511421ba10092ba32343a973e71f96ce4698f7b (patch)
tree33abfc45110aa5e7ea8a1852bab148d1d1254104
parent835dd438bc43c1483480aaee08b7a5bfa49a21b6 (diff)
Added adapter UpdateServiceRecord implementation
-rw-r--r--hcid/adapter.c22
-rw-r--r--hcid/dbus-database.c24
-rw-r--r--hcid/dbus-database.h4
3 files changed, 18 insertions, 32 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c
index eda5fc22..bd80023f 100644
--- a/hcid/adapter.c
+++ b/hcid/adapter.c
@@ -3813,26 +3813,12 @@ static DBusHandlerResult add_service_record(DBusConnection *conn,
static DBusHandlerResult update_service_record(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- DBusMessage *reply;
- dbus_uint32_t handle;
- const char *sender, *record;
- int err;
-
- if (dbus_message_get_args(msg, NULL, DBUS_TYPE_UINT32, &handle,
- DBUS_TYPE_STRING, &record, DBUS_TYPE_INVALID) == FALSE)
- return error_invalid_arguments(conn, msg, NULL);
-
- sender = dbus_message_get_sender(msg);
-
- err = update_xml_record(conn, sender, handle, record);
- if (err < 0)
- return error_failed_errno(conn, msg, err);
+ struct adapter *adapter = data;
+ bdaddr_t src;
- reply = dbus_message_new_method_return(msg);
- if (!reply)
- return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ str2ba(adapter->address, &src);
- return send_message_and_unref(conn, reply);
+ return update_xml_record(conn, msg, &src);
}
static DBusHandlerResult remove_service_record(DBusConnection *conn,
diff --git a/hcid/dbus-database.c b/hcid/dbus-database.c
index aa8a7467..a2330940 100644
--- a/hcid/dbus-database.c
+++ b/hcid/dbus-database.c
@@ -314,25 +314,19 @@ static DBusHandlerResult update_service_record(DBusConnection *conn,
return update_record(conn, msg, handle, sdp_record);
}
-int update_xml_record(DBusConnection *conn, const char *sender,
- dbus_uint32_t handle, const char *record)
+DBusHandlerResult update_xml_record(DBusConnection *conn,
+ DBusMessage *msg, bdaddr_t *src)
{
- return -EIO;
-}
-
-static DBusHandlerResult update_service_record_from_xml(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- const char *record;
struct record_data *user_record;
sdp_record_t *sdp_record;
+ const char *record;
dbus_uint32_t handle;
int len;
if (dbus_message_get_args(msg, NULL,
- DBUS_TYPE_UINT32, &handle,
- DBUS_TYPE_STRING, &record,
- DBUS_TYPE_INVALID) == FALSE)
+ DBUS_TYPE_UINT32, &handle,
+ DBUS_TYPE_STRING, &record,
+ DBUS_TYPE_INVALID) == FALSE)
return error_invalid_arguments(conn, msg, NULL);
len = (record ? strlen(record) : 0);
@@ -353,6 +347,12 @@ static DBusHandlerResult update_service_record_from_xml(DBusConnection *conn,
return update_record(conn, msg, handle, sdp_record);
}
+static DBusHandlerResult update_service_record_from_xml(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ return update_xml_record(conn, msg, BDADDR_ANY);
+}
+
int remove_record(DBusConnection *conn, const char *sender,
dbus_uint32_t handle)
{
diff --git a/hcid/dbus-database.h b/hcid/dbus-database.h
index 832c1fb5..9ca7ce6c 100644
--- a/hcid/dbus-database.h
+++ b/hcid/dbus-database.h
@@ -31,8 +31,8 @@ DBusHandlerResult database_message(DBusConnection *conn,
int add_xml_record(DBusConnection *conn, const char *sender,
const char *record, dbus_uint32_t *handle);
-int update_xml_record(DBusConnection *conn, const char *sender,
- dbus_uint32_t handle, const char *record);
+DBusHandlerResult update_xml_record(DBusConnection *conn,
+ DBusMessage *msg, bdaddr_t *src);
int remove_record(DBusConnection *conn, const char *sender,
dbus_uint32_t handle);