summaryrefslogtreecommitdiffstats
path: root/call.c
diff options
context:
space:
mode:
authorPaulK <contact@paulk.fr>2012-02-25 00:05:28 +0100
committerPaulK <contact@paulk.fr>2012-02-25 00:05:28 +0100
commit1d5e34ecc0ef25350fcb68cb02058c3f14c4aaf1 (patch)
treeea12f94e3aa2ad82c10a74647304cc4cf827040c /call.c
parenta85cf94115adb59b4f2b8b82b4fb63c6bc72ded8 (diff)
downloadhardware_ril_samsung-ril-1d5e34ecc0ef25350fcb68cb02058c3f14c4aaf1.zip
hardware_ril_samsung-ril-1d5e34ecc0ef25350fcb68cb02058c3f14c4aaf1.tar.gz
hardware_ril_samsung-ril-1d5e34ecc0ef25350fcb68cb02058c3f14c4aaf1.tar.bz2
Added DTMF global sort of lock and set the functions to use gen_phone_res
Diffstat (limited to 'call.c')
-rw-r--r--call.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/call.c b/call.c
index dc116d6..20eedc0 100644
--- a/call.c
+++ b/call.c
@@ -243,6 +243,17 @@ void ril_request_dtmf(RIL_Token t, void *data, int length)
unsigned char dtmf_count = 1;
int i;
+ if(ril_state.dtmf_tone != 0) {
+ LOGD("Another tone wasn't stopped, stopping that one before anything");
+
+ cont_dtmf.state = IPC_CALL_DTMF_STATE_STOP;
+ cont_dtmf.tone = 0;
+
+ ipc_fmt_send(IPC_CALL_CONT_DTMF, IPC_TYPE_SET, (void *) &cont_dtmf, sizeof(cont_dtmf), reqGetId(t));
+
+ usleep(300);
+ }
+
burst_len = sizeof(struct ipc_call_cont_dtmf) * dtmf_count + 1;
burst = malloc(burst_len);
memset(burst, 0, burst_len);
@@ -281,15 +292,27 @@ void ipc_call_burst_dtmf(struct ipc_message_info *info)
void ril_request_dtmf_start(RIL_Token t, void *data, int length)
{
- //TODO: Check if there is already a DTMF going on and cancel it if so
-
struct ipc_call_cont_dtmf cont_dtmf;
+
+ if(ril_state.dtmf_tone != 0) {
+ LOGD("Another tone wasn't stopped, stopping that one before anything");
+
+ cont_dtmf.state = IPC_CALL_DTMF_STATE_STOP;
+ cont_dtmf.tone = 0;
+
+ ipc_fmt_send(IPC_CALL_CONT_DTMF, IPC_TYPE_SET, (void *) &cont_dtmf, sizeof(cont_dtmf), reqGetId(t));
+
+ usleep(300);
+ }
+
cont_dtmf.state = IPC_CALL_DTMF_STATE_START;
- cont_dtmf.tone = ((char *)data)[0];
+ cont_dtmf.tone = ((unsigned char *)data)[0];
- ipc_fmt_send(IPC_CALL_CONT_DTMF, IPC_TYPE_SET, (void *) &cont_dtmf, sizeof(cont_dtmf), reqGetId(t));
+ ril_state.dtmf_tone = cont_dtmf.tone;
- RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
+ ipc_gen_phone_res_expect_to_complete(reqGetId(t), IPC_CALL_CONT_DTMF);
+
+ ipc_fmt_send(IPC_CALL_CONT_DTMF, IPC_TYPE_SET, (void *) &cont_dtmf, sizeof(cont_dtmf), reqGetId(t));
}
void ril_request_dtmf_stop(RIL_Token t)
@@ -298,7 +321,9 @@ void ril_request_dtmf_stop(RIL_Token t)
cont_dtmf.state = IPC_CALL_DTMF_STATE_STOP;
cont_dtmf.tone = 0;
- ipc_fmt_send(IPC_CALL_CONT_DTMF, IPC_TYPE_SET, (void *) &cont_dtmf, sizeof(cont_dtmf), reqGetId(t));
+ ril_state.dtmf_tone = 0;
- RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
+ ipc_gen_phone_res_expect_to_complete(reqGetId(t), IPC_CALL_CONT_DTMF);
+
+ ipc_fmt_send(IPC_CALL_CONT_DTMF, IPC_TYPE_SET, (void *) &cont_dtmf, sizeof(cont_dtmf), reqGetId(t));
}