Re: [PATCH] modem:Add powered watches on modem.

2011-02-09 Thread Denis Kenzior
Hi Guillaume,

On 01/31/2011 04:01 AM, Guillaume Zajac wrote:
> ---
>  src/modem.c |   47 +++
>  src/ofono.h |7 +++
>  2 files changed, 54 insertions(+), 0 deletions(-)
> 

Patch has been applied, but I did have to fix up some minor issues with
it in a follow-on commit.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [PATCH 5/7] cdmamodem: Add Signal Strength Support

2011-02-09 Thread Rajesh.Nagaiah

Hi Dara,

> -Original Message-
> From: Dara Spieker-Doyle [mailto:dara.spiekerdo...@gmail.com] 
> 
> Hi Rajesh
> 
> On 02/09/2011 02:58 PM, ext rajesh.naga...@elektrobit.com wrote:
> 
> > Hi Dara,
> >
> >> -Original Message-
> >> From: ofono-boun...@ofono.org
> >> [mailto:ofono-boun...@ofono.org] On Behalf Of Dara Spieker-Doyle
> >> Sent: 08 February 2011 13:05
> >> To: ofono@ofono.org
> >> Subject: [PATCH 5/7] cdmamodem: Add Signal Strength Support
> >>
> >
> >> +static gboolean cdma_get_next_number(const char *line, gint
> >> *number) {
> >> + int pos;
> >> + int end;
> >> + int len;
> >> + int value = 0;
> >> +
> >> + len = strlen(line);
> >> +
> >> + pos = 0;
> >> + end = pos;
> >> +
> >> + while (line[end]>= '0'&&  line[end]<= '9') {
> >> + value = value * 10 + (int)(line[end] - '0');
> >> + end += 1;
> >> + }
> >> +
> >> + if (pos == end)
> >> + return FALSE;
> >> +
> >> + pos = skip_to_next_field(line, end, len);
> >> +
> >> + if (number)
> >> + *number = value;
> >> +
> >> + return TRUE;
> >> +}
> >> +
> >
> > This is a duplicate of g_at_result_iter_next_number().
> > Why cant use this function instead of cdma_get_next_number() ?
> 
> This is different from g_at_result_iter_next_number() in that 
> it takes a raw response line to parse rather than the result 
> iterator. The AT syntax format of the response from this CDMA 
> device does not follow the GSM standard AT syntax format.
> 
> >
> >> +static void cdma_csq_cb(gboolean ok, GAtResult *result, gpointer
> >> +user_data) {
> >> + struct cb_data *cbd = user_data;
> >> + ofono_cdma_netreg_strength_cb_t cb = cbd->cb;
> >> + const char *prefix = cbd->user;
> >> + struct ofono_error error;
> >> + const char *attr;
> >> + int strength = -1;
> >> +
> >> + decode_at_error(&error, g_at_result_final_response(result));
> >> +
> >> + if (!ok) {
> >> + cb(&error, -1, cbd->data);
> >> + return;
> >> + }
> >> +
> >> + if (at_util_parse_attr(result, prefix,&attr) == FALSE) {
> >> + CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
> >> + return;
> >> + }
> >> +
> >> + cdma_get_next_number(attr,&strength);
> >> +
> >> + DBG("csq_cb: %d", strength);
> >> +
> >> + cb(&error, at_util_convert_signal_strength(strength),
> >> cbd->data); }
> >
> > Refer csq_cb() implementation in 
> > /drivers/atmodem/network-registration.c
> >
> 
> If you are referring to the AT result iterator use in the atmodem csq
> callback:- we cannot use that here due to the response format 
> of this CDMA device not being the same as the GSM standard.
> The prefix in this case is actually not in the same line as 
> the actual response line, so I just opted to use the same 
> algorithm as attr_cb() in /drivers/cdmamodem/devinfo for now 
> and re-use at_util_parse_attr(), taking the last line as the response.
> This could well need to be extended for alternative CDMA AT 
> devices added in the future, as the CDMA AT syntax is not 
> standardised.

Can you send whats the actual result of AT+CSQ from the modem ?
If the last line is going to be only one number value, then you
can use some utility function to convert that string to a numeric value,
rather than duplicating g_at_result_iter_next_number() logic.

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


Re: [PATCH] plugin: add plugin for Linktop/Teracom LW273 data card

2011-02-09 Thread Denis Kenzior
Hi Amit,

On 02/09/2011 10:56 AM, Amit Mendapara wrote:
> Hi Danis,
> 
> I have submitted three patches as you suggested but no one has reviewed
> it. Would you tell me what else I can do to ensure it's been integrated
> in ofono?
> 

So it looks like GMail is losing patches again.  Your patches do show up
on the mailing list archives but not in my mailbox.  Can you resend them
again, and CC my private Email as well: denk...@gmail.com.

Thanks,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [RFC PATCH 2/3] ssn: add code and call id to notifications

2011-02-09 Thread Denis Kenzior
Hi Andras,

> diff --git a/include/ssn.h b/include/ssn.h
> index d640cad..ba3701b 100644
> --- a/include/ssn.h
> +++ b/include/ssn.h
> @@ -37,9 +37,10 @@ struct ofono_ssn_driver {
>  };
>  
>  /* SSN notifications (CSSI and CSSU).  */
> -void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, int code, int index);
> -void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, int code, int index,
> - const struct ofono_phone_number *number);
> +void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, unsigned int id,
> + int code1, int index);
> +void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, unsigned int id, int code2,
> + int index, const struct ofono_phone_number *number);
>  
>  int ofono_ssn_driver_register(const struct ofono_ssn_driver *d);
>  void ofono_ssn_driver_unregister(const struct ofono_ssn_driver *d);

Right now I'm not seeing any users (or even potential ones) of the SSN
atom besides voicecall.  What do you think of removing the SSN atom and
moving these to the voicecall atom?

The only one I'm not sure about is  from 27.007:
6   forward check SS message received (can be received whenever)

Any idea what this one is about?

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [RFC PATCH 1/3] call-barring: removed +CSSI type SS notifications

2011-02-09 Thread Denis Kenzior
Hi Andras

On 02/09/2011 04:33 AM, Andras Domokos wrote:
> ---
>  src/call-barring.c |   74 
> 
>  1 files changed, 0 insertions(+), 74 deletions(-)
> 
> diff --git a/src/call-barring.c b/src/call-barring.c
> index 649826e..84ed277 100644
> --- a/src/call-barring.c
> +++ b/src/call-barring.c
> @@ -58,9 +58,6 @@ struct ofono_call_barring {
>   int ss_req_lock;
>   struct ofono_ssn *ssn;

You forgot to remove this part in your patch.  I applied your patch and
fixed this in a follow on patch.

>   struct ofono_ussd *ussd;
> - unsigned int incoming_bar_watch;
> - unsigned int outgoing_bar_watch;
> - unsigned int ssn_watch;
>   unsigned int ussd_watch;
>   const struct ofono_call_barring_driver *driver;
>   void *driver_data;

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 5/7] cdmamodem: Add Signal Strength Support

2011-02-09 Thread Dara Spieker-Doyle

Hi Rajesh

On 02/09/2011 02:58 PM, ext rajesh.naga...@elektrobit.com wrote:


Hi Dara,


-Original Message-
From: ofono-boun...@ofono.org
[mailto:ofono-boun...@ofono.org] On Behalf Of Dara Spieker-Doyle
Sent: 08 February 2011 13:05
To: ofono@ofono.org
Subject: [PATCH 5/7] cdmamodem: Add Signal Strength Support




+static gboolean cdma_get_next_number(const char *line, gint
*number) {
+ int pos;
+ int end;
+ int len;
+ int value = 0;
+
+ len = strlen(line);
+
+ pos = 0;
+ end = pos;
+
+ while (line[end]>= '0'&&  line[end]<= '9') {
+ value = value * 10 + (int)(line[end] - '0');
+ end += 1;
+ }
+
+ if (pos == end)
+ return FALSE;
+
+ pos = skip_to_next_field(line, end, len);
+
+ if (number)
+ *number = value;
+
+ return TRUE;
+}
+


This is a duplicate of g_at_result_iter_next_number().
Why cant use this function instead of cdma_get_next_number() ?


This is different from g_at_result_iter_next_number() in that it takes a 
raw response line to parse rather than the result iterator. The AT

syntax format of the response from this CDMA device does not follow the
GSM standard AT syntax format.




+static void cdma_csq_cb(gboolean ok, GAtResult *result, gpointer
+user_data) {
+ struct cb_data *cbd = user_data;
+ ofono_cdma_netreg_strength_cb_t cb = cbd->cb;
+ const char *prefix = cbd->user;
+ struct ofono_error error;
+ const char *attr;
+ int strength = -1;
+
+ decode_at_error(&error, g_at_result_final_response(result));
+
+ if (!ok) {
+ cb(&error, -1, cbd->data);
+ return;
+ }
+
+ if (at_util_parse_attr(result, prefix,&attr) == FALSE) {
+ CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
+ return;
+ }
+
+ cdma_get_next_number(attr,&strength);
+
+ DBG("csq_cb: %d", strength);
+
+ cb(&error, at_util_convert_signal_strength(strength),
cbd->data); }


Refer csq_cb() implementation in /drivers/atmodem/network-registration.c



If you are referring to the AT result iterator use in the atmodem csq
callback:- we cannot use that here due to the response format of this
CDMA device not being the same as the GSM standard.
The prefix in this case is not in the same line as the actual response 
line, so I opted to use the same algorithm as attr_cb() in 
/drivers/cdmamodem/devinfo for now and re-use at_util_parse_attr(), 
taking the last line as the response.

This could well need to be extended for alternative CDMA AT devices
added in the future, as the CDMA AT syntax is not standardised.

Cheers
Dara



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


RE: [PATCH 5/7] cdmamodem: Add Signal Strength Support

2011-02-09 Thread Rajesh.Nagaiah
Hi Dara,

> -Original Message-
> From: ofono-boun...@ofono.org 
> [mailto:ofono-boun...@ofono.org] On Behalf Of Dara Spieker-Doyle
> Sent: 08 February 2011 13:05
> To: ofono@ofono.org
> Subject: [PATCH 5/7] cdmamodem: Add Signal Strength Support
> 

> +static gboolean cdma_get_next_number(const char *line, gint 
> *number) {
> + int pos;
> + int end;
> + int len;
> + int value = 0;
> +
> + len = strlen(line);
> +
> + pos = 0;
> + end = pos;
> +
> + while (line[end] >= '0' && line[end] <= '9') {
> + value = value * 10 + (int)(line[end] - '0');
> + end += 1;
> + }
> +
> + if (pos == end)
> + return FALSE;
> +
> + pos = skip_to_next_field(line, end, len);
> +
> + if (number)
> + *number = value;
> +
> + return TRUE;
> +}
> +

