1 /* Copyright (c) 2011, The Linux Foundation. All rights reserved.
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are
5  * met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above
9  *       copyright notice, this list of conditions and the following
10  *       disclaimer in the documentation and/or other materials provided
11  *       with the distribution.
12  *     * Neither the name of The Linux Foundation nor the names of its
13  *       contributors may be used to endorse or promote products derived
14  *       from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef  LOC_API_FIXUP_H
30 #define LOC_API_FIXUP_H
31 
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36 
37 #ifndef NULLPROC
38 #define NULLPROC 0
39 #endif /* NULLPROC */
40 
41 #ifdef ADD_XDR_FLOAT
42 
43 extern bool_t xdr_float (XDR *__xdrs, float *__fp);
44 extern bool_t xdr_double (XDR *__xdrs, double *__dp);
45 
46 #endif /* ADD_XDR_FLOAT */
47 
48 #ifdef ADD_XDR_BOOL
49 extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
50 #endif /* ADD_XDR_BOOL */
51 
52 #define RPC_LOC_API_MAJOR_VERSION_NUMBER   1
53 #define RPC_LOC_API_MINOR_VERSION_NUMBER   0
54 
55 // Return value for loc_open in case of failure.
56 #define RPC_LOC_CLIENT_HANDLE_INVALID     -1
57 
58 // Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
59 // These are also the status for the ioctl callback
60 #define RPC_LOC_API_SUCCESS           0
61 #define RPC_LOC_API_GENERAL_FAILURE   1
62 #define RPC_LOC_API_UNSUPPORTED       2
63 #define RPC_LOC_API_INVALID_HANDLE    4
64 #define RPC_LOC_API_INVALID_PARAMETER 5
65 #define RPC_LOC_API_ENGINE_BUSY       6
66 #define RPC_LOC_API_PHONE_OFFLINE     7
67 #define RPC_LOC_API_TIMEOUT           8
68 
69 // Special return value for loc api calls in case of RPC failure
70 #define RPC_LOC_API_RPC_FAILURE       (-1234)
71 // Special return value for modem restart incurred RPC failure
72 #define RPC_LOC_API_RPC_MODEM_RESTART       (-1235)
73 
74 #define RPC_LOC_API_MAX_SV_COUNT                      80
75 #define RPC_LOC_API_MAX_NMEA_STRING_LENGTH            1200
76 
77 // Maximum server address that will be used in location API
78 #define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH            256
79 #define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS  3
80 #define RPC_LOC_API_MAX_NUM_NTP_SERVERS               3
81 
82 #define RPC_LOC_EVENT_PARSED_POSITION_REPORT             0x00000001 // Position report comes in loc_parsed_position_s_type
83 #define RPC_LOC_EVENT_SATELLITE_REPORT                   0x00000002 // Satellite in view report
84 #define RPC_LOC_EVENT_NMEA_1HZ_REPORT                    0x00000004 // NMEA report at 1HZ rate
85 #define RPC_LOC_EVENT_NMEA_POSITION_REPORT               0x00000008 // NMEA report at position report rate
86 #define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST           0x00000010 // NI notification/verification request
87 #define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST            0x00000020 // Assistance data, eg: time, predicted orbits request
88 #define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST            0x00000040 // Request for location server
89 #define RPC_LOC_EVENT_IOCTL_REPORT                       0x00000080 // Callback report for loc_ioctl
90 #define RPC_LOC_EVENT_STATUS_REPORT                      0x00000100 // Misc status report: eg, engine state
91 
92 #define RPC_LOC_POS_VALID_SESSION_STATUS                 0x00000001
93 #define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR             0x00000002
94 #define RPC_LOC_POS_VALID_TIMESTAMP_UTC                  0x00000004
95 #define RPC_LOC_POS_VALID_LEAP_SECONDS                   0x00000008
96 #define RPC_LOC_POS_VALID_TIME_UNC                       0x00000010
97 #define RPC_LOC_POS_VALID_LATITUDE                       0x00000020
98 #define RPC_LOC_POS_VALID_LONGITUDE                      0x00000040
99 #define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID         0x00000080
100 #define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL    0x00000100
101 #define RPC_LOC_POS_VALID_SPEED_HORIZONTAL               0x00000200
102 #define RPC_LOC_POS_VALID_SPEED_VERTICAL                 0x00000400
103 #define RPC_LOC_POS_VALID_HEADING                        0x00000800
104 #define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR               0x00001000
105 #define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ          0x00002000
106 #define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN          0x00004000
107 #define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH    0x00008000
108 #define RPC_LOC_POS_VALID_VERTICAL_UNC                   0x00010000
109 #define RPC_LOC_POS_VALID_SPEED_UNC                      0x00020000
110 #define RPC_LOC_POS_VALID_HEADING_UNC                    0x00040000
111 #define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL          0x00080000
112 #define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL            0x00100000
113 #define RPC_LOC_POS_VALID_MAGNETIC_VARIATION             0x00200000
114 #define RPC_LOC_POS_VALID_TECHNOLOGY_MASK                0x00400000
115 
116 #define RPC_LOC_POS_TECH_SATELLITE 0x00000001
117 #define RPC_LOC_POS_TECH_CELLID    0x00000002
118 #define RPC_LOC_POS_TECH_WIFI      0x00000004
119 
120 #define RPC_LOC_SV_INFO_VALID_SYSTEM         0x00000001
121 #define RPC_LOC_SV_INFO_VALID_PRN            0x00000002
122 #define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS  0x00000004
123 #define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
124 #define RPC_LOC_SV_INFO_VALID_HAS_EPH        0x00000010
125 #define RPC_LOC_SV_INFO_VALID_HAS_ALM        0x00000020
126 #define RPC_LOC_SV_INFO_VALID_ELEVATION      0x00000040
127 #define RPC_LOC_SV_INFO_VALID_AZIMUTH        0x00000080
128 #define RPC_LOC_SV_INFO_VALID_SNR            0x00000100
129 
130 #define RPC_LOC_GNSS_INFO_VALID_POS_DOP           0x00000001
131 #define RPC_LOC_GNSS_INFO_VALID_HOR_DOP           0x00000002
132 #define RPC_LOC_GNSS_INFO_VALID_VERT_DOP          0x00000004
133 #define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED  0x00000008
134 #define RPC_LOC_GNSS_INFO_VALID_SV_COUNT          0x00000010
135 #define RPC_LOC_GNSS_INFO_VALID_SV_LIST           0x00000020
136 
137 #define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH          200
138 #define RPC_LOC_NI_SUPL_HASH_LENGTH                 8
139 #define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH  4
140 #define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH           64
141 #define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS           20
142 #define RPC_LOC_NI_CODEWORD_LENGTH                  20
143 
144 #define RPC_LOC_NI_SUPL_QOP_VALID         0x01
145 #define RPC_LOC_NI_SUPL_QOP_VERACC_VALID  0x02
146 #define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID  0x04
147 #define RPC_LOC_NI_SUPL_QOP_DELAY_VALID   0x08
148 
149 #define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE                  0x00000001
150 #define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE         0x00000002
151 #define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY               0x00000004
152 #define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME          0x00000008
153 #define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED  0x00000010
154 #define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE                      0x00000020
155 #define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL                     0x00000040
156 #define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE                     0x00000080
157 #define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL         0x00000100
158 
159 #define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC                0x00000001
160 #define RPC_LOC_ASSIST_POS_VALID_LATITUDE                     0x00000002
161 #define RPC_LOC_ASSIST_POS_VALID_LONGITUDE                    0x00000004
162 #define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID       0x00000008
163 #define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL  0x00000010
164 #define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR             0x00000020
165 #define RPC_LOC_ASSIST_POS_VALID_VERT_UNC                     0x00000040
166 #define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL        0x00000080
167 #define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL          0x00000100
168 #define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_AGE                0x00000200
169 
170 #define RPC_LOC_ASSIST_DATA_ALL         0xFFFFFFFF
171 
172 #define RPC_LOC_NMEA_MASK_ALL    0xffff
173 #define RPC_LOC_NMEA_MASK_GGA    0x0001
174 #define RPC_LOC_NMEA_MASK_RMC    0x0002
175 #define RPC_LOC_NMEA_MASK_GSV    0x0004
176 #define RPC_LOC_NMEA_MASK_GSA    0x0008
177 #define RPC_LOC_NMEA_MASK_VTG    0x0010
178 
179 /* EFS data access */
180 #define RPC_LOC_EFS_MAX_PATH_LEN_BYTES  64     /* Max file name length in bytes that can be written*/
181 #define RPC_LOC_EFS_MAX_FILE_LEN_BYTES  2000   /* Max file size in bytes that can be written */
182 
183 /* WIPER valid information flag in log report */
184 #define RPC_LOC_WIPER_LOG_TIME_VALID 0x01
185 #define RPC_LOC_WIPER_LOG_POS_VALID 0x02
186 #define RPC_LOC_WIPER_LOG_AP_SET_VALID 0x04
187 
188 /* General WIPER defines */
189 #define RPC_LOC_WIPER_MAC_ADDR_LENGTH  6              // Do not change this number since it affects RPC and log packet sizes
190 #define RPC_LOC_WIPER_MAX_REPORTED_APS_PER_LOG_MSG 50 // Do not change this number since it affects RPC and log packet sizes
191 
192 /* WIPER AP Qualifier */
193 #define RPC_LOC_WIPER_AP_QUALIFIER_BEING_USED 0x1  /* AP is being used by WPS */
194 #define RPC_LOC_WIPER_AP_QUALIFIER_HIDDEN_SSID 0x2 /* AP does not broadcast SSID */
195 #define RPC_LOC_WIPER_AP_QUALIFIER_PRIVATE 0x4     /* AP has encryption turned on */
196 #define RPC_LOC_WIPER_AP_QUALIFIER_INFRASTRUCTURE_MODE 0x8     /* AP is in infrastructure mode and not in ad-hoc/unknown mode */
197 
198 /* flags for notification */
199 #define  RPC_LOC_NI_CLIENT_NAME_PRESENT             0x0001
200 #define  RPC_LOC_NI_CLIENT_EXTADDR_PRESENT          0x0002
201 #define  RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT       0x0010
202 #define  RPC_LOC_NI_REQUESTOR_ID_PRESENT            0x0020
203 #define  RPC_LOC_NI_CODEWORD_PRESENT                0x0040
204 #define  RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT         0x0080
205 #define  RPC_LOC_NI_ENCODING_TYPE_PRESENT           0x0100
206 
207 /* below are for RPC_LOC_IOCTL_SET_LBS_APN_PROFILE data */
208 /* values for apn_profiles[0].srv_system_type */
209 #define LOC_APN_PROFILE_SRV_SYS_CDMA  0x01
210 #define LOC_APN_PROFILE_SRV_SYS_HDR   0x02
211 #define LOC_APN_PROFILE_SRV_SYS_GSM   0x04
212 #define LOC_APN_PROFILE_SRV_SYS_WCDMA 0x08
213 #define LOC_APN_PROFILE_SRV_SYS_LTE   0x10
214 #define LOC_APN_PROFILE_SRV_SYS_MAX   0x1F
215 /* values for apn_profiles[0].pdp_type */
216 #define LOC_APN_PROFILE_PDN_TYPE_IPV4    0x01
217 #define LOC_APN_PROFILE_PDN_TYPE_IPV6    0x02
218 #define LOC_APN_PROFILE_PDN_TYPE_IPV4V6  0x03
219 #define LOC_APN_PROFILE_PDN_TYPE_PPP     0x04
220 #define LOC_APN_PROFILE_PDN_TYPE_MAX     0x04
221 
222 #ifdef __cplusplus
223 }
224 #endif
225 
226 #endif /* LOC_API_FIXUP_H */
227