-
Notifications
You must be signed in to change notification settings - Fork 3
/
gps-rpc.h
153 lines (135 loc) · 3.79 KB
/
gps-rpc.h
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/**
* This file is part of gps-proxy.
*
* Copyright (C) 2012 Alexander Tarasikov <[email protected]>
*
* gps-proxy is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* gps-proxy is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gps-proxy. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __GPS_RPC_H__
#define __GPS_RPC_H__
#define GPS_RPC_SOCKET_NAME "gps-rpc-socket"
#define GPS_SOCKET_RETRY_COUNT 5
enum gps_rpc_code {
/* reserved for debugging */
GPS_PROXY_NOP,
GPS_PROXY_OPEN,
/* XTRA Interface */
GPS_PROXY_XTRA_INIT,
GPS_PROXY_XTRA_INJECT_XTRA_DATA,
/* AGPS Interface */
GPS_PROXY_AGPS_INIT,
GPS_PROXY_AGPS_DATA_CONN_OPEN,
GPS_PROXY_AGPS_DATA_CONN_CLOSED,
GPS_PROXY_AGPS_DATA_CONN_FAILED,
GPS_PROXY_AGPS_AGPS_SET_SERVER,
/* NI Interface */
GPS_PROXY_NI_INIT,
GPS_PROXY_NI_RESPOND,
/* GPS Interface */
GPS_PROXY_GPS_INIT,
GPS_PROXY_GPS_START,
GPS_PROXY_GPS_STOP,
GPS_PROXY_GPS_CLEANUP,
GPS_PROXY_GPS_INJECT_TIME,
GPS_PROXY_GPS_INJECT_LOCATION,
GPS_PROXY_GPS_DELETE_AIDING_DATA,
GPS_PROXY_GPS_SET_POSITION_MODE,
GPS_PROXY_GPS_GET_EXTENSION,
/* GPS Callbacks */
GPS_LOC_CB,
GPS_STATUS_CB,
GPS_SV_STATUS_CB,
GPS_NMEA_CB,
GPS_SET_CAPABILITIES_CB,
GPS_ACQUIRE_LOCK_CB,
GPS_RELEASE_LOCK_CB,
GPS_CREATE_THREAD_CB,
GPS_REQUEST_UTC_TIME_CB,
/* XTRA Callbacks */
XTRA_REQUEST_CB,
XTRA_CREATE_THREAD_CB,
/* AGPS Callbacks */
AGPS_STATUS_CB,
AGPS_CREATE_THREAD_CB,
/* NI Callbacks */
NI_NOTIFY_CB,
NI_CREATE_THREAD_CB,
/* RIL Callbacks */
RIL_SET_ID_CB,
RIL_REF_LOC_CB,
RIL_CREATE_THREAD_CB,
RIL_INIT,
RIL_SET_REF_LOC,
RIL_SET_SET_ID,
RIL_NI_MSG,
RIL_UPDATE_NET_STATE,
RIL_UPDATE_NET_AVAILABILITY,
GPS_RPC_MAX,
};
static inline char* gps_rpc_to_s(enum gps_rpc_code code) {
#define TT_ENTRY(x) [x] = #x
char *ttbl[GPS_RPC_MAX] = {
TT_ENTRY(GPS_PROXY_NOP),
TT_ENTRY(GPS_PROXY_OPEN),
TT_ENTRY(GPS_PROXY_XTRA_INIT),
TT_ENTRY(GPS_PROXY_XTRA_INJECT_XTRA_DATA),
TT_ENTRY(GPS_PROXY_AGPS_INIT),
TT_ENTRY(GPS_PROXY_AGPS_DATA_CONN_OPEN),
TT_ENTRY(GPS_PROXY_AGPS_DATA_CONN_CLOSED),
TT_ENTRY(GPS_PROXY_AGPS_DATA_CONN_FAILED),
TT_ENTRY(GPS_PROXY_AGPS_AGPS_SET_SERVER),
TT_ENTRY(GPS_PROXY_NI_INIT),
TT_ENTRY(GPS_PROXY_NI_RESPOND),
TT_ENTRY(GPS_PROXY_GPS_INIT),
TT_ENTRY(GPS_PROXY_GPS_START),
TT_ENTRY(GPS_PROXY_GPS_STOP),
TT_ENTRY(GPS_PROXY_GPS_CLEANUP),
TT_ENTRY(GPS_PROXY_GPS_INJECT_TIME),
TT_ENTRY(GPS_PROXY_GPS_INJECT_LOCATION),
TT_ENTRY(GPS_PROXY_GPS_DELETE_AIDING_DATA),
TT_ENTRY(GPS_PROXY_GPS_SET_POSITION_MODE),
TT_ENTRY(GPS_PROXY_GPS_GET_EXTENSION),
TT_ENTRY(GPS_LOC_CB),
TT_ENTRY(GPS_STATUS_CB),
TT_ENTRY(GPS_SV_STATUS_CB),
TT_ENTRY(GPS_NMEA_CB),
TT_ENTRY(GPS_SET_CAPABILITIES_CB),
TT_ENTRY(GPS_ACQUIRE_LOCK_CB),
TT_ENTRY(GPS_RELEASE_LOCK_CB),
TT_ENTRY(GPS_CREATE_THREAD_CB),
TT_ENTRY(GPS_REQUEST_UTC_TIME_CB),
TT_ENTRY(XTRA_REQUEST_CB),
TT_ENTRY(XTRA_CREATE_THREAD_CB),
TT_ENTRY(AGPS_STATUS_CB),
TT_ENTRY(AGPS_CREATE_THREAD_CB),
TT_ENTRY(NI_NOTIFY_CB),
TT_ENTRY(NI_CREATE_THREAD_CB),
TT_ENTRY(RIL_SET_ID_CB),
TT_ENTRY(RIL_REF_LOC_CB),
TT_ENTRY(RIL_CREATE_THREAD_CB),
TT_ENTRY(RIL_INIT),
TT_ENTRY(RIL_SET_REF_LOC),
TT_ENTRY(RIL_SET_SET_ID),
TT_ENTRY(RIL_NI_MSG),
TT_ENTRY(RIL_UPDATE_NET_STATE),
TT_ENTRY(RIL_UPDATE_NET_AVAILABILITY),
};
#undef TT_ENTRY
if (code >= GPS_RPC_MAX) {
return NULL;
}
return ttbl[code];
}
#endif //__GPS_RPC_H__