All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] stk: Send the AlphaId's to agent.
@ 2010-12-20 12:52 Andrzej Zaborowski
  0 siblings, 0 replies; 8+ messages in thread
From: Andrzej Zaborowski @ 2010-12-20 12:52 UTC (permalink / raw)
  To: ofono

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

---
 src/stk.c      |    9 +++++++--
 src/stkagent.c |   31 +++++++++++++++++++++++++++++++
 src/stkagent.h |    3 +++
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index 076acc4..67cb759 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -472,12 +472,17 @@ static void stk_alpha_id_set(struct ofono_stk *stk,
 		const char *text, const struct stk_text_attribute *attr,
 		const struct stk_icon_id *icon)
 {
-	/* TODO */
+	char *alpha = dbus_apply_text_attributes(text, attr);
+
+	if (alpha || icon)
+		stk_agent_display_alpha_id(stk->current_agent, alpha, icon);
+
+	g_free(alpha);
 }
 
 static void stk_alpha_id_unset(struct ofono_stk *stk)
 {
-	/* TODO */
+	stk_agent_request_cancel(stk->current_agent);
 }
 
 static int duration_to_msecs(const struct stk_duration *duration)
diff --git a/src/stkagent.c b/src/stkagent.c
index e1a6f48..2c43053 100644
--- a/src/stkagent.c
+++ b/src/stkagent.c
@@ -964,3 +964,34 @@ int stk_agent_loop_tone(struct stk_agent *agent, const char *text,
 
 	return 0;
 }
