blob: 134b80e4243a965e56a8628dcb55212508d91db2 [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 */
Andreas Schneider94275102015-08-24 19:55:42 +0200157#ifdef RIL_CALL_AUIO_PATH_EXTRAVOLUME
codeworkxf1587a32012-08-03 23:32:29 +0200158typedef enum _ExtraVolume {
159 ORIGINAL_PATH,
160 EXTRA_VOLUME_PATH
161} ExtraVolume;
Andreas Schneider94275102015-08-24 19:55:42 +0200162#endif
codeworkxf1587a32012-08-03 23:32:29 +0200163
164/**
165 * Clock adjustment parameters.
166 */
167typedef enum _SoundClockCondition {
168 SOUND_CLOCK_STOP,
169 SOUND_CLOCK_START
170} SoundClockCondition;
171
172/**
173 * Call record adjustment parameters.
174 */
175typedef enum _CallRecCondition {
176 CALL_REC_STOP,
177 CALL_REC_START
178} CallRecCondition;
179
180/**
181 * Mute adjustment parameters.
182 */
183typedef enum _MuteCondition {
184 TX_UNMUTE, /* 0x00: TX UnMute */
185 TX_MUTE, /* 0x01: TX Mute */
186 RX_UNMUTE, /* 0x02: RX UnMute */
187 RX_MUTE, /* 0x03: RX Mute */
188 RXTX_UNMUTE, /* 0x04: RXTX UnMute */
189 RXTX_MUTE, /* 0x05: RXTX Mute */
190} MuteCondition;
191
192/**
193 * Two mic Solution control
194 * Two MIC Solution Device
195 */
196typedef enum __TwoMicSolDevice {
197 AUDIENCE,
198 FORTEMEDIA
199} TwoMicSolDevice;
200
201/**
202 * Two MIC Solution Report
203 */
204typedef enum __TwoMicSolReport {
205 TWO_MIC_SOLUTION_OFF,
206 TWO_MIC_SOLUTION_ON
207} TwoMicSolReport;
208
209/**
210 * DHA Mode
211 */
212typedef enum __DhaSolMode {
213 DHA_MODE_OFF,
214 DHA_MODE_ON
215} DhaSolMode;
216
217/**
218 * DHA Select
219 */
220typedef enum __DhaSolSelect {
221 DHA_SEL_LEFT,
222 DHA_SEL_RIGHT
223} DhaSolSelect;
224
225/**
226 * LoopbackTest parameters.
227 */
228typedef enum __LoopbackMode {
229 LOOPBACK_END,
230 LOOPBACK_ON_PCM,
231 LOOPBACK_ON_PACKET
232} LoopbackMode;
233
234typedef enum __LoopbackPath {
235 RECEIVER,
236 EARPHONE,
237 LOUDSPEAKER
238} LoopbackPath;
239
240
241/**
242 * Set in-call volume.
243 */
244int SetCallVolume(HRilClient client, SoundType type, int vol_level);
245
246/**
247 * Set external sound device path for noise reduction.
248 */
Andreas Schneider94275102015-08-24 19:55:42 +0200249#ifdef RIL_CALL_AUIO_PATH_EXTRAVOLUME
codeworkxf1587a32012-08-03 23:32:29 +0200250int SetCallAudioPath(HRilClient client, AudioPath path, ExtraVolume mode);
Andreas Schneider94275102015-08-24 19:55:42 +0200251#else
252int SetCallAudioPath(HRilClient client, AudioPath path);
253#endif
codeworkxf1587a32012-08-03 23:32:29 +0200254
255/**
256 * Set modem clock to master or slave.
257 */
258int SetCallClockSync(HRilClient client, SoundClockCondition condition);
259
260/**
261 * Set modem vtcall clock to master or slave.
262 */
263int SetVideoCallClockSync(HRilClient client, SoundClockCondition condition);
264
265/**
266 * Set voice call record
267 */
268int SetCallRecord(HRilClient client, CallRecCondition condition);
269
270/**
271 * Set mute or unmute
272 */
273int SetMute(HRilClient client, MuteCondition condition);
274
275/**
276 * Get mute state
277 */
278int GetMute(HRilClient client, RilOnComplete handler);
279
280int SetTwoMicControl(HRilClient client, TwoMicSolDevice device, TwoMicSolReport report);
281
282/**
283 * DHA Solution Set
284 */
285int SetDhaSolution(HRilClient client, DhaSolMode mode, DhaSolSelect select, char *parameter);
286
287/**
288 * Set Loopback Test Mode and Path
289 */
290int SetLoopbackTest(HRilClient client, LoopbackMode mode, AudioPath path);
291
292#ifdef __cplusplus
293};
294#endif
295
296#endif // __SECRIL_CLIENT_H__
297
298// end of file
299