~phablet-team/ofono/midori-support

« back to all changes in this revision

Viewing changes to drivers/hfpmodem/voicecall.c

Merge pull request #209 from alfonsosanchezbeato/merge-1.17

Merge 1.17

Show diffs side-by-side

added added

removed removed

Lines of Context:
333
333
                }
334
334
        }
335
335
 
 
336
        if (!ok && vd->calls)
 
337
                g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
 
338
                                        clcc_poll_cb, req->vc, NULL);
 
339
 
336
340
        req->cb(&error, req->data);
337
341
}
338
342
 
711
715
                                at_util_call_compare_by_status))
712
716
                return;
713
717
 
 
718
        /* some phones may send extra CCWA after active call is ended
 
719
         * this would trigger creation of second call in state 'WAITING'
 
720
         * as our previous WAITING call has been promoted to INCOMING
 
721
         */
 
722
        if (g_slist_find_custom(vd->calls,
 
723
                                GINT_TO_POINTER(CALL_STATUS_INCOMING),
 
724
                                at_util_call_compare_by_status))
 
725
                return;
 
726
 
 
727
 
714
728
        g_at_result_iter_init(&iter, result);
715
729
 
716
730
        if (!g_at_result_iter_next(&iter, "+CCWA:"))
1134
1148
        struct ofono_voicecall *vc = user_data;
1135
1149
        struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1136
1150
        unsigned int mpty_ids;
 
1151
        GSList *n;
 
1152
        struct ofono_call *nc;
 
1153
        unsigned int num_active = 0;
 
1154
        unsigned int num_held = 0;
1137
1155
 
1138
1156
        if (!ok)
1139
1157
                return;
1142
1160
 
1143
1161
        g_slist_foreach(vd->calls, voicecall_notify, vc);
1144
1162
        ofono_voicecall_mpty_hint(vc, mpty_ids);
 
1163
 
 
1164
        n = vd->calls;
 
1165
 
 
1166
        while (n) {
 
1167
                nc = n->data;
 
1168
 
 
1169
                if (nc->status == CALL_STATUS_ACTIVE)
 
1170
                        num_active++;
 
1171
                else if (nc->status == CALL_STATUS_HELD)
 
1172
                        num_held++;
 
1173
 
 
1174
                n = n->next;
 
1175
        }
 
1176
 
 
1177
        if ((num_active > 1 || num_held > 1) && !vd->clcc_source)
 
1178
                vd->clcc_source = g_timeout_add(POLL_CLCC_INTERVAL, poll_clcc, vc);
1145
1179
}
1146
1180
 
1147
1181
static void hfp_voicecall_initialized(gboolean ok, GAtResult *result,
1183
1217
 
1184
1218
        ofono_voicecall_set_data(vc, vd);
1185
1219
 
1186
 
        g_at_chat_send(vd->chat, "AT+CLIP=1", NULL, NULL, NULL, NULL);
1187
 
        g_at_chat_send(vd->chat, "AT+CCWA=1", NULL,
 
1220
        g_at_chat_send(vd->chat, "AT+CLIP=1", none_prefix, NULL, NULL, NULL);
 
1221
        g_at_chat_send(vd->chat, "AT+CCWA=1", none_prefix,
1188
1222
                                hfp_voicecall_initialized, vc, NULL);
1189
1223
        return 0;
1190
1224
}