RE: [PATCH] TODO: Add vCard export to SM/ME stores

2010-11-15 Thread Kiviluoto, Jaakko J
   To support this feature then first we need to convert the current
   feature into returning a dict. And then have this feature using a
 dict
   as input.
 
  Is there already a specification/draft of the format of this dict? If
 not, I would be tempted to use the 27.007 +CPBR/W field names as keys
 (e.g. index, number, type, text, adnumber, secondtext, sip_uri, etc.)
 
 there is not. So you need to propose one here.

For simplicity, I would propose that both import and export would use an array 
of dict's with the 27.007 keys:

index: type=integer, import=always export=ignored
number: type=string, import=always/empty export=optional/empty
type: type=integer, import=always export=mandatory
text: type=string, import=always/empty export=optional/empty
hidden: type=int, import=always, export=optional/default=0
group: type=string, import=if nonempty, export=optional
adnumber: type=string, import=if nonempty, export=optional
adtype: type=integer, import/export=mandatory if adnumber nonempty
secondtext: type=string, import=if nonempty, export=optional
email: type=string, import=if nonempty, export=optional
sip_uri: type=string, import=if nonempty, export=optional
tel_uri: type=string, import=if nonempty, export=optional

Either 'text' or 'number' must be nonempty on export.

This simple scheme would also necessitate removing the contact merging from the 
import functionality. Would that be ok?

Otherwise the dict would have to contain a list of number structures instead of 
number/adnumber fields, and merging/unmerging would have to be (re)implemented 
for both import and export.

Jaakko

-
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [PATCH 0/4] Emergency Calls (3rd round)

2010-11-15 Thread Predon, Frederic
Hi Andras,

 Here is a new proposal for emergency calls handling.
 
 Steps in handling emergency calls:
 - subscribe to modem online notifications (add modem online watcher)
 - an emergency call detected (phone number is emergency number)
 - increment emergency mode
   - advertise EmergencyMode property change on D-Bus (first call)
   - set modem online if it's in offline mode (minimal setup)
 - adevertise Online property change on D-Bus
 - if modem is not online postpone making the call, otherwise make
   the emergency call
 - when modem online notification comes and there is postponed call
 request
   make the emergency call
 - when an emergency call ends decrement emergency mode
   - set modem offline if it was set online due to the emergency call
 (last call)
 - advertise Online property change on D-Bus
   - advertise EmergencyMode property change on D-Bus (last call)

Do you handle the case of making an emergency call when there is no SIM card?

Fred
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 0/5] Call Counters

2010-11-15 Thread Andras Domokos
Here a proposal for call counters implementation for keeping track
of the total incoming and outgoing call duration counters. Each
established call instance is contributing to either of the call
duration counters. The 2 counters are updated periodically when
there is an established call and the information is stored in
a file. The bookkeeping of the call duration counters are per IMSI
number.
The implementation makes use of the history framework which had to be
expanded with a function for marking the beginning of a voice call.
There is a D-Bus interface to call counters for reading and clearing
the counters.

Andras Domokos (5):
  history: expand history API include file
  history: expand history API
  voicecall: take into use the new history function
  voicecall: add call counters
  Makefile: add call counters to the build

 Makefile.am|3 +
 include/history.h  |3 +
 src/callcounters.c |  388 
 src/history.c  |   24 
 src/ofono.h|4 +
 src/voicecall.c|3 +
 6 files changed, 425 insertions(+), 0 deletions(-)
 create mode 100644 src/callcounters.c

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[RFC PATCH 2/5] history: expand history API

2010-11-15 Thread Andras Domokos
---
 src/history.c |   24 
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/history.c b/src/history.c
index 0229cf5..31efadb 100644
--- a/src/history.c
+++ b/src/history.c
@@ -114,6 +114,30 @@ void __ofono_history_probe_drivers(struct ofono_modem 
*modem)
}
 }
 
