[PATCH] cdma-voicecall: Fix for crash when unregistering atom

2011-06-13 Thread Dara Spieker-Doyle
---
 src/cdma-voicecall.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/cdma-voicecall.c b/src/cdma-voicecall.c
index a590063..2bdf850 100644
--- a/src/cdma-voicecall.c
+++ b/src/cdma-voicecall.c
@@ -335,6 +335,18 @@ void ofono_cdma_voicecall_driver_unregister(
g_drivers = g_slist_remove(g_drivers, (void *)d);
 }
 
+static void cdma_voicecall_unregister(struct ofono_atom *atom)
+{
+   DBusConnection *conn = ofono_dbus_get_connection();
+   struct ofono_modem *modem = __ofono_atom_get_modem(atom);
+   const char *path = __ofono_atom_get_path(atom);
+
+   g_dbus_unregister_interface(conn, path,
+   OFONO_CDMA_VOICECALL_MANAGER_INTERFACE);
+   ofono_modem_remove_interface(modem,
+   OFONO_CDMA_VOICECALL_MANAGER_INTERFACE);
+}
+
 static void voicecall_manager_remove(struct ofono_atom *atom)
 {
struct ofono_cdma_voicecall *vc = __ofono_atom_get_data(atom);
@@ -405,6 +417,8 @@ void ofono_cdma_voicecall_register(struct 
ofono_cdma_voicecall *vc)
 
ofono_modem_add_interface(modem,
OFONO_CDMA_VOICECALL_MANAGER_INTERFACE);
+
+   __ofono_atom_register(vc-atom, cdma_voicecall_unregister);
 }
 
 void ofono_cdma_voicecall_remove(struct ofono_cdma_voicecall *vc)
-- 
1.7.4.1

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


Re: [PATCH] cdma-voicecall: Fix for crash when unregistering atom

2011-06-13 Thread Dara Spieker-Doyle

On 06/13/2011 03:37 PM, Dara Spieker-Doyle wrote:

---
  src/cdma-voicecall.c |   14 ++
  1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/cdma-voicecall.c b/src/cdma-voicecall.c
index a590063..2bdf850 100644
--- a/src/cdma-voicecall.c
+++ b/src/cdma-voicecall.c
@@ -335,6 +335,18 @@ void ofono_cdma_voicecall_driver_unregister(
g_drivers = g_slist_remove(g_drivers, (void *)d);
  }

Please ignore this patch as it contains incorrect formatting. I shall 
resubmit.


Regards
Dara

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


[PATCH v2] cdma-voicecall: Fix for crash when unregistering atom

2011-06-13 Thread Dara Spieker-Doyle
---
 src/cdma-voicecall.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/cdma-voicecall.c b/src/cdma-voicecall.c
index a590063..183433d 100644
--- a/src/cdma-voicecall.c
+++ b/src/cdma-voicecall.c
@@ -335,6 +335,18 @@ void ofono_cdma_voicecall_driver_unregister(
g_drivers = g_slist_remove(g_drivers, (void *)d);
 }
 
+static void cdma_voicecall_unregister(struct ofono_atom *atom)
+{
+   DBusConnection *conn = ofono_dbus_get_connection();
+   struct ofono_modem *modem = __ofono_atom_get_modem(atom);
+   const char *path = __ofono_atom_get_path(atom);
+
+   g_dbus_unregister_interface(conn, path,
+   OFONO_CDMA_VOICECALL_MANAGER_INTERFACE);
+   ofono_modem_remove_interface(modem,
+   OFONO_CDMA_VOICECALL_MANAGER_INTERFACE);
+}
+
 static void voicecall_manager_remove(struct ofono_atom *atom)
 {
struct ofono_cdma_voicecall *vc = __ofono_atom_get_data(atom);
@@ -405,6 +417,8 @@ void ofono_cdma_voicecall_register(struct 
ofono_cdma_voicecall *vc)
 
ofono_modem_add_interface(modem,
OFONO_CDMA_VOICECALL_MANAGER_INTERFACE);
+
+   __ofono_atom_register(vc-atom, cdma_voicecall_unregister);
 }
 
 void ofono_cdma_voicecall_remove(struct ofono_cdma_voicecall *vc)
-- 
1.7.4.1

___
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


[PATCH 1/7] gatchat: Share utility with CDMA network driver

2011-02-08 Thread Dara Spieker-Doyle
---
 gatchat/gatresult.c |   11 ---
 gatchat/gatresult.h |   11 +++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/gatchat/gatresult.c b/gatchat/gatresult.c
index 8a6dfae..6bd3ff1 100644
--- a/gatchat/gatresult.c
+++ b/gatchat/gatresult.c
@@ -94,17 +94,6 @@ const char *g_at_result_iter_raw_line(GAtResultIter *iter)
return line;
 }
 
-static inline int skip_to_next_field(const char *line, int pos, int len)
-{
-   if (pos  len  line[pos] == ',')
-   pos += 1;
-
-   while (pos  len  line[pos] == ' ')
-   pos += 1;
-
-   return pos;
-}
-
 gboolean g_at_result_iter_next_unquoted_string(GAtResultIter *iter,
const char **str)
 {
diff --git a/gatchat/gatresult.h b/gatchat/gatresult.h
index a74741f..62a2b79 100644
--- a/gatchat/gatresult.h
+++ b/gatchat/gatresult.h
@@ -68,6 +68,17 @@ const char *g_at_result_pdu(GAtResult *result);
 
 gint g_at_result_num_response_lines(GAtResult *result);
 
+static inline int skip_to_next_field(const char *line, int pos, int len)
+{
+   if (pos  len  line[pos] == ',')
+   pos += 1;
+
+   while (pos  len  line[pos] == ' ')
+   pos += 1;
+
+   return pos;
+}
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.7.0.4

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


[PATCH 0/7] Add CDMA Signal Strength Support

2011-02-08 Thread Dara Spieker-Doyle
This is a series of patches to provide CDMA Signal Strength support for the 
1xRTT
network. It provides both new atom and driver code.

HW support for testing is implemented in the nokiacdma plugin. This modem does
not support unsolicited notifications for the signal strength via the AT
interface, so this functionality is implemented with polling for the nokiacdma
plugin.

These patches have been tested against the Nokia 7205 CDMA device in a tethered
mode.

Limitations
---

The Nokia 7205 device does not support multiple AT ports, so notification of
network properties (such as the signal strength) is not available while the
port is busy with e.g. data traffic.
Support for handling these scenarios is future work.

Dara Spieker-Doyle (7):
  gatchat: Share utility with CDMA network driver
  dbus: Add CDMA netreg atom support
  cdma-netreg: Add Signal Strength Support
  cdma-netreg: Add Signal Strength Support
  cdmamodem: Add Signal Strength Support
  nokiacdma: Add cdma-netreg Support
  test: Add CDMA Signal Strength Support

 Makefile.am   |   11 +-
 drivers/cdmamodem/cdmamodem.c |2 +
 drivers/cdmamodem/cdmamodem.h |2 +
 drivers/cdmamodem/network-registration.c  |  211 
 gatchat/gatresult.c   |   11 -
 gatchat/gatresult.h   |   11 +
 include/cdma-netreg.h |   77 +++
 include/dbus.h|2 +
 plugins/nokiacdma.c   |4 +
 src/cdma-network.c|  263 +
 src/ofono.h   |2 +
 test/cdma-get-current-network-signal-strength |   21 ++
 12 files changed, 602 insertions(+), 15 deletions(-)
 create mode 100644 drivers/cdmamodem/network-registration.c
 create mode 100644 include/cdma-netreg.h
 create mode 100644 src/cdma-network.c
 create mode 100755 test/cdma-get-current-network-signal-strength

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


[PATCH 2/7] dbus: Add CDMA netreg atom support

2011-02-08 Thread Dara Spieker-Doyle
---
 include/dbus.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/dbus.h b/include/dbus.h
index 19a138a..3e80c36 100644
--- a/include/dbus.h
+++ b/include/dbus.h
@@ -60,6 +60,8 @@ extern C {
 /* CDMA Interfaces */
 #define OFONO_CDMA_VOICECALL_MANAGER_INTERFACE 
org.ofono.cdma.VoiceCallManager
 #define OFONO_CDMA_MESSAGE_MANAGER_INTERFACE org.ofono.cdma.MessageManager
+#define OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE \
+   org.ofono.cdma.NetworkRegistration
 
 /* Essentially a{sv} */
 #define OFONO_PROPERTIES_ARRAY_SIGNATURE DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING \
-- 
1.7.0.4

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


[PATCH 3/7] cdma-netreg: Add Signal Strength Support

2011-02-08 Thread Dara Spieker-Doyle
---
 Makefile.am   |2 +-
 include/cdma-netreg.h |   77 +
 2 files changed, 78 insertions(+), 1 deletions(-)
 create mode 100644 include/cdma-netreg.h

diff --git a/Makefile.am b/Makefile.am
index 758fb10..93550d0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,7 @@ pkginclude_HEADERS = include/log.h include/plugin.h 
include/history.h \
include/audio-settings.h include/nettime.h \
include/ctm.h include/cdma-voicecall.h \
include/cdma-sms.h include/sim-auth.h \
-   include/gprs-provision.h
+   include/gprs-provision.h include/cdma-netreg.h
 
 nodist_pkginclude_HEADERS = include/version.h
 
diff --git a/include/cdma-netreg.h b/include/cdma-netreg.h
new file mode 100644
index 000..4472a89
--- /dev/null
+++ b/include/cdma-netreg.h
@@ -0,0 +1,77 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2011  Nokia 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
+ *
+ */
+
+#ifndef __OFONO_CDMA_NETREG_H
+#define __OFONO_CDMA_NETREG_H
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#include ofono/types.h
+
+struct ofono_cdma_netreg;
+
+typedef void (*ofono_cdma_netreg_strength_cb_t)(
+   const struct ofono_error *error,
+   int strength, void *data);
+
+/*
+ * Network related functions, including registration status, operator selection
+ * and signal strength indicators.
+ */
+struct ofono_cdma_netreg_driver {
+   const char *name;
+   int (*probe)(struct ofono_cdma_netreg *netreg, unsigned int vendor,
+   void *data);
+   void (*remove)(struct ofono_cdma_netreg *netreg);
+   void (*strength)(struct ofono_cdma_netreg *netreg,
+   ofono_cdma_netreg_strength_cb_t, void *data);
+};
+
+/*
+ * It is the plugin's responsibility to implement CSQ polling if the modem
+ * does not support vendor extensions for signal strength notification.
+ */
+void ofono_cdma_netreg_strength_notify(struct ofono_cdma_netreg *netreg,
+   int strength);
+
+int ofono_cdma_netreg_driver_register(
+   const struct ofono_cdma_netreg_driver *d);
+void ofono_cdma_netreg_driver_unregister(
+   const struct ofono_cdma_netreg_driver *d);
+
+struct ofono_cdma_netreg *ofono_cdma_netreg_create(struct ofono_modem *modem,
+   unsigned int vendor,
+   const char *driver,
+   void *data);
+
+void ofono_cdma_netreg_register(struct ofono_cdma_netreg *netreg);
+void ofono_cdma_netreg_remove(struct ofono_cdma_netreg *netreg);
+
+void ofono_cdma_netreg_set_data(struct ofono_cdma_netreg *netreg, void *data);
+void *ofono_cdma_netreg_get_data(struct ofono_cdma_netreg *netreg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_CDMA_NETREG_H */
-- 
1.7.0.4

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


[PATCH 4/7] cdma-netreg: Add Signal Strength Support

2011-02-08 Thread Dara Spieker-Doyle
---
 Makefile.am|3 +-
 src/cdma-network.c |  263 
 src/ofono.h|2 +
 3 files changed, 267 insertions(+), 1 deletions(-)
 create mode 100644 src/cdma-network.c

diff --git a/Makefile.am b/Makefile.am
index 93550d0..c245b4c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -362,7 +362,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) 
src/ofono.ver \
src/simfs.c src/simfs.h src/audio-settings.c \
src/smsagent.c src/smsagent.h src/ctm.c \
src/cdma-voicecall.c src/sim-auth.c \
-   src/message.h src/message.c src/gprs-provision.c
+   src/message.h src/message.c src/gprs-provision.c \
+   src/cdma-network.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
 
diff --git a/src/cdma-network.c b/src/cdma-network.c
new file mode 100644
index 000..4c03536
--- /dev/null
+++ b/src/cdma-network.c
@@ -0,0 +1,263 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2011  Nokia 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 config.h
+#endif
+
+#include string.h
+#include stdio.h
+#include errno.h
+
+#include glib.h
+#include gdbus.h
+
+#include ofono.h
+
+#include common.h
+#include simutil.h
+#include util.h
+#include storage.h
+
+static GSList *g_drivers;
+
+struct ofono_cdma_netreg {
+   int signal_strength;
+   const struct ofono_cdma_netreg_driver *driver;
+   void *driver_data;
+   struct ofono_atom *atom;
+};
+
+static DBusMessage *network_get_properties(DBusConnection *conn,
+   DBusMessage *msg, void *data)
+{
+   struct ofono_cdma_netreg *netreg = data;
+   DBusMessage *reply;
+   DBusMessageIter iter;
+   DBusMessageIter dict;
+
+   reply = dbus_message_new_method_return(msg);
+   if (reply == NULL)
+   return NULL;
+
+   dbus_message_iter_init_append(reply, iter);
+
+   dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
+   OFONO_PROPERTIES_ARRAY_SIGNATURE,
+   dict);
+
+   /* TODO: Add Status Property */
+
+   if (netreg-signal_strength != -1) {
+   unsigned char strength = netreg-signal_strength;
+
+   ofono_dbus_dict_append(dict, Strength, DBUS_TYPE_BYTE,
+   strength);
+   }
+
+   /* TODO: Add DataStrength Property */
+
+   /* TODO: Add SystemIdentifier Property */
+
+   /* TODO: Add NetworkIdentifier Property */
+
+   /* TODO: Add MobileCountryCode Property */
+
+   /* TODO: Add MobileNetworkCode Property */
+
+   /* TODO: Add Name Property */
+
+   /* TODO: Add RoamingPreference Property */
+
+   dbus_message_iter_close_container(iter, dict);
+
+   return reply;
+}
+
+static GDBusMethodTable network_registration_methods[] = {
+   { GetProperties,  ,  a{sv},   network_get_properties },
+   { }
+};
+
+static GDBusSignalTable network_registration_signals[] = {
+   { PropertyChanged,sv },
+   { }
+};
+
+static void signal_strength_callback(const struct ofono_error *error,
+   int strength, void *data)
+{
+   struct ofono_cdma_netreg *netreg = data;
+
+   if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
+   DBG(Error during signal strength query);
+   return;
+   }
+
+   ofono_cdma_netreg_strength_notify(netreg, strength);
+}
+
+void ofono_cdma_netreg_strength_notify(struct ofono_cdma_netreg *netreg,
+   int strength)
+{
+   DBusConnection *conn = ofono_dbus_get_connection();
+
+   if (netreg-signal_strength == strength)
+   return;
+
+   netreg-signal_strength = strength;
+
+   if (strength != -1) {
+   const char *path = __ofono_atom_get_path(netreg-atom);
+   unsigned char strength = netreg-signal_strength;
+
+   ofono_dbus_signal_property_changed(conn, path,
+   OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE,
+   Strength, 

[PATCH 6/7] nokiacdma: Add cdma-netreg Support

2011-02-08 Thread Dara Spieker-Doyle
---
 plugins/nokiacdma.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/plugins/nokiacdma.c b/plugins/nokiacdma.c
index 7bd224d..946c1f2 100644
--- a/plugins/nokiacdma.c
+++ b/plugins/nokiacdma.c
@@ -44,6 +44,7 @@
 #include drivers/atmodem/atutil.h
 #include ofono/cdma-voicecall.h
 #include ofono/devinfo.h
+#include ofono/cdma-netreg.h
 
 #include common.h
 
@@ -147,7 +148,10 @@ static void nokiacdma_post_sim(struct ofono_modem *modem)
 
 static void nokiacdma_post_online(struct ofono_modem *modem)
 {
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+
DBG(%p, modem);
+   ofono_cdma_netreg_create(modem, 0, cdmamodem, data-chat);
 }
 
 static struct ofono_modem_driver nokiacdma_driver = {
-- 
1.7.0.4

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


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

2011-02-08 Thread Dara Spieker-Doyle
---
 Makefile.am  |3 +-
 drivers/cdmamodem/cdmamodem.c|2 +
 drivers/cdmamodem/cdmamodem.h|2 +
 drivers/cdmamodem/network-registration.c |  211 ++
 4 files changed, 217 insertions(+), 1 deletions(-)
 create mode 100644 drivers/cdmamodem/network-registration.c

diff --git a/Makefile.am b/Makefile.am
index c245b4c..272e28d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -257,7 +257,8 @@ builtin_modules += cdmamodem
 builtin_sources += drivers/cdmamodem/cdmamodem.h \
drivers/cdmamodem/cdmamodem.c \
drivers/cdmamodem/voicecall.c \
-   drivers/cdmamodem/devinfo.c
+   drivers/cdmamodem/devinfo.c \
+   drivers/cdmamodem/network-registration.c
 endif
 
 builtin_modules += g1
diff --git a/drivers/cdmamodem/cdmamodem.c b/drivers/cdmamodem/cdmamodem.c
index 9eddd88..492f1f0 100644
--- a/drivers/cdmamodem/cdmamodem.c
+++ b/drivers/cdmamodem/cdmamodem.c
@@ -36,6 +36,7 @@ static int cdmamodem_init(void)
 {
cdma_voicecall_init();
cdma_devinfo_init();
+   cdma_netreg_init();
 
return 0;
 }
@@ -44,6 +45,7 @@ static void cdmamodem_exit(void)
 {
cdma_voicecall_exit();
cdma_devinfo_exit();
+   cdma_netreg_exit();
 }
 
 OFONO_PLUGIN_DEFINE(cdmamodem, CDMA AT modem driver, VERSION,
diff --git a/drivers/cdmamodem/cdmamodem.h b/drivers/cdmamodem/cdmamodem.h
index 4365bec..a1fbf65 100644
--- a/drivers/cdmamodem/cdmamodem.h
+++ b/drivers/cdmamodem/cdmamodem.h
@@ -25,3 +25,5 @@ extern void cdma_voicecall_init(void);
 extern void cdma_voicecall_exit(void);
 extern void cdma_devinfo_init(void);
 extern void cdma_devinfo_exit(void);
+extern void cdma_netreg_init(void);
+extern void cdma_netreg_exit(void);
diff --git a/drivers/cdmamodem/network-registration.c 
b/drivers/cdmamodem/network-registration.c
new file mode 100644
index 000..4135fe1
--- /dev/null
+++ b/drivers/cdmamodem/network-registration.c
@@ -0,0 +1,211 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2011  Nokia 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 config.h
+#endif
+
+#define _GNU_SOURCE
+#include string.h
+#include stdlib.h
+#include stdio.h
+
+#include glib.h
+
+#include ofono/log.h
+#include ofono/modem.h
+#include ofono/cdma-netreg.h
+
+#include gatchat.h
+#include gatresult.h
+
+#include cdmamodem.h
+
+/* Time interval in seconds between CSQ polls */
+#define CSQ_INTERVAL 5
+
+struct cdma_netreg_data {
+   GAtChat *chat;
+   unsigned int vendor;
+   unsigned int csq_source;
+};
+
+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;
+}
+
+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);
+}
+
+static void cdma_signal_strength(struct ofono_cdma_netreg *netreg,
+   ofono_cdma_netreg_strength_cb_t cb, void *data)
+{
+   struct cdma_netreg_data *nd = ofono_cdma_netreg_get_data(netreg);
+   struct cb_data *cbd = cb_data_new(cb, data);
+
+   cbd-user = 

[PATCH 7/7] test: Add CDMA Signal Strength Support

2011-02-08 Thread Dara Spieker-Doyle
---
 Makefile.am   |3 ++-
 test/cdma-get-current-network-signal-strength |   21 +
 2 files changed, 23 insertions(+), 1 deletions(-)
 create mode 100755 test/cdma-get-current-network-signal-strength

diff --git a/Makefile.am b/Makefile.am
index 272e28d..d7048f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -481,7 +481,8 @@ test_scripts = test/backtrace \
test/cdma-hangup \
test/disable-call-forwarding \
test/list-messages \
-   test/test-sms
+   test/test-sms \
+   test/cdma-get-current-network-signal-strength
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/cdma-get-current-network-signal-strength 
b/test/cdma-get-current-network-signal-strength
new file mode 100755
index 000..3c2a457
--- /dev/null
+++ b/test/cdma-get-current-network-signal-strength
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+import dbus, sys
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+modems = manager.GetModems()
+path = modems[0][0]
+
+netreg = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.cdma.NetworkRegistration')
+
+properties = netreg.GetProperties()
+
+if properties.has_key('Strength'):
+   print Returned signal strength for current CDMA network is: '%d' %\
+   (properties['Strength'])
+else:
+   print No strength reported with GetProperties
-- 
1.7.0.4

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


[PATCH] TODO: minor style fix

2011-02-08 Thread Dara Spieker-Doyle
Bad caps

---
 TODO |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/TODO b/TODO
index 13a6baa..9bd21d6 100644
--- a/TODO
+++ b/TODO
@@ -590,7 +590,7 @@ CDMA CMAS
   Priority: Medium
   Complexity: C4
 
-CDMA NETWORK ACQUISITION
+CDMA Network Acquisition
 
 
 - Support reporting of the received signal strength indicator (RSSI)
-- 
1.7.0.4

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


Re: [PATCH] doc: Add modem Type property

2011-02-03 Thread Dara Spieker-Doyle

Hi Gustavo

On 02/03/2011 11:25 AM, ext Gustavo F. Padovan wrote:

Hi Dara,

* Dara Spieker-Doyledara.spieker-do...@nokia.com  [2011-01-20 14:48:57 -0800]:


Add support for providing the type of the attached modem device
including GSM (3GPP), CDMA (3GPP2) and Bluetooth HFP.
---
  doc/modem-api.txt |   13 +
  1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/doc/modem-api.txt b/doc/modem-api.txt
index 45043b0..fe806c8 100644
--- a/doc/modem-api.txt
+++ b/doc/modem-api.txt
@@ -82,6 +82,19 @@ Properties   boolean Powered [readwrite]

This is usually obtained by using the +CGSN AT command.

+   string Type [readonly, optional, experimental]
+
+   String representing the type of the modem device.
+
+   The possible values are:
+   gsm Modem supports one or more of the 
3GPP
+   family of technologies including GSM,
+   EDGE, UMTS, HSPA, LTE.
+   cdma  Modem supports one or more of the 3GPP2
+   family of technologies including CDMA 
1x,
+   EVDO.
+   hfp Bluetooth hands-free profile (HFP) modem


I think that this can also help with ConnMan, currently it enables all modems,
even the hfp one, which is wrong.



Yes, this is what we suspect as well and had a discussion about it in 
the IRC recently. We are currently preparing a CDMA ConnMan patch to 
establish if it will further justify supporting this interface from a 
CDMA perspective.


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


Re: [PATCH] doc: Add modem Type property

2011-01-21 Thread Dara Spieker-Doyle

Hi Gustavo and Denis

On 01/21/2011 12:25 PM, ext Gustavo F. Padovan wrote:

Hi Denis,

* Denis Kenziordenk...@gmail.com  [2011-01-21 14:15:46 -0600]:


Hi Dara,

On 01/20/2011 04:48 PM, Dara Spieker-Doyle wrote:

Add support for providing the type of the attached modem device
including GSM (3GPP), CDMA (3GPP2) and Bluetooth HFP.
---
  doc/modem-api.txt |   13 +
  1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/doc/modem-api.txt b/doc/modem-api.txt
index 45043b0..fe806c8 100644
--- a/doc/modem-api.txt
+++ b/doc/modem-api.txt
@@ -82,6 +82,19 @@ Properties   boolean Powered [readwrite]

This is usually obtained by using the +CGSN AT command.

+   string Type [readonly, optional, experimental]
+
+   String representing the type of the modem device.
+
+   The possible values are:
+   gsm Modem supports one or more of the 
3GPP
+   family of technologies including GSM,
+   EDGE, UMTS, HSPA, LTE.
+   cdma  Modem supports one or more of the 3GPP2
+   family of technologies including CDMA 
1x,
+   EVDO.
+   hfp Bluetooth hands-free profile (HFP) modem
+


So one pointed question:

How are we planning to support dual-mode devices with this property?  I
believe during the CDMA workshop we decided that the clients should
simply look at the set of interfaces, not a semi-static property...


We can have a value that is gsm  cdma. This fits for now, but won't scale.
And this list won't increase in the near future I think.

This is along the lines of my thoughts for future support of a 
multi-mode device- but I left it out for now as a value as it's future work.
Denis - Lei's about to pop in and answer your questions as he was 
actually at the workshop! :)


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


[RFC 1/1] doc: Add modem technology type property

2011-01-20 Thread Dara Spieker-Doyle
---
 doc/modem-api.txt |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/doc/modem-api.txt b/doc/modem-api.txt
index 45043b0..fe03833 100644
--- a/doc/modem-api.txt
+++ b/doc/modem-api.txt
@@ -82,6 +82,17 @@ Properties   boolean Powered [readwrite]
 
This is usually obtained by using the +CGSN AT command.
 
+   string TechnologyType [readonly, optional, experimental]
+
+   String representing the technology type of the current
+   modem device.
+
+   The possible values are:
+   gsm   The 3GPP family of technologies
+   including gsm, edge, umts, hspa, lte.
+   cdma  The 3GPP2 family of technologies
+   including cdma 1x, evdo.
+
array{string} Features [readonly]
 
List of currently enabled features. It uses simple
-- 
1.7.0.4

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


[RFC 0/1] Add modem technology type property

2011-01-20 Thread Dara Spieker-Doyle
This is a RFC to initiate discussion regarding the addition of a modem
technology type indicator property to the modem DBus interface. The need for
such a property has arisen as we cannot use the current interface to
guarantee understanding of a modem device's technology type to the upper layers
at all times.

The current design supports the behaviour where the upper layers can search for
whichever technology interfaces are available and instantiated by the current
modem device and execute accordingly. However, such behaviour only applies in
the case where there are distinguishing atoms (and associated DBus interfaces)
representing fundamentally different behaviour for different modem types. We
need to support the scenario where, for example, the different modem types
share the same DBus interface due to some, e.g. abstraction, in property
meaning, but the upper layers need to behave differently depending on the
technology. Currently, any technology distinguishing atoms are optional, which
means we cannot rely on these to provide interfaces to be used by the upper
layers to establish the technology type, e.g. ofono.cdma.voicecall may not
always be available even if the underlying modem is a CDMA modem. This implies
we would need to assign the responsibility of broadcasting the modem device
technology type through the core modem interface.

An example use case:

In 3GPP, the serial number of a device is referred to as the International
Mobile Equipment Identity (IMEI).
In 3GPP2, the serial number of a device is referred to as the Mobile Equipment
Identifier (MEID).
In oFono, such a feature is abstracted to the same serial number concept so GSM
and CDMA modems can both broadcast through the Serial modem interface.
However, the upper layer may need to process this value differently depending
on the current technology for e.g. display purposes. This interface is provided
through the core modem code, but we have no way of communicating the current
modem device type if operating in an initial offline mode without any other
atoms instantiated.

We envisage the potential for more such use cases in the future and look
forward to comments/discussion regarding our options.

Thank you

Dara Spieker-Doyle (1):
  doc: Add modem technology type property

 doc/modem-api.txt |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

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


Re: [RFC 1/1] doc: Add modem technology type property

2011-01-20 Thread Dara Spieker-Doyle

Hi Marcel

On 01/20/2011 01:34 PM, ext Marcel Holtmann wrote:

Hi Dara,


  doc/modem-api.txt |   11 +++
  1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/doc/modem-api.txt b/doc/modem-api.txt
index 45043b0..fe03833 100644
--- a/doc/modem-api.txt
+++ b/doc/modem-api.txt
@@ -82,6 +82,17 @@ Properties   boolean Powered [readwrite]

This is usually obtained by using the +CGSN AT command.

+   string TechnologyType [readonly, optional, experimental]
+
+   String representing the technology type of the current
+   modem device.
+
+   The possible values are:
+   gsm The 3GPP family of technologies
+   including gsm, edge, umts, hspa, lte.
+   cdma  The 3GPP2 family of technologies
+   including cdma 1x, evdo.


I would just call this property Type and then we can also have a value
for hfp in case it is a Bluetooth HFP modem.

Thanks - sounds good to me. I'll prepare a patch to reflect this for 
gsm/cdma types and assume the hfp type extension is future work.


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


Re: [RFC 1/1] doc: Add modem technology type property

2011-01-20 Thread Dara Spieker-Doyle

Hi Marcel

On 01/20/2011 02:05 PM, ext Marcel Holtmann wrote:




Thanks - sounds good to me. I'll prepare a patch to reflect this for
gsm/cdma types and assume the hfp type extension is future work.


not really. Actually HFP support is part of oFono already.



Sorry - I meant hfp as an extension to the Type property in 
modem-api.txt rather than an extension to oFono itself :). Did you want 
to add it separately or as part of this?


FYI: The patch is going to just cover the interface documentation for now.

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


[PATCH] doc: Add modem Type property

2011-01-20 Thread Dara Spieker-Doyle
Add support for providing the type of the attached modem device
including GSM (3GPP), CDMA (3GPP2) and Bluetooth HFP.
---
 doc/modem-api.txt |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/doc/modem-api.txt b/doc/modem-api.txt
index 45043b0..fe806c8 100644
--- a/doc/modem-api.txt
+++ b/doc/modem-api.txt
@@ -82,6 +82,19 @@ Properties   boolean Powered [readwrite]
 
This is usually obtained by using the +CGSN AT command.
 
+   string Type [readonly, optional, experimental]
+
+   String representing the type of the modem device.
+
+   The possible values are:
+   gsm   Modem supports one or more of the 3GPP
+   family of technologies including GSM,
+   EDGE, UMTS, HSPA, LTE.
+   cdma  Modem supports one or more of the 3GPP2
+   family of technologies including CDMA 
1x,
+   EVDO.
+   hfp   Bluetooth hands-free profile (HFP) modem
+
array{string} Features [readonly]
 
List of currently enabled features. It uses simple
-- 
1.7.0.4

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


[PATCH] cdmamodem: fix to follow oFono probe rules

2011-01-14 Thread Dara Spieker-Doyle
Not allowed to call register directly from probe, use g_idle_add
instead for now
---
 drivers/cdmamodem/voicecall.c |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/cdmamodem/voicecall.c b/drivers/cdmamodem/voicecall.c
index a0fa79f..94ec74b 100644
--- a/drivers/cdmamodem/voicecall.c
+++ b/drivers/cdmamodem/voicecall.c
@@ -109,6 +109,15 @@ static void cdma_hangup(struct ofono_cdma_voicecall *vc,
cdma_template(AT+CHV, vc, cdma_hangup_cb, cb, data);
 }
 
+static gboolean cdma_voicecall_initialized(gpointer user_data)
+{
+   struct ofono_cdma_voicecall *vc = user_data;
+
+   ofono_cdma_voicecall_register(vc);
+
+   return FALSE;
+}
+
 static int cdma_voicecall_probe(struct ofono_cdma_voicecall *vc,
unsigned int vendor, void *data)
 {
@@ -123,8 +132,7 @@ static int cdma_voicecall_probe(struct ofono_cdma_voicecall 
*vc,
vd-vendor = vendor;
 
ofono_cdma_voicecall_set_data(vc, vd);
-
-   ofono_cdma_voicecall_register(vc);
+   g_idle_add(cdma_voicecall_initialized, vc);
 
return 0;
 }
-- 
1.7.0.4

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


Re: [PATCH v5, 2/5] test: Add CDMA MO Call Support

2011-01-13 Thread Dara Spieker-Doyle

Hi Denis

On 01/12/2011 09:25 PM, ext Denis Kenzior wrote:

Hi Dara,

On 01/10/2011 07:45 PM, Dara Spieker-Doyle wrote:

---
  Makefile.am   |5 -
  test/cdma-dial-number |   25 +
  test/cdma-hangup  |   20 
  test/cdma-list-call   |   31 +++
  4 files changed, 80 insertions(+), 1 deletions(-)
  create mode 100755 test/cdma-dial-number
  create mode 100755 test/cdma-hangup
  create mode 100755 test/cdma-list-call


This patch does not apply:

Applying: test: Add CDMA MO Call Support
error: patch failed: Makefile.am:445
error: Makefile.am: patch does not apply
/home/denkenz/ofono-master/.git/rebase-apply/patch:32: new blank line at
EOF.
+
/home/denkenz/ofono-master/.git/rebase-apply/patch:89: new blank line at
EOF.
+
Patch failed at 0001 test: Add CDMA MO Call Support
When you have resolved this problem run git am --resolved.
If you would prefer to skip this patch, instead run git am --skip.
To restore the original branch and stop patching run git am --abort.

Also:

snip



diff --git a/test/cdma-list-call b/test/cdma-list-call
new file mode 100755
index 000..8a2e04e
--- /dev/null
+++ b/test/cdma-list-call
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+   print [ %s ] % (path)
+
+   if org.ofono.cdma.VoiceCallManager not in properties[Interfaces]:
+   continue
+
+   mgr = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.cdma.VoiceCallManager')
+
+   properties = mgr.GetProperties()
+
+   for key in properties.keys():
+   if key in [Interfaces, Features]:
+   val = 
+   for i in properties[key]:
+   val += i +  


You might want to remove this if statement.  There are no Interfaces or
Features properties in cdma.VoiceCallManager


+   else:
+   val = str(properties[key])
+   print %s = %s % (key, val)
+


Regards,
-Denis


Thank you, yes I'll fix this up and resubmit. The info re: naming style 
of the atom methods has been passed on to the other guys too to include 
in future/current CDMA patches.


Cheers
Dara


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


Re: [PATCH 2/3] cdmamodem: Add CDMA devinfo support

2011-01-13 Thread Dara Spieker-Doyle

Hi Denis

On 01/12/2011 10:03 PM, ext Denis Kenzior wrote:

Hi Dara,

On 01/11/2011 03:45 PM, Dara Spieker-Doyle wrote:

---
  Makefile.am   |3 +-
  drivers/cdmamodem/cdmamodem.c |2 +
  drivers/cdmamodem/cdmamodem.h |2 +
  drivers/cdmamodem/devinfo.c   |  169 +
  4 files changed, 175 insertions(+), 1 deletions(-)
  create mode 100644 drivers/cdmamodem/devinfo.c



Can you please rebase and resubmit this patch?  Further comments below:


diff --git a/drivers/cdmamodem/cdmamodem.h b/drivers/cdmamodem/cdmamodem.h
index a5991cf..ef4fad3 100644
--- a/drivers/cdmamodem/cdmamodem.h
+++ b/drivers/cdmamodem/cdmamodem.h
@@ -23,3 +23,5 @@

  extern void cdma_at_voicecall_init();
  extern void cdma_at_voicecall_exit();
+extern void cdma_at_devinfo_init();
+extern void cdma_at_devinfo_exit();


Please name this cdma_devinfo_init/exit


snip


+static struct ofono_devinfo_driver driver = {
+   .name   = cdmamodem,
+   .probe  = cdma_at_devinfo_probe,
+   .remove = cdma_at_devinfo_remove,
+   .query_manufacturer = cdma_at_query_manufacturer,
+   .query_model= cdma_at_query_model,
+   .query_revision = cdma_at_query_revision,
+   .query_serial   = cdma_at_query_serial


Please drop the 'at' from these.  Use cdma_devinfo_probe, etc.


+};
+


Regards,
-Denis


Yes, I will fix up and resubmit today.

Thank you
Dara


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


[PATCH v6] test: Add CDMA MO Call Support

2011-01-13 Thread Dara Spieker-Doyle
Rebasing and adding CDMA MO Call test scripts
---
 Makefile.am   |5 -
 test/cdma-dial-number |   24 
 test/cdma-hangup  |   20 
 test/cdma-list-call   |   25 +
 4 files changed, 73 insertions(+), 1 deletions(-)
 create mode 100755 test/cdma-dial-number
 create mode 100755 test/cdma-hangup
 create mode 100755 test/cdma-list-call

diff --git a/Makefile.am b/Makefile.am
index a68fc36..abdf5ac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -455,7 +455,10 @@ test_scripts = test/backtrace \
test/set-gsm-band \
test/set-umts-band \
test/lockdown-modem \
-   test/set-call-forwarding
+   test/set-call-forwarding \
+   test/cdma-list-call \
+   test/cdma-dial-number \
+   test/cdma-hangup
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/cdma-dial-number b/test/cdma-dial-number
new file mode 100755
index 000..54a67b3
--- /dev/null
+++ b/test/cdma-dial-number
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv)  2:
+   path = sys.argv[1]
+   number = sys.argv[2]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+   number = sys.argv[1]
+
+print Using modem %s % path
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Dial(number)
diff --git a/test/cdma-hangup b/test/cdma-hangup
new file mode 100755
index 000..f8e631e
--- /dev/null
+++ b/test/cdma-hangup
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv)  2:
+   path = sys.argv[1]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Hangup()
diff --git a/test/cdma-list-call b/test/cdma-list-call
new file mode 100755
index 000..c941383
--- /dev/null
+++ b/test/cdma-list-call
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+   print [ %s ] % (path)
+
+   if org.ofono.cdma.VoiceCallManager not in properties[Interfaces]:
+   continue
+
+   mgr = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.cdma.VoiceCallManager')
+
+   properties = mgr.GetProperties()
+
+   for key in properties.keys():
+   val = str(properties[key])
+   print %s = %s % (key, val)
-- 
1.7.0.4

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


