* [Bluez-devel] [DBUS PATCH]LastSeen
@ 2006-02-23 17:09 Claudio Takahasi
2006-02-23 17:23 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Claudio Takahasi @ 2006-02-23 17:09 UTC (permalink / raw)
To: bluez-devel
[-- Attachment #1: Type: text/plain, Size: 385 bytes --]
Hi Marcel,
Here is the patch to add the last seen service.
I saw that I you implemented the SDP skeleton. At least, it seems to
be more interesting than these mechanical patches :) SDP is most
important feature missing on D-Bus API.
Regards,
Claudio.
--
---------------------------------------------------------
Claudio Takahasi
Instituto Nokia de Tecnologia - INdT
[-- Attachment #2: last-seen01.patch --]
[-- Type: text/x-patch, Size: 1272 bytes --]
Index: hcid/dbus-device.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus-device.c,v
retrieving revision 1.11
diff -u -r1.11 dbus-device.c
--- hcid/dbus-device.c 23 Feb 2006 12:48:51 -0000 1.11
+++ hcid/dbus-device.c 23 Feb 2006 17:00:14 -0000
@@ -533,8 +533,35 @@
static DBusMessage* handle_dev_last_seen_req(DBusMessage *msg, void *data)
{
- /*FIXME: */
- return bluez_new_failure_msg(msg, BLUEZ_EDBUS_NOT_IMPLEMENTED);
+ struct hci_dbus_data *dbus_data = data;
+ DBusMessageIter iter;
+ DBusMessage *reply;
+ char filename[PATH_MAX + 1];
+ char addr[18], *addr_ptr, *str;
+
+ get_device_address(dbus_data->dev_id, addr, sizeof(addr));
+
+ snprintf(filename, PATH_MAX, "%s/%s/lastseen", STORAGEDIR, addr);
+
+ dbus_message_iter_init(msg, &iter);
+ dbus_message_iter_get_basic(&iter, &addr_ptr);
+
+ str = textfile_get(filename, addr_ptr);
+
+ if (!str) {
+ reply = bluez_new_failure_msg(msg, BLUEZ_ESYSTEM_OFFSET | ENXIO);
+ goto failed;
+ }
+
+ reply = dbus_message_new_method_return(msg);
+
+ dbus_message_append_args(reply, DBUS_TYPE_STRING, &str,
+ DBUS_TYPE_INVALID);
+
+ free(str);
+
+failed:
+ return reply;
}
static DBusMessage* handle_dev_last_used_req(DBusMessage *msg, void *data)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Bluez-devel] [DBUS PATCH]LastSeen
2006-02-23 17:09 [Bluez-devel] [DBUS PATCH]LastSeen Claudio Takahasi
@ 2006-02-23 17:23 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2006-02-23 17:23 UTC (permalink / raw)
To: bluez-devel
Hi Claudio,
> Here is the patch to add the last seen service.
I applied the patch and also added the last used function, because it
was a real simply copy and paste.
> I saw that I you implemented the SDP skeleton. At least, it seems to
> be more interesting than these mechanical patches :) SDP is most
> important feature missing on D-Bus API.
Actually SDP is one of the horrible protocols I've ever seen. The
current skeleton of hcid is a little playground to see how we might
proceed in the future. And at the moment it is off by default.
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-23 17:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-23 17:09 [Bluez-devel] [DBUS PATCH]LastSeen Claudio Takahasi
2006-02-23 17:23 ` 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).