This is a duplicate of g_at_result_iter_next_number().
Why cant use this function instead of cdma_get_next_number() ?

> +static void cdma_csq_cb(gboolean ok, GAtResult *result, gpointer 
> +user_data) {
> + struct cb_data *cbd = user_data;
> + ofono_cdma_netreg_strength_cb_t cb = cbd->cb;
> + const char *prefix = cbd->user;
> + struct ofono_error error;
> + const char *attr;
> + int strength = -1;
> +
> + decode_at_error(&error, g_at_result_final_response(result));
> +
> + if (!ok) {
> + cb(&error, -1, cbd->data);
> + return;
> + }
> +
> + if (at_util_parse_attr(result, prefix, &attr) == FALSE) {
> + CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
> + return;
> + }
> +
> + cdma_get_next_number(attr, &strength);
> +
> + DBG("csq_cb: %d", strength);
> +
> + cb(&error, at_util_convert_signal_strength(strength), 
> cbd->data); }

Refer csq_cb() implementation in /drivers/atmodem/network-registration.c

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


Re: [sim-ready-nofify-v5 PATCH 2/3] atmodem/sim: use ofono_sim_ready_notify

2011-02-09 Thread Denis Kenzior
Hi Pekka,

On 02/08/2011 06:32 AM, pekka.pe...@nokia.com wrote:
> From: Pekka Pessi 
> 
> Schedule a call to ofono_sim_ready_notify after pin code query returns
> SIM READY.
> 
> Vendor quirks:
> - IFX: register unsolicated +XSIM result code
> - MBM: register unsolicated *EPEV result code
> ---
>  drivers/atmodem/sim.c |  166 ++--
>  1 files changed, 117 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
> index d9c0d8d..666edbe 100644
> --- a/drivers/atmodem/sim.c
> +++ b/drivers/atmodem/sim.c
> @@ -46,10 +46,14 @@
>  
>  #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
>  
> +#define READY_TIMEOUT5000
> +
>  struct sim_data {
>   GAtChat *chat;
>   unsigned int vendor;
>   guint ready_id;
> + guint ready_source;
> + ofono_bool_t ready;
>  };
>  
>  static const char *crsm_prefix[] = { "+CRSM:", NULL };
> @@ -679,10 +683,55 @@ static void at_pin_retries_query(struct ofono_sim *sim,
>   CALLBACK_WITH_FAILURE(cb, NULL, data);
>  }
>  
> +static void ready_unregister_and_notify(struct ofono_sim *sim)
> +{
> + struct sim_data *sd = ofono_sim_get_data(sim);
> +
> + DBG("");
> +
> + if (sd->ready_source > 0) {
> + g_source_remove(sd->ready_source);
> + sd->ready_source = 0;
> + }
> +
> + ofono_sim_ready_notify(sim);
> +}
> +
> +static gboolean ready_timeout(gpointer user_data)
> +{
> + struct ofono_sim *sim = user_data;
> + struct sim_data *sd = ofono_sim_get_data(sim);
> +
> + DBG("");
> +
> + sd->ready_source = 0;
> +
> + ofono_sim_ready_notify(sim);
> +
> + return FALSE;
> +}
> +
> +static void at_wait_for_ready(struct ofono_sim *sim)
> +{
> + struct sim_data *sd = ofono_sim_get_data(sim);
> + guint timeout;
> +
> + if (sd->ready_source > 0)
> + return;
> +
> + if (!sd->ready && sd->ready_id > 0)
> + timeout = READY_TIMEOUT;
> + else
> + timeout = 0;
> +
> + sd->ready_source = g_timeout_add(timeout, ready_timeout, sim);
> +}
> +
>  static void at_cpin_cb(gboolean ok, GAtResult *result, gpointer user_data)
>  {
>   struct cb_data *cbd = user_data;
> - struct sim_data *sd = ofono_sim_get_data(cbd->user);
> + struct ofono_sim *sim = cbd->user;
> + struct sim_data *sd = ofono_sim_get_data(sim);
>   GAtResultIter iter;
>   ofono_sim_passwd_cb_t cb = cbd->cb;
>   struct ofono_error error;
> @@ -729,6 +778,11 @@ static void at_cpin_cb(gboolean ok, GAtResult *result, 
> gpointer user_data)
>   return;
>   }
>  
> + if (pin_type == OFONO_SIM_PASSWORD_NONE)
> + at_wait_for_ready(sim);
> + else
> + sd->ready = FALSE;
> +

So all this logic seems to work by luck.  oFono roughly does this:
pin_query:
send AT+CPIN?
if READY then set waiting_for_pin to none, and wait in
ofono_sim_ready_notify
if PIN then set waiting_for_pin to the pin, and wait in
ofono_sim_ready_notify

ofono_sim_ready_notify:
if waiting_for_pin is none proceed with initialization
otherwise go back to pin_query

Here's a log of this running on IFX:
ofonod[521]: Aux: > AT+CPIN?\r
ofonod[521]: Aux: < \r\n+CPIN: SIM PIN\r\n
ofonod[521]: Aux: < \r\nOK\r\n
ofonod[521]: drivers/atmodem/sim.c:at_cpin_cb() crsm_pin_cb: SIM PIN

ofonod[521]: Aux: > AT+CPIN=""\r
ofonod[521]: Aux: < \r\nOK\r\n
ofonod[521]: Aux: > AT+CPIN?\r
ofonod[521]: Aux: < \r\n+CME ERROR: 14\r\n
ofonod[521]: Querying PIN authentication state failed

ofonod[521]: Aux: < \r\n+XSIM: 7\r\n
ofonod[521]: drivers/atmodem/sim.c:at_xsim_notify()
ofonod[521]: drivers/atmodem/sim.c:ready_unregister_and_notify()
ofonod[521]: src/sim.c:ofono_sim_ready_notify()
ofonod[521]: plugins/ifx.c:xsim_notify() state 7
ofonod[521]: Aux: > AT+CPIN?\r
ofonod[521]: Aux: < \r\n+CPIN: READY\r\n
ofonod[521]: Aux: < \r\nOK\r\n
ofonod[521]: drivers/atmodem/sim.c:at_cpin_cb() crsm_pin_cb: READY
ofonod[521]: drivers/atmodem/sim.c:at_pin_retries_query()
ofonod[521]: drivers/atmodem/sim.c:ready_timeout()
ofonod[521]: src/sim.c:ofono_sim_ready_notify()

As you can see, we are in fact calling ofono_sim_ready_notify twice in
short succession.  The only reason we're not stuck for 5 seconds the
second time around is that the xsim notification function sets ready to
TRUE.  This is all pretty convoluted.  I don't really like this at all.

Another case to consider is a cold boot quirked modem, PIN disabled.  We
are highly likely to receive XSIM way before we even query the PIN.  So
ready is false, ready_id is > 0 and we end up waiting for 5 seconds here
for no good reason.