[PATCH v2, 2/2] nokiacdma: Add CDMA devinfo support

2011-01-13 Thread Dara Spieker-Doyle
---
 plugins/nokiacdma.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/plugins/nokiacdma.c b/plugins/nokiacdma.c
index e05c012..7bd224d 100644
--- a/plugins/nokiacdma.c
+++ b/plugins/nokiacdma.c
@@ -43,6 +43,7 @@
 
 #include drivers/atmodem/atutil.h
 #include ofono/cdma-voicecall.h
+#include ofono/devinfo.h
 
 #include common.h
 
@@ -137,6 +138,7 @@ static void nokiacdma_pre_sim(struct ofono_modem *modem)
struct nokiacdma_data *data = ofono_modem_get_data(modem);
 
ofono_cdma_voicecall_create(modem, 0, cdmamodem, data-chat);
+   ofono_devinfo_create(modem, 0, cdmamodem, data-chat);
 }
 
 static void nokiacdma_post_sim(struct ofono_modem *modem)
-- 
1.7.0.4

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


[PATCH v2, 0/2] Add CDMA devinfo support

2011-01-13 Thread Dara Spieker-Doyle
This is v2 of the series of patches to provide CDMA AT support device info.
It re-uses the GSM atom interface and provides cdmamodem driver support, moving
common utilities to atutil.[ch] for sharing with the atmodem driver.

HW support for testing is implemented in the nokiacdma plugin.

These patches have been tested against the Nokia 7205 CDMA device in a tethered
mode.

Dara Spieker-Doyle (2):
  cdmamodem: Add CDMA devinfo support
  nokiacdma: Add CDMA devinfo support

 Makefile.am   |3 +-
 drivers/cdmamodem/cdmamodem.c |2 +
 drivers/cdmamodem/cdmamodem.h |2 +
 drivers/cdmamodem/devinfo.c   |  188 +
 plugins/nokiacdma.c   |2 +
 5 files changed, 196 insertions(+), 1 deletions(-)
 create mode 100644 drivers/cdmamodem/devinfo.c

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


[PATCH] cdmamodem: M15 Coding style fix

2011-01-13 Thread Dara Spieker-Doyle
---
 drivers/cdmamodem/cdmamodem.h |4 ++--
 drivers/cdmamodem/voicecall.c |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/cdmamodem/cdmamodem.h b/drivers/cdmamodem/cdmamodem.h
index b085541..5011ade 100644
--- a/drivers/cdmamodem/cdmamodem.h
+++ b/drivers/cdmamodem/cdmamodem.h
@@ -21,5 +21,5 @@
 
 #include drivers/atmodem/atutil.h
 
-extern void cdma_voicecall_init();
-extern void cdma_voicecall_exit();
+extern void cdma_voicecall_init(void);
+extern void cdma_voicecall_exit(void);
diff --git a/drivers/cdmamodem/voicecall.c b/drivers/cdmamodem/voicecall.c
index 5b4f3cc..a0fa79f 100644
--- a/drivers/cdmamodem/voicecall.c
+++ b/drivers/cdmamodem/voicecall.c
@@ -147,12 +147,12 @@ static struct ofono_cdma_voicecall_driver driver = {
.hangup = cdma_hangup,
 };
 
-void cdma_voicecall_init()
+void cdma_voicecall_init(void)
 {
ofono_cdma_voicecall_driver_register(driver);
 }
 
-void cdma_voicecall_exit()
+void cdma_voicecall_exit(void)
 {
ofono_cdma_voicecall_driver_unregister(driver);
 }
-- 
1.7.0.4

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


[PATCH 0/3] Add CDMA devinfo support

2011-01-11 Thread Dara Spieker-Doyle
This series of patches provide CDMA AT support device info. It re-uses the GSM
atom interface and provides cdmamodem driver support, moving common utilities
to atutil.[ch] for sharing with the atmodem driver.

HW support for testing is implemented in the nokiacdma plugin.

These patches have been tested against the Nokia 7205 CDMA device in a tethered
mode.

Limitations
---
Patches 2/3 and 3/3 are dependent on acceptance of the CDMA MO Voicecall v5
patch series.

Dara Spieker-Doyle (3):
  atmodem: Share common devinfo utilities
  cdmamodem: Add CDMA devinfo support
  nokiacdma: Add CDMA devinfo support

 Makefile.am   |3 +-
 drivers/atmodem/atutil.c  |   56 ++
 drivers/atmodem/atutil.h  |2 +
 drivers/atmodem/devinfo.c |   59 +-
 drivers/cdmamodem/cdmamodem.c |2 +
 drivers/cdmamodem/cdmamodem.h |2 +
 drivers/cdmamodem/devinfo.c   |  169 +
 plugins/nokiacdma.c   |2 +
 8 files changed, 239 insertions(+), 56 deletions(-)
 create mode 100644 drivers/cdmamodem/devinfo.c

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


[PATCH 1/3] atmodem: Share common devinfo utilities

2011-01-11 Thread Dara Spieker-Doyle
---
 drivers/atmodem/atutil.c  |   56 ++
 drivers/atmodem/atutil.h  |2 +
 drivers/atmodem/devinfo.c |   59 +++-
 3 files changed, 62 insertions(+), 55 deletions(-)

diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index 427b098..7d7fa1b 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -438,3 +438,59 @@ gboolean at_util_parse_cscs_query(GAtResult *result,
 
return FALSE;
 }
