--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(SLP-lbs-plugin-replay C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+#Dependencies
+
+# Set required packages
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED glib-2.0 vconf dlog lbs-server-plugin deviced)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fvisibility=hidden -fPIC")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS(" -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" ")
+
+MESSAGE(${CMAKE_C_FLAGS})
+
+ADD_SUBDIRECTORY(gps-plugin)
+++ /dev/null
-ACLOCAL_AMFLAGS = -I m4
-
-SUBDIRS = . gps-plugin
-#SUBDIRS = . gps-plugin xps-plugin
+++ /dev/null
-aclocal
-libtoolize --copy
-autoheader
-autoconf
-automake --add-missing --copy --foreign
-
+++ /dev/null
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ(2.61)
-AC_INIT([libslp-lbs-plugin-replay], [0.1], [daejins.kim@samsung.com])
-AC_CONFIG_AUX_DIR([build-aux])
-AM_INIT_AUTOMAKE([foreign -Wall -Werror])
-AC_CONFIG_HEADER([config.h])
-AC_CONFIG_MACRO_DIR([m4])
-
-###### Checks for programs.
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_PROG_CXX
-AC_PROG_CPP
-AC_PROG_INSTALL
-AC_PROG_MAKE_SET
-AC_PROG_LIBTOOL
-AC_PROG_LN_S
-AC_PROG_RANLIB
-
-###### Checks for libraries.
-PKG_CHECK_MODULES(DEVICED, deviced)
-AC_SUBST(DEVICED_CFLAGS)
-AC_SUBST(DEVICED_LIBS)
-
-PKG_CHECK_MODULES(GPS_MANAGER_PLUGIN, lbs-server-plugin)
-AC_SUBST(GPS_MANAGER_PLUGIN_CFLAGS)
-AC_SUBST(GPS_MANAGER_PLUGIN_LIBS)
-
-#PKG_CHECK_MODULES(GEOCLUE_XPS_PLUGIN, geoclue-xps-plugin)
-#AC_SUBST(GEOCLUE_XPS_PLUGIN_CFLAGS)
-#AC_SUBST(GEOCLUE_XPS_PLUGIN_LIBS)
-
-PKG_CHECK_MODULES(VCONF, vconf)
-AC_SUBST(VCONF_CFLAGS)
-AC_SUBST(VCONF_LIBS)
-
-PKG_CHECK_MODULES(DLOG, dlog)
-AC_SUBST(DLOG_CFLAGS)
-AC_SUBST(DLOG_LIBS)
-
-####### Config files
-AC_CONFIG_FILES([
- Makefile
- gps-plugin/Makefile
- ])
-
-AC_OUTPUT
-
--- /dev/null
+aux_source_directory(src SOURCES)
+
+INCLUDE_DIRECTORIES(include)
+
+SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed")
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCES})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+
+SET_TARGET_PROPERTIES(${PROJECT_NAME}
+ PROPERTIES
+ VERSION ${FULLVER}
+ SOVERSION ${MAJORVER}
+ CLEAN_DIRECT_OUTPUT 1
+ )
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_DIR})
+++ /dev/null
-################# Build library ################
-lib_LTLIBRARIES = libSLP-lbs-plugin-replay.la
-
-libSLP_lbs_plugin_replay_la_SOURCES = \
- $(srcdir)/src/nmea_parser.c \
- $(srcdir)/src/gps_plugin_replay.c \
- $(srcdir)/src/setting.c
-
-libSLP_lbs_plugin_replay_la_CFLAGS = -Wall -fPIC -fvisibility=hidden -DEXPORT_API="__attribute__((visibility(\"default\")))" \
- -I$(srcdir)/include \
- $(GPS_MANAGER_PLUGIN_CFLAGS) \
- $(VCONF_CFLAGS) \
- $(DLOG_CFLAGS) \
- $(DEVICED_CFLAGS)
-
-libSLP_lbs_plugin_replay_la_LDFLAGS = -Wl,--hash-style=both -Wl,--as-needed \
- $(VCONF_LIBS) \
- $(DLOG_LIBS) \
- $(DEVICED_LIBS)
#endif
#define GPS_DLOG
-#define GPS_DLOG_DEBUG // filename and line number will be shown
+#define GPS_DLOG_DEBUG /* filename and line number will be shown */
#ifdef GPS_DLOG
#include <dlog.h>
#define DBG_WARN LOG_WARN
#define DBG_ERR LOG_ERROR
-#ifdef GPS_DLOG_DEBUG // Debug mode
+#ifdef GPS_DLOG_DEBUG /* Debug mode */
#define LOG_PLUGIN(dbg_lvl,fmt,args...) SLOG(dbg_lvl, TAG_GPS_PLUGIN, "[%-40s: %-4d] "fmt, __FILE__, __LINE__, ##args)
#define SECLOG_PLUGIN(dbg_lvl,fmt,args...) SECURE_SLOG(dbg_lvl, TAG_GPS_PLUGIN, "[%-40s: %-4d] "fmt, __FILE__, __LINE__, ##args)
-#else // Release(commercial) mode
+#else /* Release(commercial) mode */
#define LOG_PLUGIN(dbg_lvl,fmt,args...) SLOG(dbg_lvl, TAG_GPS_PLUGIN, fmt, ##args)
#define SECLOG_PLUGIN(dbg_lvl,fmt,args...) SECURE_SLOG(dbg_lvl, TAG_GPS_PLUGIN, fmt, ##args)
#endif
#ifdef __cplusplus
extern "C" {
-#endif // __cplusplus
+#endif /* __cplusplus */
-int nmea_parser(char *data, pos_data_t * pos, sv_data_t * sv);
+int nmea_parser(char *data, pos_data_t *pos, sv_data_t *sv);
#ifdef __cplusplus
}
-#endif // __cplusplus
+#endif /* __cplusplus */
#endif
int setting_get_double(const char *path, double *val);
char *setting_get_string(const char *path);
-typedef void (*key_changed_cb) (keynode_t * key, void *data);
+typedef void (*key_changed_cb)(keynode_t *key, void *data);
int setting_notify_key_changed(const char *path, void *key_changed_cb);
int setting_ignore_key_changed(const char *path, void *key_changed_cb);
replay_timeout *g_replay_timer = NULL;
int gps_plugin_replay_gps_init(gps_event_cb gps_event_cb, void *user_data);
-int gps_plugin_replay_gps_deinit(gps_failure_reason_t * reason_code);
-int gps_plugin_replay_gps_request(gps_action_t gps_action, void *gps_action_data, gps_failure_reason_t * reason_code);
+int gps_plugin_replay_gps_deinit(gps_failure_reason_t *reason_code);
+int gps_plugin_replay_gps_request(gps_action_t gps_action, void *gps_action_data, gps_failure_reason_t *reason_code);
static const gps_plugin_interface g_gps_plugin_replay_interface = {
gps_plugin_replay_gps_init,
gps_plugin_replay_gps_request
};
-void gps_plugin_replay_pos_event(pos_data_t * data)
+void gps_plugin_replay_pos_event(pos_data_t *data)
{
gps_event_info_t gps_event;
time_t timestamp;
}
}
-void gps_plugin_replay_batch_event(pos_data_t * data, replay_timeout * timer)
+void gps_plugin_replay_batch_event(pos_data_t *data, replay_timeout *timer)
{
time_t timestamp;
time(×tamp);
}
}
-void gps_plugin_replay_sv_event(sv_data_t * data)
+void gps_plugin_replay_sv_event(sv_data_t *data)
{
int i;
gps_event_info_t gps_event;
}
}
-void gps_plugin_replay_nmea_event(nmea_data_t * data)
+void gps_plugin_replay_nmea_event(nmea_data_t *data)
{
gps_event_info_t gps_event;
time_t timestamp;
}
}
-gboolean gps_plugin_replay_read_nmea(replay_timeout * timer, char *nmea_data)
+gboolean gps_plugin_replay_read_nmea(replay_timeout *timer, char *nmea_data)
{
gboolean ret = FALSE;
int ref = 0;
return ret;
}
-gboolean gps_plugin_replay_read_manual(pos_data_t * pos_data)
+gboolean gps_plugin_replay_read_manual(pos_data_t *pos_data)
{
gboolean ret = TRUE;
err = nmea_parser(nmea_data, timer->pos_data, timer->sv_data);
if (err == READ_ERROR) {
LOG_PLUGIN(DBG_ERR, "Fail to parser nmea data from file");
- //return FALSE;
+ /*return FALSE; */
} else if (err == READ_NOT_FIXED) {
LOG_PLUGIN(DBG_LOW, "GPS position is not fixed");
timer->sv_data->pos_valid = FALSE;
}
if (g_gps_event_cb != NULL) {
- if (timer->batch_mode == BATCH_MODE_ON){
+ if (timer->batch_mode == BATCH_MODE_ON) {
gps_plugin_replay_batch_event(timer->pos_data, timer);
}
}
return ret;
}
-void gps_plugin_stop_replay_mode(replay_timeout * timer)
+void gps_plugin_stop_replay_mode(replay_timeout *timer)
{
if (timer->replay_mode == REPLAY_NMEA && fclose(timer->fd) != 0) {
LOG_PLUGIN(DBG_ERR, "fclose failed");
LOG_PLUGIN(DBG_LOW, "g_source_destroy timeout_src");
} else {
LOG_PLUGIN(DBG_WARN, "timer->timeout_src is attatched to 0x%x (actual 0x%x)",
- g_source_get_context(timer->timeout_src), timer->default_context);
+ g_source_get_context(timer->timeout_src), timer->default_context);
}
timer->timeout_src = NULL;
timer->default_context = NULL;
LOG_PLUGIN(DBG_LOW, "display_unlock_state(LCD_OFF, PM_RESET_TIMER);");
}
-gboolean gps_plugin_get_nmea_fd(replay_timeout * timer)
+gboolean gps_plugin_get_nmea_fd(replay_timeout *timer)
{
char replay_file_path[256];
char *str;
return TRUE;
}
-gboolean gps_plugin_start_replay_mode(replay_timeout * timer)
+gboolean gps_plugin_start_replay_mode(replay_timeout *timer)
{
gboolean ret = FALSE;
if (timer->timeout_src != NULL) {
g_source_set_callback(timer->timeout_src, &gps_plugin_replay_timeout_cb, timer, NULL);
if (g_source_attach(timer->timeout_src, timer->default_context) > 0) {
- LOG_PLUGIN(DBG_LOW, "timeout_src(0x%x) is created & attatched to 0x%x", timer->timeout_src,
- timer->default_context);
+ LOG_PLUGIN(DBG_LOW, "timeout_src(0x%x) is created & attatched to 0x%x", timer->timeout_src, timer->default_context);
ret = TRUE;
} else {
gps_plugin_stop_replay_mode(timer);
return ret;
}
-gboolean gps_plugin_start_batch_mode(replay_timeout * timer, int batch_interval, int batch_period)
+gboolean gps_plugin_start_batch_mode(replay_timeout *timer, int batch_interval, int batch_period)
{
gboolean ret = FALSE;
time_t timestamp;
return ret;
}
-void gps_plugin_stop_batch_mode(replay_timeout * timer)
+void gps_plugin_stop_batch_mode(replay_timeout *timer)
{
if (timer->batch_mode == BATCH_MODE_ON) {
timer->batch_mode = BATCH_MODE_OFF;
}
}
-static void replay_mode_changed_cb(keynode_t * key, void *data)
+static void replay_mode_changed_cb(keynode_t *key, void *data)
{
if (setting_get_int(VCONFKEY_LOCATION_REPLAY_MODE, &g_replay_timer->replay_mode) == FALSE) {
g_replay_timer->replay_mode = REPLAY_OFF;
return timer;
}
-void gps_plugin_replay_timer_deinit(replay_timeout * timer)
+void gps_plugin_replay_timer_deinit(replay_timeout *timer)
{
if (timer == NULL) {
return;
return TRUE;
}
-int gps_plugin_replay_gps_deinit(gps_failure_reason_t * reason_code)
+int gps_plugin_replay_gps_deinit(gps_failure_reason_t *reason_code)
{
gps_plugin_replay_timer_deinit(g_replay_timer);
g_gps_event_cb = NULL;
return TRUE;
}
-int gps_plugin_replay_gps_request(gps_action_t gps_action, void *gps_action_data, gps_failure_reason_t * reason_code)
+int gps_plugin_replay_gps_request(gps_action_t gps_action, void *gps_action_data, gps_failure_reason_t *reason_code)
{
gps_action_start_data_t *gps_start_data = gps_action_data;
switch (gps_action) {
- case GPS_ACTION_SEND_PARAMS:
- break;
- case GPS_ACTION_START_SESSION:
- gps_plugin_start_replay_mode(g_replay_timer);
- break;
- case GPS_ACTION_STOP_SESSION:
- gps_plugin_stop_replay_mode(g_replay_timer);
- break;
- case GPS_ACTION_START_BATCH:
- gps_plugin_start_batch_mode(g_replay_timer, gps_start_data->interval, gps_start_data->period);
- break;
- case GPS_ACTION_STOP_BATCH:
- gps_plugin_stop_batch_mode(g_replay_timer);
- gps_plugin_stop_replay_mode(g_replay_timer);
- break;
- case GPS_INDI_SUPL_VERIFICATION:
- case GPS_INDI_SUPL_DNSQUERY:
- case GPS_ACTION_START_FACTTEST:
- case GPS_ACTION_STOP_FACTTEST:
- case GPS_ACTION_REQUEST_SUPL_NI:
- LOG_PLUGIN(DBG_LOW, "Don't use action type : [ %d ]", gps_action);
- break;
- default:
- break;
+ case GPS_ACTION_SEND_PARAMS:
+ break;
+ case GPS_ACTION_START_SESSION:
+ gps_plugin_start_replay_mode(g_replay_timer);
+ break;
+ case GPS_ACTION_STOP_SESSION:
+ gps_plugin_stop_replay_mode(g_replay_timer);
+ break;
+ case GPS_ACTION_START_BATCH:
+ gps_plugin_start_batch_mode(g_replay_timer, gps_start_data->interval, gps_start_data->period);
+ break;
+ case GPS_ACTION_STOP_BATCH:
+ gps_plugin_stop_batch_mode(g_replay_timer);
+ gps_plugin_stop_replay_mode(g_replay_timer);
+ break;
+ case GPS_INDI_SUPL_VERIFICATION:
+ case GPS_INDI_SUPL_DNSQUERY:
+ case GPS_ACTION_START_FACTTEST:
+ case GPS_ACTION_STOP_FACTTEST:
+ case GPS_ACTION_REQUEST_SUPL_NI:
+ LOG_PLUGIN(DBG_LOW, "Don't use action type : [ %d ]", gps_action);
+ break;
+ default:
+ break;
}
return TRUE;
while ((*s != 0) && (num_tokens < MAX_TOEKNS)) {
switch (state) {
- case 0:
- if (*s == ',') {
- *s = 0;
- state = 1;
- }
- break;
- case 1:
- token[num_tokens++] = s;
- if (*s == ',') {
- *s = 0;
- } else {
- state = 0;
- }
- break;
+ case 0:
+ if (*s == ',') {
+ *s = 0;
+ state = 1;
+ }
+ break;
+ case 1:
+ token[num_tokens++] = s;
+ if (*s == ',') {
+ *s = 0;
+ } else {
+ state = 0;
+ }
+ break;
}
s++;
}
return altitude;
}
-static int nmea_parser_gpgga(char *token[], pos_data_t * pos, sv_data_t * sv)
+static int nmea_parser_gpgga(char *token[], pos_data_t *pos, sv_data_t *sv)
{
double latitude, longitude, altitude;
int quality;
return READ_NOT_FIXED;
}
-// utctime = atoi(token[1]);
+ /* utctime = atoi(token[1]); */
latitude = nmea_parser_get_latitude(token[2], token[3]);
longitude = nmea_parser_get_longitude(token[4], token[5]);
altitude = nmea_parser_get_altitude(token[9], token[10]);
-// num_of_sat_used = atoi(token[7]);
-// eph = atof(token[8]);
-// geoid = nmea_parser_get_altitude(token[11], token[12]);
+ /* num_of_sat_used = atoi(token[7]); */
+ /* eph = atof(token[8]); */
+ /* geoid = nmea_parser_get_altitude(token[11], token[12]); */
pos->latitude = latitude;
pos->longitude = longitude;
return READ_SUCCESS;
}
-static int nmea_parser_gprmc(char *token[], pos_data_t * pos)
+static int nmea_parser_gprmc(char *token[], pos_data_t *pos)
{
char *status;
double latitude, longitude, speed, bearing;
- status = token[2]; //warn = *token[2];
+ status = token[2]; /*warn = *token[2]; */
if (strcmp(status, "V") == 0) {
LOG_PLUGIN(DBG_LOW, "Not fixed");
return READ_NOT_FIXED;
}
-// utctime = atoi(token[1]);
+ /* utctime = atoi(token[1]); */
latitude = nmea_parser_get_latitude(token[3], token[4]);
longitude = nmea_parser_get_longitude(token[5], token[6]);
speed = atof(token[7]);
bearing = atof(token[8]);
-// date = atoi(token[9]);
-// magvar = atof(token[10]);
+ /* date = atoi(token[9]); */
+ /* magvar = atof(token[10]); */
pos->latitude = latitude;
pos->longitude = longitude;
return READ_SUCCESS;
}
-static int nmea_parser_gpgll(char *token[], pos_data_t * pos)
+static int nmea_parser_gpgll(char *token[], pos_data_t *pos)
{
char *status;
double latitude, longitude;
- status = token[6]; //warn = *token[2];
+ status = token[6]; /*warn = *token[2]; */
if (strcmp(status, "V") == 0) {
LOG_PLUGIN(DBG_LOW, "Not fixed");
return READ_NOT_FIXED;
}
- latitude = nmea_parser_get_latitude(token[1], token[2]);
- longitude = nmea_parser_get_longitude(token[3], token[4]);
+ latitude = nmea_parser_get_latitude(token[1], token[2]);
+ longitude = nmea_parser_get_longitude(token[3], token[4]);
- pos->latitude = latitude;
- pos->longitude = longitude;
+ pos->latitude = latitude;
+ pos->longitude = longitude;
- return READ_SUCCESS;
+ return READ_SUCCESS;
}
-static int nmea_parser_gpgsa(char *token[], pos_data_t * pos)
+static int nmea_parser_gpgsa(char *token[], pos_data_t *pos)
{
int i, fix_type;
return READ_NOT_FIXED;
}
-// selection_type = *token[1];
+ /* selection_type = *token[1]; */
memset(used_sat, 0, sizeof(used_sat));
for (i = 0; i < MAX_GPS_NUM_SAT_USED; i++) {
used_sat[i] = atoi(token[i + 3]);
}
-// pdop = atof(token[15]);
-// hdop = atof(token[16]);
-// vdop = atof(token[17]);
+ /* pdop = atof(token[15]); */
+ /* hdop = atof(token[16]); */
+ /* vdop = atof(token[17]); */
return READ_SUCCESS;
}
-static int nmea_parser_gpvtg(char *token[], pos_data_t * pos)
+static int nmea_parser_gpvtg(char *token[], pos_data_t *pos)
{
double true_course, kmh_speed;
true_course = atof(token[1]);
-// magnetic_course = atof(token[3]);
-// knot_speed = atof(token[5]);
+ /* magnetic_course = atof(token[3]); */
+ /* knot_speed = atof(token[5]); */
kmh_speed = atof(token[7]);
pos->speed = kmh_speed * KMPH_TO_MPS;
return READ_SUCCESS;
}
-static int nmea_parser_gpgsv(char *token[], sv_data_t * sv)
+static int nmea_parser_gpgsv(char *token[], sv_data_t *sv)
{
int i, j;
int p, q, iter;
int msg_num, num_sv;
-// num_sen = atoi(token[1]);
+ /* num_sen = atoi(token[1]); */
msg_num = atoi(token[2]);
if (msg_num < 1) {
LOG_PLUGIN(DBG_LOW, "There is not GSV message");
return READ_SUCCESS;
}
-int nmea_parser_sentence(char *sentence, char *token[], pos_data_t * pos, sv_data_t * sv)
+int nmea_parser_sentence(char *sentence, char *token[], pos_data_t *pos, sv_data_t *sv)
{
int ret = READ_SUCCESS;
if (strcmp(sentence, "GPGGA") == 0) {
return ret;
}
-int nmea_parser(char *data, pos_data_t * pos, sv_data_t * sv)
+int nmea_parser(char *data, pos_data_t *pos, sv_data_t *sv)
{
int ret = READ_SUCCESS;
read_error_t err;
+++ /dev/null
-<manifest>
- <request>
- <domain name="_" />
- </request>
-</manifest>
Name: libslp-lbsplugin-replay
-Summary: lbs-server plugin library for replay mode
-Version: 0.2.1
+Summary: LBS Server plugin library for replay mode
+Version: 0.2.2
Release: 1
-Group: Framework/Location
+Group: Location/Libraries
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
+Source1: libslp-lbsplugin-replay.manifest
BuildRequires: cmake
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(lbs-server-plugin)
BuildRequires: pkgconfig(deviced)
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
%description
-lbs-server plugin library for replay mode
+LBS Server plugin library for replay mode
%define DATADIR /etc/lbs-server
%prep
%setup -q
+cp %{SOURCE1} .
-./autogen.sh
-./configure --prefix=%{_prefix} --datadir=%{DATADIR}
+%build
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
+ -DLIB_DIR=%{_libdir} \
-%build
-./autogen.sh
-./configure --prefix=%{_prefix} --datadir=%{DATADIR}
make %{?jobs:-j%jobs}
%install
cp -a nmea-log/*.log %{buildroot}%{DATADIR}/replay
%post
-rm -rf /usr/lib/libSLP-lbs-plugin.so
-ln -sf /usr/lib/libSLP-lbs-plugin-replay.so /usr/lib/libSLP-lbs-plugin.so
+rm -rf %{_libdir}/libSLP-lbs-plugin.so
+ln -sf %{_libdir}/libSLP-lbs-plugin-replay.so %{_libdir}/libSLP-lbs-plugin.so
+/sbin/ldconfig
+
+%postun -p /sbin/ldconfig
%files
%manifest libslp-lbsplugin-replay.manifest
#endif
#define GPS_DLOG
-#define GPS_DLOG_DEBUG // filename and line number will be shown
+#define GPS_DLOG_DEBUG /* filename and line number will be shown */
#ifdef GPS_DLOG
#include <dlog.h>
#define DBG_WARN LOG_WARN
#define DBG_ERR LOG_ERROR
-#ifdef GPS_DLOG_DEBUG // Debug mode
+#ifdef GPS_DLOG_DEBUG /* Debug mode */
#define LOG_PLUGIN(dbg_lvl,fmt,args...) SLOG(dbg_lvl, TAG_GPS_PLUGIN, "[%-40s: %-4d] "fmt, __FILE__, __LINE__, ##args)
-#else // Release(commercial) mode
+#else /* Release(commercial) mode */
#define LOG_PLUGIN(dbg_lvl,fmt,args...) SLOG(dbg_lvl, TAG_GPS_PLUGIN, fmt, ##args)
#endif
#endif
int geoclue_plugin_test_unload(void);
int geoclue_plugin_test_location(unsigned long period, LocationCallback cb, void *arg, void **handle);
int geoclue_plugin_test_cancel(void *handle, CancelCallback cb, void *arg);
-void geoclue_plugin_test_get_offline_token(const unsigned char *key,
- unsigned int keyLengh,
- OfflineTokenCallback cb,
- void *arg);
+void geoclue_plugin_test_get_offline_token(const unsigned char *key, unsigned int keyLengh, OfflineTokenCallback cb, void *arg);
int geoclue_plugin_test_offline_location(const unsigned char *key,
- unsigned int keyLength,
- const unsigned char *token,
- unsigned int tokenSize,
- LocationCallback cb,
- void *arg);
+ unsigned int keyLength,
+ const unsigned char *token,
+ unsigned int tokenSize,
+ LocationCallback cb,
+ void *arg);
static const geoclue_plugin_interface g_geoclue_plugin_interface_test_interface = {
geoclue_plugin_test_load,
};
typedef struct {
- int index; // used for handle
+ int index; /* used for handle */
plugin_LocationInfo *location;
unsigned long period;
- LocationCallback location_cb; // save from location
- void *arg; // save from location
+ LocationCallback location_cb; /* save from location */
+ void *arg; /* save from location */
} GeoclueXpsPluginTest;
static GeoclueXpsPluginTest *xps_plugint_test = NULL;
} else {
xps_plugin->location->latitude = 0;
}
- if (xps_plugin->location->longitude< 180) {
+ if (xps_plugin->location->longitude < 180) {
xps_plugin->location->longitude++;
} else {
xps_plugin->location->longitude = 0;
}
}
- // called intervals
+ /* called intervals */
if (xps_plugin->location_cb) {
xps_plugin->location_cb(xps_plugin->arg, xps_plugin->location, NULL);
}
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_load called");
- // create plugin_LocationInfo *location
+ /* create plugin_LocationInfo *location */
if (NULL == xps_plugint_test) {
xps_plugint_test = g_new0(GeoclueXpsPluginTest, 1);
if (NULL == xps_plugint_test) {
return FALSE;
} else {
xps_plugint_test->index = 0;
- xps_plugint_test->period = 5000; // 5s
+ xps_plugint_test->period = 5000; /* 5s */
xps_plugint_test->location = g_new0(plugin_LocationInfo, 1);
if (NULL == xps_plugint_test->location) {
LOG_PLUGIN(LOG_ERROR, "[ERROR] plugin_LocationInfo create fail");
xps_plugint_test->location->latitude = 10;
xps_plugint_test->location->longitude = 10;
xps_plugint_test->location->hpe = 10;
- xps_plugint_test->location->altitude= 10;
+ xps_plugint_test->location->altitude = 10;
xps_plugint_test->location->age = 10;
xps_plugint_test->location->speed = 10;
xps_plugint_test->location->bearing = 10;
}
}
- // create the timer
- //g_timeout_add (xps_plugint_test->period, update_fake_position, xps_plugint_test);
- g_timeout_add (5000, update_fake_position, xps_plugint_test);
+ /* create the timer */
+ /*g_timeout_add (xps_plugint_test->period, update_fake_position, xps_plugint_test); */
+ g_timeout_add(5000, update_fake_position, xps_plugint_test);
return TRUE;
}
{
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_unload called");
- // free plugin_LocationInfo *location
+ /* free plugin_LocationInfo *location */
if (xps_plugint_test) {
if (xps_plugint_test->location) {
g_free(xps_plugint_test->location);
xps_plugint_test = NULL;
}
- // kill the timer
+ /* kill the timer */
return TRUE;
}
int geoclue_plugin_test_location(unsigned long period, LocationCallback cb, void *arg, void **handle)
{
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_location called");
- // update the plugin_LocationInfo *location in the timer
+ /* update the plugin_LocationInfo *location in the timer */
- // update handle
+ /* update handle */
if (xps_plugint_test) {
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_location: before set handle");
xps_plugint_test->index++;
*handle = (void *)tmp;
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_location: after set handle, set[%s], handle[%s]", tmp, *handle);
- // call LocationCallback
+ /* call LocationCallback */
if (cb) {
cb(arg, xps_plugint_test->location, NULL);
xps_plugint_test->location_cb = cb;
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_location after call callback");
}
- return TRUE; // to test online
- //return FALSE; // to test the offline
+ return TRUE; /* to test online */
+ /*return FALSE; // to test the offline */
}
int geoclue_plugin_test_cancel(void *handle, CancelCallback cb, void *arg)
{
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_cancel called");
- // check handle
+ /* check handle */
if (handle) {
LOG_PLUGIN(LOG_DEBUG, "canel handle %s", handle);
g_free(handle);
handle = NULL;
}
- // call CancelCallback
+ /* call CancelCallback */
if (cb) {
cb(arg);
}
return TRUE;
}
-void geoclue_plugin_test_get_offline_token(const unsigned char *key,
- unsigned int keyLengh,
- OfflineTokenCallback cb,
- void *arg)
+void geoclue_plugin_test_get_offline_token(const unsigned char *key, unsigned int keyLengh, OfflineTokenCallback cb, void *arg)
{
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_get_offline_token called");
if (key_copied) {
LOG_PLUGIN(LOG_DEBUG, "key_copied [%s]", key_copied);
- // call OfflineTokenCallback
+ /* call OfflineTokenCallback */
if (cb) {
char *token = g_strdup("samsung_token");
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_get_offline_token: before callback");
}
int geoclue_plugin_test_offline_location(const unsigned char *key,
- unsigned int keyLength,
- const unsigned char *token,
- unsigned int tokenSize,
- LocationCallback cb,
- void *arg)
+ unsigned int keyLength,
+ const unsigned char *token,
+ unsigned int tokenSize,
+ LocationCallback cb,
+ void *arg)
{
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_offline_location called");
int geoclue_plugin_test_unload(void);
int geoclue_plugin_test_location(unsigned long period, LocationCallback cb, void *arg, void **handle);
int geoclue_plugin_test_cancel(void *handle, CancelCallback cb, void *arg);
-void geoclue_plugin_test_get_offline_token(const unsigned char *key,
- unsigned int keyLengh,
- OfflineTokenCallback cb,
- void *arg);
+void geoclue_plugin_test_get_offline_token(const unsigned char *key, unsigned int keyLengh, OfflineTokenCallback cb, void *arg);
int geoclue_plugin_test_offline_location(const unsigned char *key,
- unsigned int keyLength,
- const unsigned char *token,
- unsigned int tokenSize,
- LocationCallback cb,
- void *arg);
+ unsigned int keyLength,
+ const unsigned char *token,
+ unsigned int tokenSize,
+ LocationCallback cb,
+ void *arg);
static const geoclue_plugin_interface g_geoclue_plugin_interface_test_interface = {
geoclue_plugin_test_load,
};
typedef struct {
- int index; // used for handle
+ int index; /* used for handle */
plugin_LocationInfo *location;
unsigned long period;
- LocationCallback location_cb; // save from location
- void *arg; // save from location
+ LocationCallback location_cb; /* save from location */
+ void *arg; /* save from location */
} GeoclueXpsPluginTest;
static GeoclueXpsPluginTest *xps_plugint_test = NULL;
} else {
xps_plugin->location->latitude = 0;
}
- if (xps_plugin->location->longitude< 180) {
+ if (xps_plugin->location->longitude < 180) {
xps_plugin->location->longitude++;
} else {
xps_plugin->location->longitude = 0;
}
}
- // called intervals
+ /* called intervals */
if (xps_plugin->location_cb) {
xps_plugin->location_cb(xps_plugin->arg, xps_plugin->location, NULL);
}
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_load called");
- // create plugin_LocationInfo *location
+ /* create plugin_LocationInfo *location */
if (NULL == xps_plugint_test) {
xps_plugint_test = g_new0(GeoclueXpsPluginTest, 1);
if (NULL == xps_plugint_test) {
return FALSE;
} else {
xps_plugint_test->index = 0;
- xps_plugint_test->period = 5000; // 5s
+ xps_plugint_test->period = 5000; /* 5s */
xps_plugint_test->location = g_new0(plugin_LocationInfo, 1);
if (NULL == xps_plugint_test->location) {
LOG_PLUGIN(LOG_ERROR, "[ERROR] plugin_LocationInfo create fail");
xps_plugint_test->location->latitude = 10;
xps_plugint_test->location->longitude = 10;
xps_plugint_test->location->hpe = 10;
- xps_plugint_test->location->altitude= 10;
+ xps_plugint_test->location->altitude = 10;
xps_plugint_test->location->age = 10;
xps_plugint_test->location->speed = 10;
xps_plugint_test->location->bearing = 10;
}
}
- // create the timer
- //g_timeout_add (xps_plugint_test->period, update_fake_position, xps_plugint_test);
- g_timeout_add (5000, update_fake_position, xps_plugint_test);
+ /* create the timer */
+ /*g_timeout_add (xps_plugint_test->period, update_fake_position, xps_plugint_test); */
+ g_timeout_add(5000, update_fake_position, xps_plugint_test);
return TRUE;
}
{
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_unload called");
- // free plugin_LocationInfo *location
+ /* free plugin_LocationInfo *location */
if (xps_plugint_test) {
if (xps_plugint_test->location) {
g_free(xps_plugint_test->location);
xps_plugint_test = NULL;
}
- // kill the timer
+ /* kill the timer */
return TRUE;
}
int geoclue_plugin_test_location(unsigned long period, LocationCallback cb, void *arg, void **handle)
{
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_location called");
- // update the plugin_LocationInfo *location in the timer
+ /* update the plugin_LocationInfo *location in the timer */
- // update handle
+ /* update handle */
if (xps_plugint_test) {
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_location: before set handle");
xps_plugint_test->index++;
*handle = (void *)tmp;
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_location: after set handle, set[%s], handle[%s]", tmp, *handle);
- // call LocationCallback
+ /* call LocationCallback */
if (cb) {
cb(arg, xps_plugint_test->location, NULL);
xps_plugint_test->location_cb = cb;
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_location after call callback");
}
- return TRUE; // to test online
- //return FALSE; // to test the offline
+ return TRUE; /* to test online */
+ /*return FALSE; // to test the offline */
}
int geoclue_plugin_test_cancel(void *handle, CancelCallback cb, void *arg)
{
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_cancel called");
- // check handle
+ /* check handle */
if (handle) {
LOG_PLUGIN(LOG_DEBUG, "canel handle %s", handle);
g_free(handle);
handle = NULL;
}
- // call CancelCallback
+ /* call CancelCallback */
if (cb) {
cb(arg);
}
}
void geoclue_plugin_test_get_offline_token(const unsigned char *key,
- unsigned int keyLengh,
- OfflineTokenCallback cb,
- void *arg)
+ unsigned int keyLengh,
+ OfflineTokenCallback cb,
+ void *arg)
{
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_get_offline_token called");
if (key_copied) {
LOG_PLUGIN(LOG_DEBUG, "key_copied [%s]", key_copied);
- // call OfflineTokenCallback
+ /* call OfflineTokenCallback */
if (cb) {
char *token = g_strdup("samsung_token");
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_get_offline_token: before callback");
}
int geoclue_plugin_test_offline_location(const unsigned char *key,
- unsigned int keyLength,
- const unsigned char *token,
- unsigned int tokenSize,
- LocationCallback cb,
- void *arg)
+ unsigned int keyLength,
+ const unsigned char *token,
+ unsigned int tokenSize,
+ LocationCallback cb,
+ void *arg)
{
LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_offline_location called");