From: jk7744.park Date: Sat, 24 Oct 2015 07:45:23 +0000 (+0900) Subject: tizen 2.4 release X-Git-Tag: accepted/tizen/2.4/mobile/20151029.032900^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=73a19e077afc2d2df85ac91de3b058fe42230624;p=framework%2Flocation%2Flibslp-lbs-plugin-replay.git tizen 2.4 release --- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..1bbd63a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,24 @@ +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) diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 9ca34b2..0000000 --- a/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 - -SUBDIRS = . gps-plugin -#SUBDIRS = . gps-plugin xps-plugin diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 798eba2..0000000 --- a/autogen.sh +++ /dev/null @@ -1,6 +0,0 @@ -aclocal -libtoolize --copy -autoheader -autoconf -automake --add-missing --copy --foreign - diff --git a/configure.ac b/configure.ac deleted file mode 100644 index a1a4864..0000000 --- a/configure.ac +++ /dev/null @@ -1,50 +0,0 @@ -# -*- 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 - diff --git a/gps-plugin/CMakeLists.txt b/gps-plugin/CMakeLists.txt new file mode 100644 index 0000000..c74dac8 --- /dev/null +++ b/gps-plugin/CMakeLists.txt @@ -0,0 +1,18 @@ +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}) diff --git a/gps-plugin/Makefile.am b/gps-plugin/Makefile.am deleted file mode 100644 index 239a0c5..0000000 --- a/gps-plugin/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -################# 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) diff --git a/gps-plugin/include/gps_plugin_debug.h b/gps-plugin/include/gps_plugin_debug.h index bdc75ee..be0792f 100644 --- a/gps-plugin/include/gps_plugin_debug.h +++ b/gps-plugin/include/gps_plugin_debug.h @@ -27,7 +27,7 @@ extern "C" { #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 @@ -38,10 +38,10 @@ extern "C" { #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 diff --git a/gps-plugin/include/nmea_parser.h b/gps-plugin/include/nmea_parser.h index 4e3e941..dd2b2c8 100644 --- a/gps-plugin/include/nmea_parser.h +++ b/gps-plugin/include/nmea_parser.h @@ -24,11 +24,11 @@ #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 diff --git a/gps-plugin/include/setting.h b/gps-plugin/include/setting.h index 578c022..f2339f7 100644 --- a/gps-plugin/include/setting.h +++ b/gps-plugin/include/setting.h @@ -50,7 +50,7 @@ int setting_get_int(const char *path, int *val); 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); diff --git a/gps-plugin/src/gps_plugin_replay.c b/gps-plugin/src/gps_plugin_replay.c old mode 100755 new mode 100644 index 8661cc4..37eafe7 --- a/gps-plugin/src/gps_plugin_replay.c +++ b/gps-plugin/src/gps_plugin_replay.c @@ -67,8 +67,8 @@ typedef struct { 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, @@ -76,7 +76,7 @@ static const gps_plugin_interface g_gps_plugin_replay_interface = { 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; @@ -106,7 +106,7 @@ void gps_plugin_replay_pos_event(pos_data_t * data) } } -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); @@ -175,7 +175,7 @@ void gps_plugin_replay_batch_event(pos_data_t * data, replay_timeout * timer) } } -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; @@ -207,7 +207,7 @@ void gps_plugin_replay_sv_event(sv_data_t * data) } } -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; @@ -275,7 +275,7 @@ void gps_plugin_respond_stop_session(void) } } -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; @@ -328,7 +328,7 @@ gboolean gps_plugin_replay_read_nmea(replay_timeout * timer, char *nmea_data) 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; @@ -372,7 +372,7 @@ gboolean gps_plugin_replay_timeout_cb(gpointer data) 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; @@ -448,7 +448,7 @@ gboolean gps_plugin_batch_replay_timeout_cb(gpointer data) } 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); } } @@ -456,7 +456,7 @@ gboolean gps_plugin_batch_replay_timeout_cb(gpointer data) 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"); @@ -469,7 +469,7 @@ void gps_plugin_stop_replay_mode(replay_timeout * timer) 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; @@ -482,7 +482,7 @@ void gps_plugin_stop_replay_mode(replay_timeout * timer) 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; @@ -507,7 +507,7 @@ gboolean gps_plugin_get_nmea_fd(replay_timeout * timer) return TRUE; } -gboolean gps_plugin_start_replay_mode(replay_timeout * timer) +gboolean gps_plugin_start_replay_mode(replay_timeout *timer) { gboolean ret = FALSE; @@ -532,8 +532,7 @@ gboolean gps_plugin_start_replay_mode(replay_timeout * timer) 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); @@ -550,7 +549,7 @@ gboolean gps_plugin_start_replay_mode(replay_timeout * 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; @@ -595,7 +594,7 @@ gboolean gps_plugin_start_batch_mode(replay_timeout * timer, int batch_interval, 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; @@ -608,7 +607,7 @@ void gps_plugin_stop_batch_mode(replay_timeout * timer) } } -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; @@ -689,7 +688,7 @@ replay_timeout *gps_plugin_replay_timer_init() return timer; } -void gps_plugin_replay_timer_deinit(replay_timeout * timer) +void gps_plugin_replay_timer_deinit(replay_timeout *timer) { if (timer == NULL) { return; @@ -723,7 +722,7 @@ int gps_plugin_replay_gps_init(gps_event_cb gps_event_cb, void *user_data) 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; @@ -732,35 +731,35 @@ int gps_plugin_replay_gps_deinit(gps_failure_reason_t * reason_code) 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; diff --git a/gps-plugin/src/nmea_parser.c b/gps-plugin/src/nmea_parser.c index 4a75932..6820e48 100644 --- a/gps-plugin/src/nmea_parser.c +++ b/gps-plugin/src/nmea_parser.c @@ -90,20 +90,20 @@ int nmea_parser_tokenize(char input[], char *token[]) 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++; } @@ -166,7 +166,7 @@ static double nmea_parser_get_altitude(const char *alt, const char *unit) 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; @@ -179,13 +179,13 @@ static int nmea_parser_gpgga(char *token[], pos_data_t * pos, sv_data_t * sv) 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; @@ -196,24 +196,24 @@ static int nmea_parser_gpgga(char *token[], pos_data_t * pos, sv_data_t * sv) 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; @@ -223,27 +223,27 @@ static int nmea_parser_gprmc(char *token[], pos_data_t * pos) 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; @@ -253,27 +253,27 @@ static int nmea_parser_gpgsa(char *token[], pos_data_t * pos) 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; @@ -282,13 +282,13 @@ static int nmea_parser_gpvtg(char *token[], pos_data_t * pos) 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"); @@ -317,7 +317,7 @@ static int nmea_parser_gpgsv(char *token[], sv_data_t * sv) 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) { @@ -339,7 +339,7 @@ int nmea_parser_sentence(char *sentence, char *token[], pos_data_t * pos, sv_dat 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; diff --git a/libslp-xpsplugin-replay.manifest b/libslp-xpsplugin-replay.manifest deleted file mode 100644 index a76fdba..0000000 --- a/libslp-xpsplugin-replay.manifest +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/libslp-lbsplugin-replay.manifest b/packaging/libslp-lbsplugin-replay.manifest similarity index 100% rename from libslp-lbsplugin-replay.manifest rename to packaging/libslp-lbsplugin-replay.manifest diff --git a/packaging/libslp-lbsplugin-replay.spec b/packaging/libslp-lbsplugin-replay.spec index 5f1af32..e71fa43 100644 --- a/packaging/libslp-lbsplugin-replay.spec +++ b/packaging/libslp-lbsplugin-replay.spec @@ -1,32 +1,38 @@ 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 @@ -37,8 +43,11 @@ mkdir -p %{buildroot}%{DATADIR}/replay 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 diff --git a/xps-plugin/include/geoclue_plugin_debug.h b/xps-plugin/include/geoclue_plugin_debug.h old mode 100755 new mode 100644 index 930cbe0..71bba23 --- a/xps-plugin/include/geoclue_plugin_debug.h +++ b/xps-plugin/include/geoclue_plugin_debug.h @@ -27,7 +27,7 @@ extern "C" { #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 @@ -38,9 +38,9 @@ extern "C" { #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 diff --git a/xps-plugin/src/geoclue_xps_plugin_replay.c b/xps-plugin/src/geoclue_xps_plugin_replay.c old mode 100755 new mode 100644 index dd6b01d..a605770 --- a/xps-plugin/src/geoclue_xps_plugin_replay.c +++ b/xps-plugin/src/geoclue_xps_plugin_replay.c @@ -35,16 +35,13 @@ int geoclue_plugin_test_load(void); 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, @@ -56,11 +53,11 @@ static const geoclue_plugin_interface g_geoclue_plugin_interface_test_interface }; 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; @@ -76,7 +73,7 @@ static gboolean update_fake_position(gpointer data) } 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; @@ -108,7 +105,7 @@ static gboolean update_fake_position(gpointer data) } } - // called intervals + /* called intervals */ if (xps_plugin->location_cb) { xps_plugin->location_cb(xps_plugin->arg, xps_plugin->location, NULL); } @@ -122,7 +119,7 @@ int geoclue_plugin_test_load(void) 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) { @@ -130,7 +127,7 @@ int geoclue_plugin_test_load(void) 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"); @@ -140,16 +137,16 @@ int geoclue_plugin_test_load(void) 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; } @@ -157,7 +154,7 @@ int geoclue_plugin_test_unload(void) { 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); @@ -167,16 +164,16 @@ int geoclue_plugin_test_unload(void) 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++; @@ -184,7 +181,7 @@ int geoclue_plugin_test_location(unsigned long period, LocationCallback cb, void *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; @@ -194,30 +191,27 @@ int geoclue_plugin_test_location(unsigned long period, LocationCallback cb, void 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"); @@ -228,7 +222,7 @@ void geoclue_plugin_test_get_offline_token(const unsigned char *key, 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"); @@ -244,11 +238,11 @@ void geoclue_plugin_test_get_offline_token(const unsigned char *key, } 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"); diff --git a/xps-plugin/src/geoclue_xps_plugin_test.c b/xps-plugin/src/geoclue_xps_plugin_test.c old mode 100755 new mode 100644 index 9e5c8a6..a0f6baf --- a/xps-plugin/src/geoclue_xps_plugin_test.c +++ b/xps-plugin/src/geoclue_xps_plugin_test.c @@ -35,16 +35,13 @@ int geoclue_plugin_test_load(void); 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, @@ -56,11 +53,11 @@ static const geoclue_plugin_interface g_geoclue_plugin_interface_test_interface }; 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; @@ -76,7 +73,7 @@ static gboolean update_fake_position(gpointer data) } 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; @@ -108,7 +105,7 @@ static gboolean update_fake_position(gpointer data) } } - // called intervals + /* called intervals */ if (xps_plugin->location_cb) { xps_plugin->location_cb(xps_plugin->arg, xps_plugin->location, NULL); } @@ -122,7 +119,7 @@ int geoclue_plugin_test_load(void) 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) { @@ -130,7 +127,7 @@ int geoclue_plugin_test_load(void) 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"); @@ -140,16 +137,16 @@ int geoclue_plugin_test_load(void) 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; } @@ -157,7 +154,7 @@ int geoclue_plugin_test_unload(void) { 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); @@ -167,16 +164,16 @@ int geoclue_plugin_test_unload(void) 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++; @@ -184,7 +181,7 @@ int geoclue_plugin_test_location(unsigned long period, LocationCallback cb, void *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; @@ -194,20 +191,20 @@ int geoclue_plugin_test_location(unsigned long period, LocationCallback cb, void 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); } @@ -215,9 +212,9 @@ 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) + unsigned int keyLengh, + OfflineTokenCallback cb, + void *arg) { LOG_PLUGIN(LOG_DEBUG, "geoclue_plugin_test_get_offline_token called"); @@ -228,7 +225,7 @@ void geoclue_plugin_test_get_offline_token(const unsigned char *key, 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"); @@ -244,11 +241,11 @@ void geoclue_plugin_test_get_offline_token(const unsigned char *key, } 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");