From be542f2ed6780dd64da8ce775a0c3430b7994100 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Mon, 30 Jul 2012 13:08:04 +0200 Subject: [PATCH] Call: Added get current calls support Signed-off-by: Paul Kocialkowski --- call.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 call.c diff --git a/call.c b/call.c new file mode 100644 index 0000000..00e2be7 --- /dev/null +++ b/call.c @@ -0,0 +1,65 @@ +/* + * This file is part of hayes-ril. + * + * Copyright (C) 2012 Paul Kocialkowski + * + * Parts of this code are based on htcgeneric-ril, reference-ril: + * Copyright 2006-2011, htcgeneric-ril contributors + * Copyright 2006, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "RIL-CALL" +#include +#include + +#include + +int at_clcc_expect(struct at_response *response, void *data, RIL_Token t) +{ + RIL_Call **calls = NULL; + int calls_count = 0; + int i; + + if(response->status == AT_STATUS_UNDEF) + return AT_RESPONSE_UNHANDELD_REASON_STATUS; + + LOGD("GOT AT CLCC response"); + + if(at_status_error(response->status)) { + RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0); + } + + // TODO: count calls + for(i=0 ; i < response->data_count ; i++) { + LOGD("CLCC data: %s", response->data[i]); + } + + calls = calloc(1, sizeof(RIL_Call) * calls_count); + + // TODO: copy calls + + RIL_onRequestComplete(t, RIL_E_SUCCESS, calls, sizeof(RIL_Call) * calls_count); + + return AT_RESPONSE_HANDLED_OK; +} + +void ril_request_get_current_calls(RIL_Token t, void *data, size_t length) +{ + if(ril_globals.radio_state == RADIO_STATE_OFF) { + RIL_onRequestComplete(t, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0); + return; + } + at_send_expect_to_func("AT+CLCC", NULL, NULL, t, at_clcc_expect); +} -- 2.11.0