1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/**
* @file secril-client.h
*
* @author Myeongcheol Kim (mcmount.kim@samsung.com)
*
* @brief RIL client library for multi-client support
*/
#ifndef __SECRIL_CLIENT_H__
#define __SECRIL_CLIENT_H__
#include <sys/types.h>
#ifdef __cplusplus
extern "C"
{
#endif
struct RilClient
{
void *prv;
};
typedef struct RilClient * HRilClient;
//---------------------------------------------------------------------------
// Defines
//---------------------------------------------------------------------------
#define RIL_CLIENT_ERR_SUCCESS 0
#define RIL_CLIENT_ERR_AGAIN 1
#define RIL_CLIENT_ERR_INIT 2 // Client is not initialized
#define RIL_CLIENT_ERR_INVAL 3 // Invalid value
#define RIL_CLIENT_ERR_CONNECT 4 // Connection error
#define RIL_CLIENT_ERR_IO 5 // IO error
#define RIL_CLIENT_ERR_RESOURCE 6 // Resource not available
#define RIL_CLIENT_ERR_UNKNOWN 7
//---------------------------------------------------------------------------
// Type definitions
//---------------------------------------------------------------------------
typedef int (*RilOnComplete)(HRilClient handle, const void *data, size_t datalen);
typedef int (*RilOnUnsolicited)(HRilClient handle, const void *data, size_t datalen);
typedef int (*RilOnError)(void *data, int error);
//---------------------------------------------------------------------------
// Client APIs
//---------------------------------------------------------------------------
/**
* Open RILD multi-client.
* Return is client handle, NULL on error.
*/
HRilClient OpenClient_RILD(void);
/**
* Stop RILD multi-client. If client socket was connected,
* it will be disconnected.
*/
int CloseClient_RILD(HRilClient client);
/**
* Connect to RIL deamon. One client task starts.
* Return is 0 or error code.
*/
int Connect_RILD(HRilClient client);
/**
* check whether RILD is connected
* Returns 0 or 1
*/
int isConnected_RILD(HRilClient client);
/**
* Disconnect connection to RIL deamon(socket close).
* Return is 0 or error code.
*/
int Disconnect_RILD(HRilClient client);
/**
* Register unsolicited response handler. If handler is NULL,
* the handler for the request ID is unregistered.
* The response handler is invoked in the client task context.
* Return is 0 or error code.
*/
int RegisterUnsolicitedHandler(HRilClient client, uint32_t id, RilOnUnsolicited handler);
/**
* Register solicited response handler. If handler is NULL,
* the handler for the ID is unregistered.
* The response handler is invoked in the client task context.
* Return is 0 or error code.
*/
int RegisterRequestCompleteHandler(HRilClient client, uint32_t id, RilOnComplete handler);
/**
* Register error callback. If handler is NULL,
* the callback is unregistered.
* The response handler is invoked in the client task context.
* Return is 0 or error code.
*/
int RegisterErrorCallback(HRilClient client, RilOnError cb, void *data);
/**
* Invoke OEM request. Request ID is RIL_REQUEST_OEM_HOOK_RAW.
* Return is 0 or error code. For RIL_CLIENT_ERR_AGAIN caller should retry.
*/
int InvokeOemRequestHookRaw(HRilClient client, char *data, size_t len);
#ifdef __cplusplus
};
#endif
#endif // __SECRIL_CLIENT_H__
// end of file
|