Release Tizen2.0 beta
[framework/location/gps-manager.git] / gps-manager / include / gps_manager_plugin_intf.h
1 /*
2  * gps-manager
3  *
4  * Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>,
7  *          Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21
22 #ifndef _GPS_MANAGER_PLUGIN_INTF_H_
23 #define _GPS_MANAGER_PLUGIN_INTF_H_
24
25 #include <gps_manager_data_types.h>
26 #include <gps_manager_extra_data_types.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #define GPS_MANAGER_PLUGIN_PATH "/usr/lib/libSLP-lbs-plugin.so"
33 #define MAX_REQUESTER_ID_LEN    (128)
34 #define MAX_CLIENT_NAME_LEN     (128)
35 #define MAX_SUPL_URL_LEN        (128)
36
37 /**
38  * GPS setting parameters
39  */
40 typedef struct {
41         gps_session_t        session_type;              /**< Session type */
42         gps_operation_t      operation_mode;            /**< Operation mode */
43         gps_starting_t       starting_type;             /**< Starting type */
44         int                  num_fixes;                 /**< Total number of fixes to be done */
45         int                  time_bn_fixes;             /**< Time between fix */
46         char                 supl_url[MAX_SUPL_URL_LEN];/**< SUPL URL */
47         int                  supl_port;                 /**< SUPL port number */
48         agps_ssl_mode_t      ssl_mode;                  /**< SSL mode */
49         agps_ssl_cert_type_t cert_type;                 /**< SSL certification type */
50 } gps_server_param_t;
51
52 /**
53  * GPS asynchronous event type
54  */
55 typedef enum {
56         GPS_EVENT_START_SESSION        = 0x0000,/**< The session is started */
57         GPS_EVENT_STOP_SESSION,                 /**< The session is stopped */
58         GPS_EVENT_REPORT_POSITION      = 0x0100,/**< Bring up GPS position data */
59         GPS_EVENT_REPORT_SATELLITE,             /**< Bring up GPS SV data */
60         GPS_EVENT_REPORT_NMEA,                  /**< Bring up GPS NMEA data */
61         GPS_EVENT_SET_OPTION           = 0x0200,/**< The option is set */
62         GPS_EVENT_GET_REF_LOCATION     = 0x0300,/**< Get the reference location for AGPS */
63         GPS_EVENT_GET_IMSI,                     /**< Get IMSI for identification */
64         GPS_EVENT_OPEN_DATA_CONNECTION = 0x0400,/**< Request opening data network connection */
65         GPS_EVENT_CLOSE_DATA_CONNECTION,        /**< Request closing data network connection */
66         GPS_EVENT_DNS_LOOKUP_IND,               /**< Request resolving host name */
67         GPS_EVENT_AGPS_VERIFICATION_INDI,       /**< Verification indicator for AGPS is required */
68         GPS_EVENT_FACTORY_TEST         = 0x0500,/**< Factory test is done */
69         GPS_EVENT_ERR_CAUSE            = 0xFFFF /**< Some error is occurred */
70 } gps_event_id_t;
71
72 /**
73  * Start session response event data
74  */
75 typedef struct {
76         gps_error_t error;
77 } gps_start_session_ev_info_t;
78
79 /**
80  * Response of stop session
81  */
82 typedef struct {
83         gps_error_t error;
84 } gps_stop_session_ev_info_t;
85
86 /**
87  * Set option response event data
88  */
89 typedef struct {
90         gps_error_t error;
91 } gps_set_option_ev_info_t;
92
93
94 /**
95  * Position data from GPS
96  */
97 typedef struct {
98         gps_error_t error;
99         pos_data_t  pos;
100 } gps_pos_ev_info_t;
101
102 /**
103  * Satellite data from GPS
104  */
105 typedef struct {
106         gps_error_t error;
107         sv_data_t   sv;
108 } gps_sv_ev_info_t;
109
110 /**
111  * NMEA data from GPS
112  */
113 typedef struct {
114         gps_error_t error;
115         nmea_data_t nmea;
116 } gps_nmea_ev_info_t;
117
118 /**
119  * This enumeration defines values for notify type for GPS verification message.
120  */
121 typedef enum {
122         AGPS_NOTIFY_NO_VERIFY           = 0x00,
123         AGPS_NOTIFY_ONLY                = 0x01,
124         AGPS_NOTIFY_ALLOW_NORESPONSE    = 0x02,
125         AGPS_NOTIFY_NOTALLOW_NORESPONSE = 0x03,
126         AGPS_NOTIFY_PRIVACY_NEEDED      = 0x04,
127         AGPS_NOTIFY_PRIVACY_OVERRIDE    = 0x05
128 } agps_notify_t;
129
130 /**
131  * This enumeration defines values for requester type for GPS verification message
132  */
133 typedef enum {
134         AGPS_REQ_LOGICAL_NAME   = 0x00, /**< Specifies logical name. */
135         AGPS_REQ_EMAIL_ADDR     = 0x01, /**< Specifies e-mail address */
136         AGPS_REQ_MSISDN         = 0x02, /**< Specifies MSISDN number */
137         AGPS_REQ_URL            = 0x03, /**< Specifies URL */
138         AGPS_REQ_SIPURL         = 0x04, /**< Specifies SIPURL */
139         AGPS_REQ_MIN            = 0x05, /**< Specifies MIN */
140         AGPS_REQ_MDN            = 0x06, /**< Specifies MDN */
141         AGPS_REQ_UNKNOWN        = 0x07  /**< Unknown request */
142 } agps_supl_format_t;
143
144 /**
145  * This enumeration defines values for GPS encoding type for GPS verification message.
146  */
147 typedef enum {
148         AGPS_ENCODE_ISO646IRV           = 0x00,
149         AGPS_ENCODE_ISO8859             = 0x01,
150         AGPS_ENCODE_UTF8                = 0x02,
151         AGPS_ENCODE_UTF16               = 0x03,
152         AGPS_ENCODE_UCS2                = 0x04,
153         AGPS_ENCODE_GSMDEFAULT          = 0x05,
154         AGPS_ENCODE_SHIFT_JIS           = 0x06,
155         AGPS_ENCODE_JIS                 = 0x07,
156         AGPS_ENCODE_EUC                 = 0x08,
157         AGPS_ENCODE_GB2312              = 0x09,
158         AGPS_ENCODE_CNS11643            = 0x0A,
159         AGPS_ENCODE_KSC1001             = 0x0B,
160         AGPS_ENCODE_GERMAN              = 0x0C,
161         AGPS_ENCODE_ENGLISH             = 0x0D,
162         AGPS_ENCODE_ITALIAN             = 0x0E,
163         AGPS_ENCODE_FRENCH              = 0x0F,
164         AGPS_ENCODE_SPANISH             = 0x10,
165         AGPS_ENCODE_DUTCH               = 0x11,
166         AGPS_ENCODE_SWEDISH             = 0x12,
167         AGPS_ENCODE_DANISH              = 0x13,
168         AGPS_ENCODE_PORTUGUESE          = 0x14,
169         AGPS_ENCODE_FINNISH             = 0x15,
170         AGPS_ENCODE_NORWEGIAN           = 0x16,
171         AGPS_ENCODE_GREEK               = 0x17,
172         AGPS_ENCODE_TURKISH             = 0x18,
173         AGPS_ENCODE_HUNGARIAN           = 0x19,
174         AGPS_ENCODE_POLISH              = 0x1A,
175         AGPS_ENCODE_LANGUAGE_UNSPEC     = 0xFF
176 } agps_encoding_scheme_t;
177
178 /**
179  * This enumeration defines values for GPS encoding type for GPS verification message.
180  */
181 typedef enum {
182         AGPS_ID_ENCODE_ISO646IRV        = 0x00,
183         AGPS_ID_ENCODE_EXN_PROTOCOL_MSG = 0x01,
184         AGPS_ID_ENCODE_ASCII            = 0x02,
185         AGPS_ID_ENCODE_IA5              = 0x03,
186         AGPS_ID_ENCODE_UNICODE          = 0x04,
187         AGPS_ID_ENCODE_SHIFT_JIS        = 0x05,
188         AGPS_ID_ENCODE_KOREAN           = 0x06,
189         AGPS_ID_ENCODE_LATIN_HEBREW     = 0x07,
190         AGPS_ID_ENCODE_LATIN            = 0x08,
191         AGPS_ID_ENCODE_GSM              = 0x09
192 } agps_requester_id_encoding_t;
193
194 /**
195  *  This structure defines the values for GPS Verification message indication.
196  */
197 typedef struct {
198         /** Specifies notification type refer enum tapi_gps_notify_type_t */
199         agps_notify_t                notify_type;
200
201         /** Specifies encoding type refer enum tapi_gps_encoding_type_t */
202         agps_supl_format_t           supl_format;
203
204         /** Specifies requester type */
205         agps_encoding_scheme_t       datacoding_scheme;
206
207         agps_requester_id_encoding_t requester_id_encoding;
208
209         /** Specifies requester ID */
210         char                         requester_id[MAX_REQUESTER_ID_LEN];
211
212         /** Specifies client name */
213         char                         client_name[MAX_CLIENT_NAME_LEN];
214
215         /** Response timer */
216         int                          resp_timer;
217 } agps_verification_ev_info_t;
218
219 /**
220  * Factory test result information
221  */
222 typedef struct {
223         gps_error_t error;
224         int         prn;
225         double      snr;
226 } gps_factory_test_ev_info_t;
227
228 /**
229  * DNS query request information
230  */
231 typedef struct {
232         gps_error_t error;
233         char        domain_name[MAX_SUPL_URL_LEN];
234 } gps_dns_query_ev_info_t;
235
236 /**
237  * GPS event info
238  */
239 typedef union {
240         /** Callback related with Response */
241         gps_start_session_ev_info_t start_session_rsp;
242         gps_stop_session_ev_info_t  stop_session_rsp;
243         gps_set_option_ev_info_t    set_option_rsp;
244
245         /** Callback Related with Indication */
246         gps_pos_ev_info_t           pos_ind;
247         gps_sv_ev_info_t            sv_ind;
248         gps_nmea_ev_info_t          nmea_ind;
249         agps_verification_ev_info_t agps_verification_ind;
250
251         gps_factory_test_ev_info_t  factory_test_rsp;
252         gps_dns_query_ev_info_t     dns_query_ind;
253 } gps_event_data_t;
254
255 /**
256  * Transport Error Cause
257  */
258 typedef enum {
259         GPS_FAILURE_CAUSE_NORMAL        = 0x00,
260         GPS_FAILURE_CAUSE_FACTORY_TEST,
261         GPS_FAILURE_CAUSE_DNS_QUERY
262 } gps_failure_reason_t;
263
264 /**
265  * GPS Event Info
266  */
267 typedef struct {
268         gps_event_id_t   event_id;      /**< GPS asynchronous event id */
269         gps_event_data_t event_data;    /**< GPS event information data */
270 } gps_event_info_t;
271
272 /**
273  * Callback function
274  * LBS server needs to register a callback function with GPS OEM to receive asynchronous events.
275  */
276 typedef int (*gps_event_cb) (gps_event_info_t *gps_event_info);
277
278 /**
279  * GPS action type
280  */
281 typedef enum {
282         GPS_ACTION_SEND_PARAMS  = 0x000,
283         GPS_ACTION_START_SESSION,
284         GPS_ACTION_STOP_SESSION,
285
286         GPS_INDI_SUPL_VERIFICATION,
287         GPS_INDI_SUPL_DNSQUERY,
288
289         GPS_ACTION_START_FACTTEST,
290         GPS_ACTION_STOP_FACTTEST,
291         GPS_ACTION_REQUEST_SUPL_NI
292 } gps_action_t;
293
294 /**
295  * Cell information type
296  */
297 typedef enum {
298         GPS_CELL_INFO_TYPE_aRFCNPresent = 0,
299         GPS_CELL_INFO_TYPE_bSICPresent,
300         GPS_CELL_INFO_TYPE_rxLevPresent,
301         GPS_CELL_INFO_TYPE_frequencyInfoPresent,
302         GPS_CELL_INFO_TYPE_cellMeasuredResultPresent,
303
304         GPS_CELL_INFO_TYPE_refMCC,
305         GPS_CELL_INFO_TYPE_refMNC,
306         GPS_CELL_INFO_TYPE_refLAC,
307         GPS_CELL_INFO_TYPE_refCI,
308         GPS_CELL_INFO_TYPE_refUC,
309         GPS_CELL_INFO_TYPE_aRFCN,
310         GPS_CELL_INFO_TYPE_bSIC,
311         GPS_CELL_INFO_TYPE_rxLev
312 } agps_cell_info_t;
313
314 /**
315  * Mobile service type
316  */
317 typedef enum {
318         SVCTYPE_NONE = 0,       /**< Unknown network */
319         SVCTYPE_NOSVC,          /**< Network in no service */
320         SVCTYPE_EMERGENCY,      /**< Network emergency */
321         SVCTYPE_SEARCH,         /**< Network search 1900 */
322         SVCTYPE_2G,             /**< Network 2G */
323         SVCTYPE_2_5G,           /**< Network 2.5G */
324         SVCTYPE_2_5G_EDGE,      /**< Network EDGE */
325         SVCTYPE_3G,             /**< Network UMTS */
326         SVCTYPE_HSDPA           /**< Network HSDPA */
327 } agps_svc_type_t;
328
329 /**
330  * SUPL network-initiated information
331  */
332 typedef struct {
333         char *msg_body;         /**< SUPL NI message body */
334         int   msg_size;         /**< SUPL NI message size */
335         int   status;           /**< Return code of Status */
336 } agps_supl_ni_info_t;
337
338 /**
339  * gps-manager plugin interface
340  */
341 typedef struct {
342         /** Initialize plugin module and register callback function for event delivery. */
343         int (*init) (gps_event_cb gps_event_cb, gps_server_param_t * gps_params);
344
345         /** Deinitialize plugin module */
346         int (*deinit) (gps_failure_reason_t *reason_code);
347
348         /** Request specific action to plugin module */
349         int (*request) (gps_action_t gps_action, void *data,
350                         gps_failure_reason_t *reason_code);
351 } gps_plugin_interface;
352
353 const gps_plugin_interface *get_gps_plugin_interface();
354
355 #ifdef __cplusplus
356 }
357 #endif
358 #endif /* _GPS_MANAGER_PLUGIN_INTF_H_ */