Skip to contentSkip to conversation

stk: Add Agent register/unregister methods and logic.

PATCH New Andrzej Zaborowski 1 participant 6 messages Jul 15, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 stk: Add Agent register/unregister methods and logic.

The interface is mostly unchanged since
http://lists.ofono.org/pipermail/ofono/2010-June/003040.html
but Timeout property is removed and set to 10 minutes and an agent disconnect sends a User Ended Session response. If no agent is registered when the card sends a command for the UI, a User Ended Session is sent back immediately. This has made the code a little shorter. The "proactive session interaction with terminal display" (TS 102.223 Section 6.9) is also more correctly implemented now.

This patch adds a skeleton that command implementations use in the subsequent patches.

org.ofono.SimApplicationAgent
Methods
(int item, bool help) or GoBack/Terminate Menu(string title,
array{string} items, bool has_help, bool soft_key_preferred, int default_item, bool is_main_menu)
Handles both Set Up Menu type of menu and Select Item since they're similar. The agent can return GoBack or Terminate if is_main_menu is False. The agent may decide to release the display when it receives a main menu request following an event other than a GoBack response. default_item may be -1 meaning no default is given.

Ok/GoBack/Terminate DisplayText(string text, bool
confirmation, bool urgent, bool navigation)
The UI should show the message, optionally asking the user for confirmation. If navigation is false, the returned value will have no effect. If confirmation is false it is optional whether the user can clear the message through MMI action (if so, the agent should send a reply on user MMI action). Frames are not supported currently. A low priority message should only be shown when the screen is only used for idle text display at the moment. A high priority message should be shown when the screen is not used for other high priority message such as low battery or incoming call information. (Should there also be a "Screen busy" reply so we can pass this information to SIM app, as mandated by the spec?)

string/Back/Terminate/Help GetKey(string message, string charset,
bool help_available, bool single_key)

charset is one of:
"yesno" - response needs to be "yes" or "no" "digit" - one of 0-9, *, #, +
"gsm" - only characters from the GSM SMS charset "any" - UCS2 characters
single_key indicates that only characters from the device's key faces are allowed (e.g. no "+" allowed if device only has a basic keypad), and that the key should be returned without being shown on screen or waiting for any kind of user confirmation.

string/Back/Terminate/Help GetText(string message, string default,
string charset, byte min, byte max, bool help_available, bool password)

charset is one of:
"digit" - one of 0-9, *, #, +
"gsm" - only characters from the GSM SMS charset "any" - UCS2 characters
The returned string must be between min and max characters long. The default value should be used as the initial value of the text field being edited by user. If password is True, individual characters entered must not be revealed on the screen, but indication of new characters can be given, for example by showing them as '*'.

void Cancel(void)
Cancels a method call in progress, usually due to user taking too long to respond (timeout defined by the SIM application or manufacturer defined) or session termination or other events. No reply to the cancelled call is expected.

void Release(void)
Agent is being released, possibly because of ofono terminating, SimToolkit interface torn down or modem off. Agent is unregistered, no UnregisterAgent call is expected.

org.ofono.SimToolkit
Methods
void RegisterAgent(object)
void UnregisterAgent(object)

---
 src/stk.c |  346 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 346 insertions(+), 0 deletions(-)
src/stk.c +346 -0
index 556dc68..28a1beb 100644
@@ -46,6 +46,28 @@ struct stk_timer {
 	time_t start;
 };
 
