All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] stkagent: Add ConfirmCallSetup request.
@ 2010-08-25 15:49 Andrzej Zaborowski
  2010-08-25 15:49 ` [PATCH 2/3][RfC] Add __ofono_voicecall_dial for other atoms to make calls Andrzej Zaborowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrzej Zaborowski @ 2010-08-25 15:49 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2773 bytes --]

---
 src/stkagent.c |   65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/stkagent.h |    5 ++++
 2 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/src/stkagent.c b/src/stkagent.c
index e71436d..f62c2bd 100644
--- a/src/stkagent.c
+++ b/src/stkagent.c
@@ -789,3 +789,68 @@ int stk_agent_request_input(struct stk_agent *agent, const char *text,
 
 	return 0;
 }
+
+static void confirm_call_cb(DBusPendingCall *call, void *data)
+{
+	struct stk_agent *agent = data;
+	stk_agent_confirmation_cb cb = agent->user_cb;
+	DBusMessage *reply = dbus_pending_call_steal_reply(call);
+	enum stk_agent_result result;
+	gboolean remove_agent;
+	dbus_bool_t confirm;
+
+	if (check_error(agent, reply,
+			ALLOWED_ERROR_TERMINATE, &result) == -EINVAL) {
+		remove_agent = TRUE;
+		goto error;
+	}
+
+	if (result != STK_AGENT_RESULT_OK) {
+		cb(result, FALSE, agent->user_data);
+		goto done;
+	}
+
+	if (dbus_message_get_args(reply, NULL,
+					DBUS_TYPE_BOOLEAN, &confirm,
+					DBUS_TYPE_INVALID) == FALSE) {
+		ofono_error("Can't parse the reply to ConfirmCallSetup()");
+		remove_agent = TRUE;
+		goto error;
+	}
+
+	cb(result, confirm, agent->user_data);
+
+	CALLBACK_END();
+}
+
+int stk_agent_confirm_call(struct stk_agent *agent, const char *text,
+				uint8_t icon_id, stk_agent_confirmation_cb cb,
+				void *user_data, ofono_destroy_func destroy,
+				int timeout)
+{
+	DBusConnection *conn = ofono_dbus_get_connection();
+
+	agent->msg = dbus_message_new_method_call(agent->bus, agent->path,
+							OFONO_SIM_APP_INTERFACE,
+							"ConfirmCallSetup");
+	if (agent->msg == NULL)
+		return -ENOMEM;
+
+	dbus_message_append_args(agent->msg,
+					DBUS_TYPE_STRING, &text,
+					DBUS_TYPE_BYTE, &icon_id,
+					DBUS_TYPE_INVALID);
+
+	if (dbus_connection_send_with_reply(conn, agent->msg, &agent->call,
+						timeout) == FALSE ||
+			agent->call == NULL)
+		return -EIO;
+
+	agent->user_cb = cb;
+	agent->user_data = user_data;
+	agent->user_destroy = destroy;
+
+	dbus_pending_call_set_notify(agent->call, confirm_call_cb, agent, NULL);
+
+	return 0;
+}
diff --git a/src/stkagent.h b/src/stkagent.h
index 70f1f88..c644210 100644
--- a/src/stkagent.h
+++ b/src/stkagent.h
@@ -112,5 +112,10 @@ int stk_agent_request_input(struct stk_agent *agent, const char *text,
 				void *user_data, ofono_destroy_func destroy,
 				int timeout);
 
+int stk_agent_confirm_call(struct stk_agent *agent, const char *text,
+				uint8_t icon_id, stk_agent_confirmation_cb cb,
+				void *user_data, ofono_destroy_func destroy,
+				int timeout);
+
 void append_menu_items_variant(DBusMessageIter *iter,
 				const struct stk_menu_item *items);
-- 
1.7.1.86.g0e460.dirty


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-26  3:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-25 15:49 [PATCH 1/3] stkagent: Add ConfirmCallSetup request Andrzej Zaborowski
2010-08-25 15:49 ` [PATCH 2/3][RfC] Add __ofono_voicecall_dial for other atoms to make calls Andrzej Zaborowski
2010-08-25 15:49 ` [PATCH 3/3] stk: Handle the Set Up Call proactive command Andrzej Zaborowski
2010-08-26  3:39 ` [PATCH 1/3] stkagent: Add ConfirmCallSetup request Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.