Skip to contentSkip to conversation

list-modems: Pretty-print main menu.

PATCH In review Andrzej Zaborowski 3 participants 14 messages Aug 17, 2010 – Aug 18, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 list-modems: Pretty-print main menu.

---
 test/list-modems |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
test/list-modems +3 -0
index 191743b..eee00b0 100755
@@ -58,6 +58,9 @@ for path in properties["Modems"]:
 						"MicrophoneVolume",
 						"SpeakerVolume"]:
 				val = int(properties[key])
+			elif key in ["MainMenu"]:
+				val = ", ".join([ text + " (" + str(int(icon)) +
+					")" for text, icon in properties[key] ])
 			else:
 				val = str(properties[key])
 			print "        %s = %s" % (key, val)
Signature · 1 line
1.7.1.86.g0e460.dirty
#1 lore raw

PATCH 1/1 stkagent: Free pending call when destroying agent.

Otherwise we leak memory and additionally D-bus invokes the method callback and since the agent is already destroyed, we segfault.

---
 src/stkagent.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
src/stkagent.c +6 -5
index fc05493..e71436d 100644
@@ -127,19 +127,20 @@ void stk_agent_request_cancel(struct stk_agent *agent)
 		return;
 
 	dbus_pending_call_cancel(agent->call);
-	stk_agent_send_cancel(agent);
+
+	if (agent->disconnect_watch)
+		stk_agent_send_cancel(agent);
+
 	stk_agent_request_end(agent);
 }
 
 void stk_agent_free(struct stk_agent *agent)
 {
 	DBusConnection *conn = ofono_dbus_get_connection();
-	gboolean busy = agent->call != NULL;
 
-	if (agent->disconnect_watch) {
-		if (busy)
-			stk_agent_send_cancel(agent);
+	stk_agent_request_cancel(agent);
 
+	if (agent->disconnect_watch) {
 		stk_agent_send_release(agent);
 
 		g_dbus_remove_watch(conn, agent->disconnect_watch);
Signature · 1 line
1.7.1.86.g0e460.dirty
#2 lore raw

Re: [PATCH] stkagent: Free pending call when destroying agent.

Hi Andrew,

Quoted 3 lines · Andrzej Zaborowski

Otherwise we leak memory and additionally D-bus invokes the method callback and since the agent is already destroyed, we segfault.
---

Good catch. Patch has been applied, thanks.

Regards,
-Denis

#3 lore raw

PATCH 1/1 calypso: Subscribe to %SIMREM, %SIMINS notifications.

In reply to Andrzej Zaborowski

These notifications should be emitted on SIM removal and insertion. These notifications don't work very well though, on the hardware this has been tested on, the modem never issued %SIMINS, and %SIMREM was emitted only in some specific circumenstances.

---
 plugins/calypso.c |   35 ++++++++++++++++++++++++++++++-----
 1 files changed, 30 insertions(+), 5 deletions(-)
plugins/calypso.c +30 -5
index 6ef6968..a2d4ec8 100644
@@ -84,6 +84,7 @@ struct calypso_data {
 	gboolean phonebook_added;
 	gboolean sms_added;
 	gboolean have_sim;
+	struct ofono_sim *sim;
 };
 
 static const char *cpin_prefix[] = { "+CPIN:", NULL };
@@ -170,6 +171,23 @@ static void cstat_notify(GAtResult *result, gpointer user_data)
 	}
 }
 
+static void simind_notify(GAtResult *result, gpointer user_data)
+{
+	struct ofono_modem *modem = user_data;
+	struct calypso_data *data = ofono_modem_get_data(modem);
+	GAtResultIter iter;
+
+	if (!data->sim)
+		return;
+
+	g_at_result_iter_init(&iter, result);
+
+	if (g_at_result_iter_next(&iter, "%SIMREM:"))
+		ofono_sim_inserted_notify(data->sim, FALSE);
+	else if (g_at_result_iter_next(&iter, "%SIMINS:"))
+		ofono_sim_inserted_notify(data->sim, TRUE);
+}
+
 static void setup_modem(struct ofono_modem *modem)
 {
 	struct calypso_data *data = ofono_modem_get_data(modem);
@@ -197,6 +215,14 @@ static void setup_modem(struct ofono_modem *modem)
 	/* Disable deep sleep */
 	g_at_chat_send(data->dlcs[SETUP_DLC], "AT%SLEEP=2", NULL,
 			NULL, NULL, NULL);
+
+	/* Enable SIM removed/inserted notifications */
+	g_at_chat_register(data->dlcs[SETUP_DLC], "%SIMREM:", simind_notify,
+				FALSE, modem, NULL);
+	g_at_chat_register(data->dlcs[SETUP_DLC], "%SIMINS:", simind_notify,
+				FALSE, modem, NULL);
+	g_at_chat_send(data->dlcs[SETUP_DLC], "AT%SIMIND=1", NULL,
+				NULL, NULL, NULL);
 }
 
 static void simpin_check_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -439,12 +465,11 @@ static int calypso_disable(struct ofono_modem *modem)
 static void calypso_pre_sim(struct ofono_modem *modem)
 {
 	struct calypso_data *data = ofono_modem_get_data(modem);
-	struct ofono_sim *sim;
 
 	DBG("");
 
 	ofono_devinfo_create(modem, 0, "atmodem", data->dlcs[AUX_DLC]);
-	sim = ofono_sim_create(modem, 0, "atmodem", data->dlcs[AUX_DLC]);
+	data->sim = ofono_sim_create(modem, 0, "atmodem", data->dlcs[AUX_DLC]);
 	ofono_voicecall_create(modem, 0, "calypsomodem", data->dlcs[VOICE_DLC]);
 
 	/*
@@ -490,14 +515,14 @@ static void calypso_pre_sim(struct ofono_modem *modem)
 	 * succeeds.  It will not perform Profile Download on those cards
 	 * though, until another +CPIN command.
 	 */
-	if (data->have_sim && sim)
+	if (data->have_sim && data->sim)
 		ofono_stk_create(modem, 0, "calypsomodem", data->dlcs[AUX_DLC]);
 
 	g_at_chat_send(data->dlcs[AUX_DLC], "AT+CFUN=1",
 			none_prefix, NULL, NULL, NULL);
 
-	if (data->have_sim && sim)
-		ofono_sim_inserted_notify(sim, TRUE);
+	if (data->have_sim && data->sim)
+		ofono_sim_inserted_notify(data->sim, TRUE);
 }
 
 static void calypso_post_sim(struct ofono_modem *modem)
Signature · 1 line
1.7.1.86.g0e460.dirty
#4 lore raw

Re: [PATCH] calypso: Subscribe to %SIMREM, %SIMINS notifications.

Hi Andrew,

Quoted 5 lines · Andrzej Zaborowski

These notifications should be emitted on SIM removal and insertion. These notifications don't work very well though, on the hardware this has been tested on, the modem never issued %SIMINS, and %SIMREM was emitted only in some specific circumenstances.
---

Patch has been applied, thanks.

Regards,
-Denis

#5 lore raw

PATCH 1/1 stk: Update agent_called with GetInkey and GetInput support.

In reply to Andrzej Zaborowski
---
 src/stk.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
src/stk.c +2 -0
index 7d98f92..16cc906 100644
@@ -424,6 +424,8 @@ static gboolean agent_called(struct ofono_stk *stk)
 	switch (stk->pending_cmd->type) {
 	case STK_COMMAND_TYPE_SELECT_ITEM:
 	case STK_COMMAND_TYPE_DISPLAY_TEXT:
+	case STK_COMMAND_TYPE_GET_INPUT:
+	case STK_COMMAND_TYPE_GET_INKEY:
 		return TRUE;
 	}
 
Signature · 1 line
1.7.1.86.g0e460.dirty
#6 lore raw

Re: [PATCH] stk: Update agent_called with GetInkey and GetInput support.

Hi Andrew,

Quoted 4 lines · Andrzej Zaborowski
---
 src/stk.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis

#7 lore raw

RFC PATCH v2 1/1 doc: Proposed Set Up Call api.

In reply to Andrzej Zaborowski

The normal sequence for call setup is:

* Modem asks user for confirmation using icon1 / alphaId1.
* User confirms
* Modem starts dialling, screen displays icon2 / alphaId2,
* Call is connected, modem replies to the proactive command, screen keeps displaying icon2 / alphaId2 until the phone call is over.

---
 doc/stk-api.txt       |   11 +++++++++++
 doc/voicecall-api.txt |   11 +++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
doc/stk-api.txt +11 -0
index 2e863a9..dcb8e2b 100644
@@ -189,6 +189,17 @@ Methods		byte RequestSelection(string title, byte icon_id,
 
 			Possible Errors: [service].Error.SimToolkit.GoBack
 
+		boolean ConfirmCallSetup(string message, byte icon_id)
+
+			Asks the agent to request user to confirm an
+			outgoing call setup.  If confirmed, the next new
+			outgoing call reported by VoiceCallManager will
+			have the Information and IconID properties set to
+			inform the user.  Hanging up before the call is
+			connected will cause EndSession reply to be sent.
+
+			Possible Errors: [service].Error.SimToolkit.EndSession
+
 		void Cancel()
 
 			Asks the agent to cancel any ongoing operation in
doc/voicecall-api.txt +11 -0
index efeae42..dae3ec2 100644
@@ -106,3 +106,14 @@ Properties	string LineIdentification [readonly]
 			stamped when the call enters the "active" state.
 			Client applications can use this to infer somewhat
 			reliable call duration information.
+
+		string Information [readonly, optional]
+
+			Contains information related to the call for the
+			user.  Currently this property is set for calls
+			initiated by SIM Toolkit applications.
+
+		string IconID [readonly, optional]
+
+			Icon identifier to be used instead of or together
+			with the text information.
Signature · 1 line
1.7.1.86.g0e460.dirty
#8 lore raw

Re: [PATCH v2] [RfC] doc: Proposed Set Up Call api.

Hi Andrew,

Quoted 9 lines
doc/voicecall-api.txt +1 -0
index efeae42..dae3ec2 100644
@@ -106,3 +106,14 @@ Properties	string LineIdentification [readonly]
 			stamped when the call enters the "active" state.
 			Client applications can use this to infer somewhat
 			reliable call duration information.
+

doc/voicecall-api.txt Properties string LineIdentification [readonly] · line 119

Quoted 10 lines
doc/voicecall-api.txt +10 -0
+		string Information [readonly, optional]
+
+			Contains information related to the call for the
+			user.  Currently this property is set for calls
+			initiated by SIM Toolkit applications.
+
+		string IconID [readonly, optional]
+
+			Icon identifier to be used instead of or together
+			with the text information.

So my preference here is simply Icon, or IconIdentifier. IconID breaks our pure CamelCase rules for APIs.

Regards,
-Denis

#9 lore raw

RFC PATCH 1/1 doc: Proposed Set Up Call api.

The normal sequence for call setup is:

* Modem asks user for confirmation using icon1 / alphaId1.
* User confirms
* Modem starts dialling, screen displays icon2 / alphaId2,
* Call is connected, modem replies to the proactive command, screen keeps displaying icon2 / alphaId2 until the phone call is over.

---
 doc/stk-api.txt       |   11 +++++++++++
 doc/voicecall-api.txt |   11 +++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
doc/stk-api.txt +11 -0
index 2e863a9..dcb8e2b 100644
@@ -189,6 +189,17 @@ Methods		byte RequestSelection(string title, byte icon_id,
 
 			Possible Errors: [service].Error.SimToolkit.GoBack
 
+		boolean ConfirmCallSetup(string information, byte icon_id)
+
+			Asks the agent to request user to confirm an
+			outgoing call setup.  If confirmed, the next new
+			outgoing call reported by VoiceCallManager will
+			have the Information and Icon properties set to
+			inform the user.  Hanging up before the call is
+			connected will cause EndSession reply to be sent.
+
+			Possible Errors: [service].Error.SimToolkit.EndSession
+
 		void Cancel()
 
 			Asks the agent to cancel any ongoing operation in
doc/voicecall-api.txt +11 -0
index 59e3568..f0ba316 100644
@@ -114,3 +114,14 @@ Properties	string LineIdentification [readonly]
 			stamped when the call enters the "active" state.
 			Client applications can use this to infer somewhat
 			reliable call duration information.
+
+		string Information [readonly, optional]
+
+			Contains information related to the call for the
+			user.  Currently this property is set for calls
+			initiated by SIM Toolkit applications.
+
+		byte Icon [readonly, optional]
+
+			Icon identifier to be used instead of or together
+			with the text information.
Signature · 1 line
1.7.1.86.g0e460.dirty
#10 lore raw

Re: [PATCH] [RfC] doc: Proposed Set Up Call api.

Hi Andrew,

Quoted 43 lines

The normal sequence for call setup is:

* Modem asks user for confirmation using icon1 / alphaId1.
* User confirms
* Modem starts dialling, screen displays icon2 / alphaId2,
* Call is connected, modem replies to the proactive command, screen keeps displaying icon2 / alphaId2 until the phone call is over.

---
 doc/stk-api.txt       |   11 +++++++++++
 doc/voicecall-api.txt |   11 +++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
doc/stk-api.txt +11 -0
index 2e863a9..dcb8e2b 100644
@@ -189,6 +189,17 @@ Methods		byte RequestSelection(string title, byte icon_id,
 
 			Possible Errors: [service].Error.SimToolkit.GoBack
 
+		boolean ConfirmCallSetup(string information, byte icon_id)
+
+			Asks the agent to request user to confirm an
+			outgoing call setup.  If confirmed, the next new
+			outgoing call reported by VoiceCallManager will
+			have the Information and Icon properties set to
+			inform the user.  Hanging up before the call is
+			connected will cause EndSession reply to be sent.
+
+			Possible Errors: [service].Error.SimToolkit.EndSession
+
 		void Cancel()
 
 			Asks the agent to cancel any ongoing operation in
doc/voicecall-api.txt +1 -0
index 59e3568..f0ba316 100644
@@ -114,3 +114,14 @@ Properties	string LineIdentification [readonly]
 			stamped when the call enters the "active" state.
 			Client applications can use this to infer somewhat
 			reliable call duration information.
+

doc/voicecall-api.txt Properties string LineIdentification [readonly] · line 127

Quoted 10 lines
doc/voicecall-api.txt +10 -0
+		string Information [readonly, optional]
+
+			Contains information related to the call for the
+			user.  Currently this property is set for calls
+			initiated by SIM Toolkit applications.
+
+		byte Icon [readonly, optional]
+
+			Icon identifier to be used instead of or together
+			with the text information.

I would be fine with this. At least for an initial attempt to implement this. We need to see how far we get from here. If it doesn't work out then we have to get back to the drawing board.

Regards

Marcel

#11 lore raw

Re: [PATCH] [RfC] doc: Proposed Set Up Call api.

In reply to Andrzej Zaborowski

Hi Andrew,

Quoted 7 lines · Andrzej Zaborowski

The normal sequence for call setup is:

* Modem asks user for confirmation using icon1 / alphaId1.
* User confirms
* Modem starts dialling, screen displays icon2 / alphaId2,
* Call is connected, modem replies to the proactive command, screen keeps displaying icon2 / alphaId2 until the phone call is over.

Quoted 5 lines
---
 doc/stk-api.txt       |   11 +++++++++++
 doc/voicecall-api.txt |   11 +++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

Since we have seemingly reached consensus on the API direction, I went ahead and applied this patch. Thanks.

Regards,
-Denis

#12 lore raw

Re: [PATCH v2] [RfC] doc: Proposed Set Up Call api.

In reply to Denis Kenzior

Hi Denis,

Quoted 14 lines
Quoted 14 lines
doc/voicecall-api.txt +6 -0
index efeae42..dae3ec2 100644
@@ -106,3 +106,14 @@ Properties	string LineIdentification [readonly]
 			stamped when the call enters the "active" state.
 			Client applications can use this to infer somewhat
 			reliable call duration information.
+
+		string Information [readonly, optional]
+
+			Contains information related to the call for the
+			user.  Currently this property is set for calls
+			initiated by SIM Toolkit applications.
Quoted 8 lines

doc/voicecall-api.txt Properties string LineIdentification [readonly] · line 119

Quoted 5 lines
doc/voicecall-api.txt +5 -0
+
+		string IconID [readonly, optional]
+
+			Icon identifier to be used instead of or together
+			with the text information.

So my preference here is simply Icon, or IconIdentifier. IconID breaks our pure CamelCase rules for APIs.

I think we used Icons in STK API and thus this should be Icon to match with it. But yes, either plain Icon or IconIdentifier.

Regards

Marcel

#13 lore raw
In reply to Andrzej Zaborowski

Hi Andrew,

test/list-modems

Quoted 6 lines · Andrzej Zaborowski
---
 test/list-modems |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
test/list-modems +0 -0
index 191743b..eee00b0 100755

Patch has been applied, thanks.

Regards,
-Denis