+enum stk_agent_result {
+	STK_AGENT_RESULT_OK,
+	STK_AGENT_RESULT_HELP,
+	STK_AGENT_RESULT_BACK,
+	STK_AGENT_RESULT_TERMINATE,
+	STK_AGENT_RESULT_TIMEOUT,
+	STK_AGENT_RESULT_CANCEL,
+};
+
+struct stk_app_agent {
+	char *path;
+	char *bus;
+	DBusMessage *msg;
+	DBusPendingCall *call;
+	guint watch;
+	guint send_menu_source;
+	guint cmd_timeout;
+	void (*cmd_send)(struct ofono_stk *stk, DBusMessage *call);
+	void (*cmd_cb)(struct ofono_stk *stk, enum stk_agent_result result,
+			DBusMessage *reply);
+};
+
 struct ofono_stk {
 	const struct ofono_stk_driver *driver;
 	void *driver_data;
@@ -57,6 +79,8 @@ struct ofono_stk {
 	struct stk_timer timers[8];
 	guint timers_source;
 
+	int timeout;
+	struct stk_app_agent *app_agent;
 	struct sms_submit_req *sms_submit_req;
 	char *idle_mode_text;
 };
@@ -76,6 +100,11 @@ struct sms_submit_req {
 
 #define ENVELOPE_RETRIES_DEFAULT 5
 
+#define OFONO_NAVIGATION_PREFIX OFONO_SERVICE ".Navigation"
+#define OFONO_NAVIGATION_GOBACK OFONO_NAVIGATION_PREFIX ".Back"
+#define OFONO_NAVIGATION_TERMINATED OFONO_NAVIGATION_PREFIX ".Terminated"
+#define OFONO_NAVIGATION_HELP OFONO_NAVIGATION_PREFIX ".Help"
+
 static void envelope_queue_run(struct ofono_stk *stk);
 static void timers_update(struct ofono_stk *stk);
 
@@ -255,8 +284,319 @@ static DBusMessage *stk_get_properties(DBusConnection *conn,
 	return reply;
 }
 
+static void app_agent_request_send_cancel(struct stk_app_agent *agent)
+{
+	DBusConnection *conn = ofono_dbus_get_connection();
+	DBusMessage *message;
+
+	message = dbus_message_new_method_call(agent->bus, agent->path,
+						OFONO_SIM_APP_INTERFACE,
+						"Cancel");
+	if (message == NULL)
+		return;
+
+	dbus_message_set_no_reply(message, TRUE);
+
+	g_dbus_send_message(conn, message);
+}
+
+static void app_agent_request_end(struct stk_app_agent *agent)
+{
+	agent->cmd_send = NULL;
+	agent->cmd_cb = NULL;
+
+	if (agent->cmd_timeout) {
+		g_source_remove(agent->cmd_timeout);
+		agent->cmd_timeout = 0;
+	}
+
+	if (agent->msg) {
+		dbus_message_unref(agent->msg);
+		agent->msg = NULL;
+	}
+
+	if (agent->call) {
+		dbus_pending_call_cancel(agent->call);
+		dbus_pending_call_unref(agent->call);
+		agent->call = NULL;
+	}
+}
+
+static void app_agent_request_cancel(struct ofono_stk *stk)
+{
+	struct stk_app_agent *agent = stk->app_agent;
+
+	if (!agent)
+		return;
+
+	agent->cmd_cb(stk, STK_AGENT_RESULT_CANCEL, NULL);
+
+	app_agent_request_end(agent);
+
+	app_agent_request_send_cancel(agent);
+}
+
+static gboolean app_agent_request_timeout(gpointer user_data)
+{
+	struct ofono_stk *stk = user_data;
+	struct stk_app_agent *agent = stk->app_agent;
+
+	agent->cmd_timeout = 0;
+
+	agent->cmd_cb(stk, STK_AGENT_RESULT_TIMEOUT, NULL);
+
+	app_agent_request_end(agent);
+
+	app_agent_request_send_cancel(agent);
+
+	return FALSE;
+}
+
+static void app_agent_request_reply_handle(DBusPendingCall *call, void *data)
+{
+	struct ofono_stk *stk = data;
+	DBusError err;
+	DBusMessage *reply = dbus_pending_call_steal_reply(call);
+	enum stk_agent_result result = STK_AGENT_RESULT_OK;
+
+	dbus_error_init(&err);
+	if (dbus_set_error_from_message(&err, reply)) {
+		ofono_error("SimAppAgent %s replied with error %s, %s",
+				stk->app_agent ? stk->app_agent->path :
+				"(destroyed)", err.name, err.message);
+
+		if (g_str_has_prefix(err.name, OFONO_NAVIGATION_GOBACK))
+			result = STK_AGENT_RESULT_BACK;
+		else if (g_str_has_prefix(err.name, OFONO_NAVIGATION_HELP))
+			result = STK_AGENT_RESULT_HELP;
+		else
+			result = STK_AGENT_RESULT_TERMINATE;
+
+		dbus_error_free(&err);
+	}
+
+	if (stk->app_agent) {
+		stk->app_agent->cmd_cb(stk, result, reply);
+
+		app_agent_request_end(stk->app_agent);
+	}
+
+	dbus_message_unref(reply);
+}
+
+static gboolean app_agent_request_send(struct ofono_stk *stk,
+					struct stk_app_agent *agent)
+{
+	DBusConnection *conn = ofono_dbus_get_connection();
+
+	/*
+	 * The cmd_send callback needs to set the method name to
+	 * something different than "Cancel".
+	 */
+	agent->msg = dbus_message_new_method_call(agent->bus, agent->path,
+							OFONO_SIM_APP_INTERFACE,
+							"Cancel");
+	if (agent->msg == NULL) {
+		ofono_error("Couldn't make a DBusMessage");
+		return FALSE;
+	}
+
+	agent->cmd_send(stk, agent->msg);
+
+	if (dbus_connection_send_with_reply(conn,
+				agent->msg, &agent->call, INT_MAX) == FALSE ||
+			agent->call == NULL) {
+		dbus_message_unref(agent->msg);
+		agent->msg = NULL;
+
+		ofono_error("Couldn't send a method call");
+		return FALSE;
+	}
+
+	dbus_pending_call_set_notify(agent->call,
+					app_agent_request_reply_handle,
+					stk, NULL);
+
+	return TRUE;
+}
+
+static void app_agent_request_start(struct ofono_stk *stk,
+					void (*send)(struct ofono_stk *stk,
+							DBusMessage *call),
+					void (*cb)(struct ofono_stk *stk,
+						enum stk_agent_result result,
+						DBusMessage *reply),
+					int timeout)
+{
+	struct stk_app_agent *agent = stk->app_agent;
+
+	if (agent == NULL) {
+		cb(stk, STK_AGENT_RESULT_TERMINATE, NULL);
+
+		return;
+	}
+
+	if (agent->cmd_cb)
+		app_agent_request_cancel(stk);
+
+	agent->cmd_send = send;
+	agent->cmd_cb = cb;
+
+	app_agent_request_send(stk, agent);
+
+	/* Use the timeout value specified in the command, if any.  */
+	if (timeout == 0)
+		timeout = stk->timeout * 1000;
+
+	if (timeout < 0)
+		return;
+
+	agent->cmd_timeout = g_timeout_add(timeout, app_agent_request_timeout,
+						stk);
+}
+
+static gboolean app_agent_send_menu(gpointer user_data)
+{
+	struct ofono_stk *stk = user_data;
+
+	stk->app_agent->send_menu_source = 0;
+
+	/* TODO */
+
+	return FALSE;
+}
+
+static void app_agent_request_cancel_no_agent(struct ofono_stk *stk,
+						struct stk_app_agent *agent)
+{
+	agent->cmd_cb(stk, STK_AGENT_RESULT_TERMINATE, NULL);
+
+	app_agent_request_end(agent);
+}
+
+static void app_agent_remove(struct ofono_stk *stk, struct stk_app_agent *agent)
+{
+	DBusConnection *conn = ofono_dbus_get_connection();
+
+	if (agent->watch) {
+		DBusMessage *message;
+
+		g_dbus_remove_watch(conn, agent->watch);
+		agent->watch = 0;
+
+		if (agent->cmd_cb) {
+			app_agent_request_cancel_no_agent(stk, agent);
+
+			app_agent_request_send_cancel(agent);
+		}
+
+		message = dbus_message_new_method_call(agent->bus, agent->path,
+							OFONO_SIM_APP_INTERFACE,
+							"Release");
+		if (message) {
+			dbus_message_set_no_reply(message, TRUE);
+
+			g_dbus_send_message(conn, message);
+		}
+	} else {
+		if (agent->cmd_cb)
+			app_agent_request_cancel_no_agent(stk, agent);
+	}
+
+	if (agent->send_menu_source)
+		g_source_remove(agent->send_menu_source);
+
+	g_free(agent->path);
+	g_free(agent->bus);
+	g_free(agent);
+}
+
+static void app_agent_disconnect_cb(DBusConnection *conn, void *user_data)
+{
+	struct ofono_stk *stk = user_data;
+
+	ofono_debug("Agent exited without calling Unregister");
+
+	stk->app_agent->watch = 0;
+
+	app_agent_remove(stk, stk->app_agent);
+	stk->app_agent = NULL;
+}
+
+static struct stk_app_agent *app_agent_create(struct ofono_stk *stk,
+						const char *path,
+						const char *sender)
+{
+	struct stk_app_agent *agent = g_try_new0(struct stk_app_agent, 1);
+	DBusConnection *conn = ofono_dbus_get_connection();
+
+	if (!agent)
+		return NULL;
+
+	agent->path = g_strdup(path);
+	agent->bus = g_strdup(sender);
+
+	agent->watch = g_dbus_add_disconnect_watch(conn, sender,
+							app_agent_disconnect_cb,
+							stk, NULL);
+
+	agent->send_menu_source = g_timeout_add(0, app_agent_send_menu, stk);
+
+	return agent;
+}
+
+static DBusMessage *stk_register_agent(DBusConnection *conn,
+					DBusMessage *msg, void *data)
+{
+	struct ofono_stk *stk = data;
+	const char *agent_path;
+
+	if (stk->app_agent)
+		return __ofono_error_busy(msg);
+
+	if (dbus_message_get_args(msg, NULL,
+					DBUS_TYPE_OBJECT_PATH, &agent_path,
+					DBUS_TYPE_INVALID) == FALSE)
+		return __ofono_error_invalid_args(msg);
+
+	stk->app_agent = app_agent_create(stk, agent_path,
+						dbus_message_get_sender(msg));
+	if (!stk->app_agent)
+		return __ofono_error_failed(msg);
+
+	return dbus_message_new_method_return(msg);
+}
+
+static DBusMessage *stk_unregister_agent(DBusConnection *conn,
+						DBusMessage *msg, void *data)
+{
+	struct ofono_stk *stk = data;
+	const char *agent_path;
+	const char *agent_bus = dbus_message_get_sender(msg);
+
+	if (dbus_message_get_args(msg, NULL,
+					DBUS_TYPE_OBJECT_PATH, &agent_path,
+					DBUS_TYPE_INVALID) == FALSE)
+		return __ofono_error_invalid_args(msg);
+
+	if (!stk->app_agent)
+		return __ofono_error_failed(msg);
+
+	if (strcmp(stk->app_agent->path, agent_path))
+		return __ofono_error_failed(msg);
+	if (strcmp(stk->app_agent->bus, agent_bus))
+		return __ofono_error_failed(msg);
+
+	app_agent_remove(stk, stk->app_agent);
+	stk->app_agent = NULL;
+
+	return dbus_message_new_method_return(msg);
+}
+
 static GDBusMethodTable stk_methods[] = {
 	{ "GetProperties",		"",	"a{sv}",stk_get_properties },
+	{ "RegisterSimAppAgent",	"o",	"",	stk_register_agent },
+	{ "UnregisterSimAppAgent",	"o",	"",	stk_unregister_agent },
 
 	{ }
 };
@@ -687,6 +1027,11 @@ static void stk_unregister(struct ofono_atom *atom)
 	struct ofono_modem *modem = __ofono_atom_get_modem(atom);
 	const char *path = __ofono_atom_get_path(atom);
 
+	if (stk->app_agent) {
+		app_agent_remove(stk, stk->app_agent);
+		stk->app_agent = NULL;
+	}
+
 	if (stk->pending_cmd) {
 		stk_command_free(stk->pending_cmd);
 		stk->pending_cmd = NULL;
@@ -778,6 +1123,7 @@ void ofono_stk_register(struct ofono_stk *stk)
 
 	__ofono_atom_register(stk->atom, stk_unregister);
 
+	stk->timeout = 600; /* 10 minutes */
 	stk->envelope_q = g_queue_new();
 }
 
Signature · 1 line
1.7.1.86.g0e460.dirty
#1 lore raw

PATCH 2/6 stk: Add menu related utilities.

---
 src/stk.c |   92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 92 insertions(+), 0 deletions(-)
src/stk.c +92 -0
index 28a1beb..f3d8247 100644
@@ -55,6 +55,17 @@ enum stk_agent_result {
 	STK_AGENT_RESULT_CANCEL,
 };
 
+struct stk_menu {
+	char *title;
+	GSList *items;
+	struct stk_items_next_action_indicator next_action;
+	int default_item;
+	struct stk_text_attribute title_attr;
+	struct stk_item_text_attribute_list item_attrs;
+	gboolean soft_key;
+	gboolean has_help;
+};
+
 struct stk_app_agent {
 	char *path;
 	char *bus;
@@ -246,6 +257,87 @@ static void stk_command_cb(const struct ofono_error *error, void *data)
 	DBG("TERMINAL RESPONSE to a command reported no errors");
 }
 
+static struct stk_menu *stk_menu_create(const char *title,
+		const struct stk_text_attribute *title_attr, GSList *items,
+		const struct stk_item_text_attribute_list *item_attrs,
+		const struct stk_items_next_action_indicator *next_action,
+		int default_id, gboolean soft_key, gboolean has_help)
+{
+	struct stk_menu *ret = g_new(struct stk_menu, 1);
+	GSList *l;
+	int i;
+
+	ret->title = g_strdup(title ?: "");
+	ret->items = g_slist_copy((GSList *) items);
+	ret->default_item = -1;
+	memcpy(&ret->next_action, next_action, sizeof(ret->next_action));
+	memcpy(&ret->title_attr, title_attr, sizeof(ret->title_attr));
+	memcpy(&ret->item_attrs, item_attrs, sizeof(ret->item_attrs));
+	ret->soft_key = soft_key;
+	ret->has_help = has_help;
+
+	for (l = ret->items, i = 0; l; l = l->next, i++) {
+		struct stk_item *j = g_memdup(l->data, sizeof(*j));
+
+		j->text = g_strdup(j->text);
+		l->data = j;
+
+		if (j->id == default_id)
+			ret->default_item = i;
+	}
+
+	return ret;
+}
+
+static void stk_menu_free(struct stk_menu *menu)
+{
+	GSList *l;
+
+	for (l = menu->items; l; l = l->next) {
+		struct stk_item *i = l->data;
+
+		g_free(i->text);
+		g_free(i);
+	}
+
+	g_slist_free(menu->items);
+	g_free(menu->title);
+	g_free(menu);
+}
+
+static char **stk_menu_items_strlist(struct stk_menu *menu)
+{
+	char **items = g_new0(char *, g_slist_length(menu->items) + 1);
+	int i;
+	GSList *l;
+
+	for (i = 0, l = menu->items; l; l = l->next, i++) {
+		struct stk_item *item = l->data;
+		items[i] = item->text;
+	}
+
+	return items;
+}
+
+static void append_menu(DBusMessage *msg, struct stk_menu *menu,
+			dbus_bool_t main_menu)
+{
+	char **items;
+	dbus_bool_t has_help = menu->has_help;
+	dbus_int16_t default_item = menu->default_item;
+
+	items = stk_menu_items_strlist(menu);
+	dbus_message_append_args(msg,
+					DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
+					&items, g_slist_length(menu->items),
+					DBUS_TYPE_STRING, &menu->title,
+					DBUS_TYPE_BOOLEAN, &has_help,
+					DBUS_TYPE_INT16, &default_item,
+					DBUS_TYPE_BOOLEAN, &main_menu,
+					DBUS_TYPE_INVALID);
+	g_free(items);
+}
+
 static void stk_alpha_id_set(struct ofono_stk *stk, const char *text)
 {
 	/* TODO */
Signature · 1 line
1.7.1.86.g0e460.dirty
#2 lore raw

PATCH 3/6 stk: Handle STK menus.

In reply to Andrzej Zaborowski
---
 src/stk.c |  244 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 242 insertions(+), 2 deletions(-)
src/stk.c +242 -2
index f3d8247..34fe931 100644
@@ -92,6 +92,7 @@ struct ofono_stk {
 
 	int timeout;
 	struct stk_app_agent *app_agent;
+	struct stk_menu *main_menu, *select_item_menu;
 	struct sms_submit_req *sms_submit_req;
 	char *idle_mode_text;
 };
@@ -118,6 +119,7 @@ struct sms_submit_req {
 
 static void envelope_queue_run(struct ofono_stk *stk);
 static void timers_update(struct ofono_stk *stk);
+static void go_to_main_menu(struct ofono_stk *stk);
 
 static int stk_respond(struct ofono_stk *stk, struct stk_response *rsp,
 			ofono_stk_generic_cb_t cb)
@@ -553,7 +555,7 @@ static gboolean app_agent_send_menu(gpointer user_data)
 
 	stk->app_agent->send_menu_source = 0;
 
-	/* TODO */
+	go_to_main_menu(stk);
 
 	return FALSE;
 }
@@ -632,7 +634,9 @@ static struct stk_app_agent *app_agent_create(struct ofono_stk *stk,
 							app_agent_disconnect_cb,
 							stk, NULL);
 
-	agent->send_menu_source = g_timeout_add(0, app_agent_send_menu, stk);
+	if (stk->main_menu)
+		agent->send_menu_source = g_timeout_add(0, app_agent_send_menu,
+							stk);
 
 	return agent;
 }
@@ -992,6 +996,216 @@ static gboolean handle_command_poll_interval(const struct stk_command *cmd,
 	return TRUE;
 }
 
+static void menu_selection_envelope_cb(struct ofono_stk *stk, gboolean ok,
+					const unsigned char *data, int len)
+{
+	if (!ok) {
+		ofono_error("Sending Menu Selection to UICC failed");
+		return;
+	}
+
+	if (len)
+		ofono_error("Menu Selection returned %i bytes of unwanted data",
+				len);
+
+	DBG("Menu Selection envelope submission gave no error");
+}
+
+static void request_menu_send(struct ofono_stk *stk, DBusMessage *call)
+{
+	struct stk_command *cmd = stk->pending_cmd;
+	gboolean select_item = cmd && cmd->type == STK_COMMAND_TYPE_SELECT_ITEM;
+	struct stk_menu *menu = select_item ?
+		stk->select_item_menu : stk->main_menu;
+
+	dbus_message_set_member(call, "SelectItem");
+
+	append_menu(call, menu, !select_item);
+}
+
+static void request_menu_cb(struct ofono_stk *stk, enum stk_agent_result result,
+				DBusMessage *reply)
+{
+	enum stk_result_type type;
+	struct stk_command *cmd = stk->pending_cmd;
+	gboolean select_item = cmd && cmd->type == STK_COMMAND_TYPE_SELECT_ITEM;
+	dbus_int16_t selection;
+	dbus_bool_t help = FALSE;
+	struct stk_menu *menu = select_item ?
+		stk->select_item_menu : stk->main_menu;
+	struct stk_item *item = NULL;
+
+	switch (result) {
+	case STK_AGENT_RESULT_OK:
+		break;
+
+	case STK_AGENT_RESULT_BACK:
+		type = STK_RESULT_TYPE_GO_BACK;
+		goto send;
+
+	case STK_AGENT_RESULT_TIMEOUT:
+		type = STK_RESULT_TYPE_NO_RESPONSE;
+		goto send;
+
+	case STK_AGENT_RESULT_TERMINATE:
+	default:
+		/* Nothing to do if agent unregistered while in main menu */
+		if (!select_item)
+			goto out;
+
+		type = STK_RESULT_TYPE_USER_TERMINATED;
+		goto send;
+
+	case STK_AGENT_RESULT_CANCEL:
+		goto out;
+	}
+
+	if (dbus_message_get_args(reply, NULL,
+					DBUS_TYPE_INT16, &selection,
+					DBUS_TYPE_BOOLEAN, &help,
+					DBUS_TYPE_INVALID) != FALSE) {
+		if (help == FALSE)
+			type = STK_RESULT_TYPE_SUCCESS;
+		else
+			type = STK_RESULT_TYPE_HELP_REQUESTED;
+	} else if (dbus_message_get_args(reply, NULL,
+						DBUS_TYPE_INT16, &selection,
+						DBUS_TYPE_INVALID) != FALSE) {
+		type = STK_RESULT_TYPE_SUCCESS;
+	} else {
+		type = STK_RESULT_TYPE_USER_TERMINATED;
+
+		ofono_error("Can't parse the reply to SelectItem()");
+		goto send;
+	}
+
+	if (help != FALSE && !menu->has_help) {
+		type = STK_RESULT_TYPE_USER_TERMINATED;
+		ofono_error("Help requested but not available");
+
+		goto send;
+	}
+
+	item = g_slist_nth_data(menu->items, selection);
+	if (!item) {
+		type = STK_RESULT_TYPE_USER_TERMINATED;
+		ofono_error("Invalid item selected");
+	}
+
+send:
+	if (select_item) {
+		struct stk_response rsp;
+		struct ofono_error error = { .type = OFONO_ERROR_TYPE_FAILURE };
+
+		memset(&rsp, 0, sizeof(rsp));
+		rsp.result.type = type;
+
+		if (item)
+			rsp.select_item.item_id = item->id;
+
+		if (stk_respond(stk, &rsp, stk_command_cb))
+			stk_command_cb(&error, stk);
+	} else {
+		struct stk_envelope e;
+
+		if (type != STK_RESULT_TYPE_SUCCESS &&
+				type != STK_RESULT_TYPE_HELP_REQUESTED) {
+			ofono_error("Invalid reply to main menu request");
+
+			goto out;
+		}
+
+		memset(&e, 0, sizeof(e));
+
+		e.type = STK_ENVELOPE_TYPE_MENU_SELECTION;
+		e.src = STK_DEVICE_IDENTITY_TYPE_KEYPAD,
+		e.menu_selection.item_id = item->id;
+		e.menu_selection.help_request = help;
+
+		if (stk_send_envelope(stk, &e, menu_selection_envelope_cb, 0))
+			menu_selection_envelope_cb(stk, FALSE, NULL, -1);
+	}
+
+out:
+	if (select_item) {
+		stk_menu_free(menu);
+		stk->select_item_menu = NULL;
+	}
+}
+
+static gboolean handle_command_select_item(const struct stk_command *cmd,
+						struct stk_response *rsp,
+						struct ofono_stk *stk)
+{
+	gboolean soft_key = (cmd->qualifier & (1 << 2)) != 0;
+	gboolean has_help = (cmd->qualifier & (1 << 7)) != 0;
+
+	stk->select_item_menu = stk_menu_create(
+					cmd->select_item.alpha_id,
+					&cmd->select_item.text_attr,
+					cmd->select_item.items,
+					&cmd->select_item.item_text_attr_list,
+					&cmd->select_item.next_act,
+					cmd->select_item.item_id,
+					soft_key, has_help);
+
+	if (!stk->select_item_menu) {
+		rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
+
+		return TRUE;
+	}
+
+	app_agent_request_start(stk,
+				request_menu_send, request_menu_cb, 0);
+
+	stk->cancel_cmd = app_agent_request_cancel;
+
+	return FALSE;
+}
+
+static void go_to_main_menu(struct ofono_stk *stk)
+{
+	if (!stk->app_agent || stk->app_agent->cmd_cb || !stk->main_menu)
+		return;
+
+	app_agent_request_start(stk,
+				request_menu_send, request_menu_cb, -1);
+}
+
+static gboolean handle_command_set_up_menu(const struct stk_command *cmd,
+						struct stk_response *rsp,
+						struct ofono_stk *stk)
+{
+	gboolean soft_key = (cmd->qualifier & (1 << 0)) != 0;
+	gboolean has_help = (cmd->qualifier & (1 << 7)) != 0;
+
+	if (stk->main_menu) {
+		stk_menu_free(stk->main_menu);
+		stk->main_menu = NULL;
+	}
+
+	if (cmd->setup_menu.items == NULL)
+		return TRUE;
+
+	stk->main_menu = stk_menu_create(cmd->setup_menu.alpha_id,
+					&cmd->setup_menu.text_attr,
+					cmd->setup_menu.items,
+					&cmd->setup_menu.item_text_attr_list,
+					&cmd->setup_menu.next_act,
+					0, soft_key, has_help);
+
+	if (!stk->main_menu) {
+		rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
+
+		return TRUE;
+	}
+
+	app_agent_request_start(stk,
+				request_menu_send, request_menu_cb, -1);
+
+	return TRUE;
+}
+
 static void stk_proactive_command_cancel(struct ofono_stk *stk)
 {
 	if (!stk->pending_cmd)
@@ -1008,6 +1222,14 @@ static void stk_proactive_command_cancel(struct ofono_stk *stk)
 void ofono_stk_proactive_session_end_notify(struct ofono_stk *stk)
 {
 	stk_proactive_command_cancel(stk);
+
+	/*
+	 * Always go back to main menu, let the client decide whether
+	 * to display it or not depending on the type of UI.  TS 102.223
+	 * offers only a recommendation as to whether to release screen
+	 * (aka. close the UI) or show menu.
+	 */
+	go_to_main_menu(stk);
 }
 
 void ofono_stk_proactive_command_notify(struct ofono_stk *stk,
@@ -1068,6 +1290,14 @@ void ofono_stk_proactive_command_notify(struct ofono_stk *stk,
 			respond = handle_command_poll_interval(stk->pending_cmd,
 								&rsp, stk);
 			break;
+		case STK_COMMAND_TYPE_SELECT_ITEM:
+			respond = handle_command_select_item(stk->pending_cmd,
+								&rsp, stk);
+			break;
+		case STK_COMMAND_TYPE_SETUP_MENU:
+			respond = handle_command_set_up_menu(stk->pending_cmd,
+								&rsp, stk);
+			break;
 		}
 
 		if (respond)
@@ -1139,6 +1369,16 @@ static void stk_unregister(struct ofono_atom *atom)
 		stk->timers_source = 0;
 	}
 
+	if (stk->select_item_menu) {
+		stk_menu_free(stk->select_item_menu);
+		stk->select_item_menu = NULL;
+	}
+
+	if (stk->main_menu) {
+		stk_menu_free(stk->main_menu);
+		stk->main_menu = NULL;
+	}
+
 	g_queue_foreach(stk->envelope_q, (GFunc) g_free, NULL);
 	g_queue_free(stk->envelope_q);
 
Signature · 1 line
1.7.1.86.g0e460.dirty
#3 lore raw

PATCH 4/6 stk: Handle the Display Text proactive command.

In reply to Andrzej Zaborowski
---
 src/stk.c |  140 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 140 insertions(+), 0 deletions(-)
src/stk.c +140 -0
index 34fe931..8b6c1ca 100644
@@ -95,6 +95,7 @@ struct ofono_stk {
 	struct stk_menu *main_menu, *select_item_menu;
 	struct sms_submit_req *sms_submit_req;
 	char *idle_mode_text;
+	gboolean session_ended;
 };
 
 struct envelope_op {
@@ -1206,6 +1207,120 @@ static gboolean handle_command_set_up_menu(const struct stk_command *cmd,
 	return TRUE;
 }
 
+static void request_text_send(struct ofono_stk *stk, DBusMessage *call)
+{
+	struct stk_command_display_text *dt = &stk->pending_cmd->display_text;
+	uint8_t qualifier = stk->pending_cmd->qualifier;
+	dbus_bool_t confirm = (qualifier & (1 << 7)) != 0;
+	dbus_bool_t priority = (qualifier & (1 << 0)) != 0;
+	dbus_bool_t navigation = !dt->immediate_response;
+
+	dbus_message_set_member(call, "DisplayText");
+
+	dbus_message_append_args(call,
+					DBUS_TYPE_STRING, &dt->text,
+					DBUS_TYPE_BOOLEAN, &confirm,
+					DBUS_TYPE_BOOLEAN, &priority,
+					DBUS_TYPE_BOOLEAN, &navigation,
+					DBUS_TYPE_INVALID);
+}
+
+static void request_text_cb(struct ofono_stk *stk, enum stk_agent_result result,
+				DBusMessage *reply)
+{
+	gboolean confirm;
+	enum stk_result_type type = STK_RESULT_TYPE_SUCCESS;
+	struct stk_response rsp;
+	struct ofono_error error = { .type = OFONO_ERROR_TYPE_FAILURE };
+
+	/*
+	 * Check if we have already responded to the proactive command
+	 * because immediate response was requested.
+	 */
+	if (!stk->pending_cmd || stk->pending_cmd->type !=
+			STK_COMMAND_TYPE_DISPLAY_TEXT ||
+			stk->pending_cmd->display_text.immediate_response) {
+		/*
+		 * If session has ended in the meantime now is the time
+		 * to go back to main menu or close the application
+		 * window.
+		 */
+		if (stk->session_ended)
+			go_to_main_menu(stk);
+
+		return;
+	}
+
+	switch (result) {
+	case STK_AGENT_RESULT_OK:
+		break;
+
+	case STK_AGENT_RESULT_BACK:
+		type = STK_RESULT_TYPE_GO_BACK;
+		goto send;
+
+	case STK_AGENT_RESULT_TIMEOUT:
+		confirm = (stk->pending_cmd->qualifier & (1 << 7)) != 0;
+		if (confirm)
+			type = STK_RESULT_TYPE_NO_RESPONSE;
+
+		goto send;
+
+	case STK_AGENT_RESULT_TERMINATE:
+	default:
+		type = STK_RESULT_TYPE_USER_TERMINATED;
+		goto send;
+
+	case STK_AGENT_RESULT_CANCEL:
+		return;
+	}
+
+	if (dbus_message_get_args(reply, NULL, DBUS_TYPE_INVALID) == FALSE) {
+		type = STK_RESULT_TYPE_USER_TERMINATED;
+
+		ofono_error("Reply not understood");
+	}
+
+send:
+	memset(&rsp, 0, sizeof(rsp));
+	rsp.result.type = type;
+
+	if (stk_respond(stk, &rsp, stk_command_cb))
+		stk_command_cb(&error, stk);
+}
+
+static gboolean handle_command_display_text(const struct stk_command *cmd,
+						struct stk_response *rsp,
+						struct ofono_stk *stk)
+{
+	int timeout = 0;
+
+	if (cmd->display_text.duration.interval) {
+		timeout = cmd->display_text.duration.interval;
+		switch (cmd->display_text.duration.unit) {
+		case STK_DURATION_TYPE_MINUTES:
+			timeout *= 60;
+		case STK_DURATION_TYPE_SECONDS:
+			timeout *= 10;
+		case STK_DURATION_TYPE_SECOND_TENTHS:
+			timeout *= 100;
+		}
+	}
+
+	app_agent_request_start(stk,
+				request_text_send, request_text_cb, timeout);
+
+	if (cmd->display_text.immediate_response) {
+		stk->session_ended = FALSE;
+
+		return TRUE;
+	}
+
+	stk->cancel_cmd = app_agent_request_cancel;
+
+	return cmd->display_text.immediate_response;
+}
+
 static void stk_proactive_command_cancel(struct ofono_stk *stk)
 {
 	if (!stk->pending_cmd)
@@ -1230,6 +1345,27 @@ void ofono_stk_proactive_session_end_notify(struct ofono_stk *stk)
 	 * (aka. close the UI) or show menu.
 	 */
 	go_to_main_menu(stk);
+
+	/*
+	 * The only exception is when a DisplayText command has been
+	 * issued with the Immediate Response flag set (TS 102.223
+	 * Section 6.9):
+	 * "If the text is to be sustained, the terminal shall display
+	 * the text of applicable DISPLAY TEXT commands beyond the sending
+	 * of the TERMINAL RESPONSE and possibly beyond the end of the
+	 * proactive session.
+	 *
+	 * If a variable display timeout was indicated for a DISPLAY TEXT
+	 * command, then the session releases the display back into terminal
+	 * control no later then the period stated by the duration. If the
+	 * text is to be sustained beyond an immediate response, the
+	 * terminal shall display the text for a period that does not
+	 * exceed the duration."
+	 *
+	 * For this case we set a flag and when the text stops being
+	 * displayed we will make sure to go to main menu then.
+	 */
+	stk->session_ended = TRUE;
 }
 
 void ofono_stk_proactive_command_notify(struct ofono_stk *stk,
@@ -1298,6 +1434,10 @@ void ofono_stk_proactive_command_notify(struct ofono_stk *stk,
 			respond = handle_command_set_up_menu(stk->pending_cmd,
 								&rsp, stk);
 			break;
+		case STK_COMMAND_TYPE_DISPLAY_TEXT:
+			respond = handle_command_display_text(stk->pending_cmd,
+								&rsp, stk);
+			break;
 		}
 
 		if (respond)
Signature · 1 line
1.7.1.86.g0e460.dirty
#4 lore raw

PATCH 5/6 stk: Handle the Get Inkey proactive command.

In reply to Andrzej Zaborowski
---
 src/stk.c |  168 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 168 insertions(+), 0 deletions(-)
src/stk.c +168 -0
index 8b6c1ca..6fbdbe4 100644
@@ -32,6 +32,7 @@
 #include <gdbus.h>
 #include <errno.h>
 #include <time.h>
+#include <sys/time.h>
 
 #include "ofono.h"
 
@@ -74,6 +75,7 @@ struct stk_app_agent {
 	guint watch;
 	guint send_menu_source;
 	guint cmd_timeout;
+	struct timeval get_inkey_start_ts;
 	void (*cmd_send)(struct ofono_stk *stk, DBusMessage *call);
 	void (*cmd_cb)(struct ofono_stk *stk, enum stk_agent_result result,
 			DBusMessage *reply);
@@ -1321,6 +1323,168 @@ static gboolean handle_command_display_text(const struct stk_command *cmd,
 	return cmd->display_text.immediate_response;
 }
 
+static void request_get_key_send(struct ofono_stk *stk, DBusMessage *call)
+{
+	struct stk_command_get_inkey *cmd = &stk->pending_cmd->get_inkey;
+	uint8_t qualifier = stk->pending_cmd->qualifier;
+	dbus_bool_t alphabet = (qualifier & (1 << 0)) != 0;
+	dbus_bool_t ucs2 = (qualifier & (1 << 1)) != 0;
+	dbus_bool_t yesno = (qualifier & (1 << 2)) != 0;
+	dbus_bool_t immediate = (qualifier & (1 << 3)) != 0;
+	dbus_bool_t help = (qualifier & (1 << 7)) != 0;
+	const char *charset =
+		yesno ? "yesno" :
+		(!alphabet ? "digit" :
+		 (ucs2 ? "any" : "gsm"));
+
+	dbus_message_set_member(call, "GetKey");
+
+	dbus_message_append_args(call,
+					DBUS_TYPE_STRING, &cmd->text,
+					DBUS_TYPE_STRING, &charset,
+					DBUS_TYPE_BOOLEAN, &help,
+					DBUS_TYPE_BOOLEAN, &immediate,
+					DBUS_TYPE_INVALID);
+}
+
+static void request_get_key_cb(struct ofono_stk *stk,
+				enum stk_agent_result result,
+				DBusMessage *reply)
+{
+	struct stk_command_get_inkey *cmd = &stk->pending_cmd->get_inkey;
+	uint8_t qualifier = stk->pending_cmd->qualifier;
+	dbus_bool_t yesno = (qualifier & (1 << 2)) != 0;
+	dbus_bool_t help = (qualifier & (1 << 7)) != 0;
+	enum stk_result_type type = STK_RESULT_TYPE_SUCCESS;
+	struct stk_response rsp;
+	struct ofono_error error = { .type = OFONO_ERROR_TYPE_FAILURE };
+	char *key;
+
+	switch (result) {
+	case STK_AGENT_RESULT_OK:
+		break;
+
+	case STK_AGENT_RESULT_HELP:
+		if (!help) {
+			type = STK_RESULT_TYPE_USER_TERMINATED;
+			ofono_error("Help requested but not available");
+
+			goto send;
+		}
+
+		type = STK_RESULT_TYPE_HELP_REQUESTED;
+		goto send;
+
+	case STK_AGENT_RESULT_BACK:
+		type = STK_RESULT_TYPE_GO_BACK;
+		goto send;
+
+	case STK_AGENT_RESULT_TIMEOUT:
+		type = STK_RESULT_TYPE_NO_RESPONSE;
+		goto send;
+
+	case STK_AGENT_RESULT_TERMINATE:
+	default:
+		type = STK_RESULT_TYPE_USER_TERMINATED;
+		goto send;
+
+	case STK_AGENT_RESULT_CANCEL:
+		return;
+	}
+
+	if (dbus_message_get_args(reply, NULL,
+					DBUS_TYPE_STRING, &key,
+					DBUS_TYPE_INVALID) == FALSE) {
+		type = STK_RESULT_TYPE_USER_TERMINATED;
+		ofono_error("Reply not understood");
+
+		goto send;
+	}
+
+	if (yesno && strcasecmp(key, "yes") && strcasecmp(key, "no")) {
+		type = STK_RESULT_TYPE_USER_TERMINATED;
+		ofono_error("Yes/No reply not understood");
+
+		goto send;
+	} else if (yesno && strcasecmp(key, "yes"))
+		key = NULL; /* NULL indicates No, non-NULL indicates Yes */
+	else if (!yesno && g_utf8_strlen(key, 10) != 1) {
+		type = STK_RESULT_TYPE_USER_TERMINATED;
+		ofono_error("Reply string has incorrect length");
+
+		goto send;
+	}
+
+	/* TODO: check charset? */
+
+send:
+	memset(&rsp, 0, sizeof(rsp));
+	rsp.result.type = type;
+
+	if (type == STK_RESULT_TYPE_SUCCESS) {
+		rsp.get_inkey.text.text = key;
+		rsp.get_inkey.text.packed = FALSE;
+		rsp.get_inkey.text.yesno = yesno;
+	}
+
+	if (cmd->duration.interval) {
+		struct timeval *start_ts = &stk->app_agent->get_inkey_start_ts;
+		struct timeval end_ts;
+		int interval;
+
+		gettimeofday(&end_ts, NULL);
+
+		interval = (end_ts.tv_usec + 1099999 - start_ts->tv_usec) /
+			100000;
+		interval += (end_ts.tv_sec - start_ts->tv_sec) * 10;
+		interval -= 10;
+
+		switch (cmd->duration.unit) {
+		case STK_DURATION_TYPE_MINUTES:
+			interval = (interval + 59) / 60;
+		case STK_DURATION_TYPE_SECONDS:
+			interval = (interval + 9) / 10;
+		case STK_DURATION_TYPE_SECOND_TENTHS:
+			break;
+		}
+
+		rsp.get_inkey.duration.unit = cmd->duration.unit;
+		rsp.get_inkey.duration.interval = interval;
+	}
+
+	if (stk_respond(stk, &rsp, stk_command_cb))
+		stk_command_cb(&error, stk);
+}
+
+static gboolean handle_command_get_inkey(const struct stk_command *cmd,
+						struct stk_response *rsp,
+						struct ofono_stk *stk)
+{
+	int timeout = 0;
+
+	if (cmd->get_inkey.duration.interval) {
+		timeout = cmd->get_inkey.duration.interval;
+		switch (cmd->get_inkey.duration.unit) {
+		case STK_DURATION_TYPE_MINUTES:
+			timeout *= 60;
+		case STK_DURATION_TYPE_SECONDS:
+			timeout *= 10;
+		case STK_DURATION_TYPE_SECOND_TENTHS:
+			timeout *= 100;
+		}
+	}
+
+	gettimeofday(&stk->app_agent->get_inkey_start_ts, NULL);
+
+	app_agent_request_start(stk,
+				request_get_key_send, request_get_key_cb,
+				timeout);
+
+	stk->cancel_cmd = app_agent_request_cancel;
+
+	return FALSE;
+}
+
 static void stk_proactive_command_cancel(struct ofono_stk *stk)
 {
 	if (!stk->pending_cmd)
@@ -1438,6 +1602,10 @@ void ofono_stk_proactive_command_notify(struct ofono_stk *stk,
 			respond = handle_command_display_text(stk->pending_cmd,
 								&rsp, stk);
 			break;
+		case STK_COMMAND_TYPE_GET_INKEY:
+			respond = handle_command_get_inkey(stk->pending_cmd,
+								&rsp, stk);
+			break;
 		}
 
 		if (respond)
Signature · 1 line
1.7.1.86.g0e460.dirty
#5 lore raw

PATCH 6/6 stk: Handle the Get Input proactive command.

In reply to Andrzej Zaborowski
---
 src/stk.c |  109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 109 insertions(+), 0 deletions(-)
src/stk.c +109 -0
index 6fbdbe4..fd5113b 100644
@@ -1485,6 +1485,111 @@ static gboolean handle_command_get_inkey(const struct stk_command *cmd,
 	return FALSE;
 }
 
+static void request_get_text_send(struct ofono_stk *stk, DBusMessage *call)
+{
+	struct stk_command_get_input *cmd = &stk->pending_cmd->get_input;
+	uint8_t qualifier = stk->pending_cmd->qualifier;
+	dbus_bool_t alphabet = (qualifier & (1 << 0)) != 0;
+	dbus_bool_t ucs2 = (qualifier & (1 << 1)) != 0;
+	dbus_bool_t hidden = (qualifier & (1 << 2)) != 0;
+	dbus_bool_t help = (qualifier & (1 << 7)) != 0;
+	const char *charset =
+		!alphabet ? "digit" :
+		 (ucs2 ? "any" : "gsm");
+	const char *default_text = cmd->default_text ? cmd->default_text : "";
+
+	dbus_message_set_member(call, "GetText");
+
+	dbus_message_append_args(call,
+					DBUS_TYPE_STRING, &cmd->text,
+					DBUS_TYPE_STRING, &default_text,
+					DBUS_TYPE_STRING, &charset,
+					DBUS_TYPE_BYTE, &cmd->resp_len.min,
+					DBUS_TYPE_BYTE, &cmd->resp_len.max,
+					DBUS_TYPE_BOOLEAN, &help,
+					DBUS_TYPE_BOOLEAN, &hidden,
+					DBUS_TYPE_INVALID);
+}
+
+static void request_get_text_cb(struct ofono_stk *stk,
+				enum stk_agent_result result,
+				DBusMessage *reply)
+{
+	uint8_t qualifier = stk->pending_cmd->qualifier;
+	dbus_bool_t packed = (qualifier & (1 << 3)) != 0;
+	dbus_bool_t help = (qualifier & (1 << 7)) != 0;
+	enum stk_result_type type = STK_RESULT_TYPE_SUCCESS;
+	struct stk_response rsp;
+	struct ofono_error error = { .type = OFONO_ERROR_TYPE_FAILURE };
+	char *text;
+
+	switch (result) {
+	case STK_AGENT_RESULT_OK:
+		break;
+
+	case STK_AGENT_RESULT_HELP:
+		if (!help) {
+			type = STK_RESULT_TYPE_USER_TERMINATED;
+			ofono_error("Help requested but not available");
+
+			goto send;
+		}
+
+		type = STK_RESULT_TYPE_HELP_REQUESTED;
+		goto send;
+
+	case STK_AGENT_RESULT_BACK:
+		type = STK_RESULT_TYPE_GO_BACK;
+		goto send;
+
+	case STK_AGENT_RESULT_TIMEOUT:
+		type = STK_RESULT_TYPE_NO_RESPONSE;
+		goto send;
+
+	case STK_AGENT_RESULT_TERMINATE:
+	default:
+		type = STK_RESULT_TYPE_USER_TERMINATED;
+		goto send;
+
+	case STK_AGENT_RESULT_CANCEL:
+		return;
+	}
+
+	if (dbus_message_get_args(reply, NULL,
+					DBUS_TYPE_STRING, &text,
+					DBUS_TYPE_INVALID) == FALSE) {
+		type = STK_RESULT_TYPE_USER_TERMINATED;
+		ofono_error("Reply not understood");
+
+		goto send;
+	}
+
+send:
+	memset(&rsp, 0, sizeof(rsp));
+	rsp.result.type = type;
+
+	if (type == STK_RESULT_TYPE_SUCCESS) {
+		rsp.get_input.text.text = text;
+		rsp.get_input.text.packed = packed;
+		rsp.get_input.text.yesno = FALSE;
+	}
+
+	if (stk_respond(stk, &rsp, stk_command_cb))
+		stk_command_cb(&error, stk);
+}
+
+static gboolean handle_command_get_input(const struct stk_command *cmd,
+						struct stk_response *rsp,
+						struct ofono_stk *stk)
+{
+	app_agent_request_start(stk,
+				request_get_text_send, request_get_text_cb, 0);
+
+	stk->cancel_cmd = app_agent_request_cancel;
+
+	return FALSE;
+}
+
 static void stk_proactive_command_cancel(struct ofono_stk *stk)
 {
 	if (!stk->pending_cmd)
@@ -1606,6 +1711,10 @@ void ofono_stk_proactive_command_notify(struct ofono_stk *stk,
 			respond = handle_command_get_inkey(stk->pending_cmd,
 								&rsp, stk);
 			break;
+		case STK_COMMAND_TYPE_GET_INPUT:
+			respond = handle_command_get_input(stk->pending_cmd,
+								&rsp, stk);
+			break;
 		}
 
 		if (respond)
Signature · 1 line
1.7.1.86.g0e460.dirty