>   DBG("crsm_pin_cb: %s", pin_required);
>  
>   cb(&error, pin_type, cbd->data);
> @@ -753,13 +807,13 @@ static void at_pin_query(struct ofono_sim *sim, 
> ofono_sim_passwd_cb_t cb,
>  
>  static void at_xsim_notify(GAtResult *result, gpointer user_data)
>  {
> - struct cb_data *cbd = user_data;
> - struct sim_d

RE: [PATCHv2] doc: Assisted Satellite Navigation API and Agent API

2011-02-09 Thread Joly, Frederic
Hi Sjur,

-Original Message-
From: ofono-boun...@ofono.org [mailto:ofono-boun...@ofono.org] On Behalf Of 
Sjur Brændeland
Sent: Sunday, January 30, 2011 12:45 AM
To: remi.denis-courm...@nokia.com; Denis Kenzior; ofono@ofono.org
Cc: Simon Lethbridge
Subject: [PATCHv2] doc: Assisted Satellite Navigation API and Agent API

+   void ResetAssistanceData()
+
+   A request has been received from the network that all
+   assistance data should be reset.  This is used for 3gpp
+   performance tests.
+

Sorry to come back so late of this. By assistance data reset, you meant a reset 
of all positioning stored information? Like used in 3GPP conformance testing 
(44.014 § 8.15 for instance)?
The knowledge of positioning information is somehow "Assistance" information, 
but this is not the wording I'm used to.

Thanks,

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 3/3] nettime: Mock Timed for testing

2011-02-09 Thread Antti Paila
---
 test/test-nettime |   35 +++
 1 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100755 test/test-nettime

diff --git a/test/test-nettime b/test/test-nettime
new file mode 100755
index 000..acdd167
--- /dev/null
+++ b/test/test-nettime
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+
+import gobject
+import dbus
+import sys
+import time
+import dbus.service
+import dbus.mainloop.glib
+
+
+class NetworkTime(dbus.service.Object):
+   def __init__(self):
+   busName = dbus.service.BusName('com.meego.timed',
+   bus = dbus.SystemBus())
+   dbus.service.Object.__init__(self, busName, '/com/meego/timed')
+   @dbus.service.method(dbus_interface="com.meego.NetworkTime",
+   in_signature="a{sv}", out_signature="")
+   def Notify(self, arg):
+   print arg
+   print
+   print "Time from mobile: %d" % arg["UTC"]
+   print "DST: %d" % arg["DST"]
+   print "Timezone: %d" % arg["Timezone"]
+   print "MNC: %s" % arg["MobileNetworkCode"]
+   print "MCC: %s" % arg["MobileCountryCode"]
+
+if __name__ == '__main__':
+   dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+   agent = NetworkTime()
+
+   mainloop = gobject.MainLoop()
+   mainloop.run()
+
+
+
-- 
1.7.1

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


[PATCH 2/3] nettime: Makefile.am modification

2011-02-09 Thread Antti Paila
---
 Makefile.am |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index e402de4..b043f9e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -338,6 +338,9 @@ builtin_modules += example_provision
 builtin_sources += examples/provision.c
 endif
 
+builtin_modules += meego_nettime
+builtin_sources += plugins/meego-nettime.c
+
 builtin_modules += smart_messaging
 builtin_sources += plugins/smart-messaging.c
 
@@ -480,7 +483,8 @@ test_scripts = test/backtrace \
test/cdma-hangup \
test/disable-call-forwarding \
test/list-messages \
-   test/test-sms
+   test/test-sms \
+   test/test-nettime
 
 if TEST
 testdir = $(pkglibdir)/test
-- 
1.7.1

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


[PATCH 1/3] nettime: Network time plugin implementation

2011-02-09 Thread Antti Paila
---
 plugins/meego-nettime.c |  321 +++
 1 files changed, 321 insertions(+), 0 deletions(-)
 create mode 100644 plugins/meego-nettime.c

diff --git a/plugins/meego-nettime.c b/plugins/meego-nettime.c
new file mode 100644
index 000..442925c
--- /dev/null
+++ b/plugins/meego-nettime.c
@@ -0,0 +1,321 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2010  Nokia Corporation and/or its subsidiary(-ies).
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include 
+#endif
+
+#include 
+#include 
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "ofono.h"
+#include "common.h"
+
+#define TIMED_PATH "/com/meego/timed"
+#define TIMED_SERVICE "com.meego.timed"
+
+struct nt_data {
+   gboolean time_available;
+   gboolean time_pending;
+   time_t nw_time_utc;
+   time_t received;
+   int dst;
+   int time_zone;
+   char mcc[OFONO_MAX_MCC_LENGTH + 1];
+   char mnc[OFONO_MAX_MNC_LENGTH + 1];
+   unsigned int timed_watch;
+   gboolean timed_present;
+   struct ofono_netreg *netreg;
+   unsigned int netreg_status_watch;
+   unsigned int netreg_watch;
+};
+
+static gboolean encode_time_format(struct ofono_network_time *time,
+struct tm *tm)
+{
+
+   if (time->year < 0)
+   return FALSE;
+
+   tm->tm_year = time->year - 1900;
+   tm->tm_mon = time->mon - 1;
+   tm->tm_mday = time->mday;
+   tm->tm_hour = time->hour;
+   tm->tm_min = time->min;
+   tm->tm_sec = time->sec;
+
+   return TRUE;
+}
+
+static time_t get_monotonic_time()
+{
+   struct timespec ts;
+   clock_gettime(CLOCK_MONOTONIC, &ts);
+
+   return ts.tv_sec;
+}
+
+static int fill_time_notification(DBusMessage *msg,
+   struct nt_data *ntd)
+{
+   DBusMessageIter iter, iter_array;
+   int64_t utc;
+
+   const char *mcc = ntd->mcc;
+   const char *mnc = ntd->mnc;
+
+   dbus_message_iter_init_append(msg, &iter);
+   dbus_message_iter_open_container(&iter,
+   DBUS_TYPE_ARRAY,
+   "{sv}",
+   &iter_array);
+
+   if (ntd->time_pending) {
+   if (ntd->time_available) {
+   utc = ntd->nw_time_utc - ntd->received;
+   ofono_dbus_dict_append(&iter_array,
+   "UTC",
+   DBUS_TYPE_INT64,
+   &utc);
+   }
+
+   ofono_dbus_dict_append(&iter_array,
+   "DST",
+   DBUS_TYPE_INT32,
+   &ntd->dst);
+   ofono_dbus_dict_append(&iter_array,
+   "Timezone",
+   DBUS_TYPE_INT32,
+   &ntd->time_zone);
+   }
+
+   ofono_dbus_dict_append(&iter_array,
+   "MobileCountryCode",
+   DBUS_TYPE_STRING,
+   &mcc);
+   ofono_dbus_dict_append(&iter_array,
+   "MobileNetworkCode",
+   DBUS_TYPE_STRING,
+   &mnc);
+
+   dbus_message_iter_close_container(&iter, &iter_array);
+   return 0;
+}
+
+static DBusMessage *create_time_notification(
+   struct ofono_nettime_context *context)
+{
+   DBusMessage *message;
+   struct nt_data *ntd = context->data;
+   const char *path = ofono_modem_get_path(context->modem);
+
+   if (path == NULL) {
+   ofono_error("Fetching path for modem failed");
+   return NULL;
+   }
+
+   message = dbus_message_new_method_call(TIMED_SERVICE, TIMED_PATH,
+   "com.meego.NetworkTime", "Notify");
+
+   if (message == NULL)
+   return NULL;
+
+   dbus_message_set_no_reply(message, TRUE);
+   fill_time_notification(message, ntd);
+
+   return message;
+}
+
+static void nettime_remove(struct ofono_nettime_context *context)

[PATCH 0/3 v5] Network Time Plugin

2011-02-09 Thread Antti Paila
 This series of patches introduces the network time part of
 the NITZ feature as outlined in 3GPP spec 22.042.
 The plugin is for delivering network indicated time information
 to timed process which is responsible for maintaining the system
 time. The delivery is achieved by timed implementing an interface
 with a method that is called by the nettime plugin with time related
 info as a parameter of the method.

Antti Paila (3):
  nettime: Network time plugin implementation
  nettime: Makefile.am modification
  nettime: Mock Timed for testing

 Makefile.am |6 +-
 plugins/meego-nettime.c |  321 +++
 test/test-nettime   |   35 +
 3 files changed, 361 insertions(+), 1 deletions(-)
 create mode 100644 plugins/meego-nettime.c
 create mode 100755 test/test-nettime

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


[RFC PATCH v3] gprs: add function to handle activated context

2011-02-09 Thread Soum, RedouaneX
The purpose of the patch is to handle Network Initiated Context Activation and 
PDN connection request as part of EPS Attach procedure (LTE) in oFono core.

In order to avoid issue regarding CID allocation :
- driver should call the core using ofono_gprs_set_cid_range function to 
specify CID range for UE initiated PDN connection
- driver could use a new function to check if the CID is already used or not : 
ofono_gprs_is_cid_used, usefull in case the modem is not using a specific range 
for UE initiated PDN connection.
- driver will use a new function to notify the gprs atom of a new PDN 
connection with all the ip parameters from AT+CGCONTRDP (I can provide an 
update later to handle PCSCF and IMS Signaling Flag as well) commmand : 
ofono_gprs_context_activated

ofono_gprs_context_activated is similar to ofono_gprs_context_deactivated.
This function must be call by any gprs driver when :
 - a context has been activated without explicit request as part of attach 
procedure in LTE (PDN ACT X and X is a unused CID)
 - a context has been activated by the Network (NW PDN ACT X, NW ACT X,Y)

Behavior of the function :

List all the context and try to find correct APN with empty username and empty 
password.
If such context is not found then create a new one with "Internet" type only if 
we are in LTE with no Active context.
Otherwise deactivate the connection.

For the context (found or created):
Update the settings
Set to active

The function will also assign the context to a context driver.
---
 include/gprs-context.h |7 +++
 include/gprs.h |3 +
 src/gprs.c |  139 
 src/idmap.c|   12 
 src/idmap.h|1 +
 5 files changed, 162 insertions(+), 0 deletions(-)

diff --git a/include/gprs-context.h b/include/gprs-context.h
index c29c0dc..e208b66 100644
--- a/include/gprs-context.h
+++ b/include/gprs-context.h
@@ -76,6 +76,13 @@ struct ofono_gprs_context_driver {
ofono_gprs_context_cb_t cb, void *data);
 };
 
+
+void ofono_gprs_context_activated(struct ofono_gprs_context *gc,
+   const int cid, const char *apn,
+   const char *interface, ofono_bool_t static_ip,
+   const char *address, const char *netmask,
+   const char *gw, const char **dns);
+
 void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc,
unsigned int id);
 
diff --git a/include/gprs.h b/include/gprs.h
index 157a6f9..5a96c1c 100644
--- a/include/gprs.h
+++ b/include/gprs.h
@@ -75,6 +75,9 @@ void *ofono_gprs_get_data(struct ofono_gprs *gprs);
 
 void ofono_gprs_set_cid_range(struct ofono_gprs *gprs,
unsigned int min, unsigned int max);
+ofono_bool_t ofono_gprs_is_cid_used(struct ofono_gprs *gprs,
+   int cid);
+
 void ofono_gprs_add_context(struct ofono_gprs *gprs,
struct ofono_gprs_context *gc);
 
diff --git a/src/gprs.c b/src/gprs.c
index 5ea864c..9ab853c 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -730,6 +730,13 @@ static void pri_activate_callback(const struct ofono_error 
*error,
"Active", DBUS_TYPE_BOOLEAN, &value);
 }
 
+static void ofono_gprs_context_activated_deactivate_callback(const struct 
ofono_error *error, void *data)
+{
+   struct ofono_gprs_context *gc_driver = data;
+   if (gc_driver != NULL)
+   gc_driver->inuse = FALSE;
+}
+
 static void pri_deactivate_callback(const struct ofono_error *error, void 
*data)
 {
struct pri_context *ctx = data;
@@ -2026,6 +2033,15 @@ void ofono_gprs_set_cid_range(struct ofono_gprs *gprs,
gprs->cid_map = idmap_new_from_range(min, max);
 }
 
+ofono_bool_t ofono_gprs_is_cid_used(struct ofono_gprs *gprs,
+   int cid)
+{
+   if (gprs == NULL || gprs->cid_map == NULL)
+   return 0;
+
+   return idmap_is_free(gprs->cid_map, cid);
+}
+
 static void gprs_context_unregister(struct ofono_atom *atom)
 {
struct ofono_gprs_context *gc = __ofono_atom_get_data(atom);
@@ -2067,6 +2083,129 @@ void ofono_gprs_bearer_notify(struct ofono_gprs *gprs, 
int bearer)
"Bearer", DBUS_TYPE_STRING, &value);
 }
 
+void ofono_gprs_context_activated(struct ofono_gprs_context *gc,
+   const int cid, const char *apn,
+   const char *interface, ofono_bool_t static_ip,
+   const char *address, const char *netmask,
+   const char *gw, const char **dns)
+{
+   DBusConnection *conn = ofono_dbus_get_connection();
+   GSList *l;
+   dbus_bool_t value;
+   const char *path;
+   DBusMessage *signal;
+   GKeyFile *settings;
+   int active_context = 0;
+   int technology = 0;
+   struct pri_context *context = 0;
+
+
+   if (gc->gprs == NULL)
+  

Re: [PATCH] plugin: add plugin for Linktop/Teracom LW273 data card

2011-02-09 Thread Amit Mendapara
Hi Danis,

I have submitted three patches as you suggested but no one has reviewed it.
Would you tell me what else I can do to ensure it's been integrated in
ofono?

Regards
--
Amit Mendapara

On Mon, Feb 7, 2011 at 8:51 AM, Amit Mendapara wrote:

> Hi Denis,
>
> Thanks you for your kind attention. I will resubmit as suggested.
>
> Regards
> --
> Amit Mendapara
>
>
> On Fri, Feb 4, 2011 at 10:07 PM, Denis Kenzior  wrote:
>
>> Hi Amit,
>>
>> On 02/03/2011 10:34 AM, Amit Mendapara wrote:
>> > The LW273 and LW272 devices are being distributed by BSNL in India
>> > with Teracom
>> > brand name. Both the devices have similar specs except data speed and
>> > having same
>> > usb id (230d:0001).
>> >
>> > Links:
>> >
>> > http://www.bsnl.in/service/3G/3G_files/3g.htm
>> > http://www.teracom.in/htmls/3G.html
>> > http://www.linktop.com.cn/en/Products.asp?FID=1&LID=302
>> > 
>> > http://amit-mendapara.blogspot.com/2010/11/amazing-bsnl-3g.html
>> >
>> > Regards
>> > --
>> > Amit Mendapara
>> >
>>
>> Thanks for your patch, but please resubmit it in a proper format for
>> review.  The easiest way to do that is git-send-email.  Also, please
>> have a look at the 'Submitting patches' section in the HACKING file of
>> oFono.  Ideally this should be a 3 patch series, one adding the linktop
>> driver, one modifying udev and one modifying ofono.rules.
>>
>> Regards,
>> -Denis
>>
>
>
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [RFCv2] doc: Proposal for LTE/IMS API

2011-02-09 Thread Sjur Brændeland
Hi Rémi,

>> > > +             boolean PreConditionCheck(string Type, string
>> > > PeerAddress, +                                     uint16 PeerPort,
>> > >  uint16 LocalPort) +
>> >
>> > That stuff is per context. Should it not be in the context object rather
>> > than in the IMS manager?
>>
>> oFono should only consider QoS information from the IMS
>> Default and Dedicated bearers when checking the precondition.
>>
>> In theory there might be more than one IMS APN for a operator,
>> but I really don't see this as a real life scenario for this.
>> If anyone disagrees please speak out and explain...
>
> Well, I don't care if it is part of the normal context interface, or if it is
> an extra IMS-specific interface on the IMS context object path. But this is
> clearly a per-context thing so it should be in the context.
>
> I don't want to end up in a 'woops' situation down the line. And I don't trust
> operators not to actually implement those useless in real life scenarii...

One option could be to keep it here in the IMS API but
to include the Local IP Address as a argument to the PreConditionCheck.
This fits quite nicely with the QoS SIP Precondition operation and can
easily be used
by oFono core to map to the right APN.

There is still a theoretical problem here if you get the same Home Address from
two IMS APN, If anyone think this is an issue I'll throw in the towel
and move the
PreConditionCheck to the ConnectionContext object ;-)