+static void history_call_started(struct ofono_atom *atom, void *data)
+{
+   struct ofono_history_context *context = __ofono_atom_get_data(atom);
+   struct history_call_foreach_data *hfd = data;
+
+   if (context-driver-call_started == NULL)
+   return;
+
+   context-driver-call_started(context, hfd-call, hfd-start);
+}
+
+void __ofono_history_call_started(struct ofono_modem *modem,
+   const struct ofono_call *call,
+   time_t start)
+{
+   struct history_call_foreach_data hfd;
+
+   hfd.call = call;
+   hfd.start = start;
+
+   __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_HISTORY,
+   history_call_started, hfd);
+}
+
 static void history_call_ended(struct ofono_atom *atom, void *data)
 {
struct ofono_history_context *context = __ofono_atom_get_data(atom);
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[RFC PATCH 1/5] history: expand history API include file

2010-11-15 Thread Andras Domokos
---
 include/history.h |3 +++
 src/ofono.h   |4 
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/history.h b/include/history.h
index c1c4aa1..a2490f6 100644
--- a/include/history.h
+++ b/include/history.h
@@ -49,6 +49,9 @@ struct ofono_history_driver {
const char *name;
int (*probe)(struct ofono_history_context *context);
void (*remove)(struct ofono_history_context *context);
+   void (*call_started)(struct ofono_history_context *context,
+   const struct ofono_call *call,
+   time_t start);
void (*call_ended)(struct ofono_history_context *context,
const struct ofono_call *call,
time_t start, time_t end);
diff --git a/src/ofono.h b/src/ofono.h
index 4d76d20..61a0637 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -368,6 +368,10 @@ void __ofono_netreg_set_base_station_name(struct 
ofono_netreg *netreg,
 
 void __ofono_history_probe_drivers(struct ofono_modem *modem);
 
+void __ofono_history_call_started(struct ofono_modem *modem,
+   const struct ofono_call *call,
+   time_t start);
+
 void __ofono_history_call_ended(struct ofono_modem *modem,
const struct ofono_call *call,
time_t start, time_t end);
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 0/4] Emergency Calls (3rd round)

2010-11-15 Thread Andras Domokos

Hi Frederic,

I found a small issue in these patches, resulting into improper handling 
of the emergency calls for the non-SIM cases, but now that has been 
fixed and I am going to create a new set of patches.


The answer to your question is yes, emergency calls will be also 
possible without a SIM card.


Andras

On 11/15/2010 12:45 PM, ext Predon, Frederic wrote:

Hi Andras,

   

Here is a new proposal for emergency calls handling.

Steps in handling emergency calls:
- subscribe to modem online notifications (add modem online watcher)
- an emergency call detected (phone number is emergency number)
- increment emergency mode
   - advertise EmergencyMode property change on D-Bus (first call)
   - set modem online if it's in offline mode (minimal setup)
 - adevertise Online property change on D-Bus
- if modem is not online postpone making the call, otherwise make
   the emergency call
- when modem online notification comes and there is postponed call
request
   make the emergency call
- when an emergency call ends decrement emergency mode
   - set modem offline if it was set online due to the emergency call
(last call)
 - advertise Online property change on D-Bus
   - advertise EmergencyMode property change on D-Bus (last call)
 

Do you handle the case of making an emergency call when there is no SIM card?

Fred
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono
   


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[RFC PATCH 4/4] voicecall: add emergency call handling

2010-11-15 Thread Andras Domokos
---
 src/voicecall.c |  111 ++-
 1 files changed, 110 insertions(+), 1 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 3af614b..066cdb9 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -52,6 +52,7 @@ struct ofono_voicecall {
struct ofono_sim *sim;
unsigned int sim_watch;
unsigned int sim_state_watch;
+   unsigned int modem_online_watch;
const struct ofono_voicecall_driver *driver;
void *driver_data;
struct ofono_atom *atom;
@@ -133,6 +134,22 @@ static void add_to_en_list(GSList **l, const char **list)
*l = g_slist_prepend(*l, g_strdup(list[i++]));
 }
 
+static gint number_compare(gconstpointer a, gconstpointer b)
+{
+   const char *s1 = a, *s2 = b;
+   return strcmp(s1, s2);
+}
+
+static ofono_bool_t emergency_number(struct ofono_voicecall *vc,
+   const char *number)
+{
+   if (!number)
+   return FALSE;
+
+   return g_slist_find_custom(vc-en_list,
+   number, number_compare) ? TRUE : FALSE;
+}
+
 static const char *disconnect_reason_to_string(enum ofono_disconnect_reason r)
 {
switch (r) {
@@ -1125,6 +1142,7 @@ static struct voicecall *dial_handle_result(struct 
ofono_voicecall *vc,
 static void manager_dial_callback(const struct ofono_error *error, void *data)
 {
struct ofono_voicecall *vc = data;
+   struct ofono_modem *modem = __ofono_atom_get_modem(vc-atom);
DBusMessage *reply;
const char *number;
gboolean need_to_emit;
@@ -1143,8 +1161,12 @@ static void manager_dial_callback(const struct 
ofono_error *error, void *data)
 
dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, path,
DBUS_TYPE_INVALID);
-   } else
+   } else {
+   if (emergency_number(vc, number))
+   ofono_modem_dec_emergency_mode(modem);
+
reply = __ofono_error_failed(vc-pending);
+   }
 
__ofono_dbus_pending_reply(vc-pending, reply);
 
@@ -1156,6 +1178,7 @@ static DBusMessage *manager_dial(DBusConnection *conn,
DBusMessage *msg, void *data)
 {
struct ofono_voicecall *vc = data;
+   struct ofono_modem *modem = __ofono_atom_get_modem(vc-atom);
const char *number;
struct ofono_phone_number ph;
const char *clirstr;
@@ -1195,6 +1218,15 @@ static DBusMessage *manager_dial(DBusConnection *conn,
 
string_to_phone_number(number, ph);
 
+   if (emergency_number(vc, number)) {
+   ofono_bool_t online = ofono_modem_get_online(modem);
+
+   ofono_modem_inc_emergency_mode(modem);
+
+   if (!online)
+   return NULL;
+   }
+
vc-driver-dial(vc, ph, clir, OFONO_CUG_OPTION_DEFAULT,
manager_dial_callback, vc);
 
@@ -1748,6 +1780,7 @@ void ofono_voicecall_disconnected(struct ofono_voicecall 
*vc, int id,
const struct ofono_error *error)
 {
struct ofono_modem *modem = __ofono_atom_get_modem(vc-atom);
+   const char *number;
GSList *l;
struct voicecall *call;
time_t ts;
@@ -1767,6 +1800,7 @@ void ofono_voicecall_disconnected(struct ofono_voicecall 
*vc, int id,
}
 
call = l-data;
+   number = phone_number_to_string(call-call-phone_number);
 
ts = time(NULL);
prev_status = call-call-status;
@@ -1805,6 +1839,9 @@ void ofono_voicecall_disconnected(struct ofono_voicecall 
*vc, int id,
 
voicecalls_emit_call_removed(vc, call);
 
+   if (emergency_number(vc, number))
+   ofono_modem_dec_emergency_mode(modem);
+
voicecall_dbus_unregister(vc, call);
 
vc-call_list = g_slist_remove(vc-call_list, call);
@@ -2067,6 +2104,7 @@ static void voicecall_unregister(struct ofono_atom *atom)
 static void voicecall_remove(struct ofono_atom *atom)
 {
struct ofono_voicecall *vc = __ofono_atom_get_data(atom);
+   struct ofono_modem *modem = __ofono_atom_get_modem(atom);
 
DBG(atom: %p, atom);
 
@@ -2108,6 +2146,12 @@ static void voicecall_remove(struct ofono_atom *atom)
g_queue_free(vc-toneq);
}
 
+   if (vc-modem_online_watch) {
+   __ofono_modem_remove_online_watch(modem,
+   vc-modem_online_watch);
+   vc-modem_online_watch = 0;
+   }
+
g_free(vc);
 }
 
@@ -2205,6 +2249,7 @@ static void sim_watch(struct ofono_atom *atom,
 static void dial_request_cb(const struct ofono_error *error, void *data)
 {
struct ofono_voicecall *vc = data;
+   struct ofono_modem *modem = __ofono_atom_get_modem(vc-atom);
gboolean need_to_emit;
struct voicecall *v;
 
@@ -2214,6 +2259,9 @@ static void 

[RFC PATCH 1/4] modem: add modem online-offline watch

2010-11-15 Thread Andras Domokos
From: Andras Domokos andras.domo...@nokia.com

---
 src/modem.c |   46 ++
 src/ofono.h |8 
 2 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/src/modem.c b/src/modem.c
index 3776461..f73cc1d 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -72,6 +72,7 @@ struct ofono_modem {
ofono_bool_tpowered_pending;
guint   timeout;
ofono_bool_tonline;
+   struct ofono_watchlist  *online_watches;
GHashTable  *properties;
struct ofono_sim*sim;
unsigned intsim_watch;
@@ -362,6 +363,22 @@ static void flush_atoms(struct ofono_modem *modem, enum 
modem_state new_state)
}
 }
 
+static void notify_online_watches(struct ofono_modem *modem)
+{
+   struct ofono_watchlist_item *item;
+   GSList *l;
+   ofono_modem_online_notify_func notify;
+
+   if (modem-online_watches == NULL)
+   return;
+
+   for (l = modem-online_watches-items; l; l = l-next) {
+   item = l-data;
+   notify = item-notify;
+   notify(modem-online, item-notify_data);
+   }
+}
+
 static void modem_change_state(struct ofono_modem *modem,
enum modem_state new_state)
 {
@@ -404,11 +421,13 @@ static void modem_change_state(struct ofono_modem *modem,
__ofono_history_probe_drivers(modem);
__ofono_nettime_probe_drivers(modem);
}
+   notify_online_watches(modem);
break;
 
case MODEM_STATE_ONLINE:
if (driver-post_online)
driver-post_online(modem);
+   notify_online_watches(modem);
break;
}
 }
@@ -437,6 +456,29 @@ static void sim_state_watch(enum ofono_sim_state 
new_state, void *user)
}
 }
 
+unsigned __ofono_modem_add_online_watch(struct ofono_modem *modem,
+   ofono_modem_online_notify_func notify,
+   void *data, ofono_destroy_func destroy)
+{
+   struct ofono_watchlist_item *item;
+
+   if (modem == NULL || notify == NULL)
+   return 0;
+
+   item = g_new0(struct ofono_watchlist_item, 1);
+
+   item-notify = notify;
+   item-destroy = destroy;
+   item-notify_data = data;
+
+   return __ofono_watchlist_add_item(modem-online_watches, item);
+}
+
+void __ofono_modem_remove_online_watch(struct ofono_modem *modem, unsigned id)
+{
+   __ofono_watchlist_remove_item(modem-online_watches, id);
+}
+
 static void online_cb(const struct ofono_error *error, void *data)
 {
struct ofono_modem *modem = data;
@@ -1472,6 +1514,7 @@ int ofono_modem_register(struct ofono_modem *modem)
modem-driver_type = NULL;
 
modem-atom_watches = __ofono_watchlist_new(g_free);
+   modem-online_watches = __ofono_watchlist_new(g_free);
 
emit_modem_added(modem);
call_modemwatches(modem, TRUE);
@@ -1503,6 +1546,9 @@ static void modem_unregister(struct ofono_modem *modem)
__ofono_watchlist_free(modem-atom_watches);
modem-atom_watches = NULL;
 
+   __ofono_watchlist_free(modem-online_watches);
+   modem-online_watches = NULL;
+
modem-sim_watch = 0;
modem-sim_ready_watch = 0;
 
diff --git a/src/ofono.h b/src/ofono.h
index ab6ecd2..01cd6c0 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -177,6 +177,14 @@ unsigned int __ofono_modemwatch_add(ofono_modemwatch_cb_t 
cb, void *user,
ofono_destroy_func destroy);
 gboolean __ofono_modemwatch_remove(unsigned int id);
 
+typedef void (*ofono_modem_online_notify_func)(ofono_bool_t online,
+   void *data);
+unsigned int __ofono_modem_add_online_watch(struct ofono_modem *modem,
+   ofono_modem_online_notify_func notify,
+   void *data, ofono_destroy_func destroy);
+void __ofono_modem_remove_online_watch(struct ofono_modem *modem,
+   unsigned int id);
+
 #include ofono/call-barring.h
 
 gboolean __ofono_call_barring_is_busy(struct ofono_call_barring *cb);
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [PATCH] TODO: Add vCard export to SM/ME stores

2010-11-15 Thread Bastian, Waldo
Marcel wrote:
  diff --git a/TODO b/TODO
  index bf2305b..9dcb43f 100644
  --- a/TODO
  +++ b/TODO
  @@ -496,3 +496,14 @@ Miscellaneous
   
 Priority: Low
 Complexity: C4
  +
  +- Enable exporting contact information from vCard data to SM and ME stores.
  +  Need to implement a robust vCard parser that can extract at least the
  +  fields supported by the existing phonebook module.  Functionality should
  +  be analoguous to existing import functionality.
 
 and you will not be able to write a robust vCard parser that we can
 safely run as root or with any kind of ofonod privileges. It is just way
 too risky from a security point of view.
 
 To support this feature then first we need to convert the current
 feature into returning a dict. And then have this feature using a dict
 as input.

Does this mean that support for writing to the phonebook is expected to
be added to the phonebook modem API as part of ofono core functionality?

Cheers,
Waldo

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 0/5] Call Counters

2010-11-15 Thread Marcel Holtmann
Hi Andras,

 Here a proposal for call counters implementation for keeping track
 of the total incoming and outgoing call duration counters. Each
 established call instance is contributing to either of the call
 duration counters. The 2 counters are updated periodically when
 there is an established call and the information is stored in
 a file. The bookkeeping of the call duration counters are per IMSI
 number.
 The implementation makes use of the history framework which had to be
 expanded with a function for marking the beginning of a voice call.
 There is a D-Bus interface to call counters for reading and clearing
 the counters.

and where is the API documentation for such a D-Bus interface?

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [RFC PATCH 5/5] Makefile: add call counters to the build

2010-11-15 Thread Marcel Holtmann
Hi Andras,

  Makefile.am |3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)
 
 diff --git a/Makefile.am b/Makefile.am
 index f841b4c..a1c6097 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -295,6 +295,9 @@ builtin_modules += example_nettime
  builtin_sources += examples/nettime.c
  endif
  
 +builtin_modules += cc
 +builtin_sources += src/callcounters.c
 +

what is this? Plugins do not belong under src/. That is reserved for
oFono core functionality only.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [PATCH] TODO: Add vCard export to SM/ME stores

2010-11-15 Thread Marcel Holtmann
Hi Waldo,

  To support this feature then first we need to convert the current
  feature into returning a dict. And then have this feature using a dict
  as input.
 
 Does this mean that support for writing to the phonebook is expected to
 be added to the phonebook modem API as part of ofono core functionality?

actually no. General writing of the SIM phonebook will not be supported.

However support for allowing to write an ENTIRE phonebook back to the
SIM card (export) might be added. The emphasis here is clearly on fully
replacing an existing SIM phonebook.

It is the complement of the import function to potentially deal with
Chinese type approval. It is not a functionality that should be
considered for general use. The SIM phonebook is still a pointless
concept these days. Any UI designer wanting to expose this in a moden
smartphone needs to go back to the drawing board.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 0/4] Emergency Calls (3rd round)

2010-11-15 Thread Marcel Holtmann
Hi Andras,

 I found a small issue in these patches, resulting into improper handling 
 of the emergency calls for the non-SIM cases, but now that has been 
 fixed and I am going to create a new set of patches.
 
 The answer to your question is yes, emergency calls will be also 
 possible without a SIM card.

please do NOT top post on this mailing list.

In the last two weeks, I had to mention this way to many times. This is
really not acceptable anymore :(

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono