tizen beta release
[platform/core/location/lbs-location.git] / location / 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/location-types.h>
27 #include <location/location-position.h>
28 #include <location/location-velocity.h>
29 #include <location/location-accuracy.h>
30 #include <location/location-address.h>
31 #include <location/location-satellite.h>
32 #include <location/location-poi-info.h>
33
34 G_BEGIN_DECLS
35
36 /**
37  * @file location-module.h
38  * @brief This file contains the structure and enumeration for location plug-in development.
39  */
40
41 /**
42  * @addtogroup LocationFW
43  * @{
44  * @defgroup LocationModules Location Moduels
45  * @brief  This sub module provides the definitions and structrues for 3rd party plugin modules.
46  * @addtogroup LocationModules
47  * @{
48  */
49
50 /**
51  * @brief This represents APIs declared in a geocode plug-in for location geocode modules.
52  */
53 typedef struct{
54         int (*get_service_name)(gpointer handle, gchar **servicename);                                                                         ///< 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);         ///< This is used for getting a geocode from a plug-in.
56         int (*get_geocode_freetext)(gpointer handle, const gchar *address, GList **position_list, GList **accuracy_list);          ///< This is used for getting a geocode by using a free-fromed address from a plug-in.
57         int (*get_reverse_geocode)(gpointer handle, const LocationPosition *position, LocationAddress **address, LocationAccuracy **accuracy); ///< This is used for getting a reverse geocode from a plug-in.
58         int (*get_geocode_async)(gpointer handle, const LocationAddress *address, LocationPositionCB callback, gpointer userdata);             ///< This is used for getting a geocode from a plug-in asynchronously.
59         int (*get_geocode_freetext_async)(gpointer handle, const gchar *address, LocationPositionCB callback, gpointer userdata);              ///< This is used for getting a geocode by using a free-fromed address from a plug-in asynchronously.
60         int (*get_reverse_geocode_async)(gpointer handle, const LocationPosition *position, LocationAddressCB callback, gpointer userdata);    ///< This is used for getting a reverse geocode from a plug-in asynchronously.   
61 } LocModGeoOps;
62
63 /**
64  * @brief This represents APIs declared in a POI plug-in for location POI modules.
65  */
66 typedef struct{
67         int (*get_service_name)(gpointer handle, gchar** servicename);                                                                                                            ///< This is used for getting a service name from a plug-in.
68         int (*get_poi)(gpointer handle, gdouble radius, const gchar* keyword, LocationPOIInfo **poi);                                                                             ///< This is used for getting a POI from a plug-in.
69         int (*get_poi_from_address)(gpointer handle, const LocationAddress *address, gdouble radius, const gchar* keyword, LocationPOIInfo **poi);                                ///< This is used for getting a POI by using a address from a plug-in.
70         int (*get_poi_from_position)(gpointer handle, const LocationPosition *position, gdouble radius, const gchar* keyword, LocationPOIInfo **poi);                             ///< This is used for getting a POI by using a position from a plug-in.
71         int (*get_poi_async)(gpointer handle, gdouble radius, const gchar* keyword, LocationPOICB callback, gpointer userdata);                                                   ///< This is used for getting a POI from a plug-in asynchronously.
72         int (*get_poi_from_address_async)(gpointer handle, const LocationAddress *address, gdouble radius, const gchar* keyword, LocationPOICB callback, gpointer userdata);      ///< This is used for getting a POI by using a address from a plug-in asynchronously.
73         int (*get_poi_from_position_async)(gpointer handle, const LocationPosition *position, gdouble radius, const gchar* keyword,  LocationPOICB callback, gpointer userdata);  ///< This is used for getting a POI by using a position from a plug-in asynchronously.
74 } LocModPoiOps;
75
76 /**
77 * @brief This represents a enabled/disabled callback function for a plug-in.
78 */
79 typedef void (*LocModStatusCB)(gboolean enabled, LocationStatus status, gpointer userdata);
80
81 /**
82  * @brief This represents a position callback function for a plug-in.
83  */
84 typedef void (*LocModPositionCB) (gboolean enabled, LocationPosition *position, LocationAccuracy *accuracy, gpointer userdata);
85
86 /**
87  * @brief This represents a velocity callback function for a plug-in.
88  */
89 typedef void (*LocModVelocityCB) (gboolean enabled, LocationVelocity *velocity, LocationAccuracy *accuracy, gpointer userdata);
90
91 /**
92  * @brief This represents APIs declared in a GPS plug-in for location GPS modules.
93  */
94 typedef struct{
95         int (*start)(gpointer handle, LocModStatusCB status_cb, LocModPositionCB pos_cb, LocModVelocityCB vel_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.
96         int (*stop)(gpointer handle);                                                                                                  ///< This is used for stopping a GPS device name from a plug-in.
97         int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);                                ///< This is used for getting a position from a plug-in.
98         int (*get_velocity)(gpointer handle, LocationVelocity **velocity, LocationAccuracy **accuracy);                                ///< This is used for getting a velocity from a plug-in.
99         int (*get_nmea)(gpointer handle, gchar** nmea_data);                                                                           ///< This is used for getting a nmea string from a plug-in.
100         int (*get_satellite)(gpointer handle, LocationSatellite **satellite);                                                          ///< This is used for getting a satellite information from a plug-in.
101         int (*set_devname)(gpointer handle, const gchar *devname);                                                                     ///< This is used for setting a device name from a plug-in.
102         int (*get_devname)(gpointer handle, gchar **devname);                                                                          ///< This is used for getting a device name from a plug-in.
103 } LocModGpsOps;
104
105 /**
106  * @brief This represents APIs declared in a WPS plug-in for location WPS modules.
107  */
108 typedef struct{
109         int (*start)(gpointer handle, LocModStatusCB status_cb, LocModPositionCB pos_cb, LocModVelocityCB vel_cb, gpointer userdata);   ///< This is used for starting a WPS service from a plug-in. #LocModStatusCB, #LocModPositionCB, and #LocModVelocityCB are given from a location framework to a plug-in for asynchronous signaling.
110         int (*stop)(gpointer handle);                                                                                                   ///< This is used for stopping a WPS service from a plug-in.
111         int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);                                 ///< This is used for getting a position from a plug-in.
112         int (*get_velocity)(gpointer handle, LocationVelocity **velocity, LocationAccuracy **accuracy);                                 ///< This is used for getting a velocity from a plug-in.
113 } LocModWpsOps;
114
115 /**
116  * @brief This represents APIs declared in a SPS plug-in for location SPS modules.
117  */
118 typedef struct{
119         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.
120         int (*stop)(gpointer handle);                                                                                                                                                   ///< This is used for stopping a SPS service from a plug-in.
121         int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);                                                                                 ///< This is used for getting a position from a plug-in.
122         int (*get_velocity)(gpointer handle, LocationVelocity **velocity, LocationAccuracy **accuracy);                                                                                 ///< This is used for getting a velocity from a plug-in.
123         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.
124 } LocModSpsOps;
125
126 /**
127  * @brief This represents APIs declared in a IPS plug-in for location IPS modules.
128  */
129 typedef struct{
130         int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);          ///< This is used for getting a position from a plug-in.
131 } LocModIpsOps;
132
133 /**
134  * @brief This represents APIs declared in a CPS plug-in for location CPS modules.
135  */
136 typedef struct{
137         int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);          ///< This is used for getting a position from a plug-in.
138 } LocModCpsOps;
139
140 /**
141  * @brief This is used for exported APIs in a plug-in for a location framework.
142  */
143 #define LOCATION_MODULE_API __attribute__((visibility("default"))) G_MODULE_EXPORT 
144
145 /**
146  * @} @}
147  */
148 G_END_DECLS
149
150 #endif