+
+typedef void (*at_util_attr_cb_t)(const struct ofono_error *error,
+   const char *attribute, void *data);
+
+const char *at_util_fixup_return(const char *line, const char *prefix)
+{
+   if (g_str_has_prefix(line, prefix) == FALSE)
+   return line;
+
+   line += strlen(prefix);
+
+   while (line[0] == ' ')
+   line++;
+
+   return line;
+}
+
+void at_util_attr_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+   at_util_attr_cb_t cb = cbd-cb;
+   const char *prefix = cbd-user;
+   struct ofono_error error;
+   int numlines = g_at_result_num_response_lines(result);
+   GAtResultIter iter;
+   const char *line;
+   int i;
+
+   decode_at_error(error, g_at_result_final_response(result));
+
+   if (!ok) {
+   cb(error, NULL, cbd-data);
+   return;
+   }
+
+   if (numlines == 0) {
+   CALLBACK_WITH_FAILURE(cb, NULL, cbd-data);
+   return;
+   }
+
+   g_at_result_iter_init(iter, result);
+
+   /*
+* We have to be careful here, sometimes a stray unsolicited
+* notification will appear as part of the response and we
+* cannot rely on having a prefix to recognize the actual
+* response line.  So use the last line only as the response
+*/
+   for (i = 0; i  numlines; i++)
+   g_at_result_iter_next(iter, NULL);
+
+   line = g_at_result_iter_raw_line(iter);
+
+   cb(error, at_util_fixup_return(line, prefix), cbd-data);
+}
+
diff --git a/drivers/atmodem/atutil.h b/drivers/atmodem/atutil.h
index 3901801..cab9340 100644
--- a/drivers/atmodem/atutil.h
+++ b/drivers/atmodem/atutil.h
@@ -70,6 +70,8 @@ gboolean at_util_parse_sms_index_delivery(GAtResult *result, 
const char *prefix,
 gboolean at_util_parse_cscs_supported(GAtResult *result, int *supported);
 gboolean at_util_parse_cscs_query(GAtResult *result,
enum at_util_charset *charset);
+const char *at_util_fixup_return(const char *line, const char *prefix);
+void at_util_attr_cb(gboolean ok, GAtResult *result, gpointer user_data);
 
 struct cb_data {
void *cb;
diff --git a/drivers/atmodem/devinfo.c b/drivers/atmodem/devinfo.c
index 84ff898..b3ae9ad 100644
--- a/drivers/atmodem/devinfo.c
+++ b/drivers/atmodem/devinfo.c
@@ -35,57 +35,6 @@
 
 #include atmodem.h
 
-static const char *fixup_return(const char *line, const char *prefix)
-{
-   if (g_str_has_prefix(line, prefix) == FALSE)
-   return line;
-
-   line = line + strlen(prefix);
-
-   while (line[0] == ' ')
-   line++;
-
-   return line;
-}
-
-static void attr_cb(gboolean ok, GAtResult *result, gpointer user_data)
-{
-   struct cb_data *cbd = user_data;
-   ofono_devinfo_query_cb_t cb = cbd-cb;
-   const char *prefix = cbd-user;
-   struct ofono_error error;
-   int numlines = g_at_result_num_response_lines(result);
-   GAtResultIter iter;
-   const char *line;
-   int i;
-
-   decode_at_error(error, g_at_result_final_response(result));
-
-   if (!ok) {
-   cb(error, NULL, cbd-data);
-   return;
-   }
-
-   if (numlines == 0) {
-   CALLBACK_WITH_FAILURE(cb, NULL, cbd-data);
-   return;
-   }
-
-   g_at_result_iter_init(iter, result);
-
-   /* We have to be careful here, sometimes a stray unsolicited
-* notification will appear as part of the response and we
-* cannot rely on having a prefix to recognize the actual
-* response line.  So use the last line only as the response
-*/
-   for (i = 0; i  numlines; i++)
-   g_at_result_iter_next(iter, NULL);
-
-   line = g_at_result_iter_raw_line(iter);
-
-   cb(error, fixup_return(line, prefix), cbd-data);
-}
-
 static void at_query_manufacturer(struct ofono_devinfo *info,
ofono_devinfo_query_cb_t cb, void *data)
 {
@@ -98,7 +47,7 @@ static void at_query_manufacturer(struct ofono_devinfo *info,
cbd-user = +CGMI:;
 
if (g_at_chat_send(chat, AT+CGMI, NULL,
-   attr_cb, cbd, g_free)  0)
+   at_util_attr_cb, cbd, g_free)  0)
return;
 
 error:
@@ -119,7 +68,7 @@ static void at_query_model(struct ofono_devinfo *info,

[PATCH 2/3] cdmamodem: Add CDMA devinfo support

2011-01-11 Thread Dara Spieker-Doyle
---
 Makefile.am   |3 +-
 drivers/cdmamodem/cdmamodem.c |2 +
 drivers/cdmamodem/cdmamodem.h |2 +
 drivers/cdmamodem/devinfo.c   |  169 +
 4 files changed, 175 insertions(+), 1 deletions(-)
 create mode 100644 drivers/cdmamodem/devinfo.c

diff --git a/Makefile.am b/Makefile.am
index 5c9445f..da57645 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -249,7 +249,8 @@ if CDMAMODEM
 builtin_modules += cdmamodem
 builtin_sources += drivers/cdmamodem/cdmamodem.h \
drivers/cdmamodem/cdmamodem.c \
-   drivers/cdmamodem/voicecall.c
+   drivers/cdmamodem/voicecall.c \
+   drivers/cdmamodem/devinfo.c
 endif
 
 builtin_modules += g1
diff --git a/drivers/cdmamodem/cdmamodem.c b/drivers/cdmamodem/cdmamodem.c
index 1c15da0..0ed8414 100644
--- a/drivers/cdmamodem/cdmamodem.c
+++ b/drivers/cdmamodem/cdmamodem.c
@@ -35,6 +35,7 @@
 static int cdmamodem_init(void)
 {
cdma_at_voicecall_init();
+   cdma_at_devinfo_init();
 
return 0;
 }
@@ -42,6 +43,7 @@ static int cdmamodem_init(void)
 static void cdmamodem_exit(void)
 {
cdma_at_voicecall_exit();
+   cdma_at_devinfo_exit();
 }
 
 OFONO_PLUGIN_DEFINE(cdmamodem, CDMA AT modem driver, VERSION,
diff --git a/drivers/cdmamodem/cdmamodem.h b/drivers/cdmamodem/cdmamodem.h
index a5991cf..ef4fad3 100644
--- a/drivers/cdmamodem/cdmamodem.h
+++ b/drivers/cdmamodem/cdmamodem.h
@@ -23,3 +23,5 @@
 
 extern void cdma_at_voicecall_init();
 extern void cdma_at_voicecall_exit();
+extern void cdma_at_devinfo_init();
+extern void cdma_at_devinfo_exit();
diff --git a/drivers/cdmamodem/devinfo.c b/drivers/cdmamodem/devinfo.c
new file mode 100644
index 000..efa140a
--- /dev/null
+++ b/drivers/cdmamodem/devinfo.c
@@ -0,0 +1,169 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2010 Intel Corporation. All rights reserved.
+ *  Copyright (C) 2011 Nokia 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 config.h
+#endif
+
+#include string.h
+#include glib.h
+
+#include ofono/log.h
+#include ofono/modem.h
+#include ofono/devinfo.h
+
+#include gatchat.h
+#include gatresult.h
+
+#include cdmamodem.h
+
+static void cdma_at_query_manufacturer(struct ofono_devinfo *info,
+   ofono_devinfo_query_cb_t cb, void *data)
+{
+   struct cb_data *cbd = cb_data_new(cb, data);
+   GAtChat *chat = ofono_devinfo_get_data(info);
+
+   if (cbd == NULL)
+   goto error;
+
+   cbd-user = AT+GMI;
+
+   if (g_at_chat_send(chat, AT+GMI, NULL,
+   at_util_attr_cb, cbd, g_free)  0)
+   return;
+
+error:
+   g_free(cbd);
+
+   CALLBACK_WITH_FAILURE(cb, NULL, data);
+}
+
+static void cdma_at_query_model(struct ofono_devinfo *info,
+   ofono_devinfo_query_cb_t cb, void *data)
+{
+   struct cb_data *cbd = cb_data_new(cb, data);
+   GAtChat *chat = ofono_devinfo_get_data(info);
+
+   if (cbd == NULL)
+   goto error;
+
+   cbd-user = AT+GMM;
+
+   if (g_at_chat_send(chat, AT+GMM, NULL,
+   at_util_attr_cb, cbd, g_free)  0)
+   return;
+
+error:
+   g_free(cbd);
+
+   CALLBACK_WITH_FAILURE(cb, NULL, data);
+}
+
+static void cdma_at_query_revision(struct ofono_devinfo *info,
+   ofono_devinfo_query_cb_t cb, void *data)
+{
+   struct cb_data *cbd = cb_data_new(cb, data);
+   GAtChat *chat = ofono_devinfo_get_data(info);
+
+   if (cbd == NULL)
+   goto error;
+
+   cbd-user = AT+GMR;
+
+   if (g_at_chat_send(chat, AT+GMR, NULL,
+   at_util_attr_cb, cbd, g_free)  0)
+   return;
+
+error:
+   g_free(cbd);
+
+   CALLBACK_WITH_FAILURE(cb, NULL, data);
+}
+
+static void cdma_at_query_serial(struct ofono_devinfo *info,
+   ofono_devinfo_query_cb_t cb, void *data)
+{
+   struct cb_data *cbd = cb_data_new(cb, data);
+   GAtChat *chat = ofono_devinfo_get_data(info);
+
+   if (cbd == NULL)
+   goto error;
+
+   cbd-user = AT+GSN;
+
+   if (g_at_chat_send(chat, AT+GSN, NULL,
+  

Re: [PATCH v4, 3/5] nokiacdma: Add plugin and CDMA MO Call Support

2011-01-10 Thread Dara Spieker-Doyle

Hi Denis

On 01/10/2011 02:39 PM, ext Denis Kenzior wrote:

Hi Dara,


+static void nokiacdma_remove(struct ofono_modem *modem)
+{
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   ofono_modem_set_data(modem, NULL);
+
+   if (data-chat)
+   g_at_chat_unref(data-chat);


Feel free to skip the NULL check, g_at_chat_unref handles this just fine.



I'll remove this


+
+   g_free(data);
+}
+


snip


+static gboolean nokiacdma_set_online_cb(gpointer cb_data)
+{
+   struct cb_data *cbd = cb_data;
+   ofono_modem_online_cb_t cb = cbd-cb;
+
+   CALLBACK_WITH_SUCCESS(cb, cbd-data);
+
+   g_free(cbd);
+
+   /* do not call again */
+   return FALSE;
+}
+
+static void nokiacdma_set_online(struct ofono_modem *modem,
+   ofono_bool_t online,
+   ofono_modem_online_cb_t cb, void *user_data)
+{
+   struct cb_data *cbd = cb_data_new(cb, user_data);
+
+   DBG(modem %p %s, modem, online ? online : offline);
+
+   /* TODO: Add implementation to control modem online status */
+   g_idle_add(nokiacdma_set_online_cb, cbd);
+}
+


I'm really lost in the above two functions.  If you don't have an
implementation, you can just skip it.  oFono should do the right thing
and automatically bring devices up into online state if set_online is
missing.



OK - we'll skip it as discussed and I'll include this in the patch rebase.

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


Re: [PATCH v3, Part2, 3/3] udev: Add nokiacdma device

2011-01-03 Thread Dara Spieker-Doyle

Hi Denis

On 12/22/2010 06:23 PM, ext Denis Kenzior wrote:

Hi Dara,

On 12/21/2010 01:23 PM, Dara Spieker-Doyle wrote:

---
  plugins/udev.c |   21 +
  1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/plugins/udev.c b/plugins/udev.c
index 255755e..9447e5c 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -449,6 +449,25 @@ static void add_isi(struct ofono_modem *modem,
ofono_modem_register(modem);
  }

+static void add_nokiacdma(struct ofono_modem *modem,
+   struct udev_device *udev_device)
+{
+   const char *devnode;
+   int registered;
+
+   DBG(modem %p, modem);
+
+   devnode = udev_device_get_devnode(udev_device);
+
+   registered = ofono_modem_get_integer(modem, Registered);
+   if (registered != 0)
+   return;
+
+   ofono_modem_set_string(modem, Device, devnode);
+   ofono_modem_set_integer(modem, Registered, 1);
+   ofono_modem_register(modem);


This looks a little fishy to me.  How many ttys are created when this
device is plugged in?  Is it really just one or are you relying on luck
to select the right tty?

When the current nokiacdma (Nokia 7205) device is plugged in there is 
only one TTY created.


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


[PATCH v4, 0/5] Add nokiacdma plugin and CDMA MO Call support

2011-01-03 Thread Dara Spieker-Doyle
This series of patches is version 4 of foundation support for the nokiacdma
device plugin and the cdma-voicecall atom. This is needed for
testing the changes in the first part of the series, for providing the
foundation cdmamodem driver and simple CDMA MO Call support with hardware.

These patches have been tested against the Nokia 7205 CDMA device in a tethered
mode.

Limitations
---
The Nokia 7205 device does not support an AT interface for reporting request
responses, such as the call status and remote/network disconnect reasons, so
these are currently untested.

Dara Spieker-Doyle (5):
  cdmamodem: Add CDMA MO Call support
  test: Add CDMA MO Call Support
  nokiacdma: Add plugin and CDMA MO Call Support
  ofono-rules: Add nokiacdma device
  udev: Add nokiacdma device

 Makefile.am   |   11 ++-
 drivers/cdmamodem/cdmamodem.c |3 +
 drivers/cdmamodem/cdmamodem.h |3 +
 drivers/cdmamodem/voicecall.c |  160 +
 plugins/nokiacdma.c   |  198 +
 plugins/ofono.rules   |4 +
 plugins/udev.c|   16 
 test/cdma-dial-number |   24 +
 test/cdma-hangup  |   20 
 test/cdma-list-call   |   30 ++
 10 files changed, 467 insertions(+), 2 deletions(-)
 create mode 100644 drivers/cdmamodem/voicecall.c
 create mode 100644 plugins/nokiacdma.c
 create mode 100755 test/cdma-dial-number
 create mode 100755 test/cdma-hangup
 create mode 100755 test/cdma-list-call

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


[PATCH v4, 1/5] cdmamodem: Add CDMA MO Call support

2011-01-03 Thread Dara Spieker-Doyle
---
 Makefile.am   |3 +-
 drivers/cdmamodem/cdmamodem.c |3 +
 drivers/cdmamodem/cdmamodem.h |3 +
 drivers/cdmamodem/voicecall.c |  160 +
 4 files changed, 168 insertions(+), 1 deletions(-)
 create mode 100644 drivers/cdmamodem/voicecall.c

diff --git a/Makefile.am b/Makefile.am
index 8a8555d..68a02be 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -247,7 +247,8 @@ endif
 if CDMA_ATMODEM
 builtin_modules += cdma_atmodem
 builtin_sources += drivers/cdmamodem/cdmamodem.h \
-   drivers/cdmamodem/cdmamodem.c
+   drivers/cdmamodem/cdmamodem.c \
+   drivers/cdmamodem/voicecall.c
 endif
 
 builtin_modules += g1
diff --git a/drivers/cdmamodem/cdmamodem.c b/drivers/cdmamodem/cdmamodem.c
index 25bd0f3..20e6d96 100644
--- a/drivers/cdmamodem/cdmamodem.c
+++ b/drivers/cdmamodem/cdmamodem.c
@@ -34,11 +34,14 @@
 
 static int cdma_atmodem_init(void)
 {
+   cdma_at_voicecall_init();
+
return 0;
 }
 
 static void cdma_atmodem_exit(void)
 {
+   cdma_at_voicecall_exit();
 }
 
 OFONO_PLUGIN_DEFINE(cdma_atmodem, CDMA AT modem driver, VERSION,
diff --git a/drivers/cdmamodem/cdmamodem.h b/drivers/cdmamodem/cdmamodem.h
index 114d1fd..a5991cf 100644
--- a/drivers/cdmamodem/cdmamodem.h
+++ b/drivers/cdmamodem/cdmamodem.h
@@ -20,3 +20,6 @@
  */
 
 #include drivers/atmodem/atutil.h
+
+extern void cdma_at_voicecall_init();
+extern void cdma_at_voicecall_exit();
diff --git a/drivers/cdmamodem/voicecall.c b/drivers/cdmamodem/voicecall.c
new file mode 100644
index 000..ba4d2d4
--- /dev/null
+++ b/drivers/cdmamodem/voicecall.c
@@ -0,0 +1,160 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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 config.h
+#endif
+
+#define _GNU_SOURCE
+#include string.h
+#include stdlib.h
+#include stdio.h
+#include errno.h
+
+#include glib.h
+
+#include ofono/log.h
+#include ofono/modem.h
+#include ofono/cdma-voicecall.h
+
+#include gatchat.h
+#include gatresult.h
+
+#include cdmamodem.h
+
+static const char *none_prefix[] = { NULL };
+
+struct voicecall_driver {
+   GAtChat *chat;
+   unsigned int vendor;
+};
+
+static void at_template(const char *cmd, struct ofono_cdma_voicecall *vc,
+   GAtResultFunc result_cb, ofono_cdma_voicecall_cb_t cb,
+   void *data)
+{
+   struct voicecall_driver *vd = ofono_cdma_voicecall_get_data(vc);
+   struct cb_data *cbd = cb_data_new(cb, data);
+
+   if (cbd == NULL)
+   goto error;
+
+   cbd-user = vc;
+   cbd-cb = cb;
+   cbd-data = data;
+
+   if (g_at_chat_send(vd-chat, cmd, none_prefix,
+   result_cb, cbd, g_free)  0)
+   return;
+
+error:
+   g_free(cbd);
+
+   CALLBACK_WITH_FAILURE(cb, data);
+}
+
+static void generic_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+   ofono_cdma_voicecall_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_dial(struct ofono_cdma_voicecall *vc,
+   const struct ofono_cdma_phone_number *ph,
+   ofono_cdma_voicecall_cb_t cb, void *data)
+{
+   char buf[OFONO_CDMA_MAX_PHONE_NUMBER_LENGTH + 8];
+
+   snprintf(buf, sizeof(buf), AT+CDV=%s, ph-number);
+   at_template(buf, vc, generic_cb, cb, data);
+}
+
+static void at_hangup_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+
+   generic_cb(ok, result, user_data);
+
+   /* TODO: this should come from a modem solicited notification */
+   ofono_cdma_voicecall_disconnected(cbd-user,
+   OFONO_DISCONNECT_REASON_LOCAL_HANGUP,
+   NULL);
+}
+
+static void at_hangup(struct ofono_cdma_voicecall *vc,
+   ofono_cdma_voicecall_cb_t cb, void *data)
+{
+   /* Hangup active call */
+   at_template(AT+CHV, vc, at_hangup_cb, cb, data);
+}
+
+static int at_voicecall_probe(struct ofono_cdma_voicecall *vc,
+   unsigned 

[PATCH v4, 2/5] test: Add CDMA MO Call Support

2011-01-03 Thread Dara Spieker-Doyle
---
 Makefile.am   |5 -
 test/cdma-dial-number |   25 +
 test/cdma-hangup  |   20 
 test/cdma-list-call   |   31 +++
 4 files changed, 80 insertions(+), 1 deletions(-)
 create mode 100755 test/cdma-dial-number
 create mode 100755 test/cdma-hangup
 create mode 100755 test/cdma-list-call

diff --git a/Makefile.am b/Makefile.am
index 68a02be..4139863 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -437,7 +437,10 @@ test_scripts = test/backtrace \
test/set-tty \
test/set-gsm-band \
test/set-umts-band
-   test/lockdown-modem
+   test/lockdown-modem \
+   test/cdma-list-call \
+   test/cdma-dial-number \
+   test/cdma-hangup
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/cdma-dial-number b/test/cdma-dial-number
new file mode 100755
index 000..0b3693e
--- /dev/null
+++ b/test/cdma-dial-number
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv)  2:
+   path = sys.argv[1]
+   number = sys.argv[2]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+   number = sys.argv[1]
+
+print Using modem %s % path
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Dial(number)
+
diff --git a/test/cdma-hangup b/test/cdma-hangup
new file mode 100755
index 000..f8e631e
--- /dev/null
+++ b/test/cdma-hangup
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv)  2:
+   path = sys.argv[1]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Hangup()
diff --git a/test/cdma-list-call b/test/cdma-list-call
new file mode 100755
index 000..8a2e04e
--- /dev/null
+++ b/test/cdma-list-call
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+   print [ %s ] % (path)
+
+   if org.ofono.cdma.VoiceCallManager not in properties[Interfaces]:
+   continue
+
+   mgr = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.cdma.VoiceCallManager')
+
+   properties = mgr.GetProperties()
+
+   for key in properties.keys():
+   if key in [Interfaces, Features]:
+   val = 
+   for i in properties[key]:
+   val += i +  
+   else:
+   val = str(properties[key])
+   print %s = %s % (key, val)
+
-- 
1.7.0.4

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


[PATCH v4, 4/5] ofono-rules: Add nokiacdma device

2011-01-03 Thread Dara Spieker-Doyle
---
 plugins/ofono.rules |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/plugins/ofono.rules b/plugins/ofono.rules
index 770834f..65ab7e2 100644
--- a/plugins/ofono.rules
+++ b/plugins/ofono.rules
@@ -432,4 +432,8 @@ ATTRS{idVendor}==0421, ATTRS{idProduct}==060e, 
ENV{OFONO_DRIVER}=nokia
 # Nokia Internet Stick CS-17
 ATTRS{idVendor}==0421, ATTRS{idProduct}==0623, ENV{OFONO_DRIVER}=nokia
 
+# Nokia CDMA Device
+ATTRS{idVendor}==0421, ATTRS{idProduct}==023e, 
ENV{OFONO_DRIVER}=nokiacdma
+ATTRS{idVendor}==0421, ATTRS{idProduct}==00b6, 
ENV{OFONO_DRIVER}=nokiacdma
+
 LABEL=ofono_end
-- 
1.7.0.4

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


[PATCH v4, 3/5] nokiacdma: Add plugin and CDMA MO Call Support

2011-01-03 Thread Dara Spieker-Doyle
---
 Makefile.am |3 +
 plugins/nokiacdma.c |  198 +++
 2 files changed, 201 insertions(+), 0 deletions(-)
 create mode 100644 plugins/nokiacdma.c

diff --git a/Makefile.am b/Makefile.am
index 4139863..8572efc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -295,6 +295,9 @@ builtin_sources += plugins/ste.c
 
 builtin_modules += caif
 builtin_sources += plugins/caif.c
+
+builtin_modules += nokiacdma
+builtin_sources += plugins/nokiacdma.c
 endif
 
 if MAINTAINER_MODE
diff --git a/plugins/nokiacdma.c b/plugins/nokiacdma.c
new file mode 100644
index 000..adfecf4
--- /dev/null
+++ b/plugins/nokiacdma.c
@@ -0,0 +1,198 @@
+/*
+ * This file is part of oFono - Open Source Telephony
+ *
+ * Copyright (C) 2010 Nokia 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 config.h
+#endif
+
+#include stdlib.h
+#include errno.h
+#include termios.h
+#include string.h
+#include unistd.h
+#include sys/types.h
+#include sys/stat.h
+#include fcntl.h
+
+#include glib.h
+#include gatchat.h
+#include gattty.h
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include ofono/plugin.h
+#include ofono/log.h
+#include ofono/modem.h
+
+#include drivers/atmodem/atutil.h
+#include ofono/cdma-voicecall.h
+
+#include common.h
+
+struct nokiacdma_data {
+   GAtChat *chat;
+};
+
+static void nokiacdma_debug(const char *str, void *data)
+{
+   const char *prefix = data;
+
+   ofono_info(%s%s, prefix, str);
+}
+
+static int nokiacdma_probe(struct ofono_modem *modem)
+{
+   struct nokiacdma_data *data;
+
+   DBG(%p, modem);
+
+   data = g_try_new0(struct nokiacdma_data, 1);
+   if (data == NULL)
+   return -ENOMEM;
+
+   ofono_modem_set_data(modem, data);
+
+   return 0;
+}
+
+static void nokiacdma_remove(struct ofono_modem *modem)
+{
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   ofono_modem_set_data(modem, NULL);
+
+   if (data-chat)
+   g_at_chat_unref(data-chat);
+
+   g_free(data);
+}
+
+static int nokiacdma_enable(struct ofono_modem *modem)
+{
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+   GAtSyntax *syntax;
+   GIOChannel *channel;
+   const char *device;
+
+   device = ofono_modem_get_string(modem, Device);
+   if (device == NULL)
+   return -EINVAL;
+
+   channel = g_at_tty_open(device, NULL);
+   if (channel == NULL)
+   return -EIO;
+
+   /* TODO: Will need a CDMA AT syntax parser later. Using GSM V1 for now. 
*/
+   syntax = g_at_syntax_new_gsmv1();
+
+   data-chat = g_at_chat_new(channel, syntax);
+   g_at_syntax_unref(syntax);
+   g_io_channel_unref(channel);
+
+   if (data-chat == NULL)
+   return -ENOMEM;
+
+   if (getenv(OFONO_AT_DEBUG))
+   g_at_chat_set_debug(data-chat, nokiacdma_debug,
+   CDMA Device: );
+
+   return 0;
+}
+
+static int nokiacdma_disable(struct ofono_modem *modem)
+{
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   g_at_chat_unref(data-chat);
+   data-chat = NULL;
+
+   return 0;
+}
+
+static void nokiacdma_pre_sim(struct ofono_modem *modem)
+{
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+
+   ofono_cdma_voicecall_create(modem, 0, cdmamodem, data-chat);
+}
+
+static void nokiacdma_post_sim(struct ofono_modem *modem)
+{
+}
+
+static gboolean nokiacdma_set_online_cb(gpointer cb_data)
+{
+   struct cb_data *cbd = cb_data;
+   ofono_modem_online_cb_t cb = cbd-cb;
+
+   CALLBACK_WITH_SUCCESS(cb, cbd-data);
+
+   g_free(cbd);
+
+   /* do not call again */
+   return FALSE;
+}
+
+static void nokiacdma_set_online(struct ofono_modem *modem,
+   ofono_bool_t online,
+   ofono_modem_online_cb_t cb, void *user_data)
+{
+   struct cb_data *cbd = cb_data_new(cb, user_data);
+
+   DBG(modem %p %s, modem, online ? online : offline);
+
+   /* TODO: Add implementation to control modem online status */
+   g_idle_add(nokiacdma_set_online_cb, cbd);
+}
+
+static void nokiacdma_post_online(struct ofono_modem *modem)
+{
+   

[PATCH v4, 5/5] udev: Add nokiacdma device

2011-01-03 Thread Dara Spieker-Doyle
---
 plugins/udev.c |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/plugins/udev.c b/plugins/udev.c
index 6a59b06..12402eb 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -462,6 +462,20 @@ static void add_calypso(struct ofono_modem *modem,
ofono_modem_register(modem);
 }
 
+static void add_nokiacdma(struct ofono_modem *modem,
+   struct udev_device *udev_device)
+{
+   const char *devnode;
+
+   DBG(modem %p, modem);
+
+   devnode = udev_device_get_devnode(udev_device);
+
+   ofono_modem_set_string(modem, Device, devnode);
+   ofono_modem_set_integer(modem, Registered, 1);
+   ofono_modem_register(modem);
+}
+
 static void add_modem(struct udev_device *udev_device)
 {
struct ofono_modem *modem;
@@ -548,6 +562,8 @@ done:
add_isi(modem, udev_device);
else if (g_strcmp0(driver, calypso) == 0)
add_calypso(modem, udev_device);
+   else if (g_strcmp0(driver, nokiacdma) == 0)
+   add_nokiacdma(modem, udev_device);
 }
 
 static gboolean devpath_remove(gpointer key, gpointer value, gpointer 
user_data)
-- 
1.7.0.4

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


Re: [PATCH v3, Part1, 2/5] cdma-voicecall: Add CDMA MO Call Support

2010-12-23 Thread Dara Spieker-Doyle

Hi Denis

On 12/22/2010 05:36 PM, ext Denis Kenzior wrote:

Hi Dara,

On 12/20/2010 07:36 PM, Dara Spieker-Doyle wrote:

---
  Makefile.am  |3 +-
  src/cdma-voicecall.c |  430 ++
  src/common.c |   41 +
  src/common.h |6 +
  src/ofono.h  |3 +
  5 files changed, 482 insertions(+), 1 deletions(-)
  create mode 100644 src/cdma-voicecall.c



Patch has been applied, thanks.  I did perform some minor style tweaks
afterwards.

Regards,
-Denis


Thank you for going ahead and applying these patches, I'll review the 
diffs and make sure to doublecheck these style issues in future :)


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


Re: [PATCH v3, Part1, 4/5] cdmamodem: Add CDMA voicecall driver support for MO Call

2010-12-23 Thread Dara Spieker-Doyle

Hi Denis

Thank you for reviewing these.

On 12/22/2010 05:26 PM, ext Denis Kenzior wrote:

Hi Dara,

snip


+
+struct voicecall_driver {
+   struct ofono_cdma_voicecall *vc;
+   unsigned int local_release;


What is the use of these two variables?


+   GAtChat *chat;
+   unsigned int vendor;
+};
+
+struct change_state_req {
+   struct ofono_cdma_voicecall *vc;
+   ofono_cdma_voicecall_cb_t cb;
+   void *data;
+};


is cb_data not good enough for some reason? :)


+
+static void at_dial_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+   ofono_cdma_voicecall_cb_t cb = cbd-cb;
+   struct ofono_error error;
+
+   decode_at_error(error, g_at_result_final_response(result));
+
+   if (!ok)
+   goto out;


This if statement serves no purpose


+
+out:


And neither does the label


+   cb(error, cbd-data);
+}
+
+static void at_dial(struct ofono_cdma_voicecall *vc,
+   const struct ofono_cdma_phone_number *ph,
+   ofono_cdma_voicecall_cb_t cb, void *data)
+{
+   struct voicecall_driver *vd = ofono_cdma_voicecall_get_data(vc);
+   struct cb_data *cbd = cb_data_new(cb, data);
+   char buf[256];
+
+   if (cbd == NULL)
+   goto error;
+
+   cbd-user = vc;


Why are you assigning cbd-user and never making use of it?


For all of your above comments, yes they shouldn't be there - I will 
clean these up.



+
+   snprintf(buf, sizeof(buf), AT+CDV=%s, ph-number);
+
+   if (g_at_chat_send(vd-chat, buf, none_prefix,
+   at_dial_cb, cbd, g_free)  0)
+   return;
+
+error:
+   g_free(cbd);
+
+   CALLBACK_WITH_FAILURE(cb, data);
+}
+
+static void at_template(const char *cmd,
+   struct ofono_cdma_voicecall *vc,
+   GAtResultFunc result_cb,
+   ofono_cdma_voicecall_cb_t cb, void *data)
+{
+   struct voicecall_driver *vd = ofono_cdma_voicecall_get_data(vc);
+   struct change_state_req *req = g_try_new0(struct change_state_req, 1);
+
+   if (req == NULL)
+   goto error;
+
+   req-vc = vc;
+   req-cb = cb;
+   req-data = data;
+
+   if (g_at_chat_send(vd-chat, cmd, none_prefix,
+   result_cb, req, g_free)  0)
+   return;
+
+error:
+   g_free(req);
+
+   CALLBACK_WITH_FAILURE(cb, data);
+}
+
+static void at_hangup_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct change_state_req *req = user_data;
+
+   if (!ok) {
+   ofono_error(hangup failed.);
+   return;


Please don't do this.  If the hangup fails you never return from the
operation and will cause the cdma-voicecall atom to stall forever.
decoding the error and calling the callback is good enough.


Thanks for spotting this, I will fix it.



+   }
+
+   ofono_cdma_voicecall_disconnected(req-vc,
+   OFONO_DISCONNECT_REASON_LOCAL_HANGUP, NULL);


Fair enough, but this should really come via a modem unsolicited
notification.


Agreed, I can either mark it with a TODO to make this clear or remove 
the disconnect reason support altogether.



+   CALLBACK_WITH_SUCCESS(req-cb, req-data);


This is not necessary if you call the callback up above.  And why the
different indentation?


+}
+
+static void at_hangup(struct ofono_cdma_voicecall *vc,
+   ofono_cdma_voicecall_cb_t cb, void *data)
+{
+   /* Hangup active call */
+   at_template(AT+CHV, vc, at_hangup_cb, cb, data);
+}
+
+static int at_voicecall_probe(struct ofono_cdma_voicecall *vc,
+   unsigned int vendor, void *data)
+{
+   GAtChat *chat = data;
+   struct voicecall_driver *vd;
+
+   vd = g_try_new0(struct voicecall_driver, 1);
+   if (vd == NULL)
+   return -ENOMEM;
+
+   vd-chat = g_at_chat_clone(chat);
+   vd-vendor = vendor;
+
+   ofono_cdma_voicecall_set_data(vc, vd);
+
+   ofono_cdma_voicecall_register(vc);
+
+   return 0;
+}
+
+static void at_voicecall_remove(struct ofono_cdma_voicecall *vc)
+{
+   struct voicecall_driver *vd = ofono_cdma_voicecall_get_data(vc);
+
+   ofono_cdma_voicecall_set_data(vc, NULL);
+
+   g_at_chat_unref(vd-chat);
+   g_free(vd);
+}
+
+static struct ofono_cdma_voicecall_driver driver = {
+   .name   = cdmamodem,
+   .probe  = at_voicecall_probe,
+   .remove = at_voicecall_remove,
+   .dial   = at_dial,
+   .hangup = at_hangup,
+};
+
+void cdma_at_voicecall_init()
+{
+   ofono_cdma_voicecall_driver_register(driver);
+}
+
+void cdma_at_voicecall_exit()
+{
+   ofono_cdma_voicecall_driver_unregister(driver);
+}


Regards,
-Denis


Thanks
Dara

Re: [PATCH v3, Part1, 5/5] test: Add CDMA MO Call Support

2010-12-23 Thread Dara Spieker-Doyle

Hi Denis

On 12/22/2010 05:31 PM, ext Denis Kenzior wrote:

Hi Dara,

On 12/20/2010 07:36 PM, Dara Spieker-Doyle wrote:

---
  Makefile.am   |5 -
  test/cdma-dial-number |   24 
  test/cdma-hangup  |   20 
  test/cdma-list-call   |   30 ++
  4 files changed, 78 insertions(+), 1 deletions(-)
  create mode 100755 test/cdma-dial-number
  create mode 100755 test/cdma-hangup
  create mode 100755 test/cdma-list-call



Patch looks fine but does not apply cleanly without patch 4.  Can you
also fix these:


diff --git a/Makefile.am b/Makefile.am
index 50e893f..32ded3d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -431,7 +431,10 @@ test_scripts = test/backtrace \
test/test-push-notification \
test/test-smart-messaging \
test/send-vcard \
-   test/set-tty
+   test/set-tty \
+   test/cdma-list-call \
+   test/cdma-dial-number \
+   test/cdma-hangup

  if TEST
  testdir = $(pkglibdir)/test
diff --git a/test/cdma-dial-number b/test/cdma-dial-number
new file mode 100755
index 000..948d32d
--- /dev/null
+++ b/test/cdma-dial-number
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv)  2:
+   path = sys.argv[1]
+   number = sys.argv[2]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+   number = sys.argv[1]
+
+print Using modem %s % path
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Dial(number)
\ No newline at end of file


^


diff --git a/test/cdma-hangup b/test/cdma-hangup
new file mode 100755
index 000..f8e631e
--- /dev/null
+++ b/test/cdma-hangup
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv)  2:
+   path = sys.argv[1]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Hangup()
diff --git a/test/cdma-list-call b/test/cdma-list-call
new file mode 100755
index 000..9f9fdbc
--- /dev/null
+++ b/test/cdma-list-call
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+   print [ %s ] % (path)
+
+   if org.ofono.cdma.VoiceCallManager not in properties[Interfaces]:
+   continue
+
+   mgr = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.cdma.VoiceCallManager')
+
+   properties = mgr.GetProperties()
+
+   for key in properties.keys():
+   if key in [Interfaces, Features]:
+   val = 
+   for i in properties[key]:
+   val += i +  
+   else:
+   val = str(properties[key])
+   print %s = %s % (key, val)
\ No newline at end of file


and ^^

Regards,
-Denis


Yes I'll clean these up with the new version

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


Re: [PATCH v3, Part2, 1/3] nokiacdma: Add plugin and CDMA MO Call Support

2010-12-23 Thread Dara Spieker-Doyle

Hi Denis

On 12/22/2010 06:31 PM, ext Denis Kenzior wrote:

Hi Dara,

snip


+struct nokiacdma_data {
+   GAtChat *chat;
+   ofono_bool_t online;
+   ofono_bool_t registration_status;


What is the purpose of the above two variables?

snip


+static void nokiacdma_disconnect(gpointer user_data)
+{
+   struct ofono_modem *modem = user_data;
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   g_at_chat_unref(data-chat);
+   data-chat = NULL;
+
+   data-chat = open_device(modem, Device, CDMA Device: );
+   if (data-chat == NULL)
+   return;
+
+   g_at_chat_set_disconnect_function(data-chat,
+   nokiacdma_disconnect, modem);
+}


What are you trying to accomplish in this one?  on the huawei driver
this is used to re-open the tty because it is HUP-ed when the ppp
session ends (their way of signaling NO CARRIER).  However, I don't see
you doing PPP yet, so I'm not so sure of the purpose here?


+
+/* power up hardware */
+static int nokiacdma_enable(struct ofono_modem *modem)
+{
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   ofono_modem_set_boolean(modem, no_sim_required, TRUE);
+
+   data-chat = open_device(modem, Device, CDMA Device: );
+   if (data-chat == NULL)
+   return -EINVAL;
+
+   g_at_chat_set_disconnect_function(data-chat,
+   nokiacdma_disconnect, modem);
+
+   if (getenv(OFONO_AT_DEBUG))
+   g_at_chat_set_debug(data-chat, nokiacdma_debug,
+   CDMA Generic: );
+
+   return 0;
+}
+
+static int nokiacdma_disable(struct ofono_modem *modem)
+{
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   if (data-chat) {
+   g_at_chat_cancel_all(data-chat);
+   g_at_chat_unregister_all(data-chat);
+   g_at_chat_unref(data-chat);
+   data-chat = NULL;
+   }
+
+   return 0;


So enable and disable just open up the ports?


+}
+
+static void nokiacdma_pre_sim(struct ofono_modem *modem)
+{
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+
+   ofono_cdma_voicecall_create(modem, 0, cdmamodem,
+   data-chat);
+}
+
+static void nokiacdma_post_sim(struct ofono_modem *modem)
+{
+}
+
+static gboolean nokiacdma_set_online_cb(gpointer cb_data)
+{
+   struct cb_data *cbd = cb_data;
+   ofono_modem_online_cb_t cb = cbd-cb;
+
+   CALLBACK_WITH_SUCCESS(cb, cbd-data);
+
+   g_free(cbd);
+
+   /* do not call again */
+   return FALSE;
+}
+
+static void nokiacdma_set_online(struct ofono_modem *modem, ofono_bool_t 
online,
+   ofono_modem_online_cb_t cb, void *user_data)
+{
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+   struct cb_data *cbd = cb_data_new(cb, user_data);
+
+   DBG(modem %p %s, modem, online ? online : offline);
+
+   if (cbd == NULL)
+   goto error;
+
+   data-online = online;
+
+   /* TODO: Fix this when network registration implemented */
+   if (online)
+   data-registration_status =
+   NETWORK_REGISTRATION_STATUS_REGISTERED;
+
+   nokiacdma_set_online_cb(cbd);
+   return;
+
+error:
+   g_free(cbd);
+
+   CALLBACK_WITH_FAILURE(cb, cbd-data);
+}


I'm lost here.  What are you trying to accomplish?

snip

Regards,
-Denis


Apologies for the confusion, all these are relics of integration with 
other experimental work and are not relevant to the MO Call feature 
submission. I'll clean this up and send new versions.


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


[PATCH] TODO: Add CDMA network and voicecall tasks

2010-12-22 Thread Dara Spieker-Doyle
Also updates the task ownership fields to be consistent
with the tasks that are actually currently active.
---
 TODO |   66 +++---
 1 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/TODO b/TODO
index ee32e34..a644fde 100644
--- a/TODO
+++ b/TODO
@@ -475,7 +475,6 @@ CDMA Voicecall
 
   Priority: High
   Complexity: C2
-  Owner: Dara Spieker-Doyle dara.spieker-do...@nokia.com
 
 - Add support for Call Waiting over a CDMA network. Call Waiting (CW) provides
   notification of an incoming call to an originating subscriber, while the
@@ -495,13 +494,23 @@ CDMA Voicecall
 
   Priority: High
   Complexity: C2
-  Owner: Dara Spieker-Doyle dara.spieker-do...@nokia.com
 
 - Support sending DTMF tones over CDMA network.
 
   Priority: High
   Complexity: C2
-  Owner: Dara Spieker-Doyle dara.spieker-do...@nokia.com
+
+- Support optional network-based Plus Code Dialing for international calls over
+  a CDMA network. An input key, e.g. the + key, or a functional equivalent
+  can be used to replace the international access prefix when dialing. When
+  received, transmitted or stored, an international indicator can be included
+  with the address digits although it is the responsibility of the network to
+  ignore the international indicator when attached to a national number. This
+  is described in Section 2.7.1.3.2.4 of 3GPP2 C.S0005-E v2.0 and Section 1.2
+  of 3GPP2 N.S0027 v1.0.
+
+  Priority: High
+  Complexity: C2
 
 CDMA SMS
 ==
@@ -591,3 +600,54 @@ CDMA CMAS
 
   Priority: Medium
   Complexity: C4
+
+CDMA NETWORK ACQUISITION
+
+
+- Support reporting of the received signal strength indicator (RSSI)
+  measurement and of the pilot energy ratio (Ec/Io) measurement, for the
+  currently acquired CDMA network.
+
+  Priority: Medium
+  Complexity: C1
+  Owner: Dara Spieker-Doyle dara.spieker-do...@nokia.com
+
+- Support reporting of the received signal strength indicator (RSSI)
+  measurement and of the signal to interference-plus-noise ratio (SINR)
+  measurement, for the currently acquired 1xEV-DO data network.
+
+  Priority: Medium
+  Complexity: C1
+
+- Support reporting of the Enhanced Roaming Indicators (ERI) to indicate the
+  current roaming condition of the CDMA mobile device. Each indicator maps to
+  a unique display number within the Standard and Non-Standard service ranges,
+  as described in Section 8 of 3GPP2 C.R1001-C v1.0.
+  These numbers are stored on the device in the (Enhanced) Preferred Roaming
+  List (PRL) and it is the responsibility of the modem to broadcast the
+  relevant indicator for a currently acquired system. Further details of the
+  system acquisition process are described in 3GPP2 C.S0016-B v1.0.
+
+  Priority: Medium
+  Complexity: C2
+
+- Support reporting of identifiers of the currently acquired CDMA network,
+  including the System Identifier (SID) and the Network Identifier (NID),
+  It is the responsibility of the modem to broadcast the relevant identifiers
+  for a currently acquired system, and these identifiers are provided by the
+  network. This is described in 3GPP2 C.S0005-E v2.0.
+
+  Priority: Medium
+  Complexity: C2
+
+- Support International Roaming, including support for reporting the Mobile
+  Country Code (MCC) and the Mobile Network Code (MNC) for the currently
+  acquired network. International Roaming is provided via enhancements to the
+  PRL by encoding the MCC and the (two digit only) MNC in existing SID/NID
+  fields, as described in the CDMA Development Group standards Document IPRL
+  Enhancements for International Roaming - CDG Doc #86. It is the
+  responsibility of the modem to broadcast the values for the currently
+  acquired system.
+
+  Priority: Medium
+  Complexity: C2
-- 
1.7.0.4

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


Re: [PATCH v2 7/9] ofono-rules: Add cdmagen device

2010-12-21 Thread Dara Spieker-Doyle

Hi Marcel

On 12/21/2010 06:23 AM, ext Marcel Holtmann wrote:



so calling this driver nokiacdma sounds a bit better to me. It makes
it clear that the device is from Nokia. If you wanna shotcut it into
nokcdma then that is also fine with me, but it should reflect what it
is.


 Ok, I see. I'll rename to nokiacdma and submit new versions.

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


[PATCH v3, Part2, 1/3] nokiacdma: Add plugin and CDMA MO Call Support

2010-12-21 Thread Dara Spieker-Doyle
---
 Makefile.am |3 +
 plugins/nokiacdma.c |  275 +++
 2 files changed, 278 insertions(+), 0 deletions(-)
 create mode 100644 plugins/nokiacdma.c

diff --git a/Makefile.am b/Makefile.am
index 32ded3d..74b6759 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -293,6 +293,9 @@ builtin_sources += plugins/ste.c
 
 builtin_modules += caif
 builtin_sources += plugins/caif.c
+
+builtin_modules += nokiacdma
+builtin_sources += plugins/nokiacdma.c
 endif
 
 if MAINTAINER_MODE
diff --git a/plugins/nokiacdma.c b/plugins/nokiacdma.c
new file mode 100644
index 000..3cf2de0
--- /dev/null
+++ b/plugins/nokiacdma.c
@@ -0,0 +1,275 @@
+/*
+ * This file is part of oFono - Open Source Telephony
+ *
+ * Copyright (C) 2010 Nokia 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 config.h
+#endif
+
+#include stdlib.h
+#include errno.h
+#include termios.h
+#include string.h
+#include unistd.h
+#include sys/types.h
+#include sys/stat.h
+#include fcntl.h
+
+#include glib.h
+#include gatchat.h
+#include gattty.h
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include ofono/plugin.h
+#include ofono/log.h
+#include ofono/modem.h
+
+#include drivers/atmodem/atutil.h
+#include ofono/cdma-voicecall.h
+
+#include common.h
+
+struct nokiacdma_data {
+   GAtChat *chat;
+   ofono_bool_t online;
+   ofono_bool_t registration_status;
+};
+
+static void nokiacdma_debug(const char *str, void *data)
+{
+   const char *prefix = data;
+
+   ofono_info(%s%s, prefix, str);
+}
+
+static int nokiacdma_probe(struct ofono_modem *modem)
+{
+   struct nokiacdma_data *data;
+
+   DBG(%p, modem);
+
+   data = g_try_new0(struct nokiacdma_data, 1);
+   if (data == NULL)
+   return -ENOMEM;
+
+   ofono_modem_set_data(modem, data);
+
+   return 0;
+}
+
+static void nokiacdma_remove(struct ofono_modem *modem)
+{
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   ofono_modem_set_data(modem, NULL);
+
+   if (data-chat)
+   g_at_chat_unref(data-chat);
+
+   g_free(data);
+}
+
+static GAtChat *create_port(const char *device)
+{
+   GAtSyntax *syntax;
+   GIOChannel *channel;
+   GAtChat *chat;
+
+   channel = g_at_tty_open(device, NULL);
+   if (channel == NULL)
+   return NULL;
+
+   syntax = g_at_syntax_new_gsmv1();
+
+   chat = g_at_chat_new(channel, syntax);
+   g_at_syntax_unref(syntax);
+   g_io_channel_unref(channel);
+
+   if (chat == NULL)
+   return NULL;
+
+   return chat;
+}
+
+static GAtChat *open_device(struct ofono_modem *modem,
+   const char *key, char *debug)
+{
+   const char *device;
+   GAtChat *chat;
+
+   device = ofono_modem_get_string(modem, key);
+   if (device == NULL)
+   return NULL;
+
+   DBG(%s %s, key, device);
+
+   chat = create_port(device);
+   if (chat == NULL)
+   return NULL;
+
+   g_at_chat_add_terminator(chat, COMMAND NOT SUPPORT, -1, FALSE);
+
+   if (getenv(OFONO_AT_DEBUG))
+   g_at_chat_set_debug(chat, nokiacdma_debug, debug);
+
+   return chat;
+}
+
+static void nokiacdma_disconnect(gpointer user_data)
+{
+   struct ofono_modem *modem = user_data;
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   g_at_chat_unref(data-chat);
+   data-chat = NULL;
+
+   data-chat = open_device(modem, Device, CDMA Device: );
+   if (data-chat == NULL)
+   return;
+
+   g_at_chat_set_disconnect_function(data-chat,
+   nokiacdma_disconnect, modem);
+}
+
+/* power up hardware */
+static int nokiacdma_enable(struct ofono_modem *modem)
+{
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   ofono_modem_set_boolean(modem, no_sim_required, TRUE);
+
+   data-chat = open_device(modem, Device, CDMA Device: );
+   if (data-chat == NULL)
+   return -EINVAL;
+
+   g_at_chat_set_disconnect_function(data-chat,
+   nokiacdma_disconnect, modem);
+
+   if (getenv(OFONO_AT_DEBUG))
+   g_at_chat_set_debug(data-chat, 

[PATCH v3, Part2, 2/3] ofono-rules: Add nokiacdma device

2010-12-21 Thread Dara Spieker-Doyle
---
 plugins/ofono.rules |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/plugins/ofono.rules b/plugins/ofono.rules
index 9369566..a5ceb69 100644
--- a/plugins/ofono.rules
+++ b/plugins/ofono.rules
@@ -432,4 +432,8 @@ ATTRS{idVendor}==0421, ATTRS{idProduct}==060e, 
ENV{OFONO_DRIVER}=nokia
 # Nokia Internet Stick CS-17
 ATTRS{idVendor}==0421, ATTRS{idProduct}==0623, ENV{OFONO_DRIVER}=nokia
 
+# Nokia CDMA Device
+ATTRS{idVendor}==0421, ATTRS{idProduct}==023e, 
ENV{OFONO_DRIVER}=nokiacdma
+ATTRS{idVendor}==0421, ATTRS{idProduct}==00b6, 
ENV{OFONO_DRIVER}=nokiacdma
+
 LABEL=ofono_end
-- 
1.7.0.4

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


[PATCH v3, Part2, 3/3] udev: Add nokiacdma device

2010-12-21 Thread Dara Spieker-Doyle
---
 plugins/udev.c |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/plugins/udev.c b/plugins/udev.c
index 255755e..9447e5c 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -449,6 +449,25 @@ static void add_isi(struct ofono_modem *modem,
ofono_modem_register(modem);
 }
 
+static void add_nokiacdma(struct ofono_modem *modem,
+   struct udev_device *udev_device)
+{
+   const char *devnode;
+   int registered;
+
+   DBG(modem %p, modem);
+
+   devnode = udev_device_get_devnode(udev_device);
+
+   registered = ofono_modem_get_integer(modem, Registered);
+   if (registered != 0)
+   return;
+
+   ofono_modem_set_string(modem, Device, devnode);
+   ofono_modem_set_integer(modem, Registered, 1);
+   ofono_modem_register(modem);
+}
+
 static void add_modem(struct udev_device *udev_device)
 {
struct ofono_modem *modem;
@@ -533,6 +552,8 @@ done:
add_isi(modem, udev_device);
else if (g_strcmp0(driver, n900) == 0)
add_isi(modem, udev_device);
+   else if (g_strcmp0(driver, nokiacdma) == 0)
+   add_nokiacdma(modem, udev_device);
 }
 
 static gboolean devpath_remove(gpointer key, gpointer value, gpointer 
user_data)
-- 
1.7.0.4

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


[PATCH v3, Part2, 0/3] Add nokiacdma plugin and CDMA MO Call support

2010-12-21 Thread Dara Spieker-Doyle
This series of patches is the second part of the split of the version 2 series,
concerning the changes needed to provide foundation support for the nokiacdma
device plugin and the adding the cdma-voicecall atom. This is needed for
testing the changes in the first part of the series, for providing the 
foundation cdmamodem driver and simple CDMA MO Call support with hardware.

These patches have been tested against the Nokia 7205 CDMA device in a tethered
mode.

Limitations
---
The Nokia 7205 device does not support an AT interface for reporting request
responses, such as the call status and remote/network disconnect reasons, so
these are currently untested.

Dara Spieker-Doyle (3):
  nokiacdma: Add plugin and CDMA MO Call Support
  ofono-rules: Add nokiacdma device
  udev: Add nokiacdma device

 Makefile.am   |   20 ++-
 plugins/nokiacdma.c   |  275 ++
 plugins/ofono.rules   |4 +
 plugins/udev.c|   21 ++
 4 files changed, 303 insertions(+), 0 deletions(-)
 create mode 100644 plugins/nokiacdma.c

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


Re: [PATCH v2 8/9] udev: Add cdmagen

2010-12-20 Thread Dara Spieker-Doyle

Hi Marcel

Thank you for reviewing these patches

On 12/18/2010 10:29 AM, ext Marcel Holtmann wrote:

Hi Dara,


struct ofono_modem *modem;
@@ -533,6 +552,8 @@ done:
add_isi(modem, udev_device);
else if (g_strcmp0(driver, n900) == 0)
add_isi(modem, udev_device);
+   else if (g_strcmp0(driver, cdmagen) == 0)
+   add_cdmagen(modem, udev_device);
  }


this is actually wrong. The generic drivers running against phonesim
should not be done via udev. We did remove atgen for a reason actually
since it was not really useful.


Actually, this driver is not for running against phonesim at all. This 
plugin is intended for use against the majority of CDMA AT Modem devices 
(phones and usb sticks) connected in a tethered mode.
Please see the other email thread in this series ([Patch v2 7/9]) for 
alternative name suggestion to clarify this.


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


Re: [PATCH v2 7/9] ofono-rules: Add cdmagen device

2010-12-20 Thread Dara Spieker-Doyle

Hi Marcel

On 12/18/2010 10:31 AM, ext Marcel Holtmann wrote:

Hi Dara,


  plugins/ofono.rules |4 
  1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/plugins/ofono.rules b/plugins/ofono.rules
index da8a8ef..34698f0 100644
--- a/plugins/ofono.rules
+++ b/plugins/ofono.rules
@@ -429,6 +429,10 @@ ATTRS{idVendor}==0930, ATTRS{idProduct}==1311, 
ENV{OFONO_DRIVER}=mbm
  # Nokia Internet Stick CS-10
  ATTRS{idVendor}==0421, ATTRS{idProduct}==060e, ENV{OFONO_DRIVER}=nokia

+# Nokia CDMA Device
+ATTRS{idVendor}==0421, ATTRS{idProduct}==023e, ENV{OFONO_DRIVER}=cdmagen
+ATTRS{idVendor}==0421, ATTRS{idProduct}==00b6, ENV{OFONO_DRIVER}=cdmagen
+


since this is Nokia specific device, then using nokiacdma would be a
better name. Or using OFONO_DRIVER=nokia NOKIA_MODE=cdma and sharing the
driver might be useful.

It really all depends how much they have in common.


Nothing. All Nokia CDMA devices actually contain Qualcomm modems, so 
perhaps a better name may be along the lines of msmcdmamodem for CDMA 
AT modem devices in a tethered mode?


So what kind of

hardware is this actually? A phone or a real USB dongle?


It is a phone.

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


Re: [PATCH v2 3/9] cdma-voicecall: Add CDMA MO Call Support

2010-12-20 Thread Dara Spieker-Doyle

Hi Denis

Thank you for reviewing these patches. I will submit new versions for 
your comments, please see any open points inline.


On 12/20/2010 12:50 PM, ext Denis Kenzior wrote:


+ */
+
+#ifndef __OFONO_CDMA_VOICECALL_H
+#define __OFONO_CDMA_VOICECALL_H
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#includeofono/types.h
+
+struct ofono_cdma_voicecall_manager;


Please call this ofono_cdma_voicecall.
This is actually our preference as well as there is no multicall in 
CDMA, just the single voicecall. To that end, does it not make sense to 
also rename the interface Voicecall rather than VoiceCallManager?


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


Re: [PATCH v2 4/9] cdma-voicecall: Add CDMA MO Call Support

2010-12-20 Thread Dara Spieker-Doyle

Hi Denis

On 12/20/2010 01:01 PM, ext Denis Kenzior wrote:


+
+static const char *voicecall_build_path(struct ofono_cdma_voicecall_manager 
*vc)
+{
+ static char path[256];
+
+ snprintf(path, sizeof(path), %s/voicecall,
+ __ofono_atom_get_path(vc-atom));


I'm still confused what this is for?  The CDMA voicecall proposal does
not have leaf objects...
Sorry yes, this is the same oversight as before. I will fix this and 
remove these path references.


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


[PATCH v3, Part1, 0/5] Add CDMA MO Call Support

2010-12-20 Thread Dara Spieker-Doyle
This series of patches is the first part of the split of the version 2 series,
concerning the changes needed to provide foundation support for cdmamodem
driver and the introducing the cdma-voicecall atom. Not included in this part
of the series is the cdmagen plugin for testing these changes with hardware as
this is under further discussion. Part2 will be submitted once the naming
convention for this plugin has been resolved.
This part also contains the relevant test scripts, although these will fail
for now until the cdmagen plugin changes have been submitted.

Implementation of the following has been carried out in this set of patches:

They cover making a simple MO call over a CDMA network, including call
state management, LineIdentification, dialing and hanging up through the
cdma-voicecall atom DBus interface. 
Currently, the implemented call states available are dialing and
disconnected, initiated on dialing and hanging up, and the LineIdentification
property is updated only upon dialing. The StartTime for when a call would 
become
active has been implemented, but is untested until support for call state
transition changes is implemented. This is future work.

AT command support for dial and hangup is provided with a cdma-atmodem driver.
Also included in these patches are test scripts and a CDMA generic hardware
plugin (cdmagen) to support testing of these features.

These patches have been tested against the Nokia 7205 CDMA device in a tethered
mode.

Limitations
---
The Nokia 7205 device does not support an AT interface for reporting request
responses, such as the call status and remote/network disconnect reasons, so
these are currently untested.

Dara Spieker-Doyle (5):
  cdma-voicecall: Add CDMA MO Call Support
  cdma-voicecall: Add CDMA MO Call Support
  cdmamodem: Add cdmamodem stubs
  cdmamodem: Add CDMA MO Call Support with voicecall driver
  test: Add CDMA MO Call Support

 Makefile.am   |   17 ++-
 configure.ac  |5 +
 drivers/cdmamodem/cdmamodem.c |   48 +
 drivers/cdmamodem/cdmamodem.h |   25 +++
 drivers/cdmamodem/voicecall.c |  190 ++
 include/cdma-voicecall.h  |   89 +
 src/cdma-voicecall.c  |  430 +
 src/common.c  |   41 
 src/common.h  |6 +
 src/ofono.h   |3 +
 test/cdma-dial-number |   24 +++
 test/cdma-hangup  |   20 ++
 test/cdma-list-call   |   30 +++
 13 files changed, 925 insertions(+), 3 deletions(-)
 create mode 100644 drivers/cdmamodem/cdmamodem.c
 create mode 100644 drivers/cdmamodem/cdmamodem.h
 create mode 100644 drivers/cdmamodem/voicecall.c
 create mode 100644 include/cdma-voicecall.h
 create mode 100644 src/cdma-voicecall.c
 create mode 100755 test/cdma-dial-number
 create mode 100755 test/cdma-hangup
 create mode 100755 test/cdma-list-call

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


[PATCH v3, Part1, 1/5] cdma-voicecall: Add CDMA MO Call Support

2010-12-20 Thread Dara Spieker-Doyle
---
 Makefile.am  |2 +-
 include/cdma-voicecall.h |   89 ++
 2 files changed, 90 insertions(+), 1 deletions(-)
 create mode 100644 include/cdma-voicecall.h

diff --git a/Makefile.am b/Makefile.am
index 12b3c33..1270be5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,7 @@ include_HEADERS = include/log.h include/plugin.h 
include/history.h \
include/gprs.h include/gprs-context.h \
include/radio-settings.h include/stk.h \
include/audio-settings.h include/nettime.h \
-   include/ctm.h
+   include/ctm.h include/cdma-voicecall.h
 
 nodist_include_HEADERS = include/version.h
 
diff --git a/include/cdma-voicecall.h b/include/cdma-voicecall.h
new file mode 100644
index 000..6cd0984
--- /dev/null
+++ b/include/cdma-voicecall.h
@@ -0,0 +1,89 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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
+ *
+ */
+
+#ifndef __OFONO_CDMA_VOICECALL_H
+#define __OFONO_CDMA_VOICECALL_H
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#include ofono/types.h
+
+struct ofono_cdma_voicecall;
+
+enum cdma_call_status {
+   CDMA_CALL_STATUS_ACTIVE,
+   CDMA_CALL_STATUS_DIALING,
+   CDMA_CALL_STATUS_ALERTING,
+   CDMA_CALL_STATUS_INCOMING,
+   CDMA_CALL_STATUS_DISCONNECTED
+};
+
+typedef void (*ofono_cdma_voicecall_cb_t)(const struct ofono_error *error,
+   void *data);
+
+/* Voice call related functionality, including AT+CDV, AT+CHV */
+struct ofono_cdma_voicecall_driver {
+   const char *name;
+   int (*probe)(struct ofono_cdma_voicecall *vc,
+   unsigned int vendor, void *data);
+   void (*remove)(struct ofono_cdma_voicecall *vc);
+
+   void (*dial)(struct ofono_cdma_voicecall *vc,
+   const struct ofono_cdma_phone_number *number,
+   ofono_cdma_voicecall_cb_t cb, void *data);
+
+   /* Hangs up active, dialing, alerting or incoming calls */
+   void (*hangup)(struct ofono_cdma_voicecall *vc,
+   ofono_cdma_voicecall_cb_t cb, void *data);
+};
+
+void ofono_cdma_voicecall_disconnected(
+   struct ofono_cdma_voicecall *vc,
+   enum ofono_disconnect_reason reason,
+   const struct ofono_error *error);
+
+int ofono_cdma_voicecall_driver_register(
+   const struct ofono_cdma_voicecall_driver *d);
+void ofono_cdma_voicecall_driver_unregister(
+   const struct ofono_cdma_voicecall_driver *d);
+
+struct ofono_cdma_voicecall *ofono_cdma_voicecall_create(
+   struct ofono_modem *modem,
+   unsigned int vendor,
+   const char *driver, void *data);
+
+void ofono_cdma_voicecall_register(
+   struct ofono_cdma_voicecall *vc);
+void ofono_cdma_voicecall_remove(
+   struct ofono_cdma_voicecall *vc);
+
+void ofono_cdma_voicecall_set_data(
+   struct ofono_cdma_voicecall *vc, void *data);
+void *ofono_cdma_voicecall_get_data(
+   struct ofono_cdma_voicecall *vc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_CDMA_VOICECALL_H */
-- 
1.7.0.4

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


[PATCH v3, Part1, 2/5] cdma-voicecall: Add CDMA MO Call Support

2010-12-20 Thread Dara Spieker-Doyle
---
 Makefile.am  |3 +-
 src/cdma-voicecall.c |  430 ++
 src/common.c |   41 +
 src/common.h |6 +
 src/ofono.h  |3 +
 5 files changed, 482 insertions(+), 1 deletions(-)
 create mode 100644 src/cdma-voicecall.c

diff --git a/Makefile.am b/Makefile.am
index 1270be5..40ff52d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -319,7 +319,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) 
src/ofono.ver \
src/radio-settings.c src/stkutil.h src/stkutil.c \
src/nettime.c src/stkagent.c src/stkagent.h \
src/simfs.c src/simfs.h src/audio-settings.c \
-   src/smsagent.c src/smsagent.h src/ctm.c
+   src/smsagent.c src/smsagent.h src/ctm.c \
+   src/cdma-voicecall.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
 
diff --git a/src/cdma-voicecall.c b/src/cdma-voicecall.c
new file mode 100644
index 000..a36af75
--- /dev/null
+++ b/src/cdma-voicecall.c
@@ -0,0 +1,430 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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 config.h
+#endif
+
+#include string.h
+#include stdio.h
+#include time.h
+#include errno.h
+#include stdint.h
+
+#include glib.h
+#include gdbus.h
+
+#include ofono.h
+
+#include common.h
+
+static GSList *g_drivers;
+
+struct ofono_cdma_voicecall {
+   struct ofono_cdma_phone_number phone_number;
+   int direction;
+   enum cdma_call_status status;
+   time_t start_time;
+   DBusMessage *pending;
+   const struct ofono_cdma_voicecall_driver *driver;
+   void *driver_data;
+   struct ofono_atom *atom;
+};
+
+static const char *disconnect_reason_to_string(enum ofono_disconnect_reason r)
+{
+   switch (r) {
+   case OFONO_DISCONNECT_REASON_LOCAL_HANGUP:
+   return local;
+   case OFONO_DISCONNECT_REASON_REMOTE_HANGUP:
+   return remote;
+   default:
+   return network;
+   }
+}
+
+static const char *cdma_call_status_to_string(enum cdma_call_status status)
+{
+   switch (status) {
+   case CDMA_CALL_STATUS_ACTIVE:
+   return active;
+   case CDMA_CALL_STATUS_DIALING:
+   return dialing;
+   case CDMA_CALL_STATUS_ALERTING:
+   return alerting;
+   case CDMA_CALL_STATUS_INCOMING:
+   return incoming;
+   case CDMA_CALL_STATUS_DISCONNECTED:
+   return disconnected;
+   }
+
+   return NULL;
+}
+
+static const char *time_to_str(const time_t *t)
+{
+   static char buf[128];
+   struct tm tm;
+
+   strftime(buf, 127, %Y-%m-%dT%H:%M:%S%z, localtime_r(t, tm));
+   buf[127] = '\0';
+
+   return buf;
+}
+
+static void generic_callback(const struct ofono_error *error, void *data)
+{
+   struct ofono_cdma_voicecall *vc = data;
+   DBusMessage *reply;
+
+   if (error-type == OFONO_ERROR_TYPE_NO_ERROR)
+   reply = dbus_message_new_method_return(vc-pending);
+   else
+   reply = __ofono_error_failed(vc-pending);
+
+   __ofono_dbus_pending_reply(vc-pending, reply);
+}
+
+static void append_voicecall_properties(struct ofono_cdma_voicecall *vc,
+   DBusMessageIter *dict)
+{
+   const char *status;
+   const char *lineid;
+   const char *timestr;
+
+   status = cdma_call_status_to_string(vc-status);
+   lineid = cdma_phone_number_to_string(vc-phone_number);
+
+   ofono_dbus_dict_append(dict, State, DBUS_TYPE_STRING, status);
+
+   ofono_dbus_dict_append(dict, LineIdentification,
+   DBUS_TYPE_STRING, lineid);
+
+   if (vc-status == CDMA_CALL_STATUS_ACTIVE) {
+   timestr = time_to_str(vc-start_time);
+
+   ofono_dbus_dict_append(dict, StartTime, DBUS_TYPE_STRING,
+   timestr);
+   }
+}
+
+static DBusMessage *voicecall_manager_get_properties(DBusConnection *conn,
+   DBusMessage *msg, void *data)
+{
+   struct ofono_cdma_voicecall *vc = data;
+   

[PATCH v3, Part1, 3/5] cdmamodem: Add cdmamodem stubs

2010-12-20 Thread Dara Spieker-Doyle
---
 Makefile.am   |6 +
 configure.ac  |5 
 drivers/cdmamodem/cdmamodem.c |   45 +
 drivers/cdmamodem/cdmamodem.h |   22 
 4 files changed, 78 insertions(+), 0 deletions(-)
 create mode 100644 drivers/cdmamodem/cdmamodem.c
 create mode 100644 drivers/cdmamodem/cdmamodem.h

diff --git a/Makefile.am b/Makefile.am
index 40ff52d..861237c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -242,6 +242,12 @@ conf_DATA += plugins/phonesim.conf
 endif
 endif
 
+if CDMA_ATMODEM
+builtin_modules += cdma_atmodem
+builtin_sources += drivers/cdmamodem/cdmamodem.h \
+   drivers/cdmamodem/cdmamodem.c
+endif
+
 builtin_modules += g1
 builtin_sources += plugins/g1.c
 
diff --git a/configure.ac b/configure.ac
index 5c18f68..9cc0689 100644
--- a/configure.ac
+++ b/configure.ac
@@ -160,6 +160,11 @@ AC_ARG_ENABLE(atmodem, AC_HELP_STRING([--disable-atmodem],
[enable_atmodem=${enableval}])
 AM_CONDITIONAL(ATMODEM, test ${enable_atmodem} != no)
 
+AC_ARG_ENABLE(cdmaatmodem, AC_HELP_STRING([--disable-cdmamodem],
+   [disable CDMA AT modem support]),
+   [enable_cdma_atmodem=${enableval}])
+AM_CONDITIONAL(CDMA_ATMODEM, test ${enable_cdma_atmodem} != no)
+
 AC_ARG_ENABLE(phonesim, AC_HELP_STRING([--disable-phonesim],
[disable Phone simulator support]),
[enable_phonesim=${enableval}])
diff --git a/drivers/cdmamodem/cdmamodem.c b/drivers/cdmamodem/cdmamodem.c
new file mode 100644
index 000..25bd0f3
--- /dev/null
+++ b/drivers/cdmamodem/cdmamodem.c
@@ -0,0 +1,45 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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 config.h
+#endif
+
+#include glib.h
+#include gatchat.h
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include ofono/plugin.h
+#include ofono/types.h
+
+#include cdmamodem.h
+
+static int cdma_atmodem_init(void)
+{
+   return 0;
+}
+
+static void cdma_atmodem_exit(void)
+{
+}
+
+OFONO_PLUGIN_DEFINE(cdma_atmodem, CDMA AT modem driver, VERSION,
+   OFONO_PLUGIN_PRIORITY_DEFAULT, cdma_atmodem_init, cdma_atmodem_exit)
diff --git a/drivers/cdmamodem/cdmamodem.h b/drivers/cdmamodem/cdmamodem.h
new file mode 100644
index 000..114d1fd
--- /dev/null
+++ b/drivers/cdmamodem/cdmamodem.h
@@ -0,0 +1,22 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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
+ *
+ */
+
+#include drivers/atmodem/atutil.h
-- 
1.7.0.4

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


[PATCH v3, Part1, 5/5] test: Add CDMA MO Call Support

2010-12-20 Thread Dara Spieker-Doyle
---
 Makefile.am   |5 -
 test/cdma-dial-number |   24 
 test/cdma-hangup  |   20 
 test/cdma-list-call   |   30 ++
 4 files changed, 78 insertions(+), 1 deletions(-)
 create mode 100755 test/cdma-dial-number
 create mode 100755 test/cdma-hangup
 create mode 100755 test/cdma-list-call

diff --git a/Makefile.am b/Makefile.am
index 50e893f..32ded3d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -431,7 +431,10 @@ test_scripts = test/backtrace \
test/test-push-notification \
test/test-smart-messaging \
test/send-vcard \
-   test/set-tty
+   test/set-tty \
+   test/cdma-list-call \
+   test/cdma-dial-number \
+   test/cdma-hangup
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/cdma-dial-number b/test/cdma-dial-number
new file mode 100755
index 000..948d32d
--- /dev/null
+++ b/test/cdma-dial-number
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv)  2:
+   path = sys.argv[1]
+   number = sys.argv[2]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+   number = sys.argv[1]
+
+print Using modem %s % path
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Dial(number)
\ No newline at end of file
diff --git a/test/cdma-hangup b/test/cdma-hangup
new file mode 100755
index 000..f8e631e
--- /dev/null
+++ b/test/cdma-hangup
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv)  2:
+   path = sys.argv[1]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Hangup()
diff --git a/test/cdma-list-call b/test/cdma-list-call
new file mode 100755
index 000..9f9fdbc
--- /dev/null
+++ b/test/cdma-list-call
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+   print [ %s ] % (path)
+
+   if org.ofono.cdma.VoiceCallManager not in properties[Interfaces]:
+   continue
+
+   mgr = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.cdma.VoiceCallManager')
+
+   properties = mgr.GetProperties()
+
+   for key in properties.keys():
+   if key in [Interfaces, Features]:
+   val = 
+   for i in properties[key]:
+   val += i +  
+   else:
+   val = str(properties[key])
+   print %s = %s % (key, val)
\ No newline at end of file
-- 
1.7.0.4

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


[PATCH v2 3/9] cdma-voicecall: Add CDMA MO Call Support

2010-12-17 Thread Dara Spieker-Doyle
---
 Makefile.am  |2 +-
 include/cdma-voicecall.h |   89 ++
 2 files changed, 90 insertions(+), 1 deletions(-)
 create mode 100644 include/cdma-voicecall.h

diff --git a/Makefile.am b/Makefile.am
index 12b3c33..1270be5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,7 @@ include_HEADERS = include/log.h include/plugin.h 
include/history.h \
include/gprs.h include/gprs-context.h \
include/radio-settings.h include/stk.h \
include/audio-settings.h include/nettime.h \
-   include/ctm.h
+   include/ctm.h include/cdma-voicecall.h
 
 nodist_include_HEADERS = include/version.h
 
diff --git a/include/cdma-voicecall.h b/include/cdma-voicecall.h
new file mode 100644
index 000..aaae028
--- /dev/null
+++ b/include/cdma-voicecall.h
@@ -0,0 +1,89 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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
+ *
+ */
+
+#ifndef __OFONO_CDMA_VOICECALL_H
+#define __OFONO_CDMA_VOICECALL_H
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#include ofono/types.h
+
+struct ofono_cdma_voicecall_manager;
+
+enum cdma_call_status {
+   CDMA_CALL_STATUS_ACTIVE,
+   CDMA_CALL_STATUS_DIALING,
+   CDMA_CALL_STATUS_ALERTING,
+   CDMA_CALL_STATUS_INCOMING,
+   CDMA_CALL_STATUS_DISCONNECTED
+};
+
+typedef void (*ofono_cdma_voicecall_cb_t)(const struct ofono_error *error,
+   void *data);
+
+/* Voice call related functionality, including AT+CDV, AT+CHV */
+struct ofono_cdma_voicecall_driver {
+   const char *name;
+   int (*probe)(struct ofono_cdma_voicecall_manager *vc,
+   unsigned int vendor, void *data);
+   void (*remove)(struct ofono_cdma_voicecall_manager *vc);
+
+   void (*dial)(struct ofono_cdma_voicecall_manager *vc,
+   const struct ofono_cdma_phone_number *number,
+   ofono_cdma_voicecall_cb_t cb, void *data);
+
+   /* Hangs up active, dialing, alerting or incoming calls */
+   void (*hangup)(struct ofono_cdma_voicecall_manager *vc,
+   ofono_cdma_voicecall_cb_t cb, void *data);
+};
+
+void ofono_cdma_voicecall_manager_disconnected(
+   struct ofono_cdma_voicecall_manager *vc,
+   enum ofono_disconnect_reason reason,
+   const struct ofono_error *error);
+
+int ofono_cdma_voicecall_driver_register(
+   const struct ofono_cdma_voicecall_driver *d);
+void ofono_cdma_voicecall_driver_unregister(
+   const struct ofono_cdma_voicecall_driver *d);
+
+struct ofono_cdma_voicecall_manager *ofono_cdma_voicecall_manager_create(
+   struct ofono_modem *modem,
+   unsigned int vendor,
+   const char *driver, void *data);
+
+void ofono_cdma_voicecall_manager_register(
+   struct ofono_cdma_voicecall_manager *vc);
+void ofono_cdma_voicecall_manager_remove(
+   struct ofono_cdma_voicecall_manager *vc);
+
+void ofono_cdma_voicecall_manager_set_data(
+   struct ofono_cdma_voicecall_manager *vc, void *data);
+void *ofono_cdma_voicecall_manager_get_data(
+   struct ofono_cdma_voicecall_manager *vc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_CDMA_VOICECALL_H */
-- 
1.7.0.4

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


[PATCH v2 0/9] Add CDMA MO Call Support

2010-12-17 Thread Dara Spieker-Doyle
Submitting new versions for review comments.

This set of patches introduces the foundation for CDMA Voicecall support in
oFono. They cover making a simple MO call over a CDMA network, including call
state management, LineIdentification, dialing and hanging up through the
cdma-voicecall atom DBus interface. 
Currently, the implemented call states available are dialing and
disconnected, initiated on dialing and hanging up, and the LineIdentification
property is updated only upon dialing. The StartTime for when a call would 
become
active has been implemented, but is untested until support for call state
transition changes is implemented. This is future work.

AT command support for dial and hangup is provided with a cdma-atmodem driver.
Also included in these patches are test scripts and a CDMA generic hardware
plugin (cdmagen) to support testing of these features.

These patches have been tested against the Nokia 7205 CDMA device in a tethered
mode.

Limitations
---
The Nokia 7205 device does not support an AT interface for reporting request
responses, such as the call status and remote/network disconnect reasons, so
these are currently untested.

Dara Spieker-Doyle (9):
  dbus: Add CDMA Voicecall Interface
  types: Add CDMA Phone Number
  cdma-voicecall: Add CDMA MO Call Support
  cdma-voicecall: Add CDMA MO Call Support
  cdmamodem: Add CDMA MO Call Support
  cdmagen: Add CDMA MO Call Support
  ofono-rules: Add cdmagen device
  udev: Add cdmagen
  test: Add CDMA MO Call Support

 Makefile.am   |   20 ++-
 configure.ac  |5 +
 drivers/cdmamodem/cdmamodem.c |   48 +
 drivers/cdmamodem/cdmamodem.h |   25 +++
 drivers/cdmamodem/voicecall.c |  190 ++
 include/cdma-voicecall.h  |   89 
 include/dbus.h|3 +
 include/types.h   |8 +
 plugins/cdmagen.c |  274 +
 plugins/ofono.rules   |4 +
 plugins/udev.c|   21 ++
 src/cdma-voicecall.c  |  444 +
 src/common.c  |   41 
 src/common.h  |6 +
 src/ofono.h   |3 +
 test/cdma-dial-number |   24 +++
 test/cdma-hangup  |   20 ++
 test/cdma-list-call   |   30 +++
 18 files changed, 1252 insertions(+), 3 deletions(-)
 create mode 100644 drivers/cdmamodem/cdmamodem.c
 create mode 100644 drivers/cdmamodem/cdmamodem.h
 create mode 100644 drivers/cdmamodem/voicecall.c
 create mode 100644 include/cdma-voicecall.h
 create mode 100644 plugins/cdmagen.c
 create mode 100644 src/cdma-voicecall.c
 create mode 100755 test/cdma-dial-number
 create mode 100755 test/cdma-hangup
 create mode 100755 test/cdma-list-call

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


[PATCH v2 1/9] dbus: Add CDMA Voicecall Interface

2010-12-17 Thread Dara Spieker-Doyle
---
 include/dbus.h |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/dbus.h b/include/dbus.h
index 9e29afb..c527515 100644
--- a/include/dbus.h
+++ b/include/dbus.h
@@ -55,6 +55,9 @@ extern C {
 #define OFONO_STK_INTERFACE OFONO_SERVICE .SimToolkit
 #define OFONO_SIM_APP_INTERFACE OFONO_SERVICE .SimToolkitAgent
 
+/* CDMA Interfaces */
+#define OFONO_CDMA_VOICECALL_MANAGER_INTERFACE 
org.ofono.cdma.VoiceCallManager
+
 /* Essentially a{sv} */
 #define OFONO_PROPERTIES_ARRAY_SIGNATURE DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING \
DBUS_TYPE_STRING_AS_STRING \
-- 
1.7.0.4

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


[PATCH v2 6/9] cdmagen: Add CDMA MO Call Support

2010-12-17 Thread Dara Spieker-Doyle
---
 Makefile.am   |3 +
 plugins/cdmagen.c |  274 +
 2 files changed, 277 insertions(+), 0 deletions(-)
 create mode 100644 plugins/cdmagen.c

diff --git a/Makefile.am b/Makefile.am
index 50e893f..9949bcc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -293,6 +293,9 @@ builtin_sources += plugins/ste.c
 
 builtin_modules += caif
 builtin_sources += plugins/caif.c
+
+builtin_modules += cdmagen
+builtin_sources += plugins/cdmagen.c
 endif
 
 if MAINTAINER_MODE
diff --git a/plugins/cdmagen.c b/plugins/cdmagen.c
new file mode 100644
index 000..4ec4614
--- /dev/null
+++ b/plugins/cdmagen.c
@@ -0,0 +1,274 @@
+/*
+ * This file is part of oFono - Open Source Telephony
+ *
+ * Copyright (C) 2010 Nokia 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 config.h
+#endif
+
+#include stdlib.h
+#include errno.h
+#include termios.h
+#include string.h
+#include unistd.h
+#include sys/types.h
+#include sys/stat.h
+#include fcntl.h
+
+#include glib.h
+#include gatchat.h
+#include gattty.h
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include ofono/plugin.h
+#include ofono/log.h
+#include ofono/modem.h
+
+#include ofono/cdma-voicecall.h
+#include drivers/atmodem/atutil.h
+
+#include common.h
+
+struct cdmagen_data {
+   GAtChat *chat;
+   ofono_bool_t online;
+   ofono_bool_t registration_status;
+};
+
+static void cdmagen_debug(const char *str, void *data)
+{
+   const char *prefix = data;
+
+   ofono_info(%s%s, prefix, str);
+}
+
+static int cdmagen_probe(struct ofono_modem *modem)
+{
+   struct cdmagen_data *data;
+
+   DBG(%p, modem);
+
+   data = g_try_new0(struct cdmagen_data, 1);
+   if (data == NULL)
+   return -ENOMEM;
+
+   ofono_modem_set_data(modem, data);
+
+   return 0;
+}
+
+static void cdmagen_remove(struct ofono_modem *modem)
+{
+   struct cdmagen_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   ofono_modem_set_data(modem, NULL);
+
+   if (data-chat)
+   g_at_chat_unref(data-chat);
+
+   g_free(data);
+}
+
+static GAtChat *create_port(const char *device)
+{
+   GAtSyntax *syntax;
+   GIOChannel *channel;
+   GAtChat *chat;
+
+   channel = g_at_tty_open(device, NULL);
+   if (channel == NULL)
+   return NULL;
+
+   syntax = g_at_syntax_new_gsmv1();
+
+   chat = g_at_chat_new(channel, syntax);
+   g_at_syntax_unref(syntax);
+   g_io_channel_unref(channel);
+
+   if (chat == NULL)
+   return NULL;
+
+   return chat;
+}
+
+static GAtChat *open_device(struct ofono_modem *modem,
+   const char *key, char *debug)
+{
+   const char *device;
+   GAtChat *chat;
+
+   device = ofono_modem_get_string(modem, key);
+   if (device == NULL)
+   return NULL;
+
+   DBG(%s %s, key, device);
+
+   chat = create_port(device);
+   if (chat == NULL)
+   return NULL;
+
+   g_at_chat_add_terminator(chat, COMMAND NOT SUPPORT, -1, FALSE);
+
+   if (getenv(OFONO_AT_DEBUG))
+   g_at_chat_set_debug(chat, cdmagen_debug, debug);
+
+   return chat;
+}
+
+static void cdmagen_disconnect(gpointer user_data)
+{
+   struct ofono_modem *modem = user_data;
+   struct cdmagen_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   g_at_chat_unref(data-chat);
+   data-chat = NULL;
+
+   data-chat = open_device(modem, Device, CDMA Device: );
+   if (data-chat == NULL)
+   return;
+
+   g_at_chat_set_disconnect_function(data-chat,
+   cdmagen_disconnect, modem);
+}
+
+/* power up hardware */
+static int cdmagen_enable(struct ofono_modem *modem)
+{
+   struct cdmagen_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   ofono_modem_set_boolean(modem, no_sim_required, TRUE);
+
+   data-chat = open_device(modem, Device, CDMA Device: );
+   if (data-chat == NULL)
+   return -EINVAL;
+
+   g_at_chat_set_disconnect_function(data-chat,
+   cdmagen_disconnect, modem);
+
+   if (getenv(OFONO_AT_DEBUG))
+   g_at_chat_set_debug(data-chat, cdmagen_debug,
+   

[PATCH v2 5/9] cdmamodem: Add CDMA MO Call Support

2010-12-17 Thread Dara Spieker-Doyle
---
 Makefile.am   |7 ++
 configure.ac  |5 +
 drivers/cdmamodem/cdmamodem.c |   48 ++
 drivers/cdmamodem/cdmamodem.h |   25 ++
 drivers/cdmamodem/voicecall.c |  190 +
 5 files changed, 275 insertions(+), 0 deletions(-)
 create mode 100644 drivers/cdmamodem/cdmamodem.c
 create mode 100644 drivers/cdmamodem/cdmamodem.h
 create mode 100644 drivers/cdmamodem/voicecall.c

diff --git a/Makefile.am b/Makefile.am
index 40ff52d..50e893f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -242,6 +242,13 @@ conf_DATA += plugins/phonesim.conf
 endif
 endif
 
+if CDMA_ATMODEM
+builtin_modules += cdma_atmodem
+builtin_sources += drivers/cdmamodem/cdmamodem.h \
+   drivers/cdmamodem/cdmamodem.c \
+   drivers/cdmamodem/voicecall.c
+endif
+
 builtin_modules += g1
 builtin_sources += plugins/g1.c
 
diff --git a/configure.ac b/configure.ac
index 5c18f68..9cc0689 100644
--- a/configure.ac
+++ b/configure.ac
@@ -160,6 +160,11 @@ AC_ARG_ENABLE(atmodem, AC_HELP_STRING([--disable-atmodem],
[enable_atmodem=${enableval}])
 AM_CONDITIONAL(ATMODEM, test ${enable_atmodem} != no)
 
+AC_ARG_ENABLE(cdmaatmodem, AC_HELP_STRING([--disable-cdmamodem],
+   [disable CDMA AT modem support]),
+   [enable_cdma_atmodem=${enableval}])
+AM_CONDITIONAL(CDMA_ATMODEM, test ${enable_cdma_atmodem} != no)
+
 AC_ARG_ENABLE(phonesim, AC_HELP_STRING([--disable-phonesim],
[disable Phone simulator support]),
[enable_phonesim=${enableval}])
diff --git a/drivers/cdmamodem/cdmamodem.c b/drivers/cdmamodem/cdmamodem.c
new file mode 100644
index 000..20e6d96
--- /dev/null
+++ b/drivers/cdmamodem/cdmamodem.c
@@ -0,0 +1,48 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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 config.h
+#endif
+
+#include glib.h
+#include gatchat.h
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include ofono/plugin.h
+#include ofono/types.h
+
+#include cdmamodem.h
+
+static int cdma_atmodem_init(void)
+{
+   cdma_at_voicecall_init();
+
+   return 0;
+}
+
+static void cdma_atmodem_exit(void)
+{
+   cdma_at_voicecall_exit();
+}
+
+OFONO_PLUGIN_DEFINE(cdma_atmodem, CDMA AT modem driver, VERSION,
+   OFONO_PLUGIN_PRIORITY_DEFAULT, cdma_atmodem_init, cdma_atmodem_exit)
diff --git a/drivers/cdmamodem/cdmamodem.h b/drivers/cdmamodem/cdmamodem.h
new file mode 100644
index 000..a5991cf
--- /dev/null
+++ b/drivers/cdmamodem/cdmamodem.h
@@ -0,0 +1,25 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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
+ *
+ */
+
+#include drivers/atmodem/atutil.h
+
+extern void cdma_at_voicecall_init();
+extern void cdma_at_voicecall_exit();
diff --git a/drivers/cdmamodem/voicecall.c b/drivers/cdmamodem/voicecall.c
new file mode 100644
index 000..f9955d6
--- /dev/null
+++ b/drivers/cdmamodem/voicecall.c
@@ -0,0 +1,190 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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 

[PATCH v2 4/9] cdma-voicecall: Add CDMA MO Call Support

2010-12-17 Thread Dara Spieker-Doyle
---
 Makefile.am  |3 +-
 src/cdma-voicecall.c |  444 ++
 src/common.c |   41 +
 src/common.h |6 +
 src/ofono.h  |3 +
 5 files changed, 496 insertions(+), 1 deletions(-)
 create mode 100644 src/cdma-voicecall.c

diff --git a/Makefile.am b/Makefile.am
index 1270be5..40ff52d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -319,7 +319,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) 
src/ofono.ver \
src/radio-settings.c src/stkutil.h src/stkutil.c \
src/nettime.c src/stkagent.c src/stkagent.h \
src/simfs.c src/simfs.h src/audio-settings.c \
-   src/smsagent.c src/smsagent.h src/ctm.c
+   src/smsagent.c src/smsagent.h src/ctm.c \
+   src/cdma-voicecall.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
 
diff --git a/src/cdma-voicecall.c b/src/cdma-voicecall.c
new file mode 100644
index 000..7baaff3
--- /dev/null
+++ b/src/cdma-voicecall.c
@@ -0,0 +1,444 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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 config.h
+#endif
+
+#include string.h
+#include stdio.h
+#include time.h
+#include errno.h
+#include stdint.h
+
+#include glib.h
+#include gdbus.h
+
+#include ofono.h
+
+#include common.h
+
+static GSList *g_drivers;
+
+struct ofono_cdma_voicecall_manager {
+   struct ofono_cdma_phone_number phone_number;
+   int direction;
+   enum cdma_call_status status;
+   time_t start_time;
+   DBusMessage *pending;
+   const struct ofono_cdma_voicecall_driver *driver;
+   void *driver_data;
+   struct ofono_atom *atom;
+};
+
+static void generic_callback(const struct ofono_error *error, void *data);
+
+static const char *disconnect_reason_to_string(enum ofono_disconnect_reason r)
+{
+   switch (r) {
+   case OFONO_DISCONNECT_REASON_LOCAL_HANGUP:
+   return local;
+   case OFONO_DISCONNECT_REASON_REMOTE_HANGUP:
+   return remote;
+   default:
+   return network;
+   }
+}
+
+static const char *cdma_call_status_to_string(enum cdma_call_status status)
+{
+   switch (status) {
+   case CDMA_CALL_STATUS_ACTIVE:
+   return active;
+   case CDMA_CALL_STATUS_DIALING:
+   return dialing;
+   case CDMA_CALL_STATUS_ALERTING:
+   return alerting;
+   case CDMA_CALL_STATUS_INCOMING:
+   return incoming;
+   default:
+   return disconnected;
+   }
+}
+
+static const char *time_to_str(const time_t *t)
+{
+   static char buf[128];
+   struct tm tm;
+
+   strftime(buf, 127, %Y-%m-%dT%H:%M:%S%z, localtime_r(t, tm));
+   buf[127] = '\0';
+
+   return buf;
+}
+
+static void append_voicecall_properties(struct ofono_cdma_voicecall_manager *v,
+   DBusMessageIter *dict)
+{
+   const char *status;
+   const char *lineid;
+   const char *timestr;
+
+   status = cdma_call_status_to_string(v-status);
+   lineid = cdma_phone_number_to_string(v-phone_number);
+
+   ofono_dbus_dict_append(dict, State, DBUS_TYPE_STRING, status);
+
+   ofono_dbus_dict_append(dict, LineIdentification,
+   DBUS_TYPE_STRING, lineid);
+
+   if (v-status == CDMA_CALL_STATUS_ACTIVE) {
+   timestr = time_to_str(v-start_time);
+
+   ofono_dbus_dict_append(dict, StartTime, DBUS_TYPE_STRING,
+   timestr);
+   }
+}
+
+static DBusMessage *voicecall_manager_get_properties(DBusConnection *conn,
+   DBusMessage *msg, void *data)
+{
+   struct ofono_cdma_voicecall_manager *v = data;
+   DBusMessage *reply;
+   DBusMessageIter iter;
+   DBusMessageIter dict;
+
+   reply = dbus_message_new_method_return(msg);
+
+   if (reply == NULL)
+   return NULL;
+
+   dbus_message_iter_init_append(reply, iter);
+
+   dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
+   

[PATCH v2 7/9] ofono-rules: Add cdmagen device

2010-12-17 Thread Dara Spieker-Doyle
---
 plugins/ofono.rules |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/plugins/ofono.rules b/plugins/ofono.rules
index da8a8ef..34698f0 100644
--- a/plugins/ofono.rules
+++ b/plugins/ofono.rules
@@ -429,6 +429,10 @@ ATTRS{idVendor}==0930, ATTRS{idProduct}==1311, 
ENV{OFONO_DRIVER}=mbm
 # Nokia Internet Stick CS-10
 ATTRS{idVendor}==0421, ATTRS{idProduct}==060e, ENV{OFONO_DRIVER}=nokia
 
+# Nokia CDMA Device
+ATTRS{idVendor}==0421, ATTRS{idProduct}==023e, ENV{OFONO_DRIVER}=cdmagen
+ATTRS{idVendor}==0421, ATTRS{idProduct}==00b6, ENV{OFONO_DRIVER}=cdmagen
+
 # Nokia Internet Stick CS-17
 ATTRS{idVendor}==0421, ATTRS{idProduct}==0623, ENV{OFONO_DRIVER}=nokia
 
-- 
1.7.0.4

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


[PATCH v2 8/9] udev: Add cdmagen

2010-12-17 Thread Dara Spieker-Doyle
---
 plugins/udev.c |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/plugins/udev.c b/plugins/udev.c
index 255755e..e9541ac 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -449,6 +449,25 @@ static void add_isi(struct ofono_modem *modem,
ofono_modem_register(modem);
 }
 
+static void add_cdmagen(struct ofono_modem *modem,
+   struct udev_device *udev_device)
+{
+   const char *devnode;
+   int registered;
+
+   DBG(modem %p, modem);
+
+   devnode = udev_device_get_devnode(udev_device);
+
+   registered = ofono_modem_get_integer(modem, Registered);
+   if (registered != 0)
+   return;
+
+   ofono_modem_set_string(modem, Device, devnode);
+   ofono_modem_set_integer(modem, Registered, 1);
+   ofono_modem_register(modem);
+}
+
 static void add_modem(struct udev_device *udev_device)
 {
struct ofono_modem *modem;
@@ -533,6 +552,8 @@ done:
add_isi(modem, udev_device);
else if (g_strcmp0(driver, n900) == 0)
add_isi(modem, udev_device);
+   else if (g_strcmp0(driver, cdmagen) == 0)
+   add_cdmagen(modem, udev_device);
 }
 
 static gboolean devpath_remove(gpointer key, gpointer value, gpointer 
user_data)
-- 
1.7.0.4

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


[PATCH v2 2/9] types: Add CDMA Phone Number

2010-12-17 Thread Dara Spieker-Doyle
---
 include/types.h |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/types.h b/include/types.h
index de15437..a394775 100644
--- a/include/types.h
+++ b/include/types.h
@@ -84,6 +84,14 @@ struct ofono_phone_number {
int type;
 };
 
+/* Length of NUM_FIELDS in 3GPP2 C.S0005-E v2.0*/
+#define OFONO_CDMA_MAX_PHONE_NUMBER_LENGTH 256
+
+struct ofono_cdma_phone_number {
+   /*char maps to max size of CHARi (8 bit) in 3GPP2 C.S0005-E v2.0*/
+   char number[OFONO_CDMA_MAX_PHONE_NUMBER_LENGTH];
+};
+
 struct ofono_call {
unsigned int id;
int type;
-- 
1.7.0.4

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


[PATCH v2 9/9] test: Add CDMA MO Call Support

2010-12-17 Thread Dara Spieker-Doyle
---
 Makefile.am   |5 -
 test/cdma-dial-number |   24 
 test/cdma-hangup  |   20 
 test/cdma-list-call   |   30 ++
 4 files changed, 78 insertions(+), 1 deletions(-)
 create mode 100755 test/cdma-dial-number
 create mode 100755 test/cdma-hangup
 create mode 100755 test/cdma-list-call

diff --git a/Makefile.am b/Makefile.am
index 9949bcc..d0d269a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -434,7 +434,10 @@ test_scripts = test/backtrace \
test/test-push-notification \
test/test-smart-messaging \
test/send-vcard \
-   test/set-tty
+   test/set-tty \
+   test/cdma-list-call \
+   test/cdma-dial-number \
+   test/cdma-hangup
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/cdma-dial-number b/test/cdma-dial-number
new file mode 100755
index 000..e62018f
--- /dev/null
+++ b/test/cdma-dial-number
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv)  2:
+   path = sys.argv[1]
+   number = sys.argv[2]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+   number = sys.argv[1]
+
+print Using modem %s % path
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Dial(number, )
\ No newline at end of file
diff --git a/test/cdma-hangup b/test/cdma-hangup
new file mode 100755
index 000..f8e631e
--- /dev/null
+++ b/test/cdma-hangup
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv)  2:
+   path = sys.argv[1]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Hangup()
diff --git a/test/cdma-list-call b/test/cdma-list-call
new file mode 100755
index 000..9f9fdbc
--- /dev/null
+++ b/test/cdma-list-call
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+   print [ %s ] % (path)
+
+   if org.ofono.cdma.VoiceCallManager not in properties[Interfaces]:
+   continue
+
+   mgr = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.cdma.VoiceCallManager')
+
+   properties = mgr.GetProperties()
+
+   for key in properties.keys():
+   if key in [Interfaces, Features]:
+   val = 
+   for i in properties[key]:
+   val += i +  
+   else:
+   val = str(properties[key])
+   print %s = %s % (key, val)
\ No newline at end of file
-- 
1.7.0.4

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


Re: [PATCH 3/5] cdma-atmodem: Add CDMA MO Call Support

2010-12-13 Thread Dara Spieker-Doyle
Hi Denis

On Fri, 2010-12-10 at 22:41 +0100, Spieker-Doyle Dara
(Nokia-MS/SanDiego) wrote:
 Hi Denis
 
 On Thu, 2010-12-09 at 09:43 +0100, ext Denis Kenzior wrote:
 
  
drivers/cdma-atmodem/atutil.c|   45 +
drivers/cdma-atmodem/atutil.h|   65 +
  
  Are these verbatim copies of atmodem/atutil.[ch]?  If so, then there's
  no reason why you can't re-use those.  No need to copy them.
 
 No, they are not verbatim copies as e.g. error decoding is different.
 Would you prefer we clarify this by renaming the files cdmautil.(ch)?
 
On second thoughts, I agree for this patch - I will correct this and
re-use the drivers/atmodem/atutil.[ch].
Additionally, for future feature support, I do envisage some delta with
various AT utilities for CDMA. For example, with our current hardware,
the AT return string can have a different format from the GSM AT command
standard. 
Do you have any particular preference in such cases as to whether we
modify the e.g. gatchat sources directly to support this or whether we
create CDMA specific functions within the cdma-atmodem driver?

Thank you
Dara


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


Re: [PATCH] TODO: Add CDMA Voicecall Support Tasks

2010-12-10 Thread Dara Spieker-Doyle
Hi Denis

On Thu, 2010-12-09 at 09:04 +0100, ext Denis Kenzior wrote:

 
 Patch looks good to me, however it does not apply:
 
 fatal: cannot convert from unknown-8bit to UTF-8
 
Thank you. We are currently investigating this format issue and will
submit a new version once resolved.

Cheers
Dara


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


Re: [PATCH 2/5] cdma-voicecall: Add CDMA MO Call Support

2010-12-10 Thread Dara Spieker-Doyle
Hi Denis

Thank you for reviewing this series of patches. We shall submit new
versions according to your comments. Please find any other clarifying
points inline.

On Thu, 2010-12-09 at 09:36 +0100, ext Denis Kenzior wrote:

  +
  +static void voicecall_set_call_status(struct ofono_cdma_voicecall_manager 
  *vc,
  + enum cdma_call_status status)
  +{
  + DBusConnection *conn = ofono_dbus_get_connection();
  + const char *path;
  + const char *status_str;
  + enum cdma_call_status old_status;
  +
  + if (vc-status == status)
  + return;
  +
  + old_status = vc-status;
  +
  + vc-status = status;
  +
  + status_str = cdma_call_status_to_string(status);
  + path = voicecall_build_path(vc);
  +
  + ofono_dbus_signal_property_changed(conn, path,
  + 
  OFONO_CDMA_VOICECALL_MANAGER_INTERFACE,
  + State, DBUS_TYPE_STRING,
  + status_str);
  +
  + if (status == CDMA_CALL_STATUS_ACTIVE 
  + old_status == CDMA_CALL_STATUS_DIALING) {
  + const char *timestr;
  +
  + vc-start_time = time(NULL);
  + timestr = time_to_str(vc-start_time);
 
 So in GSM we only timestamp the call once it moves to the active state.
  Do you really want to timestamp it in the dialing stage?

I'm not sure what you mean here? We are carrying out the timestamp when
the status is active having previously been dialing in a similar way to
GSM. 
In this patch, setting of the state to active is not supported yet due
to our current hardware limitations, so the time implementation has been
provided but is untested. If you would prefer us to remove the
timestamping altogether from this patch, we can do?

 
  +
  + ofono_dbus_signal_property_changed(conn, path,
  + 
  OFONO_CDMA_VOICECALL_MANAGER_INTERFACE,
  + StartTime, DBUS_TYPE_STRING,
  + timestr);
  + }
  +}
  +
  +static void voicecall_set_call_lineid(struct ofono_cdma_voicecall_manager 
  *v)
  +{
  + DBusConnection *conn = ofono_dbus_get_connection();
  + const char *path;
  + const char *lineid_str;
  +
  + path = voicecall_build_path(v);
  +
  + /* For MO calls, LineID is the dialed phone number */
  + lineid_str = cdma_phone_number_to_string(v-phone_number);
  +
  + ofono_dbus_signal_property_changed(conn, path,
  + 
  OFONO_CDMA_VOICECALL_MANAGER_INTERFACE,
  + LineIdentification,
  + DBUS_TYPE_STRING, lineid_str);
  +}
  +
  +static void manager_dial_callback(const struct ofono_error *error, void 
  *data)
  +{
  + struct ofono_cdma_voicecall_manager *vc = data;
  + DBusMessage *reply;
  +
  + if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
  + reply = __ofono_error_failed(vc-pending);
  + } else {
  + const char *path = voicecall_build_path(vc);
 
 what path are you returning here?  This is not in the API proposal...

This was an oversight, thank you for catching it- I will remove this.

 
  +
  + reply = dbus_message_new_method_return(vc-pending);
  +
  + dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, path,
  + DBUS_TYPE_INVALID);
  + }
 
 In general the preferred style is:
 
 if (foo) {
 bar
 } else
 blah
 
  +
  + __ofono_dbus_pending_reply(vc-pending, reply);
  +}
  +
  +static DBusMessage *voicecall_manager_dial(DBusConnection *conn,
  + DBusMessage *msg, void *data)
  +{
  + struct ofono_cdma_voicecall_manager *vc = data;
  + const char *number;
  +
  + if (vc-pending)
  + return __ofono_error_busy(msg);
  +
  + if (vc-status != CDMA_CALL_STATUS_DISCONNECTED)
  + return __ofono_error_failed(msg);
  +
  + if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, number,
  + DBUS_TYPE_INVALID) == FALSE)
  + return __ofono_error_invalid_args(msg);
  +
  + if (!valid_cdma_phone_number_format(number))
  + return __ofono_error_invalid_format(msg);
  +
  + if (vc-driver-dial == NULL)
  + return __ofono_error_not_implemented(msg);
  +
  + vc-pending = dbus_message_ref(msg);
  +
  + string_to_cdma_phone_number(number, vc-phone_number);
  + voicecall_set_call_lineid(vc);
  + vc-direction = CALL_DIRECTION_MOBILE_ORIGINATED;
  + voicecall_set_call_status(vc, CDMA_CALL_STATUS_DIALING);
  + vc-driver-dial(vc, vc-phone_number, manager_dial_callback, vc);
  +
 
 What are the expectations on how the dial works?
 
 e.g. in GSM we don't create the call until after the dial returns.
 Normally this works 

[PATCH v2] TODO: Add CDMA Voicecall Support Tasks

2010-12-10 Thread Dara Spieker-Doyle
---
 TODO |   58 ++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index 8d771d6..cbcdac5 100644
--- a/TODO
+++ b/TODO
@@ -484,3 +484,61 @@ Miscellaneous
   Priority: Medium
   Complexity: C2
   Owner: Sjur Brændeland sjur.brandel...@stericsson.com
+
+CDMA Voicecall
+==
+
+- Add support for Mobile Originated and Mobile Terminated Voice Call over
+  a CDMA network. This includes management of call state and providing
+  appropriate values for the LineIdentification in each case.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle dara.spieker-do...@nokia.com
+
+- Add support for Three-Way Calling over a CDMA network. Three-Way Calling
+  provides the subscriber with the capability to add a third party to an
+  established two-party call, so that all three parties may communicate in a
+  three-way call.
+
+  In CDMA mode, the originating subscriber of a current conversation can
+  request for a third party to be added to a conversation by sending a Flash
+  With Information Message (FWIM) with dialed digits to the network. Upon
+  setting up a two-way conversation with the added party, the originating
+  subscriber can request to establish a three-way conversation by sending
+  another Flash With Information Message. Upon receiving the second Flash With
+  Information Message, the MSC reconnects the original party to the
+  conversation thus completing the setup of a three-way conversation.
+
+  CDMA Three-Way Calling is described by Figure B-5 in 3GPP2 C.S0005-E Version
+  2.0.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle dara.spieker-do...@nokia.com
+
+- Add support for Call Waiting over a CDMA network. Call Waiting (CW) provides
+  notification of an incoming call to an originating subscriber, while the
+  subscriber's call is in the 2-way state. Subsequently, the originating
+  subscriber can either answer or ignore the incoming call. If the originating
+  subscriber answers the second call, it may alternate between the two calls.
+
+  In CDMA mode, the originating subscriber of a current conversation will
+  receive either a Flash With Information Message or an Alert With Information
+  Message from the network if there is an additional mobile terminated voice
+  call incoming. The originating subscriber can change conversation parties by
+  sending a Flash With Information Message to the network and the MSC will
+  toggle the speech path between the two conversations.
+
+  CDMA Call Waiting is described by Figure B-6 in 3GPP2 C.S0005-E Version
+  2.0.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle dara.spieker-do...@nokia.com
+
+- Support sending DTMF tones over CDMA network.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle dara.spieker-do...@nokia.com
-- 
1.7.0.4

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


Re: [PATCH 2/5] cdma-voicecall: Add CDMA MO Call Support

2010-12-07 Thread Dara Spieker-Doyle
Hi Denis

On Tue, 2010-12-07 at 04:16 +0100, ext Denis Kenzior wrote:
 Hi Rajesh,
 
 On 12/03/2010 03:34 PM, 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: 03 December 2010 13:21
   
  +enum cdma_call_status {
  +CDMA_CALL_STATUS_ACTIVE = 0,
  +CDMA_CALL_STATUS_DIALING = 1,
  +CDMA_CALL_STATUS_ALERTING = 2,
  +CDMA_CALL_STATUS_INCOMING = 4,
 
  Should be 3 ?
 
  Yes indeed. I will fix this, thank you for catching it.
   
  +CDMA_CALL_STATUS_DISCONNECTED
  +};
 
  We can use the existing gsm call status itself ?
  Just that we wont use the HELD and WAITING status in CDMA.
 
  In this early phase of CDMA support in oFono, we would like 
  to evolve it in its own right for a while, per the offline 
  conversation from the MeeGo Conference in Dublin. On a case 
  by case basis, for items of large architectural impact, we 
  intend to evaluate potential re-use upfront.
  The plan is to allow smaller items like this for now, until 
  the related feature has matured sufficiently that they can be 
  re-factored correctly if applicable.
   
  I agree with the fact that we should evolve it in its own right.
  But with these kind of straight forward cases, where the GSM values
  are a superset of the CDMA values and these value definitions being
  internal to ofono, we should try to to reuse the values rather than
  creating new ones exclusive for CDMA.
  Thats my view, Denis/Marcel any comments ?
  
 
 So the general rule of thumb has been to use an int when a spec clearly
 defines the meaning of the said int.  E.g. call status int values have
 very clear meaning from 27.007.  If no such clear definition exists,
 then an enum should be used.

The 3GPP2 does not provide clear definitions, certainly not as thorough
as 27.007
 
 So the question here becomes whether the CDMA modems all re-use the GSM
 meanings / values for these states or not?  If they do, then re-using
 the GSM enum values makes sense.

As there is no clear 3GPP2 standard for call states, we cannot guarantee
that CDMA modems would all re-use the GSM meanings.
 
 If not, then using an enum defined in include/cdma-voicecall.h would be
 better.  One major benefit of defining a dedicated enum for CDMA is the
 compiler checking that all enum values are being handled.  If you re-use
 the GSM version you would have to resort to using default statements.
 This causes you to lose that extra compiler sanity checking, not to
 mention is against rule M12 of the coding style.  And yes I know we're
 not always consistent with this one ;)
 

This is our preference- we can move the cdma enum from /src/common.h
into include/cdma-voicecall.h if you would prefer that location?

Cheers
Dara


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


RE: [PATCH 2/5] cdma-voicecall: Add CDMA MO Call Support

2010-12-03 Thread Dara Spieker-Doyle
Hi Rajesh

On Fri, 2010-12-03 at 01:30 +0100, ext rajesh.naga...@elektrobit.com
wrote:

  +enum cdma_call_status {
  +   CDMA_CALL_STATUS_ACTIVE = 0,
  +   CDMA_CALL_STATUS_DIALING = 1,
  +   CDMA_CALL_STATUS_ALERTING = 2,
  +   CDMA_CALL_STATUS_INCOMING = 4,
 
 Should be 3 ?

Yes indeed. I will fix this, thank you for catching it.
 
  +   CDMA_CALL_STATUS_DISCONNECTED
  +};
 
 We can use the existing gsm call status itself ?
 Just that we wont use the HELD and WAITING status
 in CDMA.

In this early phase of CDMA support in oFono, we would like to evolve it
in its own right for a while, per the offline conversation from the
MeeGo Conference in Dublin. On a case by case basis, for items of large
architectural impact, we intend to evaluate potential re-use upfront.
The plan is to allow smaller items like this for now, until the related
feature has matured sufficiently that they can be re-factored correctly
if applicable.

Cheers
Dara

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


[PATCH] TODO: Add CDMA Voicecall Support Tasks

2010-12-02 Thread Dara Spieker-Doyle
---
 TODO |   58 ++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index a421a99..3007620 100644
--- a/TODO
+++ b/TODO
@@ -496,3 +496,61 @@ Miscellaneous
   Priority: Medium
   Complexity: C2
   Owner: Sjur Br??ndeland sjur.brandel...@stericsson.com
+
+CDMA Voicecall
+==
+
+- Add support for Mobile Originated and Mobile Terminated Voice Call over
+  a CDMA network. This includes management of call state and providing
+  appropriate values for the LineIdentification in each case.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle dara.spieker-do...@nokia.com
+
+- Add support for Three-Way Calling over a CDMA network. Three-Way Calling
+  provides the subscriber with the capability to add a third party to an
+  established two-party call, so that all three parties may communicate in a
+  three-way call.
+
+  In CDMA mode, the originating subscriber of a current conversation can
+  request for a third party to be added to a conversation by sending a Flash
+  With Information Message (FWIM) with dialed digits to the network. Upon
+  setting up a two-way conversation with the added party, the originating
+  subscriber can request to establish a three-way conversation by sending
+  another Flash With Information Message. Upon receiving the second Flash With
+  Information Message, the MSC reconnects the original party to the
+  conversation thus completing the setup of a three-way conversation.
+
+  CDMA Three-Way Calling is described by Figure B-5 in 3GPP2 C.S0005-E Version
+  2.0.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle dara.spieker-do...@nokia.com
+
+- Add support for Call Waiting over a CDMA network. Call Waiting (CW) provides
+  notification of an incoming call to an originating subscriber, while the
+  subscriber's call is in the 2-way state. Subsequently, the originating
+  subscriber can either answer or ignore the incoming call. If the originating
+  subscriber answers the second call, it may alternate between the two calls.
+
+  In CDMA mode, the originating subscriber of a current conversation will
+  receive either a Flash With Information Message or an Alert With Information
+  Message from the network if there is an additional mobile terminated voice
+  call incoming. The originating subscriber can change conversation parties by
+  sending a Flash With Information Message to the network and the MSC will
+  toggle the speech path between the two conversations.
+
+  CDMA Call Waiting is described by Figure B-6 in 3GPP2 C.S0005-E Version
+  2.0.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle dara.spieker-do...@nokia.com
+
+- Support sending DTMF tones over CDMA network.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle dara.spieker-do...@nokia.com
-- 
1.7.0.4

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


[PATCH 0/5] Add CDMA MO Call Support

2010-12-02 Thread Dara Spieker-Doyle
This set of patches introduces the foundation for CDMA Voicecall support in
oFono. They cover making a simple MO call over a CDMA network, including call
state management, LineIdentification, dialing and hanging up through the
cdma-voicecall atom DBus interface. 
Currently, the implemented call states available are dialing and
disconnected, initiated on dialing and hanging up, and the LineIdentification
property is updated only upon dialing. The StartTime for when a call would 
become
active has been implemented, but is untested until support for call state
transition changes is implemented. This is future work.

AT command support for dial and hangup is provided with a cdma-atmodem driver.
Also included in these patches are test scripts and a CDMA generic hardware
plugin (cdmagen) to support testing of these features.

These patches have been tested against the Nokia 7205 CDMA device in a tethered
mode.

Limitations
---
The Nokia 7205 device does not support an AT interface for reporting request
responses, such as the call status and remote/network disconnect reasons, so
these are currently untested.

Dara Spieker-Doyle (5):
  cdma-voicecall: Add CDMA MO Call Support
  cdma-voicecall: Add CDMA MO Call Support
  cdma-atmodem: Add CDMA MO Call Support
  cdmagen: Add CDMA MO Call Support
  test: Add CDMA MO Call Support

 Makefile.am  |   20 ++-
 configure.ac |5 +
 drivers/cdma-atmodem/atmodem.c   |   47 
 drivers/cdma-atmodem/atmodem.h   |   26 +++
 drivers/cdma-atmodem/atutil.c|   45 
 drivers/cdma-atmodem/atutil.h|   65 ++
 drivers/cdma-atmodem/voicecall.c |  195 +
 include/cdma-voicecall.h |   82 +++
 include/dbus.h   |3 +
 include/types.h  |8 +
 plugins/cdmagen.c|  276 +++
 plugins/ofono.rules  |4 +
 plugins/udev.c   |   21 ++
 src/cdma-voicecall.c |  449 ++
 src/common.c |   42 
 src/common.h |   14 ++
 src/ofono.h  |3 +
 test/cdma-dial-number|   25 ++
 test/cdma-hangup |   20 ++
 test/cdma-list-call  |   30 +++
 20 files changed, 1377 insertions(+), 3 deletions(-)
 create mode 100644 drivers/cdma-atmodem/atmodem.c
 create mode 100644 drivers/cdma-atmodem/atmodem.h
 create mode 100644 drivers/cdma-atmodem/atutil.c
 create mode 100644 drivers/cdma-atmodem/atutil.h
 create mode 100644 drivers/cdma-atmodem/voicecall.c
 create mode 100644 include/cdma-voicecall.h
 create mode 100644 plugins/cdmagen.c
 create mode 100644 src/cdma-voicecall.c
 create mode 100755 test/cdma-dial-number
 create mode 100755 test/cdma-hangup
 create mode 100755 test/cdma-list-call

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


[PATCH 2/5] cdma-voicecall: Add CDMA MO Call Support

2010-12-02 Thread Dara Spieker-Doyle
---
 Makefile.am  |3 +-
 src/cdma-voicecall.c |  449 ++
 src/common.c |   42 +
 src/common.h |   14 ++
 src/ofono.h  |3 +
 5 files changed, 510 insertions(+), 1 deletions(-)
 create mode 100644 src/cdma-voicecall.c

diff --git a/Makefile.am b/Makefile.am
index aea3fd3..f111f96 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -319,7 +319,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) 
src/ofono.ver \
src/radio-settings.c src/stkutil.h src/stkutil.c \
src/nettime.c src/stkagent.c src/stkagent.h \
src/simfs.c src/simfs.h src/audio-settings.c \
-   src/smsagent.c src/smsagent.h src/ctm.c
+   src/smsagent.c src/smsagent.h src/ctm.c \
+   src/cdma-voicecall.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
 
diff --git a/src/cdma-voicecall.c b/src/cdma-voicecall.c
new file mode 100644
index 000..8ba3222
--- /dev/null
+++ b/src/cdma-voicecall.c
@@ -0,0 +1,449 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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 config.h
+#endif
+
+#include string.h
+#include stdio.h
+#include time.h
+#include errno.h
+#include stdint.h
+
+#include glib.h
+#include gdbus.h
+
+#include ofono.h
+
+#include common.h
+
+static GSList *g_drivers;
+
+struct ofono_cdma_voicecall_manager {
+   struct ofono_cdma_phone_number phone_number;
+   int direction;
+   enum cdma_call_status status;
+   time_t start_time;
+   DBusMessage *pending;
+   const struct ofono_cdma_voicecall_manager_driver *driver;
+   void *driver_data;
+   struct ofono_atom *atom;
+};
+
+static void generic_callback(const struct ofono_error *error, void *data);
+
+static const char *disconnect_reason_to_string(enum ofono_disconnect_reason r)
+{
+   switch (r) {
+   case OFONO_DISCONNECT_REASON_LOCAL_HANGUP:
+   return local;
+   case OFONO_DISCONNECT_REASON_REMOTE_HANGUP:
+   return remote;
+   default:
+   return network;
+   }
+}
+
+static const char *cdma_call_status_to_string(enum cdma_call_status status)
+{
+   switch (status) {
+   case CDMA_CALL_STATUS_ACTIVE:
+   return active;
+   case CDMA_CALL_STATUS_DIALING:
+   return dialing;
+   case CDMA_CALL_STATUS_ALERTING:
+   return alerting;
+   case CDMA_CALL_STATUS_INCOMING:
+   return incoming;
+   default:
+   return disconnected;
+   }
+}
+
+static const char *time_to_str(const time_t *t)
+{
+   static char buf[128];
+   struct tm tm;
+
+   strftime(buf, 127, %Y-%m-%dT%H:%M:%S%z, localtime_r(t, tm));
+   buf[127] = '\0';
+
+   return buf;
+}
+
+static void append_voicecall_properties(struct ofono_cdma_voicecall_manager *v,
+   DBusMessageIter *dict)
+{
+   const char *status;
+   const char *lineid;
+   const char *timestr;
+
+   status = cdma_call_status_to_string(v-status);
+   lineid = cdma_phone_number_to_string(v-phone_number);
+
+   ofono_dbus_dict_append(dict, State, DBUS_TYPE_STRING, status);
+
+   ofono_dbus_dict_append(dict, LineIdentification,
+   DBUS_TYPE_STRING, lineid);
+
+   if (v-status == CDMA_CALL_STATUS_ACTIVE ||
+   (v-status == CDMA_CALL_STATUS_DISCONNECTED 
+   v-start_time != 0)) {
+   timestr = time_to_str(v-start_time);
+
+   ofono_dbus_dict_append(dict, StartTime, DBUS_TYPE_STRING,
+   timestr);
+   }
+}
+
+static DBusMessage *voicecall_manager_get_properties(DBusConnection *conn,
+   DBusMessage *msg, void *data)
+{
+   struct ofono_cdma_voicecall_manager *v = data;
+   DBusMessage *reply;
+   DBusMessageIter iter;
+   DBusMessageIter dict;
+
+   reply = dbus_message_new_method_return(msg);
+
+   if (reply == NULL)
+   return NULL;
+
+   

[PATCH 3/5] cdma-atmodem: Add CDMA MO Call Support

2010-12-02 Thread Dara Spieker-Doyle
---
 Makefile.am  |7 ++
 configure.ac |5 +
 drivers/cdma-atmodem/atmodem.c   |   47 +
 drivers/cdma-atmodem/atmodem.h   |   26 +
 drivers/cdma-atmodem/atutil.c|   45 +
 drivers/cdma-atmodem/atutil.h|   65 +
 drivers/cdma-atmodem/voicecall.c |  195 ++
 7 files changed, 390 insertions(+), 0 deletions(-)
 create mode 100644 drivers/cdma-atmodem/atmodem.c
 create mode 100644 drivers/cdma-atmodem/atmodem.h
 create mode 100644 drivers/cdma-atmodem/atutil.c
 create mode 100644 drivers/cdma-atmodem/atutil.h
 create mode 100644 drivers/cdma-atmodem/voicecall.c

diff --git a/Makefile.am b/Makefile.am
index f111f96..9aac08b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -242,6 +242,13 @@ conf_DATA += plugins/phonesim.conf
 endif
 endif
 
+if CDMA_ATMODEM
+builtin_modules += cdma_atmodem
+builtin_sources += drivers/cdma-atmodem/atmodem.c \
+   drivers/cdma-atmodem/atmodem.h \
+   drivers/cdma-atmodem/voicecall.c
+endif
+
 builtin_modules += g1
 builtin_sources += plugins/g1.c
 
diff --git a/configure.ac b/configure.ac
index 0c1986a..090f3ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,6 +158,11 @@ AC_ARG_ENABLE(atmodem, AC_HELP_STRING([--disable-atmodem],
[enable_atmodem=${enableval}])
 AM_CONDITIONAL(ATMODEM, test ${enable_atmodem} != no)
 
+AC_ARG_ENABLE(cdmaatmodem, AC_HELP_STRING([--disable-cdma-atmodem],
+   [disable CDMA AT modem support]),
+   [enable_cdma_atmodem=${enableval}])
+AM_CONDITIONAL(CDMA_ATMODEM, test ${enable_cdma_atmodem} != no)
+
 AC_ARG_ENABLE(phonesim, AC_HELP_STRING([--disable-phonesim],
[disable Phone simulator support]),
[enable_phonesim=${enableval}])
diff --git a/drivers/cdma-atmodem/atmodem.c b/drivers/cdma-atmodem/atmodem.c
new file mode 100644
index 000..86dd074
--- /dev/null
+++ b/drivers/cdma-atmodem/atmodem.c
@@ -0,0 +1,47 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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 config.h
+#endif
+
+#include glib.h
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include ofono/plugin.h
+#include ofono/types.h
+
+#include atmodem.h
+
+static int cdma_atmodem_init(void)
+{
+   cdma_at_voicecall_init();
+
+   return 0;
+}
+
+static void cdma_atmodem_exit(void)
+{
+   cdma_at_voicecall_exit();
+}
+
+OFONO_PLUGIN_DEFINE(cdma_atmodem, CDMA AT modem driver, VERSION,
+   OFONO_PLUGIN_PRIORITY_DEFAULT, cdma_atmodem_init, cdma_atmodem_exit)
diff --git a/drivers/cdma-atmodem/atmodem.h b/drivers/cdma-atmodem/atmodem.h
new file mode 100644
index 000..32facbc
--- /dev/null
+++ b/drivers/cdma-atmodem/atmodem.h
@@ -0,0 +1,26 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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
+ *
+ */
+
+extern void cdma_at_voicecall_init();
+extern void cdma_at_voicecall_exit();
+
+extern void cdma_at_devinfo_init();
+extern void cdma_at_devinfo_exit();
diff --git a/drivers/cdma-atmodem/atutil.c b/drivers/cdma-atmodem/atutil.c
new file mode 100644
index 000..b58c1ee
--- /dev/null
+++ b/drivers/cdma-atmodem/atutil.c
@@ -0,0 +1,45 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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 

[PATCH 4/5] cdmagen: Add CDMA MO Call Support

2010-12-02 Thread Dara Spieker-Doyle
---
 Makefile.am |3 +
 plugins/cdmagen.c   |  276 +++
 plugins/ofono.rules |4 +
 plugins/udev.c  |   21 
 4 files changed, 304 insertions(+), 0 deletions(-)
 create mode 100644 plugins/cdmagen.c

diff --git a/Makefile.am b/Makefile.am
index 9aac08b..929ce63 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -293,6 +293,9 @@ builtin_sources += plugins/ste.c
 
 builtin_modules += caif
 builtin_sources += plugins/caif.c
+
+builtin_modules += cdmagen
+builtin_sources += plugins/cdmagen.c
 endif
 
 if MAINTAINER_MODE
diff --git a/plugins/cdmagen.c b/plugins/cdmagen.c
new file mode 100644
index 000..41a4bd2
--- /dev/null
+++ b/plugins/cdmagen.c
@@ -0,0 +1,276 @@
+/*
+ * This file is part of oFono - Open Source Telephony
+ *
+ * Copyright (C) 2010 Nokia 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 config.h
+#endif
+
+#include stdlib.h
+#include errno.h
+#include termios.h
+#include string.h
+#include unistd.h
+#include sys/types.h
+#include sys/stat.h
+#include fcntl.h
+
+#include glib.h
+#include gatchat.h
+#include gattty.h
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include ofono/plugin.h
+#include ofono/log.h
+#include ofono/modem.h
+#include ofono/devinfo.h
+#include ofono/cdma-voicecall.h
+
+#include drivers/cdma-atmodem/atutil.h
+
+#include common.h
+
+struct cdmagen_data {
+   GAtChat *chat;
+   ofono_bool_t online;
+   ofono_bool_t registration_status;
+};
+
+static void cdmagen_debug(const char *str, void *data)
+{
+   const char *prefix = data;
+
+   ofono_info(%s%s, prefix, str);
+}
+
+static int cdmagen_probe(struct ofono_modem *modem)
+{
+   struct cdmagen_data *data;
+
+   DBG(%p, modem);
+
+   data = g_try_new0(struct cdmagen_data, 1);
+   if (data == NULL)
+   return -ENOMEM;
+
+   ofono_modem_set_data(modem, data);
+
+   return 0;
+}
+
+static void cdmagen_remove(struct ofono_modem *modem)
+{
+   struct cdmagen_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   ofono_modem_set_data(modem, NULL);
+
+   if (data-chat)
+   g_at_chat_unref(data-chat);
+
+   g_free(data);
+}
+
+static GAtChat *create_port(const char *device)
+{
+   GAtSyntax *syntax;
+   GIOChannel *channel;
+   GAtChat *chat;
+
+   channel = g_at_tty_open(device, NULL);
+   if (channel == NULL)
+   return NULL;
+
+   syntax = g_at_syntax_new_gsmv1();
+
+   chat = g_at_chat_new(channel, syntax);
+   g_at_syntax_unref(syntax);
+   g_io_channel_unref(channel);
+
+   if (chat == NULL)
+   return NULL;
+
+   return chat;
+}
+
+static GAtChat *open_device(struct ofono_modem *modem,
+   const char *key, char *debug)
+{
+   const char *device;
+   GAtChat *chat;
+
+   device = ofono_modem_get_string(modem, key);
+   if (device == NULL)
+   return NULL;
+
+   DBG(%s %s, key, device);
+
+   chat = create_port(device);
+   if (chat == NULL)
+   return NULL;
+
+   g_at_chat_add_terminator(chat, COMMAND NOT SUPPORT, -1, FALSE);
+
+   if (getenv(OFONO_AT_DEBUG))
+   g_at_chat_set_debug(chat, cdmagen_debug, debug);
+
+   return chat;
+}
+
+static void cdmagen_disconnect(gpointer user_data)
+{
+   struct ofono_modem *modem = user_data;
+   struct cdmagen_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   g_at_chat_unref(data-chat);
+   data-chat = NULL;
+
+   data-chat = open_device(modem, Device, CDMA Device: );
+   if (data-chat == NULL)
+   return;
+
+   g_at_chat_set_disconnect_function(data-chat,
+   cdmagen_disconnect, modem);
+}
+
+/* power up hardware */
+static int cdmagen_enable(struct ofono_modem *modem)
+{
+   struct cdmagen_data *data = ofono_modem_get_data(modem);
+
+   DBG(%p, modem);
+
+   ofono_modem_set_boolean(modem, no_sim_required, TRUE);
+
+   data-chat = open_device(modem, Device, CDMA Device: );
+   if (data-chat == NULL)
+   return -EINVAL;
+
+   g_at_chat_set_disconnect_function(data-chat,
+   cdmagen_disconnect, modem);
+
+   if (getenv(OFONO_AT_DEBUG))
+ 

[PATCH 5/5] test: Add CDMA MO Call Support

2010-12-02 Thread Dara Spieker-Doyle
---
 Makefile.am   |5 -
 test/cdma-dial-number |   25 +
 test/cdma-hangup  |   20 
 test/cdma-list-call   |   30 ++
 4 files changed, 79 insertions(+), 1 deletions(-)
 create mode 100755 test/cdma-dial-number
 create mode 100755 test/cdma-hangup
 create mode 100755 test/cdma-list-call

diff --git a/Makefile.am b/Makefile.am
index 929ce63..1d0b414 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -432,7 +432,10 @@ test_scripts = test/backtrace \
test/test-push-notification \
test/test-smart-messaging \
test/send-vcard \
-   test/set-tty
+   test/set-tty \
+   test/cdma-list-call \
+   test/cdma-dial-number \
+   test/cdma-hangup
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/cdma-dial-number b/test/cdma-dial-number
new file mode 100755
index 000..fbf5e85
--- /dev/null
+++ b/test/cdma-dial-number
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv)  2:
+   path = sys.argv[1]
+   number = sys.argv[2]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+   number = sys.argv[1]
+
+print Using modem %s % path
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Dial(number, )
+
diff --git a/test/cdma-hangup b/test/cdma-hangup
new file mode 100755
index 000..f8e631e
--- /dev/null
+++ b/test/cdma-hangup
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv)  2:
+   path = sys.argv[1]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Hangup()
diff --git a/test/cdma-list-call b/test/cdma-list-call
new file mode 100755
index 000..9f9fdbc
--- /dev/null
+++ b/test/cdma-list-call
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+   print [ %s ] % (path)
+
+   if org.ofono.cdma.VoiceCallManager not in properties[Interfaces]:
+   continue
+
+   mgr = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.cdma.VoiceCallManager')
+
+   properties = mgr.GetProperties()
+
+   for key in properties.keys():
+   if key in [Interfaces, Features]:
+   val = 
+   for i in properties[key]:
+   val += i +  
+   else:
+   val = str(properties[key])
+   print %s = %s % (key, val)
\ No newline at end of file
-- 
1.7.0.4

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