[ACR-716] Mock location
[platform/core/location/lbs-location.git] / location / module / location-module.h
1 /*
2  * libslp-location
3  *
4  * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
7  *          Genie Kim <daejins.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-batch.h>
29 #include <location-velocity.h>
30 #include <location-accuracy.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 /**
51 * @brief This represents a enabled/disabled callback function for a plug-in.
52 */
53 typedef void (*LocModStatusCB)(gboolean enabled, LocationStatus status, gpointer userdata);
54
55 /**
56  * @brief This represents a position callback function for a plug-in.
57  */
58 typedef void (*LocModPositionExtCB)(gboolean enabled, LocationPosition *position, LocationVelocity *velocity, LocationAccuracy *accuracy, gpointer userdata);
59
60 /**
61  * @brief This represents a batch callback function for a plug-in.
62  */
63 typedef void (*LocModBatchExtCB)(gboolean enabled, guint num_of_location, gpointer userdata);
64
65 /**
66  * @brief This represents a velocity callback function for a plug-in.
67  */
68 typedef void (*LocModSatelliteCB)(gboolean enabled, LocationSatellite *satellite, gpointer userdata);
69
70 /**
71  * @brief This represents APIs declared in a GPS plug-in for location GPS modules.
72  */
73 typedef struct {
74         int (*start)(gpointer handle, guint pos_update_interval, LocModStatusCB status_cb, LocModPositionExtCB pos_ext_cb, LocModSatelliteCB sat_cb, gpointer userdata);  /*/< This is used for starting a GPS device from a plug-in. #LocModStatusCB, #LocModPositionExtCB are given from a location framework to a plug-in for asynchronous signaling. */
75         int (*start_batch)(gpointer handle, LocModBatchExtCB batch_ext_cb, guint batch_interval, guint batch_period, gpointer userdata);                                                                                        /*/< This is used for starting a GPS batch mode from a plug-in. #LocModBatchExtCB are given from a location framework to a plug-in for asynchronous signaling. */
76         int (*stop)(gpointer handle);                                                                                                  /*/< This is used for stopping a GPS device name from a plug-in. */
77         int (*stop_batch)(gpointer handle);                                                                                            /*/< This is used for stopping a GPS batch mode from a plug-in. */
78         int (*get_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);   /*/< This is used for getting a position from a plug-in. */
79         int (*get_last_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);   /*/< This is used for getting a last position from a plug-in. */
80         int (*get_nmea)(gpointer handle, gchar **nmea_data);                                                                           /*/< This is used for getting a nmea string from a plug-in. */
81         int (*get_satellite)(gpointer handle, LocationSatellite **satellite);                                                          /*/< This is used for getting a satellite information from a plug-in. */
82         int (*get_last_satellite)(gpointer handle, LocationSatellite **satellite);                                                     /*/< This is used for getting a last satellite information from a plug-in. */
83         int (*set_option)(gpointer handle, const char *option);
84         int (*set_position_update_interval)(gpointer handle, guint interval);
85         int (*set_mock_location)(gpointer handle, LocationPosition *position, LocationVelocity *velocity, LocationAccuracy *accuracy, LocModStatusCB status_cb, gpointer userdata);
86         int (*clear_mock_location)(gpointer handle, LocModStatusCB status_cb, gpointer userdata);
87 } LocModGpsOps;
88
89 /**
90  * @brief This represents APIs declared in a WPS plug-in for location WPS modules.
91  */
92 typedef struct {
93         int (*start)(gpointer handle, LocModStatusCB status_cb, LocModPositionExtCB pos_ext_cb, gpointer userdata);   /*/< This is used for starting a WPS service from a plug-in. #LocModStatusCB, #LocModPositionExtCB and #LocModSatelliteCB(Not used) are given from a location framework to a plug-in for asynchronous signaling. */
94         int (*stop)(gpointer handle);                                                                                                   /*/< This is used for stopping a WPS service from a plug-in. */
95         int (*get_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);   /*/< This is used for getting a position from a plug-in. */
96         int (*get_last_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);   /*/< This is used for getting a last position from a plug-in. */
97         int (*set_option)(gpointer handle, const char *option);
98         int (*set_mock_location)(gpointer handle, LocationPosition *position, LocationVelocity *velocity, LocationAccuracy *accuracy, LocModStatusCB status_cb, gpointer userdata);
99         int (*clear_mock_location)(gpointer handle, LocModStatusCB status_cb, gpointer userdata);
100 } LocModWpsOps;
101
102 /**
103  * @brief This is used for exported APIs in a plug-in for a location framework.
104  */
105 #define LOCATION_MODULE_API __attribute__((visibility("default"))) G_MODULE_EXPORT
106
107 /**
108  * @} @}
109  */
110 G_END_DECLS
111
112 #endif