+
+static void alpha_id_cb(DBusPendingCall *call, void *data)
+{
+	stk_agent_request_end(data);
+}
+
+int stk_agent_display_alpha_id(struct stk_agent *agent, const char *text,
+				const struct stk_icon_id *icon)
+{
+	DBusConnection *conn = ofono_dbus_get_connection();
+
+	agent->msg = dbus_message_new_method_call(agent->bus, agent->path,
+							OFONO_SIM_APP_INTERFACE,
+							"DisplayAlphaId");
+	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,
+						0) == FALSE ||
+			agent->call == NULL)
+		return -EIO;
+
+	dbus_pending_call_set_notify(agent->call, alpha_id_cb, agent, NULL);
+
+	return 0;
+}
diff --git a/src/stkagent.h b/src/stkagent.h
index 517bcfe..00bacc2 100644
--- a/src/stkagent.h
+++ b/src/stkagent.h
@@ -137,3 +137,6 @@ int stk_agent_loop_tone(struct stk_agent *agent, const char *text,
 
 void append_menu_items_variant(DBusMessageIter *iter,
 				const struct stk_menu_item *items);
+
+int stk_agent_display_alpha_id(struct stk_agent *agent, const char *text,
+				const struct stk_icon_id *icon);
-- 
1.7.1.86.g0e460.dirty


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

* [PATCH 1/2] stk: Send the AlphaId's to agent.
@ 2010-12-21  9:34 Andrzej Zaborowski
  0 siblings, 0 replies; 8+ messages in thread
From: Andrzej Zaborowski @ 2010-12-21  9:34 UTC (permalink / raw)
  To: ofono

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

v2: Method name changed according to irc talk.
---
 src/stk.c      |    9 +++++++--
 src/stkagent.c |   31 +++++++++++++++++++++++++++++++
 src/stkagent.h |    3 +++
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index 076acc4..67cb759 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -472,12 +472,17 @@ static void stk_alpha_id_set(struct ofono_stk *stk,
 		const char *text, const struct stk_text_attribute *attr,
 		const struct stk_icon_id *icon)
 {
-	/* TODO */
+	char *alpha = dbus_apply_text_attributes(text, attr);
+
+	if (alpha || icon)
+		stk_agent_display_action_info(stk->current_agent, alpha, icon);
+
+	g_free(alpha);
 }
 
 static void stk_alpha_id_unset(struct ofono_stk *stk)
 {
-	/* TODO */
+	stk_agent_request_cancel(stk->current_agent);
 }
 
 static int duration_to_msecs(const struct stk_duration *duration)
diff --git a/src/stkagent.c b/src/stkagent.c
index e1a6f48..2c43053 100644
--- a/src/stkagent.c
+++ b/src/stkagent.c
@@ -964,3 +964,34 @@ int stk_agent_loop_tone(struct stk_agent *agent, const char *text,
 
 	return 0;
 }
+
+static void action_info_cb(DBusPendingCall *call, void *data)
+{
+	stk_agent_request_end(data);
+}
+
+int stk_agent_display_action_info(struct stk_agent *agent, const char *text,
+					const struct stk_icon_id *icon)
+{
+	DBusConnection *conn = ofono_dbus_get_connection();
+
+	agent->msg = dbus_message_new_method_call(agent->bus, agent->path,
+						OFONO_SIM_APP_INTERFACE,
+						"DisplayActionInformation");
+	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,
+						0) == FALSE ||
+			agent->call == NULL)
+		return -EIO;
+
+	dbus_pending_call_set_notify(agent->call, action_info_cb, agent, NULL);
+
+	return 0;
+}
diff --git a/src/stkagent.h b/src/stkagent.h
index 517bcfe..00bacc2 100644
--- a/src/stkagent.h
+++ b/src/stkagent.h
@@ -137,3 +137,6 @@ int stk_agent_loop_tone(struct stk_agent *agent, const char *text,
 
 void append_menu_items_variant(DBusMessageIter *iter,
 				const struct stk_menu_item *items);
+
+int stk_agent_display_action_info(struct stk_agent *agent, const char *text,
+					const struct stk_icon_id *icon);
-- 
1.7.1.86.g0e460.dirty


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

* [PATCH] gisi: fix use of unitialised variable.
@ 2010-12-23  4:39 Andrzej Zaborowski
  2010-12-23  4:39 ` [PATCH] n900: remove unneeded g_isi_client_destroy call Andrzej Zaborowski
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Andrzej Zaborowski @ 2010-12-23  4:39 UTC (permalink / raw)
  To: ofono

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

Set no msg.version if it's not available.
---
 gisi/modem.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/gisi/modem.c b/gisi/modem.c
index ff06cf2..9fb4d34 100644
--- a/gisi/modem.c
+++ b/gisi/modem.c
@@ -293,7 +293,6 @@ static gboolean isi_callback(GIOChannel *channel, GIOCondition cond,
 		msg.error = 0;
 		msg.data = buf;
 		msg.len = len;
-		msg.version = &mux->version;
 
 		if (modem->trace != NULL)
 			modem->trace(&msg, NULL);
@@ -311,6 +310,8 @@ static gboolean isi_callback(GIOChannel *channel, GIOCondition cond,
 			return TRUE;
 		}
 
+		msg.version = &mux->version;
+
 		if (g_isi_msg_id(&msg) == COMMON_MESSAGE)
 			common_message_decode(mux, &msg);
 
-- 
1.7.1.86.g0e460.dirty


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

* [PATCH] n900: remove unneeded g_isi_client_destroy call.
  2010-12-23  4:39 [PATCH] gisi: fix use of unitialised variable Andrzej Zaborowski
@ 2010-12-23  4:39 ` Andrzej Zaborowski
  2010-12-24  0:26   ` Denis Kenzior
  2010-12-23  4:39 ` [PATCH 1/2] stk: Send the AlphaId's to agent Andrzej Zaborowski
  2010-12-24  0:26 ` [PATCH] gisi: fix use of unitialised variable Denis Kenzior
  2 siblings, 1 reply; 8+ messages in thread
From: Andrzej Zaborowski @ 2010-12-23  4:39 UTC (permalink / raw)
  To: ofono

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

"client" is either NULL or uninitialised in this place.
---
 plugins/n900.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/plugins/n900.c b/plugins/n900.c
index 711f4ed..29daf05 100644
--- a/plugins/n900.c
+++ b/plugins/n900.c
@@ -382,7 +382,6 @@ static int n900_probe(struct ofono_modem *modem)
 	return 0;
 
 error:
-	g_isi_client_destroy(client);
 	g_isi_modem_destroy(isimodem);
 	gpio_remove(modem);
 	g_free(isi);
-- 
1.7.1.86.g0e460.dirty


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

* [PATCH 1/2] stk: Send the AlphaId's to agent.
  2010-12-23  4:39 [PATCH] gisi: fix use of unitialised variable Andrzej Zaborowski
  2010-12-23  4:39 ` [PATCH] n900: remove unneeded g_isi_client_destroy call Andrzej Zaborowski
@ 2010-12-23  4:39 ` Andrzej Zaborowski
  2010-12-24  0:32   ` Denis Kenzior
  2010-12-24  0:26 ` [PATCH] gisi: fix use of unitialised variable Denis Kenzior
  2 siblings, 1 reply; 8+ messages in thread
From: Andrzej Zaborowski @ 2010-12-23  4:39 UTC (permalink / raw)
  To: ofono

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

v2: Method name changed according to irc talk.
v3: Terminate session if return signature doesn't match but allow
agent to return from the call if it does match.
---
 src/stk.c      |    9 +++++++--
 src/stkagent.c |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/stkagent.h |    3 +++
 3 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index 87208d1..9dcbda6 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -472,12 +472,17 @@ static void stk_alpha_id_set(struct ofono_stk *stk,
 		const char *text, const struct stk_text_attribute *attr,
 		const struct stk_icon_id *icon)
 {
-	/* TODO */
+	char *alpha = dbus_apply_text_attributes(text, attr);
+
+	if (alpha || icon)
+		stk_agent_display_action_info(stk->current_agent, alpha, icon);
+
+	g_free(alpha);
 }
 
 static void stk_alpha_id_unset(struct ofono_stk *stk)
 {
-	/* TODO */
+	stk_agent_request_cancel(stk->current_agent);
 }
 
 static int duration_to_msecs(const struct stk_duration *duration)
diff --git a/src/stkagent.c b/src/stkagent.c
index e1a6f48..2cdc6e1 100644
--- a/src/stkagent.c
+++ b/src/stkagent.c
@@ -964,3 +964,52 @@ int stk_agent_loop_tone(struct stk_agent *agent, const char *text,
 
 	return 0;
 }
+
+static void action_info_cb(DBusPendingCall *call, void *data)
+{
+	struct stk_agent *agent = data;
+	DBusMessage *reply = dbus_pending_call_steal_reply(call);
+	enum stk_agent_result result;
+	gboolean remove_agent;
+
+	if (check_error(agent, reply, 0, &result) == -EINVAL) {
+		remove_agent = TRUE;
+		goto error;
+	}
+
+	if (dbus_message_get_args(reply, NULL, DBUS_TYPE_INVALID) == FALSE) {
+		ofono_error("Can't parse the reply to DisplayActionInfo()");
+		remove_agent = TRUE;
+		goto error;
+	}
+
+	goto done;
+
+	CALLBACK_END();
+}
+
+int stk_agent_display_action_info(struct stk_agent *agent, const char *text,
+					const struct stk_icon_id *icon)
+{
+	DBusConnection *conn = ofono_dbus_get_connection();
+
+	agent->msg = dbus_message_new_method_call(agent->bus, agent->path,
+						OFONO_SIM_APP_INTERFACE,
+						"DisplayActionInformation");
+	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,
+						0) == FALSE ||
+			agent->call == NULL)
+		return -EIO;
+
+	dbus_pending_call_set_notify(agent->call, action_info_cb, agent, NULL);
+
+	return 0;
+}
diff --git a/src/stkagent.h b/src/stkagent.h
index 517bcfe..6477dbf 100644
--- a/src/stkagent.h
+++ b/src/stkagent.h
@@ -137,3 +137,6 @@ int stk_agent_loop_tone(struct stk_agent *agent, const char *text,
 
 void append_menu_items_variant(DBusMessageIter *iter,
 				const struct stk_menu_item *items);
+
+int stk_agent_display_action_info(struct stk_agent *agent, const char *text,
+					const struct stk_icon_id *icon);
-- 
1.7.1.86.g0e460.dirty


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

* Re: [PATCH] n900: remove unneeded g_isi_client_destroy call.
  2010-12-23  4:39 ` [PATCH] n900: remove unneeded g_isi_client_destroy call Andrzej Zaborowski
@ 2010-12-24  0:26   ` Denis Kenzior
  0 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2010-12-24  0:26 UTC (permalink / raw)
  To: ofono

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

Hi Andrew,

On 12/22/2010 10:39 PM, Andrzej Zaborowski wrote:
> "client" is either NULL or uninitialised in this place.
> ---
>  plugins/n900.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH] gisi: fix use of unitialised variable.
  2010-12-23  4:39 [PATCH] gisi: fix use of unitialised variable Andrzej Zaborowski
  2010-12-23  4:39 ` [PATCH] n900: remove unneeded g_isi_client_destroy call Andrzej Zaborowski
  2010-12-23  4:39 ` [PATCH 1/2] stk: Send the AlphaId's to agent Andrzej Zaborowski
@ 2010-12-24  0:26 ` Denis Kenzior
  2 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2010-12-24  0:26 UTC (permalink / raw)
  To: ofono

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

Hi Andrew,

On 12/22/2010 10:39 PM, Andrzej Zaborowski wrote:
> Set no msg.version if it's not available.
> ---
>  gisi/modem.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH 1/2] stk: Send the AlphaId's to agent.
  2010-12-23  4:39 ` [PATCH 1/2] stk: Send the AlphaId's to agent Andrzej Zaborowski
@ 2010-12-24  0:32   ` Denis Kenzior
  0 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2010-12-24  0:32 UTC (permalink / raw)
  To: ofono

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

Hi Andrew,

On 12/22/2010 10:39 PM, Andrzej Zaborowski wrote:
> v2: Method name changed according to irc talk.
> v3: Terminate session if return signature doesn't match but allow
> agent to return from the call if it does match.
> ---
>  src/stk.c      |    9 +++++++--
>  src/stkagent.c |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
>  src/stkagent.h |    3 +++
>  3 files changed, 59 insertions(+), 2 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2010-12-24  0:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-23  4:39 [PATCH] gisi: fix use of unitialised variable Andrzej Zaborowski
2010-12-23  4:39 ` [PATCH] n900: remove unneeded g_isi_client_destroy call Andrzej Zaborowski
2010-12-24  0:26   ` Denis Kenzior
2010-12-23  4:39 ` [PATCH 1/2] stk: Send the AlphaId's to agent Andrzej Zaborowski
2010-12-24  0:32   ` Denis Kenzior
2010-12-24  0:26 ` [PATCH] gisi: fix use of unitialised variable Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2010-12-21  9:34 [PATCH 1/2] stk: Send the AlphaId's to agent Andrzej Zaborowski
2010-12-20 12:52 Andrzej Zaborowski

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.