Anyway, I think either solution would work just fine.
In terms of the "separation of concern" i think keeping it here is the
best solution,
but putting it in the ConnectionContext is more flexible.

I'm not going to keep arguing for this forever ;-)

>> > > +             array{string} PcscfAddresses [readonly]
>> >
>> > Should this be in the context object? The AT command is per CID. Would it
>> > make any sense for a network to have different P-CSCF based on the
>> > bearer?
>>
>> As mentioned above, I don't see why an operator would ever have more than
>> one IMS APN. If we only have one IMS APN, then we might as well present
>> this information here in the IMS API.
>
> How do you cope with two connections to the same APN?

3GPP TS 24.229,  B.2.2.1 "PDP context activation and P-CSCF discovery",
describes that the P-CSCF can be provided as dynamic parameter with the
PDN connection, stored on the ISIM, or by provisioning. As far as I understand
this It is up to the IMS application to select which one of the P-CSCF
addresses it should use.

So I think the best would be to expose the P-CSCF address stored on ISIM
in the IMS API, and move add the P-CSCF provided with the PDN Connection
to the ConnectionContext API.


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


[PATCH 7/7] isi: implement set_attach_policy

2011-02-09 Thread Rémi Denis-Courmont
---
 drivers/isimodem/gprs.c |  131 --
 1 files changed, 23 insertions(+), 108 deletions(-)

diff --git a/drivers/isimodem/gprs.c b/drivers/isimodem/gprs.c
index ea90704..ad5a768 100644
--- a/drivers/isimodem/gprs.c
+++ b/drivers/isimodem/gprs.c
@@ -62,6 +62,8 @@ struct gprs_data {
 
 static void configure_resp_cb(const GIsiMessage *msg, void *opaque)
 {
+   struct isi_cb_data *cbd = opaque;
+   ofono_gprs_cb_t cb = cbd->cb;
const uint8_t *data = g_isi_msg_data(msg);
 
if (g_isi_msg_error(msg) < 0) {
@@ -75,26 +77,13 @@ static void configure_resp_cb(const GIsiMessage *msg, void 
*opaque)
if (g_isi_msg_data_len(msg) < 1)
return;
 
-   if (data[0] != GPDS_OK)
+   if (data[0] != GPDS_OK) {
DBG("GPDS configure failed: %s", gpds_status_name(data[0]));
-}
-
-static void set_attach_mode(struct ofono_gprs *gprs, int attached)
-{
-   struct gprs_data *gd = ofono_gprs_get_data(gprs);
-
-   const unsigned char msg[] = {
-   GPDS_CONFIGURE_REQ,
-   attached ? GPDS_ATTACH_MODE_AUTOMATIC : GPDS_ATTACH_MODE_MANUAL,
-   GPDS_MT_ACT_MODE_REJECT,
-   GPDS_CLASSC_MODE_DEFAULT,
-   GPDS_AOL_CTX_DEFAULT,
-   0x00,
-   0x00
-   };
+   CALLBACK_WITH_FAILURE(cb, cbd->data);
+   return;
+   }
 
-   g_isi_client_send(gd->client, msg, sizeof(msg),
-   configure_resp_cb, gprs, NULL);
+   CALLBACK_WITH_SUCCESS(cb, cbd->data);
 }
 
 static void detach_ind_cb(const GIsiMessage *msg, void *opaque)
@@ -114,8 +103,6 @@ static void detach_ind_cb(const GIsiMessage *msg, void 
*opaque)
DBG("detached: %s (0x%02"PRIx8")",
gpds_isi_cause_name(data[0]), data[0]);
 
-   set_attach_mode(gprs, FALSE);
-
ofono_gprs_detached_notify(gprs);
 }
 
@@ -324,101 +311,29 @@ static void isi_gprs_remove(struct ofono_gprs *gprs)
g_free(gd);
 }
 
