1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef RIL_INTERFACE_H
18#define RIL_INTERFACE_H
19
20#define RIL_CLIENT_LIBPATH "libsecril-client.so"
21
22#define RIL_CLIENT_ERR_SUCCESS      0
23#define RIL_CLIENT_ERR_AGAIN        1
24#define RIL_CLIENT_ERR_INIT         2 // Client is not initialized
25#define RIL_CLIENT_ERR_INVAL        3 // Invalid value
26#define RIL_CLIENT_ERR_CONNECT      4 // Connection error
27#define RIL_CLIENT_ERR_IO           5 // IO error
28#define RIL_CLIENT_ERR_RESOURCE     6 // Resource not available
29#define RIL_CLIENT_ERR_UNKNOWN      7
30
31#define RIL_OEM_UNSOL_RESPONSE_BASE 11000 // RIL response base index
32#define RIL_UNSOL_WB_AMR_STATE \
33    (RIL_OEM_UNSOL_RESPONSE_BASE + 17)    // RIL AMR state index
34
35struct ril_handle
36{
37    void *handle;
38    void *client;
39    int volume_steps_max;
40};
41
42enum ril_sound_type {
43    SOUND_TYPE_VOICE,
44    SOUND_TYPE_SPEAKER,
45    SOUND_TYPE_HEADSET,
46    SOUND_TYPE_BTVOICE
47};
48
49enum ril_audio_path {
50    SOUND_AUDIO_PATH_HANDSET,
51    SOUND_AUDIO_PATH_HEADSET,
52    SOUND_AUDIO_PATH_SPEAKER,
53    SOUND_AUDIO_PATH_BLUETOOTH,
54    SOUND_AUDIO_PATH_BLUETOOTH_NO_NR,
55    SOUND_AUDIO_PATH_HEADPHONE
56};
57
58enum ril_clock_state {
59    SOUND_CLOCK_STOP,
60    SOUND_CLOCK_START
61};
62
63/* Function prototypes */
64int ril_open(struct ril_handle *ril);
65int ril_close(struct ril_handle *ril);
66int ril_set_call_volume(struct ril_handle *ril, enum ril_sound_type sound_type,
67                        float volume);
68int ril_set_call_audio_path(struct ril_handle *ril, enum ril_audio_path path);
69void ril_register_set_wb_amr_callback(void *function, void *data);
70#endif
71
72