summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2012-10-08 22:04:34 -0500
committerDenis Kenzior <denkenz@gmail.com>2012-10-09 11:26:58 -0500
commit085b6ac719a6c636602b058a20c1da1e2bc6b249 (patch)
treee11eea1efa5bfbd1c8184396636c8a300d9377d1 /tools
parent83c00d9f8d6ba200a2fb9602be33ac26d6fc4872 (diff)
downloadofono-085b6ac719a6c636602b058a20c1da1e2bc6b249.tar.bz2
stktest: Add support for RequestDigit in agent
Diffstat (limited to 'tools')
-rw-r--r--tools/stktest.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/stktest.c b/tools/stktest.c
index 17d1aeb6..2e51ba44 100644
--- a/tools/stktest.c
+++ b/tools/stktest.c
@@ -65,6 +65,8 @@ enum test_result {
typedef DBusMessage *(*display_text_cb_t)(DBusMessage *msg, const char *text,
unsigned char icon_id,
gboolean urgent);
+typedef DBusMessage *(*request_digit_cb_t)(DBusMessage *msg, const char *alpha,
+ unsigned char icon_id);
typedef void (*terminal_response_func)(const unsigned char *pdu,
unsigned int len);
@@ -251,6 +253,45 @@ static DBusMessage *agent_display_text(DBusConnection *conn, DBusMessage *msg,
return reply;
}
+static DBusMessage *agent_request_digit(DBusConnection *conn, DBusMessage *msg,
+ void *data)
+{
+ const char *alpha;
+ unsigned char icon_id;
+ struct test *test;
+ request_digit_cb_t func;
+ DBusMessage *reply;
+
+ if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &alpha,
+ DBUS_TYPE_BYTE, &icon_id,
+ DBUS_TYPE_INVALID) == FALSE)
+ return stktest_error_invalid_args(msg);
+
+ if (cur_test == NULL)
+ return stktest_error_failed(msg);
+
+ test = cur_test->data;
+ func = test->agent_func;
+
+ if (strcmp(test->method, "RequestDigit")) {
+ g_printerr("Wrong method called!\n");
+ __stktest_test_finish(FALSE);
+ return stktest_error_failed(msg);
+ }
+
+ if (func == NULL) {
+ g_printerr("RequestDigit not expected to be called");
+ __stktest_test_finish(FALSE);
+ return stktest_error_failed(msg);
+ }
+
+ reply = func(msg, alpha, icon_id);
+ if (reply == NULL)
+ pending = dbus_message_ref(msg);
+
+ return reply;
+}
+
static void server_debug(const char *str, void *data)
{
g_print("%s: %s\n", (char *) data, str);
@@ -869,6 +910,10 @@ static const GDBusMethodTable agent_methods[] = {
GDBUS_ARGS({ "text", "s" }, { "icon_id", "y" },
{ "urgent", "b" }), NULL,
agent_display_text) },
+ { GDBUS_ASYNC_METHOD("RequestDigit",
+ GDBUS_ARGS({ "alpha", "s" }, { "icon_id", "y" }),
+ GDBUS_ARGS({ "digit", "s" }),
+ agent_request_digit) },
{ GDBUS_NOREPLY_METHOD("Cancel", NULL, NULL, agent_cancel) },
{ },
};