summaryrefslogtreecommitdiffstats
path: root/src/cdma-voicecall.c
diff options
context:
space:
mode:
authorCaiwen Zhang <caiwen.zhang@windriver.com>2011-08-12 17:20:15 +0800
committerDenis Kenzior <denkenz@gmail.com>2011-12-15 23:44:42 -0600
commit42c50e2dc310a594eaf2818e0e340e0543e733a6 (patch)
tree592c0b0a1cac4476f7755fe6f243ed2c9d8b855b /src/cdma-voicecall.c
parent1dc0597f36e00a6ea5d430cfc90d7421ef15e86a (diff)
downloadofono-42c50e2dc310a594eaf2818e0e340e0543e733a6.tar.bz2
Add call waiting support in CDMA voice call
Diffstat (limited to 'src/cdma-voicecall.c')
-rw-r--r--src/cdma-voicecall.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/cdma-voicecall.c b/src/cdma-voicecall.c
index 70a69644..34374116 100644
--- a/src/cdma-voicecall.c
+++ b/src/cdma-voicecall.c
@@ -40,6 +40,7 @@ static GSList *g_drivers;
struct ofono_cdma_voicecall {
struct ofono_cdma_phone_number phone_number;
+ struct ofono_cdma_phone_number waiting_number;
int direction;
enum cdma_call_status status;
time_t start_time;
@@ -108,14 +109,33 @@ static void append_voicecall_properties(struct ofono_cdma_voicecall *vc,
{
const char *status;
const char *lineid;
+ const char *waiting_call = NULL;
+ ofono_bool_t call_waiting;
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_DISCONNECTED) {
+ if (vc->phone_number.number[0] != '\0') {
+ lineid = cdma_phone_number_to_string(&vc->phone_number);
+ ofono_dbus_dict_append(dict, "LineIdentification",
+ DBUS_TYPE_STRING, &lineid);
+ }
+
+ if (vc->waiting_number.number[0] != '\0') {
+ waiting_call = cdma_phone_number_to_string(
+ &vc->waiting_number);
+
+ ofono_dbus_dict_append(dict, "CallWaitingNumber",
+ DBUS_TYPE_STRING, &waiting_call);
+ }
+ }
+
+ call_waiting = (waiting_call != NULL);
+
+ ofono_dbus_dict_append(dict, "CallWaiting",
+ DBUS_TYPE_BOOLEAN, &call_waiting);
if (vc->status == CDMA_CALL_STATUS_ACTIVE) {
const char *timestr = time_to_str(&vc->start_time);
@@ -172,6 +192,7 @@ static void voicecall_set_call_status(struct ofono_cdma_voicecall *vc,
const char *status_str;
enum cdma_call_status old_status;
+ DBG("status: %s", cdma_call_status_to_string(status));
if (vc->status == status)
return;
@@ -198,6 +219,14 @@ static void voicecall_set_call_status(struct ofono_cdma_voicecall *vc,
"StartTime", DBUS_TYPE_STRING,
&timestr);
}
+
+ if (status == CDMA_CALL_STATUS_DISCONNECTED) {
+ memset(&vc->phone_number, 0,
+ sizeof(struct ofono_cdma_phone_number));
+
+ memset(&vc->waiting_number, 0,
+ sizeof(struct ofono_cdma_phone_number));
+ }
}
static void voicecall_set_call_lineid(struct ofono_cdma_voicecall *vc)