diff options
author | PaulK <contact@paulk.fr> | 2012-02-25 00:05:28 +0100 |
---|---|---|
committer | PaulK <contact@paulk.fr> | 2012-02-25 00:05:28 +0100 |
commit | 1d5e34ecc0ef25350fcb68cb02058c3f14c4aaf1 (patch) | |
tree | ea12f94e3aa2ad82c10a74647304cc4cf827040c /call.c | |
parent | a85cf94115adb59b4f2b8b82b4fb63c6bc72ded8 (diff) | |
download | hardware_replicant_libsamsung-ril-1d5e34ecc0ef25350fcb68cb02058c3f14c4aaf1.tar.gz hardware_replicant_libsamsung-ril-1d5e34ecc0ef25350fcb68cb02058c3f14c4aaf1.tar.bz2 hardware_replicant_libsamsung-ril-1d5e34ecc0ef25350fcb68cb02058c3f14c4aaf1.zip |
Added DTMF global sort of lock and set the functions to use gen_phone_res
Diffstat (limited to 'call.c')
-rw-r--r-- | call.c | 39 |
1 files changed, 32 insertions, 7 deletions
@@ -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)); } |