blob: 4c4c2b006345768e0d528910a9eaf8b391db1582 [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
codeworkxf1587a32012-08-03 23:32:29 +020078/**
79 * Connect to RIL deamon. One client task starts.
80 * Return is 0 or error code.
81 */
82int Connect_RILD_Second(HRilClient client);
Christopher N. Hesse5eda55f2017-02-21 22:54:34 +010083
codeworkxf1587a32012-08-03 23:32:29 +020084/**
85 * check whether RILD is connected
86 * Returns 0 or 1
87 */
88int isConnected_RILD(HRilClient client);
89
90/**
91 * Disconnect connection to RIL deamon(socket close).
92 * Return is 0 or error code.
93 */
94int Disconnect_RILD(HRilClient client);
95
96/**
97 * Register unsolicited response handler. If handler is NULL,
98 * the handler for the request ID is unregistered.
99 * The response handler is invoked in the client task context.
100 * Return is 0 or error code.
101 */
102int RegisterUnsolicitedHandler(HRilClient client, uint32_t id, RilOnUnsolicited handler);
103
104/**
105 * Register solicited response handler. If handler is NULL,
106 * the handler for the ID is unregistered.
107 * The response handler is invoked in the client task context.
108 * Return is 0 or error code.
109 */
110int RegisterRequestCompleteHandler(HRilClient client, uint32_t id, RilOnComplete handler);
111
112/**
113 * Register error callback. If handler is NULL,
114 * the callback is unregistered.
115 * The response handler is invoked in the client task context.
116 * Return is 0 or error code.
117 */
118int RegisterErrorCallback(HRilClient client, RilOnError cb, void *data);
119
120/**
121 * Invoke OEM request. Request ID is RIL_REQUEST_OEM_HOOK_RAW.
122 * Return is 0 or error code. For RIL_CLIENT_ERR_AGAIN caller should retry.
123 */
124int InvokeOemRequestHookRaw(HRilClient client, char *data, size_t len);
125
126/**
127 * Sound device types.
128 */
129typedef enum _SoundType {
130 SOUND_TYPE_VOICE,
131 SOUND_TYPE_SPEAKER,
132 SOUND_TYPE_HEADSET,
133 SOUND_TYPE_BTVOICE
134} SoundType;
135
136/**
137 * External sound device path.
138 */
139typedef enum _AudioPath {
Andreas Schneidere0058812017-02-14 17:24:02 +0100140 SOUND_AUDIO_PATH_EARPIECE,
141 SOUND_AUDIO_PATH_HANDSET = SOUND_AUDIO_PATH_EARPIECE,
codeworkxf1587a32012-08-03 23:32:29 +0200142 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 */
Android-Andi40afadb2016-01-07 11:51:38 +0100157#ifdef RIL_CALL_AUDIO_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 */
Android-Andi40afadb2016-01-07 11:51:38 +0100249#ifdef RIL_CALL_AUDIO_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