9f374c9345c406f212dab323e0f5f76de04a61cf
[platform/core/location/lbs-location.git] / location / module / location-module.h
1 /*
2  * libslp-location
3  *
4  * Copyright (c) 2010-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 __LOCATION_MODULE_H__
23 #define __LOCATION_MODULE_H__
24
25 #include <gmodule.h>
26 #include <location-types.h>
27 #include <location-position.h>
28 #include <location-velocity.h>
29 #include <location-accuracy.h>
30 #include <location-address.h>
31 #include <location-satellite.h>
32
33 G_BEGIN_DECLS
34
35 /**
36  * @file location-module.h
37  * @brief This file contains the structure and enumeration for location plug-in development.
38  */
39
40 /**
41  * @addtogroup LocationFW
42  * @{
43  * @defgroup LocationModules Location Modules
44  * @brief  This sub module provides the definitions and structrues for 3rd party plugin modules.
45  * @addtogroup LocationModules
46  * @{
47  */
48
49 /**
50  * @brief This represents APIs declared in a geocode plug-in for location geocode modules.
51  */
52 typedef struct{
53         int (*get_service_name)(gpointer handle, gchar **servicename);
54         ///< This is used for getting a service name from a plug-in.
55         int (*get_geocode)(gpointer handle, const LocationAddress *address, GList **position_list, GList **accuracy_list);
56         ///< This is used for getting a geocode from a plug-in.
57         int (*get_geocode_freetext)(gpointer handle, const gchar *address, GList **position_list, GList **accuracy_list);
58         ///< This is used for getting a geocode by using a free-fromed address from a plug-in.
59         int (*get_reverse_geocode)(gpointer handle, const LocationPosition *position, LocationAddress **address, LocationAccuracy **accuracy);
60         ///< This is used for getting a reverse geocode from a plug-in.
61         int (*get_geocode_async)(gpointer handle, const LocationAddress *address, LocationPositionCB callback, gpointer userdata);
62         ///< This is used for getting a geocode from a plug-in asynchronously.
63         int (*get_geocode_freetext_async)(gpointer handle, const gchar *address, LocationPositionCB callback, gpointer userdata);
64         ///< This is used for getting a geocode by using a free-fromed address from a plug-in asynchronously.
65         int (*get_reverse_geocode_async)(gpointer handle, const LocationPosition *position, LocationAddressCB callback, gpointer userdata);
66         ///< This is used for getting a reverse geocode from a plug-in asynchronously.
67         int (*search_poi) (gpointer handle, const LocationPOIFilter *filter, const LocationPosition *position, const LocationPreference *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
68         ///< This is used for searching poi with the position from a plug-in asynchronously.
69         int (*search_poi_by_area) (gpointer handle, const LocationPOIFilter *filter, const LocationBoundary *boundary, const LocationPreference *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
70         ///< This is used for searching poi with the boundary from a plug-in asynchronously.
71         int (*search_poi_by_address) (gpointer handle, const LocationPOIFilter *filter, const LocationAddress *address, const LocationPreference *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
72         ///< This is used for searching poi with the address from a plug-in asynchronously.
73         int (*search_poi_by_freeform) (gpointer handle, const LocationPOIFilter * filter, const gchar *freeform, const LocationPreference *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
74         ///< This is used for searching poi with the freeform address from a plug-in asynchronously.
75         int (*cancel_poi_request) (gpointer handle, guint req_id);
76         ///< This is used for cancel poi request from a plug-in.
77         int (*request_route) (gpointer handle, const LocationPosition *origin, const LocationPosition *destination, GList *waypoint, const LocationPreference *svc_pref, const LocationRoutePreference * pref, LocationRouteCB cb, const gpointer user_data, guint * req_id);
78         ///< This is used for requesting route from a plug-in asynchronously.
79         int (*cancel_route_request) (gpointer handle, guint req_id);
80         ///< This is used for cancel route request from a plug-in.
81         gboolean (*is_supported_map_provider_capability) (gpointer handle, LocationMapServiceType type);
82         ///< This is used to check whether map service is supported on a plug-in.
83         int (*get_map_provider_capability_key) (gpointer handle, LocationMapServiceType type, GList **key);
84         ///< This is used to get map service keys on a plug-in.
85 } LocModServiceOps;
86
87 /**
88 * @brief This represents a enabled/disabled callback function for a plug-in.
89 */
90 typedef void (*LocModStatusCB)(gboolean enabled, LocationStatus status, gpointer userdata);
91
92 /**
93  * @brief This represents a position callback function for a plug-in.
94  */
95 typedef void (*LocModPositionCB) (gboolean enabled, LocationPosition *position, LocationAccuracy *accuracy, gpointer userdata);
96
97 /**
98  * @brief This represents a velocity callback function for a plug-in.
99  */
100 typedef void (*LocModVelocityCB) (gboolean enabled, LocationVelocity *velocity, LocationAccuracy *accuracy, gpointer userdata);
101
102 /**
103  * @brief This represents a velocity callback function for a plug-in.
104  */
105 typedef void (*LocModSatelliteCB) (gboolean enabled, LocationSatellite *satellite, gpointer userdata);
106
107 /**
108  * @brief This represents APIs declared in a GPS plug-in for location GPS modules.
109  */
110 typedef struct{
111         int (*start)(gpointer handle, LocModStatusCB status_cb, LocModPositionCB pos_cb, LocModVelocityCB vel_cb, LocModSatelliteCB sat_cb, gpointer userdata);  ///< This is used for starting a GPS device from a plug-in. #LocModStatusCB, #LocModPositionCB, and #LocModVelocityCB are given from a location framework to a plug-in for asynchronous signaling.
112         int (*stop)(gpointer handle);                                                                                                  ///< This is used for stopping a GPS device name from a plug-in.
113         int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);                                ///< This is used for getting a position from a plug-in.
114         int (*get_velocity)(gpointer handle, LocationVelocity **velocity, LocationAccuracy **accuracy);                                ///< This is used for getting a velocity from a plug-in.
115         int (*get_last_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);                           ///< This is used for getting a last position from a plug-in.
116         int (*get_last_velocity)(gpointer handle, LocationVelocity **velocity, LocationAccuracy **accuracy);                           ///< This is used for getting a last velocity from a plug-in.
117         int (*get_nmea)(gpointer handle, gchar** nmea_data);                                                                           ///< This is used for getting a nmea string from a plug-in.
118         int (*get_satellite)(gpointer handle, LocationSatellite **satellite);                                                          ///< This is used for getting a satellite information from a plug-in.
119         int (*get_last_satellite)(gpointer handle, LocationSatellite **satellite);                                                     ///< This is used for getting a last satellite information from a plug-in.
120         int (*set_devname)(gpointer handle, const gchar *devname);                                                                     ///< This is used for setting a device name from a plug-in.
121         int (*get_devname)(gpointer handle, gchar **devname);                                                                          ///< This is used for getting a device name from a plug-in.
122 } LocModGpsOps;
123
124 /**
125  * @brief This represents APIs declared in a WPS plug-in for location WPS modules.
126  */
127 typedef struct{
128         int (*start)(gpointer handle, LocModStatusCB status_cb, LocModPositionCB pos_cb, LocModVelocityCB vel_cb, LocModSatelliteCB sat_cb, gpointer userdata);   ///< This is used for starting a WPS service from a plug-in. #LocModStatusCB, #LocModPositionCB, #LocModVelocityCB and #LocModSatelliteCB(Not used) are given from a location framework to a plug-in for asynchronous signaling.
129         int (*stop)(gpointer handle);                                                                                                   ///< This is used for stopping a WPS service from a plug-in.
130         int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);                                 ///< This is used for getting a position from a plug-in.
131         int (*get_velocity)(gpointer handle, LocationVelocity **velocity, LocationAccuracy **accuracy);                                 ///< This is used for getting a velocity from a plug-in.
132         int (*get_last_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);                                                    ///< This is used for getting a last position from a plug-in.
133         int (*get_last_velocity)(gpointer handle, LocationVelocity **velocity, LocationAccuracy **accuracy);                           ///< This is used for getting a last velocity from a plug-in.
134 } LocModWpsOps;
135
136 /**
137  * @brief This represents APIs declared in a SPS plug-in for location SPS modules.
138  */
139 typedef struct{
140         int (*start)(gpointer handle, LocModStatusCB status_cb, LocModPositionCB pos_cb, LocModVelocityCB vel_cb, gpointer userdata);                                                   ///< This is used for starting a SPS service from a plug-in. #LocModStatusCB, #LocModPositionCB and #LocModVelocityCB are given from a location framework to a plug-in for asynchronous signaling.
141         int (*stop)(gpointer handle);                                                                                                                                                   ///< This is used for stopping a SPS service from a plug-in.
142         int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);                                                                                 ///< This is used for getting a position from a plug-in.
143         int (*get_velocity)(gpointer handle, LocationVelocity **velocity, LocationAccuracy **accuracy);                                                                                 ///< This is used for getting a velocity from a plug-in.
144         int (*update_data)(gpointer handle, const LocationPosition *position, const LocationVelocity *velocity, const LocationAccuracy *accuracy, const LocationSatellite *satellite);  ///< This is used for updating compensated position/velocity data for a plug-in.
145 } LocModSpsOps;
146
147 /**
148  * @brief This represents APIs declared in a IPS plug-in for location IPS modules.
149  */
150 typedef struct{
151         int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);          ///< This is used for getting a position from a plug-in.
152 } LocModIpsOps;
153
154 /**
155  * @brief This represents APIs declared in a CPS plug-in for location CPS modules.
156  */
157 typedef struct{
158         int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);          ///< This is used for getting a position from a plug-in.
159 } LocModCpsOps;
160
161 /**
162  * @brief This is used for exported APIs in a plug-in for a location framework.
163  */
164 #define LOCATION_MODULE_API __attribute__((visibility("default"))) G_MODULE_EXPORT
165
166 /**
167  * @} @}
168  */
169 G_END_DECLS
170
171 #endif