From: Caiwen Zhang Date: Fri, 12 Aug 2011 09:20:15 +0000 (+0800) Subject: Add call waiting support in CDMA voice call X-Git-Tag: 1.1~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42c50e2dc310a594eaf2818e0e340e0543e733a6;p=platform%2Fupstream%2Fofono.git Add call waiting support in CDMA voice call --- diff --git a/src/cdma-voicecall.c b/src/cdma-voicecall.c index 70a6964..3437411 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, ×tr); } + + 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)