Skip to content

Commit 3c18959

Browse files
committed
ril: API cleanup and add support for lock timeout
Signed-off-by: Ajay Bhargav <[email protected]>
1 parent efee5d9 commit 3c18959

File tree

1 file changed

+24
-35
lines changed

1 file changed

+24
-35
lines changed

include/ril/ril.h

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,16 @@
55
#ifndef __RIL_H__
66
#define __RIL_H__
77

8-
#ifndef _DOXYGEN_
9-
#ifndef FALSE
10-
#define FALSE 0
11-
#endif
12-
13-
#ifndef TRUE
14-
#define TRUE 1
15-
#endif
8+
#include <stdint.h>
169

17-
#ifndef NULL
18-
#define NULL ((void *) 0)
10+
#ifdef __cplusplus
11+
extern "C"
12+
{
1913
#endif
2014

2115
#define RIL_MAX_URC_PREFIX_LEN 50 /**< Maximum allowed URC keyword length */
2216
#define PHONE_NUMBER_MAX_LEN 41 /**< Maximum phone number length */
2317

24-
typedef unsigned char u8;
25-
typedef signed char s8;
26-
typedef unsigned short u16;
27-
typedef short s16;
28-
typedef unsigned int u32;
29-
typedef int s32;
30-
typedef unsigned long long u64;
31-
typedef long long s64;
32-
typedef unsigned int ticks;
33-
#endif
34-
3518
/**
3619
* System Initialization status
3720
*/
@@ -151,14 +134,20 @@ enum ril_rc_e {
151134
RIL_AT_UNINITIALIZED = -5,/**< RIL is not initialized */
152135
};
153136

137+
/**
138+
* Incoming call type
139+
*/
140+
enum ril_calltype_e {
141+
MD_VOICE_CALL_TYPE_VOICE,/**< Voice call */
142+
MD_VOICE_CALL_TYPE_VIDEO /**< Video call */
143+
};
144+
154145
/**
155146
* Incoming call phone info
156147
*/
157-
struct callinfo_t {
158-
s32 type; /**< Type of address with following possible values.\n
159-
129: Unknown type (ISDN format number)\n
160-
145: International number type (ISDN format) */
161-
char phoneNumber[PHONE_NUMBER_MAX_LEN]; /**< Phone number as null terminated string */
148+
struct ril_callinfo_t {
149+
int type; /**< Incoming call type @ref ril_calltype_e */
150+
char number[PHONE_NUMBER_MAX_LEN]; /**< Phone number as null terminated string */
162151
};
163152

164153
/**
@@ -175,19 +164,15 @@ typedef void (*urc_handler_f)(const char *strURC, void *reserved);
175164
* @param arg User argument passed via @ref ril_send_atcommand
176165
* @return RIL response return code @ref ril_resp_rc
177166
*/
178-
typedef s32 (*atrsp_callback_f)(char* line, u32 len, void* arg);
167+
typedef int (*atrsp_callback_f)(char* line, uint32_t len, void* arg);
179168

180169
/**
181170
* RIL receive core data callback function
182171
* @param ptrData Incoming data from RIL core
183172
* @param dataLen Length of incoming data
184173
* @param reserved Reserved (unused)
185174
*/
186-
typedef void (*ril_recvcb_f)(u8* ptrData, u32 dataLen, void* reserved);
187-
188-
#ifdef __cplusplus
189-
extern "C" {
190-
#endif
175+
typedef void (*ril_recvcb_f)(uint8_t* ptrData, uint32_t dataLen, void* reserved);
191176

192177
/**
193178
* Callback variable for user RIL processing function. This variable can be assigned when processing function
@@ -204,7 +189,11 @@ extern ril_recvcb_f cb_rcvCoreData;
204189
* @param cb [in] processing callback function @ref atrsp_callback_f
205190
* @param arg [in] User argument passed to callback function
206191
* @param timeout [in] Timeout for command execution
207-
* @param wait [in] Wait for RIL to be available (TRUE) or not (FALSE). If wait is false, function may return with @ref RIL_AT_BUSY
192+
* @param wait [in] Wait for RIL to be available (TRUE) or not (FALSE).
193+
* If wait is false, function returns immideatly if RIL is
194+
* unavailable.
195+
* If true function will wait for RIL availability until
196+
* timeout occurs.
208197
* @return RIL return code @ref ril_rc_e
209198
*/
210199
int ril_send_atcommand(const char *cmd, atrsp_callback_f cb, void *arg, unsigned int timeout, int wait);
@@ -235,10 +224,10 @@ int ril_urc_detach(const char *keyword);
235224
/**
236225
* Get exclusive access to Radio interface layer. This lock is only an advisory lock for RIL.
237226
* @note ril_lock() and ril_unlock() should be called from same task
238-
* @param wait [in] 1 to wait for RIL to be available, 0 otherwise
227+
* @param timeout [in] Timeout value in milliseconds to wait for lock
239228
* @return 0 on success, -EWOULDBLOCK on error or when lock is unavailable
240229
*/
241-
int ril_lock(int wait);
230+
int ril_lock(int timeout);
242231

243232
/**
244233
* Unlock RIL layer

0 commit comments

Comments
 (0)