2 * This file is part of hayes-ril.
4 * Copyright (C) 2012 Paul Kocialkowski <contact@paulk.fr>
6 * Parts of this code are based on htcgeneric-ril, reference-ril:
7 * Copyright 2006-2011, htcgeneric-ril contributors
8 * Copyright 2006, The Android Open Source Project
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
23 #define LOG_TAG "RIL-CALL"
24 #include <utils/Log.h>
25 #include <telephony/ril.h>
27 #include <hayes-ril.h>
29 int at_clcc_expect(struct at_response *response, void *data, RIL_Token t)
31 RIL_Call **calls = NULL;
35 if(response->status == AT_STATUS_UNDEF)
36 return AT_RESPONSE_UNHANDELD_REASON_STATUS;
38 LOGD("GOT AT CLCC response");
40 if(at_status_error(response->status)) {
41 RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
45 for(i=0 ; i < response->data_count ; i++) {
46 LOGD("CLCC data: %s", response->data[i]);
49 calls = calloc(1, sizeof(RIL_Call) * calls_count);
53 RIL_onRequestComplete(t, RIL_E_SUCCESS, calls, sizeof(RIL_Call) * calls_count);
55 return AT_RESPONSE_HANDLED_OK;
58 void ril_request_get_current_calls(RIL_Token t, void *data, size_t length)
60 if(ril_globals.radio_state == RADIO_STATE_OFF) {
61 RIL_onRequestComplete(t, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0);
64 at_send_expect_to_func("AT+CLCC", NULL, NULL, t, at_clcc_expect);