---
 drivers/hfpmodem/voicecall.c | 92 +++++++++++++++++++++++---------------------
 1 file changed, 48 insertions(+), 44 deletions(-)

diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index 6ffe9d5..1ab2aa2 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -84,13 +84,14 @@ static GSList *find_dialing(GSList *calls)
 {
        GSList *c;
 
-       c = g_slist_find_custom(calls, GINT_TO_POINTER(CALL_STATUS_DIALING),
+       c = g_slist_find_custom(calls,
+                               GINT_TO_POINTER(OFONO_CALL_STATUS_DIALING),
                                at_util_call_compare_by_status);
 
        if (c == NULL)
                c = g_slist_find_custom(calls,
-                                       GINT_TO_POINTER(CALL_STATUS_ALERTING),
-                                       at_util_call_compare_by_status);
+                               GINT_TO_POINTER(OFONO_CALL_STATUS_ALERTING),
+                               at_util_call_compare_by_status);
 
        return c;
 }
@@ -104,7 +105,8 @@ static void voicecall_notify(gpointer value, gpointer user)
 }
 
 static struct ofono_call *create_call(struct ofono_voicecall *vc, int type,
-                                       int direction, int status,
+                                       enum ofono_call_direction direction,
+                                       enum ofono_call_status status,
                                        const char *num, int num_type, int clip)
 {
        struct voicecall_data *d = ofono_voicecall_get_data(vc);
@@ -230,10 +232,10 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
                nc = n ? n->data : NULL;
                oc = o ? o->data : NULL;
 
-               if (nc && (nc->status == CALL_STATUS_ACTIVE))
+               if (nc && (nc->status == OFONO_CALL_STATUS_ACTIVE))
                        num_active++;
 
-               if (nc && (nc->status == CALL_STATUS_HELD))
+               if (nc && (nc->status == OFONO_CALL_STATUS_HELD))
                        num_held++;
 
                if (oc && (nc == NULL || (nc->id > oc->id))) {
@@ -361,14 +363,15 @@ static void atd_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
        for (l = vd->calls; l; l = l->next) {
                call = l->data;
 
-               if (call->status != CALL_STATUS_ACTIVE)
+               if (call->status != OFONO_CALL_STATUS_ACTIVE)
                        continue;
 
-               call->status = CALL_STATUS_HELD;
+               call->status = OFONO_CALL_STATUS_HELD;
                ofono_voicecall_notify(vc, call);
        }
 
-       call = create_call(vc, 0, 0, CALL_STATUS_DIALING, NULL, type, validity);
+       call = create_call(vc, 0, OFONO_CALL_DIRECTION_MOBILE_ORIGINATED,
+                       OFONO_CALL_STATUS_DIALING, NULL, type, validity);
        if (call == NULL) {
                ofono_error("Unable to allocate call, "
                                "call tracking will fail!");
@@ -478,10 +481,10 @@ static void hfp_answer(struct ofono_voicecall *vc,
 static void hfp_hangup(struct ofono_voicecall *vc,
                        ofono_voicecall_cb_t cb, void *data)
 {
-       unsigned int affected = (1 << CALL_STATUS_INCOMING) |
-                               (1 << CALL_STATUS_DIALING) |
-                               (1 << CALL_STATUS_ALERTING) |
-                               (1 << CALL_STATUS_ACTIVE);
+       unsigned int affected = (1 << OFONO_CALL_STATUS_INCOMING) |
+                               (1 << OFONO_CALL_STATUS_DIALING) |
+                               (1 << OFONO_CALL_STATUS_ALERTING) |
+                               (1 << OFONO_CALL_STATUS_ACTIVE);
 
        /* Hangup current active call */
        hfp_template("AT+CHUP", vc, generic_cb, affected, cb, data);
@@ -504,7 +507,7 @@ static void hfp_release_all_held(struct ofono_voicecall *vc,
                                ofono_voicecall_cb_t cb, void *data)
 {
        struct voicecall_data *vd = ofono_voicecall_get_data(vc);
-       unsigned int held_status = 1 << CALL_STATUS_HELD;
+       unsigned int held_status = 1 << OFONO_CALL_STATUS_HELD;
 
        if (vd->ag_mpty_features & HFP_AG_CHLD_0) {
                hfp_template("AT+CHLD=0", vc, generic_cb, held_status,
@@ -519,7 +522,7 @@ static void hfp_set_udub(struct ofono_voicecall *vc,
                        ofono_voicecall_cb_t cb, void *data)
 {
        struct voicecall_data *vd = ofono_voicecall_get_data(vc);
-       unsigned int incoming_or_waiting = 1 << CALL_STATUS_WAITING;
+       unsigned int incoming_or_waiting = 1 << OFONO_CALL_STATUS_WAITING;
 
        if (vd->ag_mpty_features & HFP_AG_CHLD_0) {
                hfp_template("AT+CHLD=0", vc, generic_cb, incoming_or_waiting,
@@ -759,7 +762,7 @@ static void ccwa_notify(GAtResult *result, gpointer 
user_data)
 
        /* CCWA can repeat, ignore if we already have an waiting call */
        if (g_slist_find_custom(vd->calls,
-                               GINT_TO_POINTER(CALL_STATUS_WAITING),
+                               GINT_TO_POINTER(OFONO_CALL_STATUS_WAITING),
                                at_util_call_compare_by_status))
                return;
 
@@ -768,7 +771,7 @@ static void ccwa_notify(GAtResult *result, gpointer 
user_data)
         * as our previous WAITING call has been promoted to INCOMING
         */
        if (g_slist_find_custom(vd->calls,
-                               GINT_TO_POINTER(CALL_STATUS_INCOMING),
+                               GINT_TO_POINTER(OFONO_CALL_STATUS_INCOMING),
                                at_util_call_compare_by_status))
                return;
 
@@ -791,8 +794,8 @@ static void ccwa_notify(GAtResult *result, gpointer 
user_data)
 
        DBG("ccwa_notify: %s %d %d", num, num_type, validity);
 
-       call = create_call(vc, 0, 1, CALL_STATUS_WAITING, num, num_type,
-                               validity);
+       call = create_call(vc, 0, OFONO_CALL_DIRECTION_MOBILE_TERMINATED,
+                       OFONO_CALL_STATUS_WAITING, num, num_type, validity);
 
        if (call == NULL) {
                ofono_error("malloc call struct failed.  "
@@ -811,7 +814,7 @@ static gboolean clip_timeout(gpointer user_data)
        struct ofono_call *call;
 
        l = g_slist_find_custom(vd->calls,
-                               GINT_TO_POINTER(CALL_STATUS_INCOMING),
+                               GINT_TO_POINTER(OFONO_CALL_STATUS_INCOMING),
                                at_util_call_compare_by_status);
 
        if (l == NULL)
@@ -840,13 +843,13 @@ static void ring_notify(GAtResult *result, gpointer 
user_data)
 
        /* RING can repeat, ignore if we already have an incoming call */
        if (g_slist_find_custom(vd->calls,
-                               GINT_TO_POINTER(CALL_STATUS_INCOMING),
+                               GINT_TO_POINTER(OFONO_CALL_STATUS_INCOMING),
                                at_util_call_compare_by_status))
                return;
 
        waiting = g_slist_find_custom(vd->calls,
-                                       GINT_TO_POINTER(CALL_STATUS_WAITING),
-                                       at_util_call_compare_by_status);
+                               GINT_TO_POINTER(OFONO_CALL_STATUS_WAITING),
+                               at_util_call_compare_by_status);
 
        /* If we started receiving RINGS but have a waiting call, most
         * likely all other calls were dropped and we just didn't get
@@ -861,14 +864,15 @@ static void ring_notify(GAtResult *result, gpointer 
user_data)
                vd->calls = waiting;
 
                call = waiting->data;
-               call->status = CALL_STATUS_INCOMING;
+               call->status = OFONO_CALL_STATUS_INCOMING;
                ofono_voicecall_notify(vc, call);
 
                return;
        }
 
        /* Generate an incoming call of voice type */
-       call = create_call(vc, 0, 1, CALL_STATUS_INCOMING, NULL, 128, 2);
+       call = create_call(vc, 0, OFONO_CALL_DIRECTION_MOBILE_TERMINATED,
+                               OFONO_CALL_STATUS_INCOMING, NULL, 128, 2);
 
        if (call == NULL)
                ofono_error("Couldn't create call, call management is fubar!");
@@ -890,7 +894,7 @@ static void clip_notify(GAtResult *result, gpointer 
user_data)
        struct ofono_call *call;
 
        l = g_slist_find_custom(vd->calls,
-                               GINT_TO_POINTER(CALL_STATUS_INCOMING),
+                               GINT_TO_POINTER(OFONO_CALL_STATUS_INCOMING),
                                at_util_call_compare_by_status);
 
        if (l == NULL) {
@@ -951,15 +955,15 @@ static void ciev_call_notify(struct ofono_voicecall *vc,
                 * calls, dialing calls are kept.  This also handles the
                 * situation when dialing and waiting calls exist
                 */
-               release_with_status(vc, CALL_STATUS_HELD);
-               release_with_status(vc, CALL_STATUS_ACTIVE);
+               release_with_status(vc, OFONO_CALL_STATUS_HELD);
+               release_with_status(vc, OFONO_CALL_STATUS_ACTIVE);
 
                /* Promote waiting to incoming if it is the last call */
                if (vd->calls && vd->calls->next == NULL) {
                        call = vd->calls->data;
 
-                       if (call->status == CALL_STATUS_WAITING) {
-                               call->status = CALL_STATUS_INCOMING;
+                       if (call->status == OFONO_CALL_STATUS_WAITING) {
+                               call->status = OFONO_CALL_STATUS_INCOMING;
                                ofono_voicecall_notify(vc, call);
                        }
                }
@@ -976,10 +980,10 @@ static void ciev_call_notify(struct ofono_voicecall *vc,
                for (l = vd->calls; l; l = l->next) {
                        call = l->data;
 
-                       if (call->status == CALL_STATUS_DIALING ||
-                                       call->status == CALL_STATUS_ALERTING ||
-                                       call->status == CALL_STATUS_INCOMING) {
-                               call->status = CALL_STATUS_ACTIVE;
+                       if (call->status == OFONO_CALL_STATUS_DIALING ||
+                               call->status == OFONO_CALL_STATUS_ALERTING ||
+                               call->status == OFONO_CALL_STATUS_INCOMING) {
+                               call->status = OFONO_CALL_STATUS_ACTIVE;
                                ofono_voicecall_notify(vc, call);
                        }
                }
@@ -1006,8 +1010,8 @@ static void ciev_callsetup_notify(struct ofono_voicecall 
*vc,
        dialing = find_dialing(vd->calls);
 
        waiting = g_slist_find_custom(vd->calls,
-                                       GINT_TO_POINTER(CALL_STATUS_WAITING),
-                                       at_util_call_compare_by_status);
+                               GINT_TO_POINTER(OFONO_CALL_STATUS_WAITING),
+                               at_util_call_compare_by_status);
 
        /* This is a truly bizarre case not covered at all by the specification
         * (yes, they are complete idiots).  Here we assume the other side is
@@ -1052,7 +1056,7 @@ static void ciev_callsetup_notify(struct ofono_voicecall 
*vc,
                         * call=1 arrives first, then callsetup=0
                         */
 
-                       call->status = CALL_STATUS_ACTIVE;
+                       call->status = OFONO_CALL_STATUS_ACTIVE;
                        ofono_voicecall_notify(vc, call);
                } else {
                        g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
@@ -1085,13 +1089,13 @@ static void ciev_callsetup_notify(struct 
ofono_voicecall *vc,
        case 3:
        {
                GSList *o = g_slist_find_custom(vd->calls,
-                                       GINT_TO_POINTER(CALL_STATUS_DIALING),
-                                       at_util_call_compare_by_status);
+                               GINT_TO_POINTER(OFONO_CALL_STATUS_DIALING),
+                               at_util_call_compare_by_status);
 
                if (o) {
                        struct ofono_call *call = o->data;
 
-                       call->status = CALL_STATUS_ALERTING;
+                       call->status = OFONO_CALL_STATUS_ALERTING;
                        ofono_voicecall_notify(vc, call);
                }
 
@@ -1142,10 +1146,10 @@ static void ciev_callheld_notify(struct ofono_voicecall 
*vc,
                        for (l = vd->calls; l; l = l->next) {
                                call = l->data;
 
-                               if (call->status != CALL_STATUS_ACTIVE)
+                               if (call->status != OFONO_CALL_STATUS_ACTIVE)
                                        continue;
 
-                               call->status = CALL_STATUS_HELD;
+                               call->status = OFONO_CALL_STATUS_HELD;
                                ofono_voicecall_notify(vc, call);
                        }
                } else if (callheld == 1) {
@@ -1225,9 +1229,9 @@ static void hfp_clcc_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
        while (n) {
                nc = n->data;
 
-               if (nc->status == CALL_STATUS_ACTIVE)
+               if (nc->status == OFONO_CALL_STATUS_ACTIVE)
                        num_active++;
-               else if (nc->status == CALL_STATUS_HELD)
+               else if (nc->status == OFONO_CALL_STATUS_HELD)
                        num_held++;
 
                n = n->next;
-- 
1.9.1

_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to