From: Anderson Lizardo <anderson.lizardo@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Anderson Lizardo <anderson.lizardo@openbossa.org>
Subject: [PATCH RFC BlueZ 5/5] Add testing API to dummy Time Server provider
Date: Fri, 2 Dec 2011 14:34:10 -0400 [thread overview]
Message-ID: <1322850850-18019-6-git-send-email-anderson.lizardo@openbossa.org> (raw)
In-Reply-To: <1322850850-18019-1-git-send-email-anderson.lizardo@openbossa.org>
The new TimeUpdated() is useful to test Current Time Characteristic
value notifications.
---
time/provider-dummy.c | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/time/provider-dummy.c b/time/provider-dummy.c
index ba0744f..ab90f7b 100644
--- a/time/provider-dummy.c
+++ b/time/provider-dummy.c
@@ -23,20 +23,59 @@
*/
#include <stdint.h>
+#include <glib.h>
+#include <dbus/dbus.h>
+#include <gdbus.h>
#include "server.h"
#include "log.h"
+#define TIME_DUMMY_IFACE "org.bluez.TimeProviderTest"
+#define TIME_DUMMY_PATH "/org/bluez/test"
+
+static DBusConnection *connection = NULL;
+
+static DBusMessage *time_updated(DBusConnection *conn, DBusMessage *msg,
+ void *data)
+{
+ DBG("");
+
+ current_time_updated();
+
+ return dbus_message_new_method_return(msg);
+}
+
+static GDBusMethodTable dummy_methods[] = {
+ { "TimeUpdated", "", "", time_updated },
+};
+
int time_provider_init(void)
{
DBG("");
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+
+ if (g_dbus_register_interface(connection, TIME_DUMMY_PATH,
+ TIME_DUMMY_IFACE, dummy_methods, NULL,
+ NULL, NULL, NULL) == FALSE) {
+ error("time-dummy interface %s init failed on path %s",
+ TIME_DUMMY_IFACE, TIME_DUMMY_PATH);
+ dbus_connection_unref(connection);
+
+ return -1;
+ }
+
return 0;
}
void time_provider_exit(void)
{
DBG("");
+
+ g_dbus_unregister_interface(connection, TIME_DUMMY_PATH,
+ TIME_DUMMY_IFACE);
+ dbus_connection_unref(connection);
+ connection = NULL;
}
void time_provider_status(uint8_t *state, uint8_t *result)
--
1.7.0.4
next prev parent reply other threads:[~2011-12-02 18:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-02 18:34 [PATCH RFC BlueZ 0/5] Time Profile (server) improvements Anderson Lizardo
2011-12-02 18:34 ` [PATCH RFC BlueZ 1/5] Time Profile: add Reference Time Update Service Anderson Lizardo
2011-12-02 18:34 ` [PATCH RFC BlueZ 2/5] Time Profile: implement generic "time provider" interface Anderson Lizardo
2011-12-02 18:34 ` [PATCH RFC BlueZ 3/5] Time Profile: Add "timed" time provider Anderson Lizardo
2011-12-02 18:34 ` [PATCH RFC BlueZ 4/5] Add support for sending notifications for current time Anderson Lizardo
2011-12-02 18:34 ` Anderson Lizardo [this message]
2012-02-01 22:48 ` [PATCH RFC BlueZ 0/5] Time Profile (server) improvements Arik Nemtsov
2012-02-01 23:12 ` Anderson Lizardo
2012-02-02 12:19 ` Arik Nemtsov
2012-02-02 13:07 ` Anderson Lizardo
2012-02-02 13:32 ` Arik Nemtsov
2012-02-02 14:06 ` Anderson Lizardo
2012-05-16 11:40 ` Arun K. Singh
2012-05-17 14:50 ` Anderson Lizardo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1322850850-18019-6-git-send-email-anderson.lizardo@openbossa.org \
--to=anderson.lizardo@openbossa.org \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).