All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] sim: add getters for mcc and mnc
@ 2011-01-19  7:21 Jukka Saunamaki
  2011-01-19  7:21 ` [PATCH 1/3] sim: store mcc and mnc separate from imsi Jukka Saunamaki
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jukka Saunamaki @ 2011-01-19  7:21 UTC (permalink / raw)
  To: ofono

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

These patches add getter functions for home PLMN MCC and MCC values to SIM atom.

Jukka Saunamaki (3):
      sim: store mcc and mnc separate from imsi
      sim: getters for mcc and mnc definition
      sim: getters for mcc and mnc implementation

 include/sim.h |    2 ++
 src/sim.c     |   50 +++++++++++++++++++++++++++++++-------------------
 2 files changed, 33 insertions(+), 19 deletions(-)


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

* [PATCH 1/3] sim: store mcc and mnc separate from imsi
  2011-01-19  7:21 [PATCH 0/3] sim: add getters for mcc and mnc Jukka Saunamaki
@ 2011-01-19  7:21 ` Jukka Saunamaki
  2011-01-19  7:21 ` [PATCH 2/3] sim: getters for mcc and mnc definition Jukka Saunamaki
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jukka Saunamaki @ 2011-01-19  7:21 UTC (permalink / raw)
  To: ofono

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

---
 src/sim.c |   34 +++++++++++++++-------------------
 1 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/src/sim.c b/src/sim.c
index d627647..891116b 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -78,6 +78,8 @@ struct ofono_sim {
 	gboolean barred_dialing;
 
 	char *imsi;
+	char mcc[OFONO_MAX_MCC_LENGTH + 1];
+	char mnc[OFONO_MAX_MNC_LENGTH + 1];
 
 	GSList *own_numbers;
 	GSList *new_numbers;
@@ -348,21 +350,13 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
 	bdn = sim->barred_dialing;
 	ofono_dbus_dict_append(&dict, "BarredDialing", DBUS_TYPE_BOOLEAN, &bdn);
 
-	if (sim->mnc_length && sim->imsi) {
-		char mcc[OFONO_MAX_MCC_LENGTH + 1];
-		char mnc[OFONO_MAX_MNC_LENGTH + 1];
+	if (sim->mcc[0] != '\0' && sim->mnc[0] != '\0') {
 		const char *str;
-
-		strncpy(mcc, sim->imsi, OFONO_MAX_MCC_LENGTH);
-		mcc[OFONO_MAX_MCC_LENGTH] = '\0';
-		strncpy(mnc, sim->imsi + OFONO_MAX_MCC_LENGTH, sim->mnc_length);
-		mnc[sim->mnc_length] = '\0';
-
-		str = mcc;
+		str = sim->mcc;
 		ofono_dbus_dict_append(&dict, "MobileCountryCode",
 					DBUS_TYPE_STRING, &str);
 
-		str = mnc;
+		str = sim->mnc;
 		ofono_dbus_dict_append(&dict, "MobileNetworkCode",
 					DBUS_TYPE_STRING, &str);
 	}
@@ -1299,22 +1293,21 @@ static void sim_imsi_cb(const struct ofono_error *error, const char *imsi,
 						DBUS_TYPE_STRING, &sim->imsi);
 
 	if (sim->mnc_length) {
-		char mcc[OFONO_MAX_MCC_LENGTH + 1];
-		char mnc[OFONO_MAX_MNC_LENGTH + 1];
 		const char *str;
 
-		strncpy(mcc, sim->imsi, OFONO_MAX_MCC_LENGTH);
-		mcc[OFONO_MAX_MCC_LENGTH] = '\0';
-		strncpy(mnc, sim->imsi + OFONO_MAX_MCC_LENGTH, sim->mnc_length);
-		mnc[sim->mnc_length] = '\0';
+		strncpy(sim->mcc, sim->imsi, OFONO_MAX_MCC_LENGTH);
+		sim->mcc[OFONO_MAX_MCC_LENGTH] = '\0';
+		strncpy(sim->mnc, sim->imsi + OFONO_MAX_MCC_LENGTH,
+			sim->mnc_length);
+		sim->mnc[sim->mnc_length] = '\0';
 
-		str = mcc;
+		str = sim->mcc;
 		ofono_dbus_signal_property_changed(conn, path,
 						OFONO_SIM_MANAGER_INTERFACE,
 						"MobileCountryCode",
 						DBUS_TYPE_STRING, &str);
 
-		str = mnc;
+		str = sim->mnc;
 		ofono_dbus_signal_property_changed(conn, path,
 						OFONO_SIM_MANAGER_INTERFACE,
 						"MobileNetworkCode",
@@ -2060,6 +2053,9 @@ static void sim_free_state(struct ofono_sim *sim)
 		sim->imsi = NULL;
 	}
 
+	sim->mcc[0] = '\0';
+	sim->mnc[0] = '\0';
+
 	if (sim->own_numbers) {
 		g_slist_foreach(sim->own_numbers, (GFunc)g_free, NULL);
 		g_slist_free(sim->own_numbers);
-- 
1.7.1


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

* [PATCH 2/3] sim: getters for mcc and mnc definition
  2011-01-19  7:21 [PATCH 0/3] sim: add getters for mcc and mnc Jukka Saunamaki
  2011-01-19  7:21 ` [PATCH 1/3] sim: store mcc and mnc separate from imsi Jukka Saunamaki
@ 2011-01-19  7:21 ` Jukka Saunamaki
  2011-01-19  7:21 ` [PATCH 3/3] sim: getters for mcc and mnc implementation Jukka Saunamaki
  2011-01-20 17:05 ` [PATCH 0/3] sim: add getters for mcc and mnc Denis Kenzior
  3 siblings, 0 replies; 5+ messages in thread
From: Jukka Saunamaki @ 2011-01-19  7:21 UTC (permalink / raw)
  To: ofono

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

---
 include/sim.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/sim.h b/include/sim.h
index 830322a..81df60e 100644
--- a/include/sim.h
+++ b/include/sim.h
@@ -178,6 +178,8 @@ void ofono_sim_set_data(struct ofono_sim *sim, void *data);
 void *ofono_sim_get_data(struct ofono_sim *sim);
 
 const char *ofono_sim_get_imsi(struct ofono_sim *sim);
+const char *ofono_sim_get_mcc(struct ofono_sim *sim);
+const char *ofono_sim_get_mnc(struct ofono_sim *sim);
 enum ofono_sim_phase ofono_sim_get_phase(struct ofono_sim *sim);
 
 enum ofono_sim_cphs_phase ofono_sim_get_cphs_phase(struct ofono_sim *sim);
-- 
1.7.1


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

* [PATCH 3/3] sim: getters for mcc and mnc implementation
  2011-01-19  7:21 [PATCH 0/3] sim: add getters for mcc and mnc Jukka Saunamaki
  2011-01-19  7:21 ` [PATCH 1/3] sim: store mcc and mnc separate from imsi Jukka Saunamaki
  2011-01-19  7:21 ` [PATCH 2/3] sim: getters for mcc and mnc definition Jukka Saunamaki
@ 2011-01-19  7:21 ` Jukka Saunamaki
  2011-01-20 17:05 ` [PATCH 0/3] sim: add getters for mcc and mnc Denis Kenzior
  3 siblings, 0 replies; 5+ messages in thread
From: Jukka Saunamaki @ 2011-01-19  7:21 UTC (permalink / raw)
  To: ofono

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

---
 src/sim.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/sim.c b/src/sim.c
index 891116b..86c3f13 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -1990,6 +1990,22 @@ const char *ofono_sim_get_imsi(struct ofono_sim *sim)
 	return sim->imsi;
 }
 
+const char *ofono_sim_get_mcc(struct ofono_sim *sim)
+{
+	if (sim == NULL)
+		return NULL;
+
+	return sim->mcc;
+}
+
+const char *ofono_sim_get_mnc(struct ofono_sim *sim)
+{
+	if (sim == NULL)
+		return NULL;
+
+	return sim->mnc;
+}
+
 enum ofono_sim_phase ofono_sim_get_phase(struct ofono_sim *sim)
 {
 	if (sim == NULL)
-- 
1.7.1


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

* Re: [PATCH 0/3] sim: add getters for mcc and mnc
  2011-01-19  7:21 [PATCH 0/3] sim: add getters for mcc and mnc Jukka Saunamaki
                   ` (2 preceding siblings ...)
  2011-01-19  7:21 ` [PATCH 3/3] sim: getters for mcc and mnc implementation Jukka Saunamaki
@ 2011-01-20 17:05 ` Denis Kenzior
  3 siblings, 0 replies; 5+ messages in thread
From: Denis Kenzior @ 2011-01-20 17:05 UTC (permalink / raw)
  To: ofono

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

Hi Jukka,

On 01/19/2011 01:21 AM, Jukka Saunamaki wrote:
> These patches add getter functions for home PLMN MCC and MCC values to SIM atom.
> 
> Jukka Saunamaki (3):
>       sim: store mcc and mnc separate from imsi
>       sim: getters for mcc and mnc definition
>       sim: getters for mcc and mnc implementation
> 
>  include/sim.h |    2 ++
>  src/sim.c     |   50 +++++++++++++++++++++++++++++++-------------------
>  2 files changed, 33 insertions(+), 19 deletions(-)

All three patches have been applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2011-01-20 17:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-19  7:21 [PATCH 0/3] sim: add getters for mcc and mnc Jukka Saunamaki
2011-01-19  7:21 ` [PATCH 1/3] sim: store mcc and mnc separate from imsi Jukka Saunamaki
2011-01-19  7:21 ` [PATCH 2/3] sim: getters for mcc and mnc definition Jukka Saunamaki
2011-01-19  7:21 ` [PATCH 3/3] sim: getters for mcc and mnc implementation Jukka Saunamaki
2011-01-20 17:05 ` [PATCH 0/3] sim: add getters for mcc and mnc 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.