From: Sjur Brændeland sjur.brandel...@stericsson.com
---
Makefile.am |1 +
drivers/stemodem/stemodem.c |2 +
drivers/stemodem/stemodem.h |3 +
drivers/stemodem/voicecall.c | 596 ++
plugins/ste.c|2 +-
5 files changed, 603 insertions(+), 1 deletions(-)
create mode 100644 drivers/stemodem/voicecall.c
diff --git a/Makefile.am b/Makefile.am
index ac13d73..ecd2660 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -159,6 +159,7 @@ builtin_sources += drivers/atmodem/atutil.h \
drivers/stemodem/stemodem.h \
drivers/stemodem/stemodem.c \
drivers/stemodem/gprs-context.c \
+ drivers/stemodem/voicecall.c \
drivers/stemodem/caif_socket.h \
drivers/stemodem/if_caif.h
diff --git a/drivers/stemodem/stemodem.c b/drivers/stemodem/stemodem.c
index 53207db..9184a42 100644
--- a/drivers/stemodem/stemodem.c
+++ b/drivers/stemodem/stemodem.c
@@ -37,6 +37,7 @@
static int stemodem_init(void)
{
ste_gprs_context_init();
+ ste_voicecall_init();
return 0;
}
@@ -44,6 +45,7 @@ static int stemodem_init(void)
static void stemodem_exit(void)
{
ste_gprs_context_exit();
+ ste_voicecall_exit();
}
OFONO_PLUGIN_DEFINE(stemodem, STE modem driver, VERSION,
diff --git a/drivers/stemodem/stemodem.h b/drivers/stemodem/stemodem.h
index e55a2c3..e7c6934 100644
--- a/drivers/stemodem/stemodem.h
+++ b/drivers/stemodem/stemodem.h
@@ -25,3 +25,6 @@
extern void ste_gprs_context_init();
extern void ste_gprs_context_exit();
+extern void ste_voicecall_init();
+extern void ste_voicecall_exit();
+
diff --git a/drivers/stemodem/voicecall.c b/drivers/stemodem/voicecall.c
new file mode 100644
index 000..e74aa3d
--- /dev/null
+++ b/drivers/stemodem/voicecall.c
@@ -0,0 +1,596 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2009 Intel Corporation. All rights reserved.
+ * Copyright (C) 2010 ST-Ericsson AB.
+ *
+ * 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/voicecall.h
+
+#include gatchat.h
+#include gatresult.h
+#include common.h
+
+#include stemodem.h
+
+enum call_status_ste {
+ STE_CALL_STATUS_IDLE = 0,
+ STE_CALL_STATUS_CALLING = 1,
+ STE_CALL_STATUS_CONNECTING = 2,
+ STE_CALL_STATUS_ACTIVE = 3,
+ STE_CALL_STATUS_HOLD = 4,
+ STE_CALL_STATUS_WAITING = 5,
+ STE_CALL_STATUS_ALERTING = 6,
+ STE_CALL_STATUS_BUSY = 7
+};
+
+static const char *none_prefix[] = { NULL };
+
+struct voicecall_data {
+ GSList *calls;
+ unsigned int local_release;
+ GAtChat *chat;
+};
+
+struct release_id_req {
+ struct ofono_voicecall *vc;
+ ofono_voicecall_cb_t cb;
+ void *data;
+ int id;
+};
+
+struct change_state_req {
+ struct ofono_voicecall *vc;
+ ofono_voicecall_cb_t cb;
+ void *data;
+ int affected_types;
+};
+
+/* Translate from the ECAV-based STE-status to CLCC based status */
+static int call_status_ste_to_ofono(int status)
+{
+ switch (status) {
+ case STE_CALL_STATUS_IDLE:
+ return CALL_STATUS_DISCONNECTED;
+ case STE_CALL_STATUS_CALLING:
+ return CALL_STATUS_DIALING;
+ case STE_CALL_STATUS_CONNECTING:
+ return CALL_STATUS_ALERTING;
+ case STE_CALL_STATUS_ACTIVE:
+ return CALL_STATUS_ACTIVE;
+ case STE_CALL_STATUS_HOLD:
+ return CALL_STATUS_HELD;
+ case STE_CALL_STATUS_WAITING:
+ return CALL_STATUS_WAITING;
+ case STE_CALL_STATUS_ALERTING:
+ return CALL_STATUS_INCOMING;
+ case STE_CALL_STATUS_BUSY:
+ return CALL_STATUS_DISCONNECTED;
+ default:
+ return CALL_STATUS_DISCONNECTED;
+ }
+}
+
+static struct ofono_call *create_call(struct ofono_voicecall *vc, int type,
+ int direction, int status,
+ const char *num, int num_type, int clip)
+{
+ struct