-static void attach_resp_cb(const GIsiMessage *msg, void *opaque)
-{
-   struct isi_cb_data *cbd = opaque;
-   ofono_gprs_cb_t cb = cbd->cb;
-   const uint8_t *data = g_isi_msg_data(msg);
-
-   if (g_isi_msg_error(msg) < 0) {
-   DBG("ISI message error: %d", g_isi_msg_error(msg));
-   goto error;
-   }
-
-   if (g_isi_msg_id(msg) != GPDS_ATTACH_RESP)
-   return;
-
-   if (g_isi_msg_data_len(msg) < 2)
-   goto error;
-
-   if (data[0] != GPDS_OK) {
-   DBG("attach failed: %s", gpds_status_name(data[0]));
-   goto error;
-   }
-
-   set_attach_mode(cbd->user, TRUE);
-
-   CALLBACK_WITH_SUCCESS(cb, cbd->data);
-   return;
-
-error:
-   CALLBACK_WITH_FAILURE(cb, cbd->data);
-}
-
-static void detach_resp_cb(const GIsiMessage *msg, void *opaque)
-{
-   struct isi_cb_data *cbd = opaque;
-   ofono_gprs_cb_t cb = cbd->cb;
-   const uint8_t *data = g_isi_msg_data(msg);
-
-   if (g_isi_msg_error(msg) < 0) {
-   DBG("ISI client error: %d", g_isi_msg_error(msg));
-   goto error;
-   }
-
-   if (g_isi_msg_id(msg) != GPDS_DETACH_RESP)
-   return;
-
-   if (g_isi_msg_data_len(msg) < 2)
-   goto error;
-
-   if (data[0] != GPDS_OK) {
-   DBG("detach failed: %s", gpds_status_name(data[0]));
-   goto error;
-   }
-
-   set_attach_mode(cbd->user, FALSE);
-
-   CALLBACK_WITH_SUCCESS(cb, cbd->data);
-   return;
-
-error:
-   CALLBACK_WITH_FAILURE(cb, cbd->data);
-}
-
-static void isi_gprs_set_attached(struct ofono_gprs *gprs, int attached,
+static void isi_gprs_set_attach_policy(struct ofono_gprs *gprs,
+   ofono_bool_t always_on,
ofono_gprs_cb_t cb, void *data)
 {
struct gprs_data *gd = ofono_gprs_get_data(gprs);
struct isi_cb_data *cbd = isi_cb_data_new(gprs, cb, data);
+   const unsigned char msg[] = {
+   GPDS_CONFIGURE_REQ,
+   always_on ? GPDS_ATTACH_MODE_AUTOMATIC
+   : GPDS_ATTACH_MODE_MANUAL,
+   GPDS_MT_ACT_MODE_REJECT,
+   GPDS_CLASSC_MODE_DEFAULT,
+   GPDS_AOL_CTX_DEFAULT,
+   0x00,
+   0x00
+   };
 
if (cbd == NULL || gd == NULL)
goto error;
 
-   if (attached) {
-   const unsigned char msg[] = {
-   GPDS_ATTACH_REQ,
-   GPDS_FOLLOW_OFF
-   };
-
-   if (g_isi_client_send_with_timeout(gd->client,
-   msg, sizeof(msg),
-   GPDS_ATTACH_TIMEOUT, attach_resp_cb,
-   cbd, g_free))
-   return;
-   } else {
-   const unsigned char msg[] = {
-   

[PATCH 5/7] include: replace set_attached with set_attach_policy

2011-02-09 Thread Rémi Denis-Courmont
---
 include/gprs.h |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/gprs.h b/include/gprs.h
index 157a6f9..15c1080 100644
--- a/include/gprs.h
+++ b/include/gprs.h
@@ -41,7 +41,8 @@ struct ofono_gprs_driver {
int (*probe)(struct ofono_gprs *gprs, unsigned int vendor,
void *data);
void (*remove)(struct ofono_gprs *gprs);
-   void (*set_attached)(struct ofono_gprs *gprs, int attached,
+   void (*set_attach_policy)(struct ofono_gprs *gprs,
+   ofono_bool_t always_on,
ofono_gprs_cb_t cb, void *data);
void (*attached_status)(struct ofono_gprs *gprs,
ofono_gprs_status_cb_t cb, void *data);
-- 
1.7.1

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


[PATCH 6/7] atmodem: dummy set_attach_policy

2011-02-09 Thread Rémi Denis-Courmont
---
 drivers/atmodem/gprs.c |   30 --
 1 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index 6e01994..3fcf17d 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -51,31 +51,17 @@ struct gprs_data {
unsigned int vendor;
 };
 
-static void at_cgatt_cb(gboolean ok, GAtResult *result, gpointer user_data)
-{
-   struct cb_data *cbd = user_data;
-   ofono_gprs_cb_t cb = cbd->cb;
-   struct ofono_error error;
-
-   decode_at_error(&error, g_at_result_final_response(result));
-
-   cb(&error, cbd->data);
-}
-
-static void at_gprs_set_attached(struct ofono_gprs *gprs, int attached,
+static void at_gprs_set_attach_policy(struct ofono_gprs *gprs,
+   ofono_bool_t always_on,
ofono_gprs_cb_t cb, void *data)
 {
-   struct gprs_data *gd = ofono_gprs_get_data(gprs);
-   struct cb_data *cbd = cb_data_new(cb, data);
-   char buf[64];
-
-   snprintf(buf, sizeof(buf), "AT+CGATT=%i", attached ? 1 : 0);
+   /* TODO: vendor specific stuff */
 
-   if (g_at_chat_send(gd->chat, buf, none_prefix,
-   at_cgatt_cb, cbd, g_free) > 0)
+   /* Pure standard modems only support demand-attach policy */
+   if (!always_on) {
+   CALLBACK_WITH_SUCCESS(cb, data);
return;
-
-   g_free(cbd);
+   }
 
CALLBACK_WITH_FAILURE(cb, data);
 }
@@ -401,7 +387,7 @@ static struct ofono_gprs_driver driver = {
.name   = "atmodem",
.probe  = at_gprs_probe,
.remove = at_gprs_remove,
-   .set_attached   = at_gprs_set_attached,
+   .set_attach_policy  = at_gprs_set_attach_policy,
.attached_status= at_gprs_registration_status,
 };
 
-- 
1.7.1

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


[PATCH 3/7] gprs: let the modems automatically attach when activating a context

2011-02-09 Thread Rémi Denis-Courmont
If some really stupid modem does not support attach on demand, this
really should be worked around in the specific driver (at least
AT and ISI modems support this).
---
 src/dbus.c  |   13 -
 src/gprs.c  |6 --
 src/ofono.h |2 --
 3 files changed, 0 insertions(+), 21 deletions(-)

diff --git a/src/dbus.c b/src/dbus.c
index 01d43cf..a635121 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -336,19 +336,6 @@ DBusMessage *__ofono_error_in_use(DBusMessage *msg)
"The resource is currently in use");
 }
 
-DBusMessage *__ofono_error_not_attached(DBusMessage *msg)
-{
-   return g_dbus_create_error(msg, OFONO_ERROR_INTERFACE ".NotAttached",
-   "GPRS is not attached");
-}
-
-DBusMessage *__ofono_error_attach_in_progress(DBusMessage *msg)
-{
-   return g_dbus_create_error(msg,
-   OFONO_ERROR_INTERFACE ".AttachInProgress",
-   "GPRS Attach is in progress");
-}
-
 DBusMessage *__ofono_error_canceled(DBusMessage *msg)
 {
return g_dbus_create_error(msg, OFONO_ERROR_INTERFACE ".Canceled",
diff --git a/src/gprs.c b/src/gprs.c
index ee66b2a..f8d0fb5 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1068,12 +1068,6 @@ static DBusMessage *pri_set_property(DBusConnection 
*conn,
if (ctx->active == (ofono_bool_t) value)
return dbus_message_new_method_return(msg);
 
-   if (value && !ctx->gprs->attached)
-   return __ofono_error_not_attached(msg);
-
-   if (ctx->gprs->flags & GPRS_FLAG_ATTACHING)
-   return __ofono_error_attach_in_progress(msg);
-
if (value) {
if (assign_context(ctx) == FALSE)
return __ofono_error_not_implemented(msg);
diff --git a/src/ofono.h b/src/ofono.h
index 229fcb2..f44f3ad 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -54,8 +54,6 @@ DBusMessage *__ofono_error_not_available(DBusMessage *msg);
 DBusMessage *__ofono_error_timed_out(DBusMessage *msg);
 DBusMessage *__ofono_error_sim_not_ready(DBusMessage *msg);
 DBusMessage *__ofono_error_in_use(DBusMessage *msg);
-DBusMessage *__ofono_error_not_attached(DBusMessage *msg);
-DBusMessage *__ofono_error_attach_in_progress(DBusMessage *msg);
 DBusMessage *__ofono_error_canceled(DBusMessage *msg);
 DBusMessage *__ofono_error_access_denied(DBusMessage *msg);
 
-- 
1.7.1

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


[PATCH 4/7] gprs: do not watch registration status or re-attach

2011-02-09 Thread Rémi Denis-Courmont
This is not needed since we let the modem automatically attach.
---
 src/gprs.c |  175 +++
 1 files changed, 9 insertions(+), 166 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index f8d0fb5..800624b 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -46,9 +46,6 @@
 #include "simutil.h"
 #include "util.h"
 
-#define GPRS_FLAG_ATTACHING 0x1
-#define GPRS_FLAG_RECHECK 0x2
-
 #define SETTINGS_STORE "gprs"
 #define SETTINGS_GROUP "Settings"
 #define MAX_CONTEXT_NAME_LENGTH 127
@@ -75,7 +72,6 @@ enum packet_bearer {
 struct ofono_gprs {
GSList *contexts;
ofono_bool_t attached;
-   ofono_bool_t driver_attached;
ofono_bool_t powered;
ofono_bool_t suspended;
int status;
@@ -85,10 +81,6 @@ struct ofono_gprs {
struct idmap *pid_map;
unsigned int last_context_id;
struct idmap *cid_map;
-   int netreg_status;
-   struct ofono_netreg *netreg;
-   unsigned int netreg_watch;
-   unsigned int status_watch;
GKeyFile *settings;
char *imsi;
DBusMessage *pending;
@@ -137,7 +129,6 @@ struct pri_context {
struct ofono_gprs *gprs;
 };
 
-static void gprs_netreg_update(struct ofono_gprs *gprs);
 static void gprs_deactivate_next(struct ofono_gprs *gprs);
 
 const char *packet_bearer_to_string(int bearer)
@@ -1272,7 +1263,8 @@ static void update_suspended_property(struct ofono_gprs 
*gprs,
 
gprs->suspended = suspended;
 
-   if (gprs->attached)
+   if (gprs->status == NETWORK_REGISTRATION_STATUS_REGISTERED ||
+   gprs->status == NETWORK_REGISTRATION_STATUS_ROAMING)
ofono_dbus_signal_property_changed(conn, path,
OFONO_CONNECTION_MANAGER_INTERFACE,
"Suspended", DBUS_TYPE_BOOLEAN, &value);
@@ -1319,8 +1311,7 @@ static void gprs_attached_update(struct ofono_gprs *gprs)
ofono_bool_t attached;
dbus_bool_t value;
 
-   attached = gprs->driver_attached &&
-   (gprs->status == NETWORK_REGISTRATION_STATUS_REGISTERED ||
+   attached = (gprs->status == NETWORK_REGISTRATION_STATUS_REGISTERED ||
gprs->status == NETWORK_REGISTRATION_STATUS_ROAMING);
 
if (attached == gprs->attached)
@@ -1372,87 +1363,6 @@ static void registration_status_cb(const struct 
ofono_error *error,
 
if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
ofono_gprs_status_notify(gprs, status);
-
-   if (gprs->flags & GPRS_FLAG_RECHECK) {
-   gprs->flags &= ~GPRS_FLAG_RECHECK;
-   gprs_netreg_update(gprs);
-   }
-}
-
-static void gprs_attach_callback(const struct ofono_error *error, void *data)
-{
-   struct ofono_gprs *gprs = data;
-
-   DBG("%s error = %d", __ofono_atom_get_path(gprs->atom), error->type);
-
-   gprs->flags &= ~GPRS_FLAG_ATTACHING;
-
-   if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
-   gprs->driver_attached = !gprs->driver_attached;
-
-   if (gprs->driver->attached_status) {
-   gprs->driver->attached_status(gprs, registration_status_cb,
-   gprs);
-   return;
-   }
-
-   gprs_attached_update(gprs);
-
-   if (gprs->flags & GPRS_FLAG_RECHECK) {
-   gprs->flags &= ~GPRS_FLAG_RECHECK;
-   gprs_netreg_update(gprs);
-   }
-}
-
-static void gprs_netreg_removed(struct ofono_gprs *gprs)
-{
-   gprs->netreg = NULL;
-
-   gprs->flags &= ~(GPRS_FLAG_RECHECK | GPRS_FLAG_ATTACHING);
-   gprs->status_watch = 0;
-   gprs->netreg_status = NETWORK_REGISTRATION_STATUS_NOT_REGISTERED;
-   gprs->driver_attached = FALSE;
-
-   gprs_attached_update(gprs);
-}
-
-static void gprs_netreg_update(struct ofono_gprs *gprs)
-{
-   ofono_bool_t attach;
-
-   attach = gprs->netreg_status == NETWORK_REGISTRATION_STATUS_REGISTERED
-   || NETWORK_REGISTRATION_STATUS_ROAMING;
-
-   attach = attach && gprs->powered;
-
-   if (gprs->driver_attached == attach)
-   return;
-
-   if (gprs->flags & GPRS_FLAG_ATTACHING) {
-   gprs->flags |= GPRS_FLAG_RECHECK;
-   return;
-   }
-
-   gprs->flags |= GPRS_FLAG_ATTACHING;
-
-   gprs->driver->set_attached(gprs, attach, gprs_attach_callback, gprs);
-   gprs->driver_attached = attach;
-}
-
-static void netreg_status_changed(int status, int lac, int ci, int tech,
-   const char *mcc, const char *mnc,
-   void *data)
-{
-   struct ofono_gprs *gprs = data;
-
-   DBG("%d", status);
-
-   if (gprs->netreg_status == status)
-   return;
-
-   gprs->netreg_status = status;
-
-   gprs_netreg_update(gprs);
 }
 
 static DBusMessage *gprs_get_properties(DBusConnection *conn,
@@ -1526,9 +1436,6 @@ static DBusMes

[PATCH 2/7] doc: remove RoamingAllowed

2011-02-09 Thread Rémi Denis-Courmont
---
 doc/connman-api.txt |8 
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/doc/connman-api.txt b/doc/connman-api.txt
index 22c59dc..4c24701 100644
--- a/doc/connman-api.txt
+++ b/doc/connman-api.txt
@@ -106,14 +106,6 @@ Properties boolean Attached [readonly]
for an appropriate time for GPRS service to resume
before taking corrective action.
 
-   boolean RoamingAllowed [readwrite]
-
-   Contains whether data roaming is allowed.  In the off
-   setting, if the packet radio registration state
-   indicates that the modem is roaming, oFono will
-   automatically detach and no further connection
-   establishment will be possible.
-
boolean Powered [readwrite]
 
Controls whether packet radio use is allowed. Setting
-- 
1.7.1

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


[PATCH 1/7] gprs: remove RoamingAllowed property

2011-02-09 Thread Rémi Denis-Courmont
No roaming policies need to be enforced per GPRS context rather than
for the whole GPRS service. Otherwise, you would not be able to receive
an MMS or even register to the IMS SIP while roaming.
---
 src/gprs.c |   52 +++-
 1 files changed, 3 insertions(+), 49 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 33711dc..ee66b2a 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -76,7 +76,6 @@ struct ofono_gprs {
GSList *contexts;
ofono_bool_t attached;
ofono_bool_t driver_attached;
-   ofono_bool_t roaming_allowed;
ofono_bool_t powered;
ofono_bool_t suspended;
int status;
@@ -1427,10 +1426,8 @@ static void gprs_netreg_update(struct ofono_gprs *gprs)
 {
ofono_bool_t attach;
 
-   attach = gprs->netreg_status == NETWORK_REGISTRATION_STATUS_REGISTERED;
-
-   attach = attach || (gprs->roaming_allowed &&
-   gprs->netreg_status == NETWORK_REGISTRATION_STATUS_ROAMING);
+   attach = gprs->netreg_status == NETWORK_REGISTRATION_STATUS_REGISTERED
+   || NETWORK_REGISTRATION_STATUS_ROAMING;
 
attach = attach && gprs->powered;
 
@@ -1493,10 +1490,6 @@ static DBusMessage *gprs_get_properties(DBusConnection 
*conn,
DBUS_TYPE_STRING, &bearer);
}
 
-   value = gprs->roaming_allowed;
-   ofono_dbus_dict_append(&dict, "RoamingAllowed",
-   DBUS_TYPE_BOOLEAN, &value);
-
value = gprs->powered;
ofono_dbus_dict_append(&dict, "Powered", DBUS_TYPE_BOOLEAN, &value);
 
@@ -1538,27 +1531,7 @@ static DBusMessage *gprs_set_property(DBusConnection 
*conn,
 
dbus_message_iter_recurse(&iter, &var);
 
-   if (!strcmp(property, "RoamingAllowed")) {
-   if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BOOLEAN)
-   return __ofono_error_invalid_args(msg);
-
-   dbus_message_iter_get_basic(&var, &value);
-
-   if (gprs->roaming_allowed == (ofono_bool_t) value)
-   return dbus_message_new_method_return(msg);
-
-   gprs->roaming_allowed = value;
-
-   if (gprs->settings) {
-   g_key_file_set_integer(gprs->settings, SETTINGS_GROUP,
-   "RoamingAllowed",
-   gprs->roaming_allowed);
-   storage_sync(gprs->imsi, SETTINGS_STORE,
-   gprs->settings);
-   }
-
-   gprs_netreg_update(gprs);
-   } else if (!strcmp(property, "Powered")) {
+   if (!strcmp(property, "Powered")) {
if (gprs->driver->set_attached == NULL)
return __ofono_error_not_implemented(msg);
 
@@ -2001,10 +1974,6 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, 
int status)
if (gprs->powered == FALSE)
goto detach;
 
-   if (gprs->roaming_allowed == FALSE &&
-   status == NETWORK_REGISTRATION_STATUS_ROAMING)
-   goto detach;
-
gprs->driver_attached = TRUE;
gprs_attached_update(gprs);
 
@@ -2509,7 +2478,6 @@ static void gprs_load_settings(struct ofono_gprs *gprs, 
const char *imsi)
/*
 * If any error occurs, simply switch to defaults.
 * Default to Powered = True
-* and RoamingAllowed = False
 */
if (error) {
g_error_free(error);
@@ -2518,20 +2486,6 @@ static void gprs_load_settings(struct ofono_gprs *gprs, 
const char *imsi)
"Powered", gprs->powered);
}
 
-   error = NULL;
-   gprs->roaming_allowed = g_key_file_get_boolean(gprs->settings,
-   SETTINGS_GROUP,
-   "RoamingAllowed",
-   &error);
-
-   if (error) {
-   g_error_free(error);
-   gprs->roaming_allowed = FALSE;
-   g_key_file_set_boolean(gprs->settings, SETTINGS_GROUP,
-   "RoamingAllowed",
-   gprs->roaming_allowed);
-   }
-
groups = g_key_file_get_groups(gprs->settings, NULL);
 
for (i = 0; groups[i]; i++) {
-- 
1.7.1

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


[PATCHv2 0/7] Move GPRS attach logic to the modem

2011-02-09 Thread Rémi Denis-Courmont
   Hello,

This series moves responsibility for GPRS attach to the modem.

In most cases, the modem will attach on-demand when a first context is
activated. This simplifies the oFono interface and implementation.

Some operators require the device be always attached. This is managed
by a new driver callback to set the attach policy.

TBD: configuration option for the policy

Changes since version 1:
 - rebased

-- 
Rémi Denis-Courmont
Nokia Devices R&D, Maemo Software, Helsinki
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


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

2011-02-09 Thread Aki Niemi
Hi Marcel,

2010/11/23 Marcel Holtmann :
>> So the aa{sv} parameter/return value would be of format:
>> {
>>   'name'    : string,
>>   'group'   : string,   // optional, for eg. organization
>>   'hidden'  : integer,  // boolean value: defaults to 0
>>   'numbers' : array of dict {
>>     'number'   : string,
>>     'category' : integer
>>   },
>>   'emails' : array of dict {
>>     'address'  : string,
>>     'category' : integer
>>   },
>>   'voip_uris' : array of dict {
>>     'uri'      : string,
>>     'category' : integer
>>   },
>> }
>>
>> category : enum { // like existing "enum phonebook_number_type"
>>   HOME, MOBILE, FAX, WORK, OTHER
>> }
>
> this feels a bit too complicated for me. I actually don't want to
> over-design this feature, but it does have to be consistent with our
> other key names.

I agree, how about a strict subset of the spec, like a dict of name -> number?

> To be honest, the more and more I think about this, the more my
> conclusion is to not support phonebook export. It is a bad idea. It is
> highly complex and it is not a feature that will be used anyway.

I tend to agree. However, people seem to really want to have this
export(), so we need to arrive at some reasonable conclusion here.

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


[PATCH] Fix Uplink data transfer in RawIP mode

2011-02-09 Thread Carlos Pargada
Fix Uplink Data transfer in RawIP mode with IFX Modem

Change Data flow from stream mode to Packet mode between GatRawIP and GatMux.


---
 gatchat/gatio.c|   98 ++-
 gatchat/gatio.h|1 +
 gatchat/gatrawip.c |   75 ++-
 3 files changed, 155 insertions(+), 19 deletions(-)

diff --git a/gatchat/gatio.c b/gatchat/gatio.c
index 9d44a78..5ad640d 100644
--- a/gatchat/gatio.c
+++ b/gatchat/gatio.c
@@ -77,7 +77,7 @@ static void read_watcher_destroy_notify(gpointer user_data)
io->user_disconnect(io->user_disconnect_data);
 }
 
-static gboolean received_data(GIOChannel *channel, GIOCondition cond,
+static gboolean stream_received_data(GIOChannel *channel, GIOCondition cond,
gpointer data)
 {
unsigned char *buf;
@@ -132,6 +132,51 @@ static gboolean received_data(GIOChannel *channel, 
GIOCondition cond,
return TRUE;
 }
 
+static gboolean packet_received_data(GIOChannel *channel, GIOCondition cond,
+   gpointer data)
+{
+   unsigned char *buf;
+   GAtIO *io = data;
+   GIOStatus status;
+   gsize rbytes;
+   gsize toread;
+
+
+   if (cond & G_IO_NVAL)
+   return FALSE;
+
+   toread= 2048;
+   rbytes = 0;
+
+   ring_buffer_reset(io->buf);
+   buf = ring_buffer_write_ptr(io->buf, 0);
+
+   if (buf == NULL)
+   return FALSE;
+
+   status = g_io_channel_read_chars(channel, (char *) buf,
+   toread, &rbytes, NULL);
+
+   if (status == G_IO_STATUS_ERROR)
+   return FALSE;
+
+   if (rbytes > 0)
+   ring_buffer_write_advance(io->buf, rbytes);
+
+
+
+   if (rbytes > 0 && io->read_handler)
+   io->read_handler(io->buf, io->read_data);
+
+   if (cond & (G_IO_HUP | G_IO_ERR))
+   return FALSE;
+
+   if (rbytes == 0 && status != G_IO_STATUS_AGAIN)
+   return FALSE;
+
+   return TRUE;
+}
+
 gsize g_at_io_write(GAtIO *io, const gchar *data, gsize count)
 {
GIOStatus status;
@@ -175,6 +220,50 @@ static gboolean can_write_data(GIOChannel *channel, 
GIOCondition cond,
 
 }
 
+static GAtIO *create_packet_io(GIOChannel *channel, GIOFlags flags)
+{
+   GAtIO *io;
+
+   if (channel == NULL)
+   return NULL;
+
+   io = g_try_new0(GAtIO, 1);
+
+   if (io == NULL)
+   return io;
+
+   io->ref_count = 1;
+   io->debugf = NULL;
+
+
+   io->max_read_attempts = 1;
+   io->use_write_watch = TRUE;
+
+   io->buf = ring_buffer_new(2048);
+
+   if (!io->buf)
+   goto error;
+
+   if (!g_at_util_setup_io(channel, flags))
+   goto error;
+
+   io->channel = channel;
+   io->read_watch = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT,
+   G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+   packet_received_data, io,
+   read_watcher_destroy_notify);
+
+   return io;
+
+error:
+   if (io->buf)
+   ring_buffer_free(io->buf);
+
+   g_free(io);
+
+   return NULL;
+}
+
 static GAtIO *create_io(GIOChannel *channel, GIOFlags flags)
 {
GAtIO *io;
@@ -208,7 +297,7 @@ static GAtIO *create_io(GIOChannel *channel, GIOFlags flags)
io->channel = channel;
io->read_watch = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
-   received_data, io,
+   stream_received_data, io,
read_watcher_destroy_notify);
 
return io;
@@ -222,6 +311,11 @@ error:
return NULL;
 }
 
+GAtIO *g_raw_io_new(GIOChannel *channel)
+{
+   return create_packet_io(channel, G_IO_FLAG_NONBLOCK);
+}
+
 GAtIO *g_at_io_new(GIOChannel *channel)
 {
return create_io(channel, G_IO_FLAG_NONBLOCK);
diff --git a/gatchat/gatio.h b/gatchat/gatio.h
index 5a9f9f9..4b8bc00 100644
--- a/gatchat/gatio.h
+++ b/gatchat/gatio.h
@@ -37,6 +37,7 @@ struct ring_buffer;
 typedef void (*GAtIOReadFunc)(struct ring_buffer *buffer, gpointer user_data);
 typedef gboolean (*GAtIOWriteFunc)(gpointer user_data);
 
+GAtIO *g_raw_io_new(GIOChannel *channel);
 GAtIO *g_at_io_new(GIOChannel *channel);
 GAtIO *g_at_io_new_blocking(GIOChannel *channel);
 
diff --git a/gatchat/gatrawip.c b/gatchat/gatrawip.c
index 539f71f..ab72035 100644
--- a/gatchat/gatrawip.c
+++ b/gatchat/gatrawip.c
@@ -42,10 +42,17 @@ struct _GAtRawIP {
char *ifname;
struct ring_buffer *write_buffer;
struct ring_buffer *tun_write_buffer;
+   GQueue *packet_queue;
GAtDebugFunc debugf;
gpointer debug_data;
 };
 
+struct PacketRaw {
+   unsigned char *buf;
+   int len;
+};
+
+
 GAtRawIP *g_at_rawip_new(GIOChannel *channel)

Re: [PATCH -v3 5/7] dun_gw: Add DUN server plugin for oFono

2011-02-09 Thread Guillaume Zajac

Hi Gustavo,

On 08/02/2011 23:01, Gustavo F. Padovan wrote:

DUN server is probed when modem state changes to online. It registers
DUN record to Bluetooth adapter and wait for incoming DUN connection.

Based on a patch from Zhenhua Zhang
---
  Makefile.am |3 +
  plugins/bluetooth.h |3 +
  plugins/dun_gw.c|  189 +++
  3 files changed, 195 insertions(+), 0 deletions(-)
  create mode 100644 plugins/dun_gw.c

diff --git a/Makefile.am b/Makefile.am
index 047a85f..8a845fa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -321,6 +321,9 @@ builtin_sources += plugins/bluetooth.c plugins/bluetooth.h
  builtin_modules += hfp
  builtin_sources += plugins/hfp.c plugins/bluetooth.h

+builtin_modules += dun_gw
+builtin_sources += plugins/dun_gw.c plugins/bluetooth.h
+
  builtin_sources += $(btio_sources)
  builtin_cflags += @BLUEZ_CFLAGS@
  builtin_libadd += @BLUEZ_LIBS@
diff --git a/plugins/bluetooth.h b/plugins/bluetooth.h
index 505d908..79e1a4a 100644
--- a/plugins/bluetooth.h
+++ b/plugins/bluetooth.h
@@ -32,6 +32,9 @@
  /* Profiles bitfield */
  #define HFP_AG 0x01

+/* Server bitfield */
+#define DUN_GW 0x01
+
  struct bluetooth_profile {
const char *name;
int (*create)(const char *device, const char *dev_addr,
diff --git a/plugins/dun_gw.c b/plugins/dun_gw.c
new file mode 100644
index 000..32c199e
--- /dev/null
+++ b/plugins/dun_gw.c
@@ -0,0 +1,189 @@
+/*
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include
+#endif
+#include
+#include
+#include
+#include
+#include
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include
+#include
+#include
+#include
+
+#include "bluetooth.h"
+
+#define DUN_GW_CHANNEL 1
+
+static struct server *server;
+static guint modemwatch_id;
+static guint channel_watch;
+
+static const gchar *dun_record = "  
 \
+   
 \
+ \
+  \
+  \
+ \
+  \
+   
\
+ \
+  \
+\
+\
+   \
+\
+\
+  \
+   \
+ \
+  \
+   
\
+ \
+  \
+\
+\
+ \
+   \
+ \
+  \
+   
\
+ \
+  \
+  \
+";
+
+
+static gboolean dun_gw_disconnect_cb(GIOChannel *io, GIOCondition cond,
+   gpointer user_data)
+{
+   g_io_channel_unref(io);
+
+   return FALSE;
+}
+
+static void dun_gw_connect_cb(GIOChannel *io, GError *err, gpointer user_data)
+{
+   struct ofono_emulator *emulator = user_data;
+   int fd;
+
+   DBG("");
+
+   if (err) {
+   DBG("%s", err->message);
+   

[RFC PATCH 3/3] voicecall: handle voice call SS notifications

2011-02-09 Thread Andras Domokos
---
 include/types.h |2 +
 src/voicecall.c |  242 ++-
 2 files changed, 241 insertions(+), 3 deletions(-)

diff --git a/include/types.h b/include/types.h
index d25f409..b639c8a 100644
--- a/include/types.h
+++ b/include/types.h
@@ -96,6 +96,8 @@ struct ofono_call {
char name[OFONO_MAX_CALLER_NAME_LENGTH + 1];
int clip_validity;
int cnap_validity;
+   ofono_bool_t remote_held;
+   ofono_bool_t remote_multiparty;
 };
 
 struct ofono_network_time {
diff --git a/src/voicecall.c b/src/voicecall.c
index 4606668..7178714 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -53,6 +53,15 @@ struct ofono_voicecall {
struct ofono_sim_context *sim_context;
unsigned int sim_watch;
unsigned int sim_state_watch;
+   struct ofono_ssn *ssn;
+   unsigned int ssn_watch;
+   unsigned int ssn_mt_fwd_watch;
+   unsigned int ssn_mt_hold_watch;
+   unsigned int ssn_mt_unhold_watch;
+   unsigned int ssn_mt_mpty_watch;
+   unsigned int ssn_mo_fwd_watch;
+   unsigned int ssn_mo_local_bar_watch;
+   unsigned int ssn_mo_remote_bar_watch;
const struct ofono_voicecall_driver *driver;
void *driver_data;
struct ofono_atom *atom;
@@ -400,6 +409,12 @@ static void append_voicecall_properties(struct voicecall 
*v,
 
ofono_dbus_dict_append(dict, "Multiparty", DBUS_TYPE_BOOLEAN, &mpty);
 
+   ofono_dbus_dict_append(dict, "RemoteHeld", DBUS_TYPE_BOOLEAN,
+   &v->call->remote_held);
+
+   ofono_dbus_dict_append(dict, "RemoteMultiparty", DBUS_TYPE_BOOLEAN,
+   &v->call->remote_multiparty);
+
if (v->message)
ofono_dbus_dict_append(dict, "Information",
DBUS_TYPE_STRING, &v->message);
@@ -1869,9 +1884,11 @@ static GDBusMethodTable manager_methods[] = {
 };
 
 static GDBusSignalTable manager_signals[] = {
-   { "PropertyChanged","sv" },
-   { "CallAdded",  "oa{sv}" },
-   { "CallRemoved","o" },
+   { "Forwarded",   "s" },
+   { "BarringActive",   "s" },
+   { "PropertyChanged", "sv" },
+   { "CallAdded",   "oa{sv}" },
+   { "CallRemoved", "o" },
{ }
 };
 
@@ -2182,6 +2199,11 @@ static void voicecall_unregister(struct ofono_atom *atom)
vc->sim_watch = 0;
}
 
+   if (vc->ssn_watch) {
+   __ofono_modem_remove_atom_watch(modem, vc->ssn_watch);
+   vc->ssn_watch = 0;
+   }
+
if (vc->dial_req)
dial_request_finish(vc);
 
@@ -2225,6 +2247,29 @@ static void voicecall_remove(struct ofono_atom *atom)
vc->sim = NULL;
}
 
+   if (vc->ssn_mt_fwd_watch)
+   __ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_mt_fwd_watch);
+
+   if (vc->ssn_mt_hold_watch)
+   __ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_mt_hold_watch);
+
+   if (vc->ssn_mt_unhold_watch)
+   __ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_mt_unhold_watch);
+
+   if (vc->ssn_mt_mpty_watch)
+   __ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_mt_mpty_watch);
+
+   if (vc->ssn_mo_fwd_watch)
+   __ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_mo_fwd_watch);
+
+   if (vc->ssn_mo_local_bar_watch)
+   __ofono_ssn_mt_watch_remove(vc->ssn,
+   vc->ssn_mo_local_bar_watch);
+
+   if (vc->ssn_mo_remote_bar_watch)
+   __ofono_ssn_mo_watch_remove(vc->ssn,
+   vc->ssn_mo_remote_bar_watch);
+
if (vc->tone_source) {
g_source_remove(vc->tone_source);
vc->tone_source = 0;
@@ -2341,12 +2386,194 @@ static void sim_watch(struct ofono_atom *atom,
sim_state_watch(ofono_sim_get_state(sim), vc);
 }
 
+static void ssn_mt_forwarded_notify(unsigned int id, int code1, int idx,
+   const struct ofono_phone_number *ph,
+   void *data)
+{
+   struct ofono_voicecall *vc = data;
+   DBusConnection *conn = ofono_dbus_get_connection();
+   const char *path = __ofono_atom_get_path(vc->atom);
+   char *info = "incoming";
+
+   g_dbus_emit_signal(conn, path, OFONO_VOICECALL_MANAGER_INTERFACE,
+   "Forwarded",
+   DBUS_TYPE_STRING, &info,
+   DBUS_TYPE_INVALID);
+}
+
+static struct voicecall *voicecall_select(struct ofono_voicecall *vc,
+   unsigned int id, int code)
+{
+   struct voicecall *v = NULL;
+   GSList *l;
+
+   for (l = vc->call_list; l; l = l->next) {
+   struct voicecall *v1 = l->data;
+
+   if (id == 0 && g_slist_length(vc->call_list) == 1) {
+  

[RFC PATCH 2/3] ssn: add code and call id to notifications

2011-02-09 Thread Andras Domokos
---
 drivers/atmodem/ssn.c |4 ++--
 include/ssn.h |7 ---
 src/ofono.h   |6 --
 src/ssn.c |   11 ++-
 4 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/atmodem/ssn.c b/drivers/atmodem/ssn.c
index b7a9df4..b00871d 100644
--- a/drivers/atmodem/ssn.c
+++ b/drivers/atmodem/ssn.c
@@ -56,7 +56,7 @@ static void cssi_notify(GAtResult *result, gpointer user_data)
if (!g_at_result_iter_next_number(&iter, &index))
index = 0;
 
-   ofono_ssn_cssi_notify(ssn, code1, index);
+   ofono_ssn_cssi_notify(ssn, 0, code1, index);
 }
 
 static void cssu_notify(GAtResult *result, gpointer user_data)
@@ -93,7 +93,7 @@ static void cssu_notify(GAtResult *result, gpointer user_data)
return;
 
 out:
-   ofono_ssn_cssu_notify(ssn, code2, index, &ph);
+   ofono_ssn_cssu_notify(ssn, 0, code2, index, &ph);
 }
 
 static void at_ssn_initialized(gboolean ok, GAtResult *result,
diff --git a/include/ssn.h b/include/ssn.h
index d640cad..ba3701b 100644
--- a/include/ssn.h
+++ b/include/ssn.h
@@ -37,9 +37,10 @@ struct ofono_ssn_driver {
 };
 
 /* SSN notifications (CSSI and CSSU).  */
-void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, int code, int index);
-void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, int code, int index,
-   const struct ofono_phone_number *number);
+void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, unsigned int id,
+   int code1, int index);
+void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, unsigned int id, int code2,
+   int index, const struct ofono_phone_number *number);
 
 int ofono_ssn_driver_register(const struct ofono_ssn_driver *d);
 void ofono_ssn_driver_unregister(const struct ofono_ssn_driver *d);
diff --git a/src/ofono.h b/src/ofono.h
index 6ba0187..eafab21 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -314,8 +314,10 @@ int __ofono_sms_sim_download(struct ofono_stk *stk, const 
struct sms *msg,
 
 #include 
 
-typedef void (*ofono_ssn_mo_notify_cb)(int index, void *user);
-typedef void (*ofono_ssn_mt_notify_cb)(int index,
+typedef void (*ofono_ssn_mo_notify_cb)(unsigned int id, int code1, int index,
+   void *user);
+
+typedef void (*ofono_ssn_mt_notify_cb)(unsigned int id, int code2, int index,
const struct ofono_phone_number *ph,
void *user);
 
diff --git a/src/ssn.c b/src/ssn.c
index 64c94b7..065e4fd 100644
--- a/src/ssn.c
+++ b/src/ssn.c
@@ -112,7 +112,8 @@ gboolean __ofono_ssn_mt_watch_remove(struct ofono_ssn *ssn, 
unsigned int id)
return __ofono_watchlist_remove_item(ssn->mt_handler_list, id);
 }
 
-void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, int code1, int index)
+void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, unsigned int id,
+   int code1, int index)
 {
struct ssn_handler *h;
GSList *l;
@@ -123,12 +124,12 @@ void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, int 
code1, int index)
notify = h->item.notify;
 
if (h->code == code1)
-   notify(index, h->item.notify_data);
+   notify(id, code1, index, h->item.notify_data);
}
 }
 
-void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, int code2, int index,
-   const struct ofono_phone_number *ph)
+void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, unsigned int id, int code2,
+   int index, const struct ofono_phone_number *ph)
 {
struct ssn_handler *h;
GSList *l;
@@ -139,7 +140,7 @@ void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, int 
code2, int index,
notify = h->item.notify;
 
if (h->code == code2)
-   notify(index, ph, h->item.notify_data);
+   notify(id, code2, index, ph, h->item.notify_data);
}
 }
 
-- 
1.7.0.4

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


[RFC PATCH 1/3] call-barring: removed +CSSI type SS notifications

2011-02-09 Thread Andras Domokos
---
 src/call-barring.c |   74 
 1 files changed, 0 insertions(+), 74 deletions(-)

diff --git a/src/call-barring.c b/src/call-barring.c
index 649826e..84ed277 100644
--- a/src/call-barring.c
+++ b/src/call-barring.c
@@ -58,9 +58,6 @@ struct ofono_call_barring {
int ss_req_lock;
struct ofono_ssn *ssn;
struct ofono_ussd *ussd;
-   unsigned int incoming_bar_watch;
-   unsigned int outgoing_bar_watch;
-   unsigned int ssn_watch;
unsigned int ussd_watch;
const struct ofono_call_barring_driver *driver;
void *driver_data;
@@ -987,41 +984,10 @@ static GDBusMethodTable cb_methods[] = {
 };
 
 static GDBusSignalTable cb_signals[] = {
-   { "IncomingBarringInEffect","" },
-   { "OutgoingBarringInEffect","" },
{ "PropertyChanged","sv" },
{ }
 };
 
-static void call_barring_incoming_enabled_notify(int idx, void *userdata)
-{
-   struct ofono_call_barring *cb = userdata;
-   DBusConnection *conn = ofono_dbus_get_connection();
-   const char *path = __ofono_atom_get_path(cb->atom);
-
-   g_dbus_emit_signal(conn, path, OFONO_CALL_BARRING_INTERFACE,
-   "IncomingBarringInEffect", DBUS_TYPE_INVALID);
-}
-
-static void call_barring_outgoing_enabled_notify(int idx, void *userdata)
-{
-   struct ofono_call_barring *cb = userdata;
-   DBusConnection *conn = ofono_dbus_get_connection();
-   const char *path = __ofono_atom_get_path(cb->atom);
-   DBusMessage *signal;
-
-   signal = dbus_message_new_signal(path, OFONO_CALL_BARRING_INTERFACE,
-   "OutgoingBarringInEffect");
-
-   if (signal == NULL) {
-   ofono_error("Unable to allocate new %s.OutgoingBarringInEffect"
-   " signal", OFONO_CALL_BARRING_INTERFACE);
-   return;
-   }
-
-   g_dbus_send_message(conn, signal);
-}
-
 int ofono_call_barring_driver_register(const struct ofono_call_barring_driver 
*d)
 {
DBG("driver: %p, name: %s", d, d->name);
@@ -1054,14 +1020,6 @@ static void call_barring_unregister(struct ofono_atom 
*atom)
if (cb->ussd)
cb_unregister_ss_controls(cb);
 
-   if (cb->incoming_bar_watch)
-   __ofono_ssn_mo_watch_remove(cb->ssn, cb->incoming_bar_watch);
-   if (cb->outgoing_bar_watch)
-   __ofono_ssn_mt_watch_remove(cb->ssn, cb->outgoing_bar_watch);
-
-   if (cb->ssn_watch)
-   __ofono_modem_remove_atom_watch(modem, cb->ssn_watch);
-
if (cb->ussd_watch)
__ofono_modem_remove_atom_watch(modem, cb->ussd_watch);
 }
@@ -1116,29 +1074,6 @@ struct ofono_call_barring 
*ofono_call_barring_create(struct ofono_modem *modem,
return cb;
 }
 
-static void ssn_watch(struct ofono_atom *atom,
-   enum ofono_atom_watch_condition cond, void *data)
-{
-   struct ofono_call_barring *cb = data;
-
-   if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
-   cb->ssn = NULL;
-   cb->incoming_bar_watch = 0;
-   cb->outgoing_bar_watch = 0;
-   return;
-   }
-
-   cb->ssn = __ofono_atom_get_data(atom);
-
-   cb->incoming_bar_watch =
-   __ofono_ssn_mo_watch_add(cb->ssn, SS_MO_INCOMING_BARRING,
-   call_barring_incoming_enabled_notify, cb, NULL);
-
-   cb->outgoing_bar_watch =
-   __ofono_ssn_mo_watch_add(cb->ssn, SS_MO_OUTGOING_BARRING,
-   call_barring_outgoing_enabled_notify, cb, NULL);
-}
-
 static void ussd_watch(struct ofono_atom *atom,
enum ofono_atom_watch_condition cond, void *data)
 {
@@ -1158,7 +1093,6 @@ void ofono_call_barring_register(struct 
ofono_call_barring *cb)
DBusConnection *conn = ofono_dbus_get_connection();
const char *path = __ofono_atom_get_path(cb->atom);
struct ofono_modem *modem = __ofono_atom_get_modem(cb->atom);
-   struct ofono_atom *ssn_atom;
struct ofono_atom *ussd_atom;
 
if (!g_dbus_register_interface(conn, path,
@@ -1173,14 +1107,6 @@ void ofono_call_barring_register(struct 
ofono_call_barring *cb)
 
ofono_modem_add_interface(modem, OFONO_CALL_BARRING_INTERFACE);
 
-   cb->ssn_watch = __ofono_modem_add_atom_watch(modem, OFONO_ATOM_TYPE_SSN,
-   ssn_watch, cb, NULL);
-
-   ssn_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SSN);
-
-   if (ssn_atom && __ofono_atom_get_registered(ssn_atom))
-   ssn_watch(ssn_atom, OFONO_ATOM_WATCH_CONDITION_REGISTERED, cb);
-
cb->ussd_watch = __ofono_modem_add_atom_watch(modem,
OFONO_ATOM_TYPE_USSD,
ussd_watch, cb, NULL);
-- 
1.7.0.4

___
ofono mailing li

[PATCH 0/3] Voice call SS notifications

2011-02-09 Thread Andras Domokos
Here are the implementation proposal for handling some of the voice call
related Supplementary Services notifications.

Implementation details:
- removed the +CSSI type SS notifications handling from the
  call-barring code
- expanded the SS notify functions with call number info, useful
  for modems capable of delivering it in the SS notifications
- expanded the SS callback functions with call number info and
  service code, useful in demultiplexing when a common callback
  function is defined for multiple service codes
- added +CSSU and +CSSI type SS notifications handling to the
  voicecall code

The API level detailed changes are explained in the doc files. 

Andras Domokos (3):
  call-barring: removed +CSSI type SS notifications
  ssn: add code and call id to notifications
  voicecall: handle voice call SS notifications

 drivers/atmodem/ssn.c |4 +-
 include/ssn.h |7 +-
 include/types.h   |2 +
 src/call-barring.c|   74 ---
 src/ofono.h   |6 +-
 src/ssn.c |   11 +-
 src/voicecall.c   |  242 -
 7 files changed, 257 insertions(+), 89 deletions(-)

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


Re: [PATCH 1/2] ste: Add support for multiple pdp contexts.

2011-02-09 Thread Marit Sofie Henriksen
2011/2/8 Marcel Holtmann 

> Hi Marit,
>
> > diff --git a/plugins/ste.c b/plugins/ste.c
> > index cf8aed8..749c4f3 100644
> > --- a/plugins/ste.c
> > +++ b/plugins/ste.c
> > @@ -66,6 +66,7 @@
> >  #include 
> >
> >  #define NUM_CHAT 1
> > +#define MAX_PDP_CONTEXTS 4
> >
> >  static const char *cpin_prefix[] = { "+CPIN:", NULL };
> >
> > @@ -363,6 +364,7 @@ static void ste_post_online(struct ofono_modem
> *modem)
> >   struct ofono_message_waiting *mw;
> >   struct ofono_gprs *gprs;
> >   struct ofono_gprs_context *gc;
> > + int i;
> >
> >   DBG("%p", modem);
> >
> > @@ -378,13 +380,18 @@ static void ste_post_online(struct ofono_modem
> *modem)
> >
> >   gprs = ofono_gprs_create(modem, OFONO_VENDOR_MBM,
> >   "atmodem", data->chat);
> > - gc = ofono_gprs_context_create(modem, 0, "stemodem", data->chat);
> > -
> > - if (gprs && gc)
> > - ofono_gprs_add_context(gprs, gc);
> > + if (gprs) {
> > + for (i = 0; i < MAX_PDP_CONTEXTS; i++) {
> > + gc = ofono_gprs_context_create(
> > + modem, 0, "stemodem", data->chat);
> > + if (gc == NULL)
> > + break;
> > +
> > + ofono_gprs_add_context(gprs, gc);
> > + }
> > + }
>
> you do not need to create the GPRS context atom multiple times. You can
> just add the gc multiple times.
>
> So I just wanna make sure that you guys wanna have multiple GPRS context
> atom instances. For things like PPP and RawIP we have no other choice,
> but for example ISI is a bit more flexible here. That is the reason why
> we do allow it. Maybe CAIF is as flexible.
>
> It is a bit question about resources that are used. I am fine either
> way, but I need you to at least think about it ;)
>
> Regards
>
> Marcel
>
>
Hi Marcel,
Thanks for your input. We have given this some more thought and discussed
amongst us, and we would like to go for the solution as it is, adding
multiple GPRS context atom instances. I hope this is OK with you.

In the driver our internal gprs_context_data is associated with the
ofono_gprs_context. If we were to have only one gc, we would have to handle
all the activations with the same gprs_context_data, and that would bring us
back to where we were, with a significantly more complex implementation.

Br Marit


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