blob: fb1729c069fe94d886acd86dc4339d3b7c3dc682 [file] [log] [blame]
codeworkxf1587a32012-08-03 23:32:29 +02001/**
2 * @file secril-client.h
3 *
4 * @author Myeongcheol Kim (mcmount.kim@samsung.com)
5 *
6 * @brief RIL client library for multi-client support
7 */
8
9#ifndef __SECRIL_CLIENT_H__
10#define __SECRIL_CLIENT_H__
11
12#include <sys/types.h>
13//#include "SecProductFeature_RIL.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19struct RilClient {
20 void *prv;
21};
22
23typedef struct RilClient * HRilClient;
24
25
26//---------------------------------------------------------------------------
27// Defines
28//---------------------------------------------------------------------------
29#define RIL_CLIENT_ERR_SUCCESS 0
30#define RIL_CLIENT_ERR_AGAIN 1
31#define RIL_CLIENT_ERR_INIT 2 // Client is not initialized
32#define RIL_CLIENT_ERR_INVAL 3 // Invalid value
33#define RIL_CLIENT_ERR_CONNECT 4 // Connection error
34#define RIL_CLIENT_ERR_IO 5 // IO error
35#define RIL_CLIENT_ERR_RESOURCE 6 // Resource not available
36#define RIL_CLIENT_ERR_UNKNOWN 7
37
38
39//---------------------------------------------------------------------------
40// Type definitions
41//---------------------------------------------------------------------------
42
43typedef int (*RilOnComplete)(HRilClient handle, const void *data, size_t datalen);
44
45typedef int (*RilOnUnsolicited)(HRilClient handle, const void *data, size_t datalen);
46
47typedef int (*RilOnError)(void *data, int error);
48
49
50//---------------------------------------------------------------------------
51// Client APIs
52//---------------------------------------------------------------------------
53
54/**
55 * Open RILD multi-client.
56 * Return is client handle, NULL on error.
57 */
58HRilClient OpenClient_RILD(void);
59
60/**
61 * Stop RILD multi-client. If client socket was connected,
62 * it will be disconnected.
63 */
64int CloseClient_RILD(HRilClient client);
65
66/**
67 * Connect to RIL deamon. One client task starts.
68 * Return is 0 or error code.
69 */
70int Connect_RILD(HRilClient client);
71
72/**
73 * Connect to QRIL deamon. One client task starts.
74 * Return is 0 or error code.
75 */
76int Connect_QRILD(HRilClient client);
77
78#if defined(SEC_PRODUCT_FEATURE_RIL_CALL_DUALMODE_CDMAGSM)
79/**
80 * Connect to RIL deamon. One client task starts.
81 * Return is 0 or error code.
82 */
83int Connect_RILD_Second(HRilClient client);
84#endif
85/**
86 * check whether RILD is connected
87 * Returns 0 or 1
88 */
89int isConnected_RILD(HRilClient client);
90
91/**
92 * Disconnect connection to RIL deamon(socket close).
93 * Return is 0 or error code.
94 */
95int Disconnect_RILD(HRilClient client);
96
97/**
98 * Register unsolicited response handler. If handler is NULL,
99 * the handler for the request ID is unregistered.
100 * The response handler is invoked in the client task context.
101 * Return is 0 or error code.
102 */
103int RegisterUnsolicitedHandler(HRilClient client, uint32_t id, RilOnUnsolicited handler);
104
105/**
106 * Register solicited response handler. If handler is NULL,
107 * the handler for the ID is unregistered.
108 * The response handler is invoked in the client task context.
109 * Return is 0 or error code.
110 */
111int RegisterRequestCompleteHandler(HRilClient client, uint32_t id, RilOnComplete handler);
112
113/**
114 * Register error callback. If handler is NULL,
115 * the callback is unregistered.
116 * The response handler is invoked in the client task context.
117 * Return is 0 or error code.
118 */
119int RegisterErrorCallback(HRilClient client, RilOnError cb, void *data);
120
121/**
122 * Invoke OEM request. Request ID is RIL_REQUEST_OEM_HOOK_RAW.
123 * Return is 0 or error code. For RIL_CLIENT_ERR_AGAIN caller should retry.
124 */
125int InvokeOemRequestHookRaw(HRilClient client, char *data, size_t len);
126
127/**
128 * Sound device types.
129 */
130typedef enum _SoundType {
131 SOUND_TYPE_VOICE,
132 SOUND_TYPE_SPEAKER,
133 SOUND_TYPE_HEADSET,
134 SOUND_TYPE_BTVOICE
135} SoundType;
136
137/**
138 * External sound device path.
139 */
140typedef enum _AudioPath {
141 SOUND_AUDIO_PATH_HANDSET,
142 SOUND_AUDIO_PATH_HEADSET,
143 SOUND_AUDIO_PATH_SPEAKER,
144 SOUND_AUDIO_PATH_BLUETOOTH,
145 SOUND_AUDIO_PATH_STEREO_BT,
146 SOUND_AUDIO_PATH_HEADPHONE,
147 SOUND_AUDIO_PATH_BLUETOOTH_NO_NR,
148 SOUND_AUDIO_PATH_MIC1,
149 SOUND_AUDIO_PATH_MIC2,
150 SOUND_AUDIO_PATH_BLUETOOTH_WB,
151 SOUND_AUDIO_PATH_BLUETOOTH_WB_NO_NR
152} AudioPath;
153
154/**
155 * ExtraVolume
156 */
157typedef enum _ExtraVolume {
158 ORIGINAL_PATH,
159 EXTRA_VOLUME_PATH
160} ExtraVolume;
161
162/**
163 * Clock adjustment parameters.
164 */
165typedef enum _SoundClockCondition {
166 SOUND_CLOCK_STOP,
167 SOUND_CLOCK_START
168} SoundClockCondition;
169
170/**
171 * Call record adjustment parameters.
172 */
173typedef enum _CallRecCondition {
174 CALL_REC_STOP,
175 CALL_REC_START
176} CallRecCondition;
177
178/**
179 * Mute adjustment parameters.
180 */
181typedef enum _MuteCondition {
182 TX_UNMUTE, /* 0x00: TX UnMute */
183 TX_MUTE, /* 0x01: TX Mute */
184 RX_UNMUTE, /* 0x02: RX UnMute */
185 RX_MUTE, /* 0x03: RX Mute */
186 RXTX_UNMUTE, /* 0x04: RXTX UnMute */
187 RXTX_MUTE, /* 0x05: RXTX Mute */
188} MuteCondition;
189
190/**
191 * Two mic Solution control
192 * Two MIC Solution Device
193 */
194typedef enum __TwoMicSolDevice {
195 AUDIENCE,
196 FORTEMEDIA
197} TwoMicSolDevice;
198
199/**
200 * Two MIC Solution Report
201 */
202typedef enum __TwoMicSolReport {
203 TWO_MIC_SOLUTION_OFF,
204 TWO_MIC_SOLUTION_ON
205} TwoMicSolReport;
206
207/**
208 * DHA Mode
209 */
210typedef enum __DhaSolMode {
211 DHA_MODE_OFF,
212 DHA_MODE_ON
213} DhaSolMode;
214
215/**
216 * DHA Select
217 */
218typedef enum __DhaSolSelect {
219 DHA_SEL_LEFT,
220 DHA_SEL_RIGHT
221} DhaSolSelect;
222
223/**
224 * LoopbackTest parameters.
225 */
226typedef enum __LoopbackMode {
227 LOOPBACK_END,
228 LOOPBACK_ON_PCM,
229 LOOPBACK_ON_PACKET
230} LoopbackMode;
231
232typedef enum __LoopbackPath {
233 RECEIVER,
234 EARPHONE,
235 LOUDSPEAKER
236} LoopbackPath;
237
238
239/**
240 * Set in-call volume.
241 */
242int SetCallVolume(HRilClient client, SoundType type, int vol_level);
243
244/**
245 * Set external sound device path for noise reduction.
246 */
247int SetCallAudioPath(HRilClient client, AudioPath path, ExtraVolume mode);
248
249/**
250 * Set modem clock to master or slave.
251 */
252int SetCallClockSync(HRilClient client, SoundClockCondition condition);
253
254/**
255 * Set modem vtcall clock to master or slave.
256 */
257int SetVideoCallClockSync(HRilClient client, SoundClockCondition condition);
258
259/**
260 * Set voice call record
261 */
262int SetCallRecord(HRilClient client, CallRecCondition condition);
263
264/**
265 * Set mute or unmute
266 */
267int SetMute(HRilClient client, MuteCondition condition);
268
269/**
270 * Get mute state
271 */
272int GetMute(HRilClient client, RilOnComplete handler);
273
274int SetTwoMicControl(HRilClient client, TwoMicSolDevice device, TwoMicSolReport report);
275
276/**
277 * DHA Solution Set
278 */
279int SetDhaSolution(HRilClient client, DhaSolMode mode, DhaSolSelect select, char *parameter);
280
281/**
282 * Set Loopback Test Mode and Path
283 */
284int SetLoopbackTest(HRilClient client, LoopbackMode mode, AudioPath path);
285
286#ifdef __cplusplus
287};
288#endif
289
290#endif // __SECRIL_CLIENT_H__
291
292// end of file
293