Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 1 | /* |
Shiv Maliyappanahalli | 07a9ea2 | 2014-01-06 14:53:52 -0800 | [diff] [blame] | 2 | * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 3 | * Not a contribution. |
| 4 | * |
| 5 | * Copyright (C) 2013 The Android Open Source Project |
| 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
| 18 | */ |
| 19 | |
| 20 | #ifndef VOICE_H |
| 21 | #define VOICE_H |
| 22 | |
| 23 | #define BASE_SESS_IDX 0 |
| 24 | #define VOICE_SESS_IDX (BASE_SESS_IDX) |
| 25 | |
| 26 | #ifdef MULTI_VOICE_SESSION_ENABLED |
Vicky Sehrawat | 7e4fc15 | 2014-02-12 17:58:59 -0800 | [diff] [blame] | 27 | #define MAX_VOICE_SESSIONS 5 |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 28 | #else |
| 29 | #define MAX_VOICE_SESSIONS 1 |
| 30 | #endif |
| 31 | |
| 32 | #define BASE_CALL_STATE 1 |
| 33 | #define CALL_INACTIVE (BASE_CALL_STATE) |
| 34 | #define CALL_ACTIVE (BASE_CALL_STATE + 1) |
| 35 | |
| 36 | #define VOICE_VSID 0x10C01000 |
| 37 | |
Vidyakumar Athota | 2850d53 | 2013-11-19 16:02:12 -0800 | [diff] [blame] | 38 | #define AUDIO_PARAMETER_KEY_INCALLMUSIC "incall_music_enabled" |
| 39 | #define AUDIO_PARAMETER_VALUE_TRUE "true" |
| 40 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 41 | struct audio_device; |
| 42 | struct str_parms; |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 43 | struct stream_in; |
Shiv Maliyappanahalli | f3b9a42 | 2013-10-22 16:38:08 -0700 | [diff] [blame] | 44 | struct stream_out; |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 45 | |
| 46 | struct call_state { |
| 47 | int current; |
| 48 | int new; |
| 49 | }; |
| 50 | |
| 51 | struct voice_session { |
| 52 | struct pcm *pcm_rx; |
| 53 | struct pcm *pcm_tx; |
| 54 | struct call_state state; |
| 55 | uint32_t vsid; |
| 56 | }; |
| 57 | |
| 58 | struct voice { |
| 59 | struct voice_session session[MAX_VOICE_SESSIONS]; |
| 60 | int tty_mode; |
| 61 | bool mic_mute; |
| 62 | float volume; |
Shiv Maliyappanahalli | 07a9ea2 | 2014-01-06 14:53:52 -0800 | [diff] [blame] | 63 | bool voice_device_set; |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 64 | }; |
| 65 | |
Vidyakumar Athota | 2850d53 | 2013-11-19 16:02:12 -0800 | [diff] [blame] | 66 | enum { |
| 67 | INCALL_REC_NONE = -1, |
| 68 | INCALL_REC_UPLINK, |
| 69 | INCALL_REC_DOWNLINK, |
| 70 | INCALL_REC_UPLINK_AND_DOWNLINK, |
| 71 | }; |
| 72 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 73 | int voice_start_call(struct audio_device *adev); |
| 74 | int voice_stop_call(struct audio_device *adev); |
| 75 | int voice_set_parameters(struct audio_device *adev, struct str_parms *parms); |
Shiv Maliyappanahalli | f930849 | 2013-12-12 12:18:09 -0800 | [diff] [blame] | 76 | void voice_get_parameters(struct audio_device *adev, struct str_parms *query, |
| 77 | struct str_parms *reply); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 78 | void voice_init(struct audio_device *adev); |
| 79 | bool voice_is_in_call(struct audio_device *adev); |
| 80 | int voice_set_mic_mute(struct audio_device *dev, bool state); |
| 81 | bool voice_get_mic_mute(struct audio_device *dev); |
| 82 | int voice_set_volume(struct audio_device *adev, float volume); |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 83 | int voice_check_and_set_incall_rec_usecase(struct audio_device *adev, |
Shiv Maliyappanahalli | f3b9a42 | 2013-10-22 16:38:08 -0700 | [diff] [blame] | 84 | struct stream_in *in); |
| 85 | int voice_check_and_set_incall_music_usecase(struct audio_device *adev, |
| 86 | struct stream_out *out); |
Vidyakumar Athota | 2850d53 | 2013-11-19 16:02:12 -0800 | [diff] [blame] | 87 | int voice_check_and_stop_incall_rec_usecase(struct audio_device *adev, |
| 88 | struct stream_in *in); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 89 | #endif //VOICE_H |