* [Bluez-devel] [DBUS PATCH]RemoteAlias
@ 2006-02-22 18:10 Claudio Takahasi
2006-02-22 23:46 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Claudio Takahasi @ 2006-02-22 18:10 UTC (permalink / raw)
To: bluez-devel
[-- Attachment #1: Type: text/plain, Size: 348 bytes --]
Hi Marcel,
here is the patch that implements the RemoteAlias.
What should be the reply message when the alias is not found?
This patch returns"org.bluez.Error: No such device or address", is it ok?
Regards,
Caudio.
--
---------------------------------------------------------
Claudio Takahasi
Instituto Nokia de Tecnologia - INdT
[-- Attachment #2: remote_alias01.patch --]
[-- Type: text/x-patch, Size: 1497 bytes --]
Index: hcid/dbus-device.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus-device.c,v
retrieving revision 1.6
diff -u -r1.6 dbus-device.c
--- hcid/dbus-device.c 21 Feb 2006 23:55:19 -0000 1.6
+++ hcid/dbus-device.c 22 Feb 2006 18:04:38 -0000
@@ -538,8 +538,41 @@
static DBusMessage* handle_dev_remote_alias_req(DBusMessage *msg, void *data)
{
- /*FIXME: */
- return bluez_new_failure_msg(msg, BLUEZ_EDBUS_NOT_IMPLEMENTED);
+ struct hci_dbus_data *dbus_data = data;
+ DBusConnection *connection = get_dbus_connection();
+ DBusMessageIter iter;
+ DBusMessage *reply;
+ DBusMessage *signal;
+ char str[249], *str_ptr = str, *addr_ptr;
+ bdaddr_t bdaddr;
+ int err;
+
+ dbus_message_iter_init(msg, &iter);
+ dbus_message_iter_get_basic(&iter, &addr_ptr);
+
+ str2ba(addr_ptr, &bdaddr);
+
+ err = get_device_alias(dbus_data->dev_id, &bdaddr, str, sizeof(str));
+
+ if (err < 0) {
+ reply = bluez_new_failure_msg(msg, BLUEZ_ESYSTEM_OFFSET | -err);
+ goto failed;
+ }
+
+ signal = dev_signal_factory(dbus_data->dev_id, DEV_SIG_REMOTE_ALIAS,
+ DBUS_TYPE_STRING, &addr_ptr,
+ DBUS_TYPE_STRING, &str_ptr,
+ DBUS_TYPE_INVALID);
+ if (signal) {
+ dbus_connection_send(connection, signal, NULL);
+ dbus_connection_flush(connection);
+ dbus_message_unref(signal);
+ }
+
+ reply = dbus_message_new_method_return(msg);
+failed:
+ return reply;
+
}
static DBusMessage* handle_dev_remote_name_req(DBusMessage *msg, void *data)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Bluez-devel] [DBUS PATCH]RemoteAlias
2006-02-22 18:10 [Bluez-devel] [DBUS PATCH]RemoteAlias Claudio Takahasi
@ 2006-02-22 23:46 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2006-02-22 23:46 UTC (permalink / raw)
To: bluez-devel
Hi Claudio,
> here is the patch that implements the RemoteAlias.
>
> What should be the reply message when the alias is not found?
> This patch returns"org.bluez.Error: No such device or address", is it ok?
it has been replaced by GetRemoteAlias. See my other email for details.
Regards
Marcel
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-02-22 23:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-22 18:10 [Bluez-devel] [DBUS PATCH]RemoteAlias Claudio Takahasi
2006-02-22 23:46 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).