* [PATCH v2 0/4] Support for emergency number list from network/modem
@ 2011-03-28 13:58 Jeevaka Badrappan
2011-03-28 13:58 ` [PATCH v2 1/4] include: Add ofono_voicecall_en_list_notify api Jeevaka Badrappan
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Jeevaka Badrappan @ 2011-03-28 13:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]
Hi,
Following set of patch adds the emergency number list update from
the network/modem. Upon emergency number list update from modem, ofono
core will be updated which will result in dbus property change signal
as well. With this patch, even if the emergency number list maintained
in ofono matches with the received emergency number list from modem,
dbus property change will be signalled. If this should be avoided,
then it needs to be decided whether the check should be added in core
or for each modem.
Regards,
Jeevaka
Jeevaka Badrappan (4):
include: Add ofono_voicecall_en_list_notify api
voicecall: refactor emergency number list handling
voicecall: network emergency number list support
ifxmodem: emergency number list support
drivers/ifxmodem/voicecall.c | 98 ++++++++++++++++++++++++++++++++++++++++++
include/voicecall.h | 3 +
src/voicecall.c | 45 ++++++++++++++++---
3 files changed, 138 insertions(+), 8 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/4] include: Add ofono_voicecall_en_list_notify api
2011-03-28 13:58 [PATCH v2 0/4] Support for emergency number list from network/modem Jeevaka Badrappan
@ 2011-03-28 13:58 ` Jeevaka Badrappan
2011-03-30 3:03 ` Denis Kenzior
2011-03-28 13:58 ` [PATCH v2 2/4] voicecall: refactor emergency number list handling Jeevaka Badrappan
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Jeevaka Badrappan @ 2011-03-28 13:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 617 bytes --]
---
include/voicecall.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/include/voicecall.h b/include/voicecall.h
index 5e6da02..477b226 100644
--- a/include/voicecall.h
+++ b/include/voicecall.h
@@ -140,6 +140,9 @@ struct ofono_voicecall_driver {
ofono_voicecall_cb_t cb, void *data);
};
+void ofono_voicecall_en_list_notify(struct ofono_voicecall *vc,
+ GSList *nw_en_list);
+
void ofono_voicecall_notify(struct ofono_voicecall *vc,
const struct ofono_call *call);
void ofono_voicecall_disconnected(struct ofono_voicecall *vc, int id,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/4] voicecall: refactor emergency number list handling
2011-03-28 13:58 [PATCH v2 0/4] Support for emergency number list from network/modem Jeevaka Badrappan
2011-03-28 13:58 ` [PATCH v2 1/4] include: Add ofono_voicecall_en_list_notify api Jeevaka Badrappan
@ 2011-03-28 13:58 ` Jeevaka Badrappan
2011-03-30 3:06 ` Denis Kenzior
2011-03-28 13:58 ` [PATCH v2 3/4] voicecall: network emergency number list support Jeevaka Badrappan
2011-03-28 13:58 ` [PATCH v2 4/4] ifxmodem: " Jeevaka Badrappan
3 siblings, 1 reply; 10+ messages in thread
From: Jeevaka Badrappan @ 2011-03-28 13:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3214 bytes --]
---
src/voicecall.c | 32 ++++++++++++++++++++++++--------
1 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index b1d5586..826e10c 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -47,7 +47,8 @@ struct ofono_voicecall {
GSList *release_list;
GSList *multiparty_list;
GSList *en_list; /* emergency number list */
- GSList *new_en_list; /* Emergency numbers being read from SIM */
+ GSList *sim_en_list; /* Emergency numbers being read from SIM */
+ GSList *new_en_list; /* Emergency numbers from modem/network/no SIM*/
DBusMessage *pending;
struct ofono_sim *sim;
struct ofono_sim_context *sim_context;
@@ -2071,6 +2072,7 @@ static void emit_en_list_changed(struct ofono_voicecall *vc)
static void set_new_ecc(struct ofono_voicecall *vc)
{
int i = 0;
+ GSList *l;
g_slist_foreach(vc->en_list, (GFunc) g_free, NULL);
g_slist_free(vc->en_list);
@@ -2079,6 +2081,12 @@ static void set_new_ecc(struct ofono_voicecall *vc)
vc->en_list = vc->new_en_list;
vc->new_en_list = NULL;
+ for (l = vc->sim_en_list; l; l = l->next) {
+ if (!g_slist_find_custom(vc->en_list, l->data, number_compare))
+ vc->en_list = g_slist_prepend(vc->en_list,
+ g_strdup(l->data));
+ }
+
while (default_en_list[i]) {
GSList *l;
@@ -2120,10 +2128,11 @@ static void ecc_g2_read_cb(int ok, int total_length, int record,
data += 3;
if (en[0] != '\0')
- vc->new_en_list = g_slist_prepend(vc->new_en_list,
+ vc->sim_en_list = g_slist_prepend(vc->sim_en_list,
g_strdup(en));
}
+ vc->sim_en_list = g_slist_reverse(vc->sim_en_list);
set_new_ecc(vc);
}
@@ -2149,16 +2158,17 @@ static void ecc_g3_read_cb(int ok, int total_length, int record,
extract_bcd_number(data, 3, en);
if (en[0] != '\0')
- vc->new_en_list = g_slist_prepend(vc->new_en_list,
+ vc->sim_en_list = g_slist_prepend(vc->sim_en_list,
g_strdup(en));
if (record != total)
return;
check:
- if (!ok && vc->new_en_list == NULL)
+ if (!ok && vc->sim_en_list == NULL)
return;
+ vc->sim_en_list = g_slist_reverse(vc->sim_en_list);
set_new_ecc(vc);
}
@@ -2231,6 +2241,12 @@ static void voicecall_remove(struct ofono_atom *atom)
vc->new_en_list = NULL;
}
+ if (vc->sim_en_list) {
+ g_slist_foreach(vc->sim_en_list, (GFunc) g_free, NULL);
+ g_slist_free(vc->sim_en_list);
+ vc->sim_en_list = NULL;
+ }
+
if (vc->sim_state_watch) {
ofono_sim_remove_state_watch(vc->sim, vc->sim_state_watch);
vc->sim_state_watch = 0;
@@ -2330,10 +2346,10 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)
* Free the currently being read EN list, just in case the
* SIM is removed when we're still reading them
*/
- if (vc->new_en_list) {
- g_slist_foreach(vc->new_en_list, (GFunc) g_free, NULL);
- g_slist_free(vc->new_en_list);
- vc->new_en_list = NULL;
+ if (vc->sim_en_list) {
+ g_slist_foreach(vc->sim_en_list, (GFunc) g_free, NULL);
+ g_slist_free(vc->sim_en_list);
+ vc->sim_en_list = NULL;
}
add_to_en_list(&vc->new_en_list, default_en_list_no_sim);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/4] voicecall: network emergency number list support
2011-03-28 13:58 [PATCH v2 0/4] Support for emergency number list from network/modem Jeevaka Badrappan
2011-03-28 13:58 ` [PATCH v2 1/4] include: Add ofono_voicecall_en_list_notify api Jeevaka Badrappan
2011-03-28 13:58 ` [PATCH v2 2/4] voicecall: refactor emergency number list handling Jeevaka Badrappan
@ 2011-03-28 13:58 ` Jeevaka Badrappan
2011-03-28 13:58 ` [PATCH v2 4/4] ifxmodem: " Jeevaka Badrappan
3 siblings, 0 replies; 10+ messages in thread
From: Jeevaka Badrappan @ 2011-03-28 13:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 748 bytes --]
---
src/voicecall.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index 826e10c..e3b1135 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2172,6 +2172,19 @@ check:
set_new_ecc(vc);
}
+void ofono_voicecall_en_list_notify(struct ofono_voicecall *vc,
+ GSList *new_en_list)
+{
+ GSList *l;
+
+ for (l = new_en_list; l; l = l->next)
+ vc->new_en_list = g_slist_prepend(vc->new_en_list,
+ g_strdup(l->data));
+
+ vc->new_en_list = g_slist_reverse(vc->new_en_list);
+ set_new_ecc(vc);
+}
+
int ofono_voicecall_driver_register(const struct ofono_voicecall_driver *d)
{
DBG("driver: %p, name: %s", d, d->name);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 4/4] ifxmodem: emergency number list support
2011-03-28 13:58 [PATCH v2 0/4] Support for emergency number list from network/modem Jeevaka Badrappan
` (2 preceding siblings ...)
2011-03-28 13:58 ` [PATCH v2 3/4] voicecall: network emergency number list support Jeevaka Badrappan
@ 2011-03-28 13:58 ` Jeevaka Badrappan
2011-03-30 3:17 ` Denis Kenzior
3 siblings, 1 reply; 10+ messages in thread
From: Jeevaka Badrappan @ 2011-03-28 13:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3862 bytes --]
---
drivers/ifxmodem/voicecall.c | 98 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 98 insertions(+), 0 deletions(-)
diff --git a/drivers/ifxmodem/voicecall.c b/drivers/ifxmodem/voicecall.c
index 87a48e6..a92ac11 100644
--- a/drivers/ifxmodem/voicecall.c
+++ b/drivers/ifxmodem/voicecall.c
@@ -42,11 +42,13 @@
#include "ifxmodem.h"
static const char *none_prefix[] = { NULL };
+static const char *xlema_prefix[] = { "+XLEMA:", NULL };
struct voicecall_data {
GSList *calls;
unsigned int local_release;
GAtChat *chat;
+ GSList *en_list;
};
struct release_id_req {
@@ -786,6 +788,95 @@ static void xcolp_notify(GAtResult *result, gpointer user_data)
ofono_voicecall_notify(vc, call);
}
+static gint number_compare(gconstpointer a, gconstpointer b)
+{
+ const char *s1 = a, *s2 = b;
+ return strcmp(s1, s2);
+}
+
+static void xlema_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_voicecall *vc = user_data;
+ struct voicecall_data *vd = ofono_voicecall_get_data(vc);
+ GAtResultIter iter;
+ int index, total_cnt;
+ const char *number;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+XLEMA:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &index))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &total_cnt))
+ return;
+
+ if (!g_at_result_iter_next_string(&iter, &number))
+ return;
+
+ // Skip the category, EN valid with simpresence and mcc fields
+
+ if (!g_slist_find_custom(vd->en_list, number, number_compare))
+ vd->en_list = g_slist_prepend(vd->en_list, g_strdup(number));
+
+ if (index != total_cnt)
+ return;
+
+ vd->en_list = g_slist_reverse(vd->en_list);
+
+ ofono_voicecall_en_list_notify(vc, vd->en_list);
+
+ g_slist_foreach(vd->en_list, (GFunc) g_free, NULL);
+ g_slist_free(vd->en_list);
+ vd->en_list = NULL;
+}
+
+static void xlema_read(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_voicecall *vc = user_data;
+ struct voicecall_data *vd = ofono_voicecall_get_data(vc);
+ GAtResultIter iter;
+ int index, total_cnt;
+ const char *number;
+
+ if (!ok) {
+ DBG("Emergency number list read failed");
+ return;
+ }
+
+ g_at_result_iter_init(&iter, result);
+
+ while (g_at_result_iter_next(&iter, "+XLEMA:")) {
+ if (!g_at_result_iter_next_number(&iter, &index))
+ continue;
+
+ if (!g_at_result_iter_next_number(&iter, &total_cnt))
+ continue;
+
+ if (!g_at_result_iter_next_string(&iter, &number))
+ continue;
+
+ // Skip the category, EN valid with simpresence and mcc fields
+ g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_skip_next(&iter);
+
+ if (!g_slist_find_custom(vd->en_list, number, number_compare))
+ vd->en_list = g_slist_prepend(vd->en_list,
+ g_strdup(number));
+ }
+
+ vd->en_list = g_slist_reverse(vd->en_list);
+
+ ofono_voicecall_en_list_notify(vc, vd->en_list);
+
+ g_slist_foreach(vd->en_list, (GFunc) g_free, NULL);
+ g_slist_free(vd->en_list);
+ vd->en_list = NULL;
+}
+
static void ifx_voicecall_initialized(gboolean ok, GAtResult *result,
gpointer user_data)
{
@@ -803,7 +894,14 @@ static void ifx_voicecall_initialized(gboolean ok, GAtResult *result,
FALSE, vc, NULL);
g_at_chat_register(vd->chat, "+XCOLP:", xcolp_notify, FALSE, vc, NULL);
+ g_at_chat_register(vd->chat, "+XLEMA:", xlema_notify, FALSE, vc, NULL);
+ /* Enable emergency number list notification */
+ g_at_chat_send(vd->chat, "AT+XLEMA=1", none_prefix, NULL, NULL, NULL);
+
ofono_voicecall_register(vc);
+
+ g_at_chat_send(vd->chat, "AT+XLEMA?", xlema_prefix, xlema_read, vc,
+ NULL);
}
static int ifx_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/4] include: Add ofono_voicecall_en_list_notify api
2011-03-28 13:58 ` [PATCH v2 1/4] include: Add ofono_voicecall_en_list_notify api Jeevaka Badrappan
@ 2011-03-30 3:03 ` Denis Kenzior
0 siblings, 0 replies; 10+ messages in thread
From: Denis Kenzior @ 2011-03-30 3:03 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 938 bytes --]
Hi Jeevaka,
On 03/28/2011 08:58 AM, Jeevaka Badrappan wrote:
> ---
> include/voicecall.h | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/include/voicecall.h b/include/voicecall.h
> index 5e6da02..477b226 100644
> --- a/include/voicecall.h
> +++ b/include/voicecall.h
> @@ -140,6 +140,9 @@ struct ofono_voicecall_driver {
> ofono_voicecall_cb_t cb, void *data);
> };
>
> +void ofono_voicecall_en_list_notify(struct ofono_voicecall *vc,
> + GSList *nw_en_list);
> +
We have a long-standing rule not to introduce G* types into the oFono
public API. For lists, please use an array of strings for this. Refer
to e.g. ofono_netreg_operator_list_cb_t or similar for an example.
> void ofono_voicecall_notify(struct ofono_voicecall *vc,
> const struct ofono_call *call);
> void ofono_voicecall_disconnected(struct ofono_voicecall *vc, int id,
Regards,
-Denis
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/4] voicecall: refactor emergency number list handling
2011-03-28 13:58 ` [PATCH v2 2/4] voicecall: refactor emergency number list handling Jeevaka Badrappan
@ 2011-03-30 3:06 ` Denis Kenzior
2011-03-30 13:33 ` Jeevaka.Badrappan
0 siblings, 1 reply; 10+ messages in thread
From: Denis Kenzior @ 2011-03-30 3:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3632 bytes --]
Hi Jeevaka,
On 03/28/2011 08:58 AM, Jeevaka Badrappan wrote:
> ---
> src/voicecall.c | 32 ++++++++++++++++++++++++--------
> 1 files changed, 24 insertions(+), 8 deletions(-)
>
> diff --git a/src/voicecall.c b/src/voicecall.c
> index b1d5586..826e10c 100644
> --- a/src/voicecall.c
> +++ b/src/voicecall.c
> @@ -47,7 +47,8 @@ struct ofono_voicecall {
> GSList *release_list;
> GSList *multiparty_list;
> GSList *en_list; /* emergency number list */
> - GSList *new_en_list; /* Emergency numbers being read from SIM */
> + GSList *sim_en_list; /* Emergency numbers being read from SIM */
> + GSList *new_en_list; /* Emergency numbers from modem/network/no SIM*/
> DBusMessage *pending;
> struct ofono_sim *sim;
> struct ofono_sim_context *sim_context;
> @@ -2071,6 +2072,7 @@ static void emit_en_list_changed(struct ofono_voicecall *vc)
> static void set_new_ecc(struct ofono_voicecall *vc)
> {
> int i = 0;
> + GSList *l;
>
> g_slist_foreach(vc->en_list, (GFunc) g_free, NULL);
> g_slist_free(vc->en_list);
> @@ -2079,6 +2081,12 @@ static void set_new_ecc(struct ofono_voicecall *vc)
> vc->en_list = vc->new_en_list;
> vc->new_en_list = NULL;
>
> + for (l = vc->sim_en_list; l; l = l->next) {
> + if (!g_slist_find_custom(vc->en_list, l->data, number_compare))
> + vc->en_list = g_slist_prepend(vc->en_list,
> + g_strdup(l->data));
> + }
> +
> while (default_en_list[i]) {
> GSList *l;
>
> @@ -2120,10 +2128,11 @@ static void ecc_g2_read_cb(int ok, int total_length, int record,
> data += 3;
>
> if (en[0] != '\0')
> - vc->new_en_list = g_slist_prepend(vc->new_en_list,
> + vc->sim_en_list = g_slist_prepend(vc->sim_en_list,
> g_strdup(en));
To preserve the old behavior, can we also check that the number is not
on the default_en_list?
> }
>
> + vc->sim_en_list = g_slist_reverse(vc->sim_en_list);
> set_new_ecc(vc);
> }
>
> @@ -2149,16 +2158,17 @@ static void ecc_g3_read_cb(int ok, int total_length, int record,
> extract_bcd_number(data, 3, en);
>
> if (en[0] != '\0')
> - vc->new_en_list = g_slist_prepend(vc->new_en_list,
> + vc->sim_en_list = g_slist_prepend(vc->sim_en_list,
> g_strdup(en));
Same comment here
>
> if (record != total)
> return;
>
> check:
> - if (!ok && vc->new_en_list == NULL)
> + if (!ok && vc->sim_en_list == NULL)
> return;
>
> + vc->sim_en_list = g_slist_reverse(vc->sim_en_list);
> set_new_ecc(vc);
> }
>
> @@ -2231,6 +2241,12 @@ static void voicecall_remove(struct ofono_atom *atom)
> vc->new_en_list = NULL;
> }
>
> + if (vc->sim_en_list) {
> + g_slist_foreach(vc->sim_en_list, (GFunc) g_free, NULL);
> + g_slist_free(vc->sim_en_list);
> + vc->sim_en_list = NULL;
> + }
> +
> if (vc->sim_state_watch) {
> ofono_sim_remove_state_watch(vc->sim, vc->sim_state_watch);
> vc->sim_state_watch = 0;
> @@ -2330,10 +2346,10 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)
> * Free the currently being read EN list, just in case the
> * SIM is removed when we're still reading them
> */
> - if (vc->new_en_list) {
> - g_slist_foreach(vc->new_en_list, (GFunc) g_free, NULL);
> - g_slist_free(vc->new_en_list);
> - vc->new_en_list = NULL;
> + if (vc->sim_en_list) {
> + g_slist_foreach(vc->sim_en_list, (GFunc) g_free, NULL);
> + g_slist_free(vc->sim_en_list);
> + vc->sim_en_list = NULL;
> }
>
> add_to_en_list(&vc->new_en_list, default_en_list_no_sim);
Otherwise looks good.
Regards,
-Denis
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 4/4] ifxmodem: emergency number list support
2011-03-28 13:58 ` [PATCH v2 4/4] ifxmodem: " Jeevaka Badrappan
@ 2011-03-30 3:17 ` Denis Kenzior
0 siblings, 0 replies; 10+ messages in thread
From: Denis Kenzior @ 2011-03-30 3:17 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4499 bytes --]
Hi Jeevaka,
On 03/28/2011 08:58 AM, Jeevaka Badrappan wrote:
> ---
> drivers/ifxmodem/voicecall.c | 98 ++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 98 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/ifxmodem/voicecall.c b/drivers/ifxmodem/voicecall.c
> index 87a48e6..a92ac11 100644
> --- a/drivers/ifxmodem/voicecall.c
> +++ b/drivers/ifxmodem/voicecall.c
> @@ -42,11 +42,13 @@
> #include "ifxmodem.h"
>
> static const char *none_prefix[] = { NULL };
> +static const char *xlema_prefix[] = { "+XLEMA:", NULL };
>
> struct voicecall_data {
> GSList *calls;
> unsigned int local_release;
> GAtChat *chat;
> + GSList *en_list;
> };
>
> struct release_id_req {
> @@ -786,6 +788,95 @@ static void xcolp_notify(GAtResult *result, gpointer user_data)
> ofono_voicecall_notify(vc, call);
> }
>
> +static gint number_compare(gconstpointer a, gconstpointer b)
> +{
> + const char *s1 = a, *s2 = b;
> + return strcmp(s1, s2);
> +}
> +
> +static void xlema_notify(GAtResult *result, gpointer user_data)
> +{
> + struct ofono_voicecall *vc = user_data;
> + struct voicecall_data *vd = ofono_voicecall_get_data(vc);
> + GAtResultIter iter;
> + int index, total_cnt;
> + const char *number;
> +
> + g_at_result_iter_init(&iter, result);
> +
> + if (!g_at_result_iter_next(&iter, "+XLEMA:"))
> + return;
> +
> + if (!g_at_result_iter_next_number(&iter, &index))
> + return;
> +
> + if (!g_at_result_iter_next_number(&iter, &total_cnt))
> + return;
> +
> + if (!g_at_result_iter_next_string(&iter, &number))
> + return;
> +
> + // Skip the category, EN valid with simpresence and mcc fields
Just a nitpick, but can you please use C-style comments ;)
> +
> + if (!g_slist_find_custom(vd->en_list, number, number_compare))
> + vd->en_list = g_slist_prepend(vd->en_list, g_strdup(number));
> +
Does this duplicate detection belong in the core? It might be more
efficient to bite the bullet and use something like a GHashtable to
build the final list of ECCs.
> + if (index != total_cnt)
> + return;
> +
> + vd->en_list = g_slist_reverse(vd->en_list);
> +
> + ofono_voicecall_en_list_notify(vc, vd->en_list);
> +
> + g_slist_foreach(vd->en_list, (GFunc) g_free, NULL);
> + g_slist_free(vd->en_list);
> + vd->en_list = NULL;
> +}
> +
> +static void xlema_read(gboolean ok, GAtResult *result, gpointer user_data)
> +{
> + struct ofono_voicecall *vc = user_data;
> + struct voicecall_data *vd = ofono_voicecall_get_data(vc);
> + GAtResultIter iter;
> + int index, total_cnt;
> + const char *number;
> +
> + if (!ok) {
> + DBG("Emergency number list read failed");
> + return;
> + }
> +
> + g_at_result_iter_init(&iter, result);
> +
> + while (g_at_result_iter_next(&iter, "+XLEMA:")) {
> + if (!g_at_result_iter_next_number(&iter, &index))
> + continue;
> +
> + if (!g_at_result_iter_next_number(&iter, &total_cnt))
> + continue;
> +
> + if (!g_at_result_iter_next_string(&iter, &number))
> + continue;
> +
> + // Skip the category, EN valid with simpresence and mcc fields
Again about c-style comments
> + g_at_result_iter_skip_next(&iter);
> + g_at_result_iter_skip_next(&iter);
> + g_at_result_iter_skip_next(&iter);
> +
> + if (!g_slist_find_custom(vd->en_list, number, number_compare))
> + vd->en_list = g_slist_prepend(vd->en_list,
> + g_strdup(number));
> + }
> +
> + vd->en_list = g_slist_reverse(vd->en_list);
> +
> + ofono_voicecall_en_list_notify(vc, vd->en_list);
> +
> + g_slist_foreach(vd->en_list, (GFunc) g_free, NULL);
> + g_slist_free(vd->en_list);
> + vd->en_list = NULL;
> +}
> +
> static void ifx_voicecall_initialized(gboolean ok, GAtResult *result,
> gpointer user_data)
> {
> @@ -803,7 +894,14 @@ static void ifx_voicecall_initialized(gboolean ok, GAtResult *result,
> FALSE, vc, NULL);
> g_at_chat_register(vd->chat, "+XCOLP:", xcolp_notify, FALSE, vc, NULL);
>
> + g_at_chat_register(vd->chat, "+XLEMA:", xlema_notify, FALSE, vc, NULL);
An empty line here please
> + /* Enable emergency number list notification */
> + g_at_chat_send(vd->chat, "AT+XLEMA=1", none_prefix, NULL, NULL, NULL);
> +
> ofono_voicecall_register(vc);
> +
> + g_at_chat_send(vd->chat, "AT+XLEMA?", xlema_prefix, xlema_read, vc,
> + NULL);
> }
>
> static int ifx_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
Regards,
-Denis
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v2 2/4] voicecall: refactor emergency number list handling
2011-03-30 3:06 ` Denis Kenzior
@ 2011-03-30 13:33 ` Jeevaka.Badrappan
2011-03-30 15:41 ` Denis Kenzior
0 siblings, 1 reply; 10+ messages in thread
From: Jeevaka.Badrappan @ 2011-03-30 13:33 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]
Hi Denis,
Denis Kenzior wrote:
> Hi Jeevaka,
>
>> void emit_en_list_changed(struct ofono_voicecall *vc) static void
>> set_new_ecc(struct ofono_voicecall *vc) {
>> int i = 0;
>> + GSList *l;
>>
>> g_slist_foreach(vc->en_list, (GFunc) g_free, NULL);
>> g_slist_free(vc->en_list); @@ -2079,6 +2081,12 @@ static void
>> set_new_ecc(struct ofono_voicecall *vc) vc->en_list =
>> vc->new_en_list; vc->new_en_list = NULL;
>>
>> + for (l = vc->sim_en_list; l; l = l->next) {
>> + if (!g_slist_find_custom(vc->en_list, l->data,
number_compare))
>> + vc->en_list = g_slist_prepend(vc->en_list,
>> +
> g_strdup(l->data));
>> + }
>> +
>> while (default_en_list[i]) {
>> GSList *l;
>>
>> @@ -2120,10 +2128,11 @@ static void ecc_g2_read_cb(int ok, int
>> total_length, int record, data += 3;
>>
>> if (en[0] != '\0')
>> - vc->new_en_list =
> g_slist_prepend(vc->new_en_list,
>> + vc->sim_en_list =
> g_slist_prepend(vc->sim_en_list,
>>
> g_strdup(en));
>
> To preserve the old behavior, can we also check that the
> number is not on the default_en_list?
SIM ecc number check with default_en_list is already taken care inside
set_new_ecc function.
Regards,
Jeevaka
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/4] voicecall: refactor emergency number list handling
2011-03-30 13:33 ` Jeevaka.Badrappan
@ 2011-03-30 15:41 ` Denis Kenzior
0 siblings, 0 replies; 10+ messages in thread
From: Denis Kenzior @ 2011-03-30 15:41 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1625 bytes --]
Hi Jeevaka,
On 03/30/2011 08:33 AM, Jeevaka.Badrappan(a)elektrobit.com wrote:
> Hi Denis,
>
> Denis Kenzior wrote:
>> Hi Jeevaka,
>>
>>> void emit_en_list_changed(struct ofono_voicecall *vc) static void
>>> set_new_ecc(struct ofono_voicecall *vc) {
>>> int i = 0;
>>> + GSList *l;
>>>
>>> g_slist_foreach(vc->en_list, (GFunc) g_free, NULL);
>>> g_slist_free(vc->en_list); @@ -2079,6 +2081,12 @@ static void
>>> set_new_ecc(struct ofono_voicecall *vc) vc->en_list =
>>> vc->new_en_list; vc->new_en_list = NULL;
>>>
>>> + for (l = vc->sim_en_list; l; l = l->next) {
>>> + if (!g_slist_find_custom(vc->en_list, l->data,
> number_compare))
>>> + vc->en_list = g_slist_prepend(vc->en_list,
>>> +
>> g_strdup(l->data));
>>> + }
>>> +
>>> while (default_en_list[i]) {
>>> GSList *l;
>>>
>>> @@ -2120,10 +2128,11 @@ static void ecc_g2_read_cb(int ok, int
>>> total_length, int record, data += 3;
>>>
>>> if (en[0] != '\0')
>>> - vc->new_en_list =
>> g_slist_prepend(vc->new_en_list,
>>> + vc->sim_en_list =
>> g_slist_prepend(vc->sim_en_list,
>>>
>> g_strdup(en));
>>
>> To preserve the old behavior, can we also check that the
>> number is not on the default_en_list?
>
> SIM ecc number check with default_en_list is already taken care inside
> set_new_ecc function.
>
Thinking some more about it, yes you're absolutely right that it works
out in the end.
It might still be a good idea to use a Hashtable to fake a Set (e.g.
uniqueness) behavior of ECCs. That would make the driver
implementations a bit simpler as well.
Regards,
-Denis
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-03-30 15:41 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-28 13:58 [PATCH v2 0/4] Support for emergency number list from network/modem Jeevaka Badrappan
2011-03-28 13:58 ` [PATCH v2 1/4] include: Add ofono_voicecall_en_list_notify api Jeevaka Badrappan
2011-03-30 3:03 ` Denis Kenzior
2011-03-28 13:58 ` [PATCH v2 2/4] voicecall: refactor emergency number list handling Jeevaka Badrappan
2011-03-30 3:06 ` Denis Kenzior
2011-03-30 13:33 ` Jeevaka.Badrappan
2011-03-30 15:41 ` Denis Kenzior
2011-03-28 13:58 ` [PATCH v2 3/4] voicecall: network emergency number list support Jeevaka Badrappan
2011-03-28 13:58 ` [PATCH v2 4/4] ifxmodem: " Jeevaka Badrappan
2011-03-30 3:17 ` 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.