* Read EFad and expose MNC length in IMSI as a SimManager property.
@ 2009-08-19 16:00 Andrzej Zaborowski
2009-08-20 2:09 ` Gu, Yang
0 siblings, 1 reply; 5+ messages in thread
From: Andrzej Zaborowski @ 2009-08-19 16:00 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3008 bytes --]
Alternatively we could expose the MNC as a separate property.
---
src/sim.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/simutil.h | 1 +
2 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/src/sim.c b/src/sim.c
index 39976b3..0af02cd 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -77,6 +77,7 @@ struct sim_file_op {
struct sim_manager_data {
struct ofono_sim_ops *ops;
char *imsi;
+ int mnc_length;
GSList *own_numbers;
GSList *new_numbers;
GSList *ready_notify;
@@ -164,6 +165,7 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
DBusMessageIter iter;
DBusMessageIter dict;
char **own_numbers;
+ unsigned char mnc_len;
reply = dbus_message_new_method_return(msg);
if (!reply)
@@ -179,6 +181,13 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
ofono_dbus_dict_append(&dict, "SubscriberIdentity",
DBUS_TYPE_STRING, &sim->imsi);
+ if (sim->mnc_length) {
+ mnc_len = sim->mnc_length;
+
+ ofono_dbus_dict_append(&dict, "MNCLength",
+ DBUS_TYPE_BYTE, &mnc_len);
+ }
+
own_numbers = get_own_numbers(sim->own_numbers);
ofono_dbus_dict_append_array(&dict, "SubscriberNumbers",
@@ -432,15 +441,56 @@ check:
sim->new_numbers = NULL;
}
+static void sim_ad_read_cb(struct ofono_modem *modem, int ok,
+ enum ofono_sim_file_structure structure,
+ int length, int record,
+ const unsigned char *data,
+ int record_length, void *userdata)
+{
+ struct sim_manager_data *sim = userdata;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ int new_mnc_length;
+ unsigned char value;
+ struct ofono_phone_number ph;
+
+ if (!ok)
+ return;
+
+ if (structure != OFONO_SIM_FILE_STRUCTURE_TRANSPARENT)
+ return;
+
+ if (length < 4)
+ return;
+
+ new_mnc_length = data[3] & 0xf;
+
+ if (sim->mnc_length != new_mnc_length) {
+ sim->mnc_length = new_mnc_length;
+
+ value = new_mnc_length;
+ ofono_dbus_signal_property_changed(conn, modem->path,
+ SIM_MANAGER_INTERFACE,
+ "MNCLength", DBUS_TYPE_BYTE,
+ &value);
+ }
+}
+
static void sim_own_numbers_update(struct ofono_modem *modem)
{
ofono_sim_read(modem, SIM_EFMSISDN_FILEID,
sim_msisdn_read_cb, modem->sim_manager);
}
+static void sim_mnc_length_update(struct ofono_modem *modem)
+{
+ ofono_sim_read(modem, SIM_EFAD_FILEID,
+ sim_ad_read_cb, modem->sim_manager);
+}
+
static void sim_ready(struct ofono_modem *modem)
{
sim_own_numbers_update(modem);
+ sim_mnc_length_update(modem);
}
static void sim_imsi_cb(const struct ofono_error *error, const char *imsi,
diff --git a/src/simutil.h b/src/simutil.h
index c0d3d52..9bb5323 100644
--- a/src/simutil.h
+++ b/src/simutil.h
@@ -22,6 +22,7 @@
enum sim_fileid {
SIM_EFMSISDN_FILEID = 0x6f40,
SIM_EFSPN_FILEID = 0x6f46,
+ SIM_EFAD_FILEID = 0x6fad,
SIM_EFPNN_FILEID = 0x6fc5,
SIM_EFOPL_FILEID = 0x6fc6,
SIM_EFMBDN_FILEID = 0x6fc7,
--
1.6.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* RE: Read EFad and expose MNC length in IMSI as a SimManager property.
2009-08-19 16:00 Read EFad and expose MNC length in IMSI as a SimManager property Andrzej Zaborowski
@ 2009-08-20 2:09 ` Gu, Yang
2009-08-20 14:20 ` Andrzej Zaborowski
0 siblings, 1 reply; 5+ messages in thread
From: Gu, Yang @ 2009-08-20 2:09 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4219 bytes --]
Several minor comments on this patch:
1. How about unify all the mnc_length to be unsigned char?
2. For this piece of code:
>+ value = new_mnc_length;
>+ ofono_dbus_signal_property_changed(conn, modem->path,
>+ SIM_MANAGER_INTERFACE,
>+ "MNCLength", DBUS_TYPE_BYTE,
>+ &value);
Is it necessary to use temporary variable value? Why not use &sim->mnc_length instead of &value?
3. In function sim_ad_read_cb(), variable "ph" is defined by not used. Current build system is not smart enough to check if all the variables are used or not. I sugguest to add some option, such as -Wunused, in our build system to check this kind of situation.
Regards,
-Yang
>-----Original Message-----
>From: ofono-bounces(a)ofono.org [mailto:ofono-bounces(a)ofono.org] On Behalf
>Of Andrzej Zaborowski
>Sent: Thursday, August 20, 2009 12:00 AM
>To: ofono(a)ofono.org
>Subject: Read EFad and expose MNC length in IMSI as a SimManager property.
>
>Alternatively we could expose the MNC as a separate property.
>---
> src/sim.c | 50
>++++++++++++++++++++++++++++++++++++++++++++++++++
> src/simutil.h | 1 +
> 2 files changed, 51 insertions(+), 0 deletions(-)
>
>diff --git a/src/sim.c b/src/sim.c
>index 39976b3..0af02cd 100644
>--- a/src/sim.c
>+++ b/src/sim.c
>@@ -77,6 +77,7 @@ struct sim_file_op {
> struct sim_manager_data {
> struct ofono_sim_ops *ops;
> char *imsi;
>+ int mnc_length;
> GSList *own_numbers;
> GSList *new_numbers;
> GSList *ready_notify;
>@@ -164,6 +165,7 @@ static DBusMessage
>*sim_get_properties(DBusConnection *conn,
> DBusMessageIter iter;
> DBusMessageIter dict;
> char **own_numbers;
>+ unsigned char mnc_len;
>
> reply = dbus_message_new_method_return(msg);
> if (!reply)
>@@ -179,6 +181,13 @@ static DBusMessage
>*sim_get_properties(DBusConnection *conn,
> ofono_dbus_dict_append(&dict, "SubscriberIdentity",
> DBUS_TYPE_STRING, &sim->imsi);
>
>+ if (sim->mnc_length) {
>+ mnc_len = sim->mnc_length;
>+
>+ ofono_dbus_dict_append(&dict, "MNCLength",
>+ DBUS_TYPE_BYTE, &mnc_len);
>+ }
>+
> own_numbers = get_own_numbers(sim->own_numbers);
>
> ofono_dbus_dict_append_array(&dict, "SubscriberNumbers",
>@@ -432,15 +441,56 @@ check:
> sim->new_numbers = NULL;
> }
>
>+static void sim_ad_read_cb(struct ofono_modem *modem, int ok,
>+ enum ofono_sim_file_structure structure,
>+ int length, int record,
>+ const unsigned char *data,
>+ int record_length, void *userdata)
>+{
>+ struct sim_manager_data *sim = userdata;
>+ DBusConnection *conn = ofono_dbus_get_connection();
>+ int new_mnc_length;
>+ unsigned char value;
>+ struct ofono_phone_number ph;
>+
>+ if (!ok)
>+ return;
>+
>+ if (structure != OFONO_SIM_FILE_STRUCTURE_TRANSPARENT)
>+ return;
>+
>+ if (length < 4)
>+ return;
>+
>+ new_mnc_length = data[3] & 0xf;
>+
>+ if (sim->mnc_length != new_mnc_length) {
>+ sim->mnc_length = new_mnc_length;
>+
>+ value = new_mnc_length;
>+ ofono_dbus_signal_property_changed(conn, modem->path,
>+ SIM_MANAGER_INTERFACE,
>+ "MNCLength", DBUS_TYPE_BYTE,
>+ &value);
>+ }
>+}
>+
> static void sim_own_numbers_update(struct ofono_modem *modem)
> {
> ofono_sim_read(modem, SIM_EFMSISDN_FILEID,
> sim_msisdn_read_cb, modem->sim_manager);
> }
>
>+static void sim_mnc_length_update(struct ofono_modem *modem)
>+{
>+ ofono_sim_read(modem, SIM_EFAD_FILEID,
>+ sim_ad_read_cb, modem->sim_manager);
>+}
>+
> static void sim_ready(struct ofono_modem *modem)
> {
> sim_own_numbers_update(modem);
>+ sim_mnc_length_update(modem);
> }
>
> static void sim_imsi_cb(const struct ofono_error *error, const char *imsi,
>diff --git a/src/simutil.h b/src/simutil.h
>index c0d3d52..9bb5323 100644
>--- a/src/simutil.h
>+++ b/src/simutil.h
>@@ -22,6 +22,7 @@
> enum sim_fileid {
> SIM_EFMSISDN_FILEID = 0x6f40,
> SIM_EFSPN_FILEID = 0x6f46,
>+ SIM_EFAD_FILEID = 0x6fad,
> SIM_EFPNN_FILEID = 0x6fc5,
> SIM_EFOPL_FILEID = 0x6fc6,
> SIM_EFMBDN_FILEID = 0x6fc7,
>--
>1.6.1
>
>_______________________________________________
>ofono mailing list
>ofono(a)ofono.org
>http://lists.ofono.org/listinfo/ofono
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Read EFad and expose MNC length in IMSI as a SimManager property.
2009-08-20 2:09 ` Gu, Yang
@ 2009-08-20 14:20 ` Andrzej Zaborowski
2009-08-26 0:37 ` andrzej zaborowski
0 siblings, 1 reply; 5+ messages in thread
From: Andrzej Zaborowski @ 2009-08-20 14:20 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1040 bytes --]
2009/8/20 Gu, Yang <yang.gu@intel.com>:
> Several minor comments on this patch:
> 1. How about unify all the mnc_length to be unsigned char?
> 2. For this piece of code:
>>+ value = new_mnc_length;
>>+ ofono_dbus_signal_property_changed(conn, modem->path,
>>+ SIM_MANAGER_INTERFACE,
>>+ "MNCLength", DBUS_TYPE_BYTE,
>>+ &value);
> Is it necessary to use temporary variable value? Why not use &sim->mnc_length instead of &value?
Necessary no, we can use unsigned char for sim->mnc_length --
ofono_dbus_signal_property_changed requires unsigned char * -- it's
just proper to use ints for integers. I changed it as you suggest
nevertheless.
>
> 3. In function sim_ad_read_cb(), variable "ph" is defined by not used.
Thanks for noticing, removed in the attachment.
Regards
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Read-EFad-and-expose-MNC-length-in-IMSI-as-a-SimMana.patch --]
[-- Type: text/x-patch, Size: 2806 bytes --]
From 274eeee297e45b1ad7536cdaf80c41af5a063411 Mon Sep 17 00:00:00 2001
From: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Date: Thu, 20 Aug 2009 18:01:07 +0200
Subject: [PATCH] Read EFad and expose MNC length in IMSI as a SimManager property.
Alternatively we could expose the MNC as a separate property.
---
src/sim.c | 43 +++++++++++++++++++++++++++++++++++++++++++
src/simutil.h | 1 +
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/src/sim.c b/src/sim.c
index 39976b3..d4387c9 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -77,6 +77,7 @@ struct sim_file_op {
struct sim_manager_data {
struct ofono_sim_ops *ops;
char *imsi;
+ unsigned char mnc_length;
GSList *own_numbers;
GSList *new_numbers;
GSList *ready_notify;
@@ -179,6 +180,10 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
ofono_dbus_dict_append(&dict, "SubscriberIdentity",
DBUS_TYPE_STRING, &sim->imsi);
+ if (sim->mnc_length)
+ ofono_dbus_dict_append(&dict, "MNCLength",
+ DBUS_TYPE_BYTE, &sim->mnc_length);
+
own_numbers = get_own_numbers(sim->own_numbers);
ofono_dbus_dict_append_array(&dict, "SubscriberNumbers",
@@ -432,15 +437,53 @@ check:
sim->new_numbers = NULL;
}
+static void sim_ad_read_cb(struct ofono_modem *modem, int ok,
+ enum ofono_sim_file_structure structure,
+ int length, int record,
+ const unsigned char *data,
+ int record_length, void *userdata)
+{
+ struct sim_manager_data *sim = userdata;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ int new_mnc_length;
+
+ if (!ok)
+ return;
+
+ if (structure != OFONO_SIM_FILE_STRUCTURE_TRANSPARENT)
+ return;
+
+ if (length < 4)
+ return;
+
+ new_mnc_length = data[3] & 0xf;
+
+ if (sim->mnc_length != new_mnc_length) {
+ sim->mnc_length = new_mnc_length;
+
+ ofono_dbus_signal_property_changed(conn, modem->path,
+ SIM_MANAGER_INTERFACE,
+ "MNCLength", DBUS_TYPE_BYTE,
+ &sim->mnc_length);
+ }
+}
+
static void sim_own_numbers_update(struct ofono_modem *modem)
{
ofono_sim_read(modem, SIM_EFMSISDN_FILEID,
sim_msisdn_read_cb, modem->sim_manager);
}
+static void sim_mnc_length_update(struct ofono_modem *modem)
+{
+ ofono_sim_read(modem, SIM_EFAD_FILEID,
+ sim_ad_read_cb, modem->sim_manager);
+}
+
static void sim_ready(struct ofono_modem *modem)
{
sim_own_numbers_update(modem);
+ sim_mnc_length_update(modem);
}
static void sim_imsi_cb(const struct ofono_error *error, const char *imsi,
diff --git a/src/simutil.h b/src/simutil.h
index c0d3d52..9bb5323 100644
--- a/src/simutil.h
+++ b/src/simutil.h
@@ -22,6 +22,7 @@
enum sim_fileid {
SIM_EFMSISDN_FILEID = 0x6f40,
SIM_EFSPN_FILEID = 0x6f46,
+ SIM_EFAD_FILEID = 0x6fad,
SIM_EFPNN_FILEID = 0x6fc5,
SIM_EFOPL_FILEID = 0x6fc6,
SIM_EFMBDN_FILEID = 0x6fc7,
--
1.6.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: Read EFad and expose MNC length in IMSI as a SimManager property.
2009-08-20 14:20 ` Andrzej Zaborowski
@ 2009-08-26 0:37 ` andrzej zaborowski
2009-08-31 20:16 ` Denis Kenzior
0 siblings, 1 reply; 5+ messages in thread
From: andrzej zaborowski @ 2009-08-26 0:37 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1159 bytes --]
Attaching an updated patch.
2009/8/20 Andrzej Zaborowski <andrew.zaborowski@intel.com>:
> 2009/8/20 Gu, Yang <yang.gu@intel.com>:
>> Several minor comments on this patch:
>> 1. How about unify all the mnc_length to be unsigned char?
>> 2. For this piece of code:
>>>+ value = new_mnc_length;
>>>+ ofono_dbus_signal_property_changed(conn, modem->path,
>>>+ SIM_MANAGER_INTERFACE,
>>>+ "MNCLength", DBUS_TYPE_BYTE,
>>>+ &value);
>> Is it necessary to use temporary variable value? Why not use &sim->mnc_length instead of &value?
>
> Necessary no, we can use unsigned char for sim->mnc_length --
> ofono_dbus_signal_property_changed requires unsigned char * -- it's
> just proper to use ints for integers. I changed it as you suggest
> nevertheless.
>
>>
>> 3. In function sim_ad_read_cb(), variable "ph" is defined by not used.
>
> Thanks for noticing, removed in the attachment.
Regards
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Read-EFad-and-expose-MNC-length-in-IMSI-as-a-SimMana.patch --]
[-- Type: text/x-patch, Size: 2754 bytes --]
From a7743edeb4b0644a19076238e2de329e3a3d9cdb Mon Sep 17 00:00:00 2001
From: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Date: Wed, 26 Aug 2009 02:36:45 +0200
Subject: [PATCH] Read EFad and expose MNC length in IMSI as a SimManager property.
Alternatively we could expose the MNC as a separate property.
---
src/sim.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
src/simutil.h | 1 +
2 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/src/sim.c b/src/sim.c
index 3309c98..f76d4ed 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -76,6 +76,7 @@ struct sim_file_op {
struct ofono_sim {
char *imsi;
+ unsigned char mnc_length;
GSList *own_numbers;
GSList *new_numbers;
gboolean ready;
@@ -154,6 +155,10 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
ofono_dbus_dict_append(&dict, "SubscriberIdentity",
DBUS_TYPE_STRING, &sim->imsi);
+ if (sim->mnc_length)
+ ofono_dbus_dict_append(&dict, "MNCLength",
+ DBUS_TYPE_BYTE, &sim->mnc_length);
+
own_numbers = get_own_numbers(sim->own_numbers);
ofono_dbus_dict_append_array(&dict, "SubscriberNumbers",
@@ -406,17 +411,56 @@ check:
sim->new_numbers = NULL;
}
+static void sim_ad_read_cb(int ok,
+ enum ofono_sim_file_structure structure,
+ int length, int record,
+ const unsigned char *data,
+ int record_length, void *userdata)
+{
+ struct ofono_sim *sim = userdata;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(sim->atom);
+ int new_mnc_length;
+
+ if (!ok)
+ return;
+
+ if (structure != OFONO_SIM_FILE_STRUCTURE_TRANSPARENT)
+ return;
+
+ if (length < 4)
+ return;
+
+ new_mnc_length = data[3] & 0xf;
+
+ if (sim->mnc_length != new_mnc_length) {
+ sim->mnc_length = new_mnc_length;
+
+ ofono_dbus_signal_property_changed(conn, path,
+ SIM_MANAGER_INTERFACE,
+ "MNCLength", DBUS_TYPE_BYTE,
+ &sim->mnc_length);
+ }
+}
+
static void sim_own_numbers_update(struct ofono_sim *sim)
{
ofono_sim_read(sim, SIM_EFMSISDN_FILEID,
sim_msisdn_read_cb, sim);
}
+static void sim_mnc_length_update(struct ofono_sim *sim)
+{
+ ofono_sim_read(sim, SIM_EFAD_FILEID,
+ sim_ad_read_cb, sim);
+}
+
static void sim_ready(void *user)
{
struct ofono_sim *sim = user;
sim_own_numbers_update(sim);
+ sim_mnc_length_update(sim);
}
static void sim_imsi_cb(const struct ofono_error *error, const char *imsi,
diff --git a/src/simutil.h b/src/simutil.h
index c0d3d52..9bb5323 100644
--- a/src/simutil.h
+++ b/src/simutil.h
@@ -22,6 +22,7 @@
enum sim_fileid {
SIM_EFMSISDN_FILEID = 0x6f40,
SIM_EFSPN_FILEID = 0x6f46,
+ SIM_EFAD_FILEID = 0x6fad,
SIM_EFPNN_FILEID = 0x6fc5,
SIM_EFOPL_FILEID = 0x6fc6,
SIM_EFMBDN_FILEID = 0x6fc7,
--
1.6.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-08-31 20:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-19 16:00 Read EFad and expose MNC length in IMSI as a SimManager property Andrzej Zaborowski
2009-08-20 2:09 ` Gu, Yang
2009-08-20 14:20 ` Andrzej Zaborowski
2009-08-26 0:37 ` andrzej zaborowski
2009-08-31 20:16 ` Denis Kenzior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox