summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongmei Wang <dongme@codeaurora.org>2014-12-02 18:39:10 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2014-12-05 15:15:33 -0800
commit836bdc4386232b3a86d062f89f3093845d05cb29 (patch)
treeeca28ce187f928bfdaa7291bd7254d9f2c0cad76
parent42c543919b189a758445dc1fd59030e735ad30ec (diff)
downloadgps-836bdc4386232b3a86d062f89f3093845d05cb29.tar.gz
loc-pla: Create Platform Library Abstraction layer
Defined PLA functions to enable gps libraries to call platform-dependent library calls transparantly. Removed fake files and replaced the fake function with defined PLA functions. CRs-fixed: 605817 Change-Id: I677f658001329a10ef9b49bd963631a83fb4c85f
-rw-r--r--configure.ac4
-rw-r--r--core/ContextBase.cpp1
-rw-r--r--core/LocAdapterBase.cpp1
-rw-r--r--core/LocApiBase.cpp1
-rw-r--r--core/LocApiBase.h4
-rw-r--r--core/LocDualContext.cpp1
-rw-r--r--core/Makefile.am10
-rw-r--r--core/MsgTask.cpp9
-rw-r--r--core/fake_sched_policy.h65
-rw-r--r--core/loc_core_log.cpp1
-rw-r--r--loc_api/Makefile.am17
-rw-r--r--loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp3
-rw-r--r--loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c3
-rw-r--r--loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c3
-rw-r--r--loc_api/libloc_api_50001/LocEngAdapter.h3
-rw-r--r--loc_api/libloc_api_50001/loc.cpp12
-rw-r--r--loc_api/libloc_api_50001/loc_eng.cpp19
-rw-r--r--loc_api/libloc_api_50001/loc_eng.h1
-rw-r--r--loc_api/libloc_api_50001/loc_eng_agps.cpp3
-rw-r--r--loc_api/libloc_api_50001/loc_eng_agps.h2
-rw-r--r--loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp5
-rw-r--r--loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c5
-rw-r--r--loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c5
-rw-r--r--loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp5
-rw-r--r--loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c5
-rw-r--r--loc_api/libloc_api_50001/loc_eng_msg.h4
-rw-r--r--loc_api/libloc_api_50001/loc_eng_ni.cpp3
-rw-r--r--loc_api/libloc_api_50001/loc_eng_nmea.cpp4
-rw-r--r--loc_api/libloc_api_50001/loc_eng_xtra.cpp5
-rw-r--r--platform_lib_abstractions/loc_pla/Makefile.am10
-rw-r--r--platform_lib_abstractions/loc_pla/configure.ac61
-rw-r--r--platform_lib_abstractions/loc_pla/include/platform_lib_android_runtime.h45
-rw-r--r--platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h (renamed from platform_lib_abstractions/platform_lib_time.h)16
-rw-r--r--platform_lib_abstractions/loc_pla/include/platform_lib_includes.h (renamed from platform_lib_abstractions/platform_lib_time.cpp)30
-rw-r--r--platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h (renamed from utils/log_util.h)25
-rw-r--r--platform_lib_abstractions/loc_pla/include/platform_lib_macros.h (renamed from platform_lib_abstractions/platform_lib_macros.h)43
-rw-r--r--platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h (renamed from loc_api/fake_property_service.h)14
-rw-r--r--platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h46
-rw-r--r--platform_lib_abstractions/loc_pla/include/platform_lib_time.h (renamed from platform_lib_abstractions/platform_lib_includes.h)13
-rw-r--r--platform_lib_abstractions/loc_pla/loc-pla.pc.in10
-rw-r--r--platform_lib_abstractions/loc_pla/src/Makefile.am40
-rw-r--r--platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp40
-rw-r--r--platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp40
-rw-r--r--platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp (renamed from core/fake_sched_policy.c)39
-rw-r--r--platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp39
-rw-r--r--platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp41
-rw-r--r--platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp (renamed from loc_api/fake_property_service.c)30
-rw-r--r--utils/Makefile.am13
-rw-r--r--utils/linked_list.c5
-rw-r--r--utils/loc_cfg.cpp4
-rw-r--r--utils/loc_log.cpp60
-rw-r--r--utils/loc_target.cpp5
-rw-r--r--utils/loc_timer.h4
-rw-r--r--utils/msg_q.c5
54 files changed, 525 insertions, 357 deletions
diff --git a/configure.ac b/configure.ac
index 9b0f6ce..4ef39ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,6 +41,10 @@ PKG_CHECK_MODULES([DATA], [data])
AC_SUBST([DATA_CFLAGS])
AC_SUBST([DATA_LIBS])
+PKG_CHECK_MODULES([LOCPLA], [loc-pla])
+AC_SUBST([LOCPLA_CFLAGS])
+AC_SUBST([LOCPLA_LIBS])
+
AC_ARG_WITH([libhardware_includes],
AC_HELP_STRING([--with-libhardware-includes=@<:@dir@:>@],
[Specify the location of the libhardware headers]),
diff --git a/core/ContextBase.cpp b/core/ContextBase.cpp
index db84509..b2869bb 100644
--- a/core/ContextBase.cpp
+++ b/core/ContextBase.cpp
@@ -35,7 +35,6 @@
#include <ContextBase.h>
#include <msg_q.h>
#include <loc_target.h>
-#include <log_util.h>
#include <platform_lib_includes.h>
#include <loc_log.h>
diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp
index c6199da..054a295 100644
--- a/core/LocAdapterBase.cpp
+++ b/core/LocAdapterBase.cpp
@@ -32,7 +32,6 @@
#include <dlfcn.h>
#include <LocAdapterBase.h>
#include <loc_target.h>
-#include <log_util.h>
#include <platform_lib_includes.h>
namespace loc_core {
diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp
index 64bc249..3cd2ffa 100644
--- a/core/LocApiBase.cpp
+++ b/core/LocApiBase.cpp
@@ -32,7 +32,6 @@
#include <dlfcn.h>
#include <LocApiBase.h>
#include <LocAdapterBase.h>
-#include <log_util.h>
#include <platform_lib_includes.h>
namespace loc_core {
diff --git a/core/LocApiBase.h b/core/LocApiBase.h
index e162cfc..c48927c 100644
--- a/core/LocApiBase.h
+++ b/core/LocApiBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@
#include <ctype.h>
#include <gps_extended.h>
#include <MsgTask.h>
-#include <log_util.h>
+#include <platform_lib_log_util.h>
namespace loc_core {
diff --git a/core/LocDualContext.cpp b/core/LocDualContext.cpp
index d9420ad..b4eaf7f 100644
--- a/core/LocDualContext.cpp
+++ b/core/LocDualContext.cpp
@@ -33,7 +33,6 @@
#include <unistd.h>
#include <LocDualContext.h>
#include <msg_q.h>
-#include <log_util.h>
#include <loc_log.h>
namespace loc_core {
diff --git a/core/Makefile.am b/core/Makefile.am
index 8a3c2a1..e2d05be 100644
--- a/core/Makefile.am
+++ b/core/Makefile.am
@@ -1,6 +1,6 @@
AM_CFLAGS = -I./ \
-I../utils \
- -I../platform_lib_abstractions \
+ $(LOCPLA_CFLAGS) \
-fno-short-enums
libloc_core_la_h_sources = \
@@ -13,8 +13,7 @@ libloc_core_la_h_sources = \
UlpProxyBase.h \
gps_extended_c.h \
gps_extended.h \
- loc_core_log.h \
- fake_sched_policy.h
+ loc_core_log.h
libloc_core_la_c_sources = \
MsgTask.cpp \
@@ -22,8 +21,7 @@ libloc_core_la_c_sources = \
LocAdapterBase.cpp \
ContextBase.cpp \
LocDualContext.cpp \
- loc_core_log.cpp \
- fake_sched_policy.c
+ loc_core_log.cpp
library_includedir = $(pkgincludedir)/core
@@ -41,7 +39,7 @@ libloc_core_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
libloc_core_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
-libloc_core_la_LIBADD = -lstdc++ -ldl ../utils/libgps_utils_so.la
+libloc_core_la_LIBADD = -lstdc++ -ldl $(LOCPLA_LIBS) ../utils/libgps_utils_so.la
#Create and Install libraries
lib_LTLIBRARIES = libloc_core.la
diff --git a/core/MsgTask.cpp b/core/MsgTask.cpp
index 7d70a9d..df6db80 100644
--- a/core/MsgTask.cpp
+++ b/core/MsgTask.cpp
@@ -29,16 +29,9 @@
#define LOG_NDDEBUG 0
#define LOG_TAG "LocSvc_MsgTask"
-#ifdef _ANDROID
-#include <cutils/sched_policy.h>
-#include <android_runtime/AndroidRuntime.h>
-#else
-#include "fake_sched_policy.h"
-#endif
#include <unistd.h>
#include <MsgTask.h>
#include <msg_q.h>
-#include <log_util.h>
#include <loc_log.h>
#include <platform_lib_includes.h>
@@ -100,7 +93,7 @@ void* MsgTask::loopMain(void* arg) {
MsgTask* copy = (MsgTask*)arg;
// make sure we do not run in background scheduling group
- set_sched_policy(GETTID_PLATFORM_LIB_ABSTRACTION, SP_FOREGROUND);
+ platform_lib_abstraction_set_sched_policy(platform_lib_abstraction_gettid(), PLA_SP_FOREGROUND);
if (NULL != copy->mAssociator) {
copy->mAssociator();
diff --git a/core/fake_sched_policy.h b/core/fake_sched_policy.h
deleted file mode 100644
index 5b7c7de..0000000
--- a/core/fake_sched_policy.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef _FAKE_SCHED_POLICY_H
-#define _FAKE_SCHED_POLICY_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- SP_BACKGROUND = 0,
- SP_FOREGROUND = 1,
-} SchedPolicy;
-
-/*===========================================================================
-FUNCTION set_sched_policy
-
-DESCRIPTION
- Local copy of this function which bypasses android set_sched_policy
-
-DEPENDENCIES
- None
-
-RETURN VALUE
- 0
-
-SIDE EFFECTS
- N/A
-
-===========================================================================*/
-int set_sched_policy(int tid, SchedPolicy policy);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _FAKE_SCHED_POLICY_H
-
diff --git a/core/loc_core_log.cpp b/core/loc_core_log.cpp
index 43cd60b..7d26ba6 100644
--- a/core/loc_core_log.cpp
+++ b/core/loc_core_log.cpp
@@ -31,7 +31,6 @@
#define LOG_TAG "LocSvc_core_log"
#include <loc_log.h>
-#include <log_util.h>
#include <loc_core_log.h>
#include <platform_lib_includes.h>
diff --git a/loc_api/Makefile.am b/loc_api/Makefile.am
index e18d3a7..c5bffed 100644
--- a/loc_api/Makefile.am
+++ b/loc_api/Makefile.am
@@ -2,8 +2,8 @@ AM_CFLAGS = \
-I./ \
-I../core \
-I./libloc_api_50001 \
- -I../platform_lib_abstractions \
-I../utils \
+ $(LOCPLA_CFLAGS) \
-fno-short-enums \
-DTARGET_USES_QCOM_BSP
@@ -26,8 +26,7 @@ libloc_eng_so_la_SOURCES = \
libloc_api_50001/loc_eng_dmn_conn_handler.cpp \
libloc_api_50001/loc_eng_dmn_conn_thread_helper.c \
libloc_api_50001/loc_eng_dmn_conn_glue_msg.c \
- libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c \
- fake_property_service.c
+ libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
libloc_eng_so_la_SOURCES += libloc_eng_so_la_h_sources
@@ -41,13 +40,12 @@ libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
-libloc_eng_so_la_LIBADD = -lstdc++ -ldl -llog ../utils/libgps_utils_so.la ../core/libloc_core.la
+libloc_eng_so_la_LIBADD = -lstdc++ -ldl -llog $(LOCPLA_LIBS) ../utils/libgps_utils_so.la ../core/libloc_core.la
libgps_default_so_la_SOURCES = \
libloc_api_50001/loc.cpp \
- libloc_api_50001/gps.c \
- fake_property_service.c
+ libloc_api_50001/gps.c
if USE_GLIB
libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
@@ -59,7 +57,7 @@ libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
-libgps_default_so_la_LIBADD = -lstdc++ -llog ../utils/libgps_utils_so.la ../core/libloc_core.la -ldl libloc_eng_so.la
+libgps_default_so_la_LIBADD = -lstdc++ -llog $(LOCPLA_LIBS) ../utils/libgps_utils_so.la ../core/libloc_core.la -ldl libloc_eng_so.la
libloc_ds_api_CFLAGS = \
@@ -83,7 +81,7 @@ libloc_ds_api_la_LDFLAGS += -Wl,--export-dynamic
libloc_ds_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) $(libloc_ds_api_CFLAGS)
endif
-libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices -ldsi_netctrl ../utils/libgps_utils_so.la
+libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices -ldsi_netctrl $(LOCPLA_LIBS) ../utils/libgps_utils_so.la
libloc_api_v02_CFLAGS = \
$(QMIF_CFLAGS) \
@@ -108,7 +106,7 @@ libloc_api_v02_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) $(libloc_api_v02_CFLAGS
endif
libloc_api_v02_la_CXXFLAGS = -std=c++0x
-libloc_api_v02_la_LIBADD = -lstdc++ -lqmi_cci -lqmi_common_so ../core/libloc_core.la ../utils/libgps_utils_so.la libloc_ds_api.la
+libloc_api_v02_la_LIBADD = -lstdc++ -lqmi_cci -lqmi_common_so $(QMIF_LIBS) $(LOCPLA_LIBS) ../core/libloc_core.la ../utils/libgps_utils_so.la libloc_ds_api.la
library_include_HEADERS = \
libloc_api_50001/LocEngAdapter.h \
@@ -119,7 +117,6 @@ library_include_HEADERS = \
libloc_api_50001/loc_eng_agps.h \
libloc_api_50001/loc_eng_msg.h \
libloc_api_50001/loc_eng_log.h \
- fake_property_service.h \
$(WORKSPACE)/qcom-opensource/location/loc_api/ds_api/ds_client.h \
$(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/location_service_v02.h \
$(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_v02_log.h \
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp
index 08474fc..24708d4 100644
--- a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -38,7 +38,6 @@
#include <LocAdapterBase.h>
#include <loc_api_fixup.h>
#include <loc_api_rpc_glue.h>
-#include <log_util.h>
#include <loc_log.h>
#include <loc_api_log.h>
#ifdef USE_GLIB
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
index 1c48232..eb685fd 100644
--- a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011, 2014 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -32,7 +32,6 @@
#include "loc_api_log.h"
#include "loc_log.h"
-#include "log_util.h"
#include "platform_lib_includes.h"
#include "rpc/rpc.h"
#include "loc_api_fixup.h"
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
index e0f400c..8c12426 100644
--- a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -62,7 +62,6 @@
#endif /* USE_GLIB */
/* Logging Improvement */
-#include "log_util.h"
#include "platform_lib_includes.h"
/*Maximum number of Modem init*/
#define RPC_TRY_NUM 10
diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h
index d03dc66..ea04f07 100644
--- a/loc_api/libloc_api_50001/LocEngAdapter.h
+++ b/loc_api/libloc_api_50001/LocEngAdapter.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,7 +33,6 @@
#include <hardware/gps.h>
#include <loc.h>
#include <loc_eng_log.h>
-#include <log_util.h>
#include <LocAdapterBase.h>
#include <LocDualContext.h>
#include <UlpProxyBase.h>
diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp
index 7031605..0a933af 100644
--- a/loc_api/libloc_api_50001/loc.cpp
+++ b/loc_api/libloc_api_50001/loc.cpp
@@ -43,11 +43,7 @@
#include <fcntl.h>
#include <errno.h>
#include <LocDualContext.h>
-#ifdef _ANDROID
-#include <cutils/properties.h>
-#else
-#include "fake_property_service.h"
-#endif
+#include <platform_lib_includes.h>
using namespace loc_core;
@@ -174,7 +170,7 @@ extern "C" const GpsInterface* gps_get_hardware_interface ()
loc_eng_read_config();
// check to see if GPS should be disabled
- property_get("gps.disable", propBuf, "");
+ platform_lib_abstraction_property_get("gps.disable", propBuf, "");
if (propBuf[0] == '1')
{
LOC_LOGD("gps_get_interface returning NULL because gps.disable=1\n");
@@ -475,7 +471,7 @@ static int loc_inject_location(double latitude, double longitude, float accuracy
{
char value[PROPERTY_VALUE_MAX];
memset(value, 0, sizeof(value));
- (void)property_get("persist.gps.qc_nlp_in_use", value, "0");
+ (void)platform_lib_abstraction_property_get("persist.gps.qc_nlp_in_use", value, "0");
if(0 == strcmp(value, "1"))
{
enable_cpi = false;
@@ -596,7 +592,7 @@ const void* loc_get_extension(const char* name)
else if (strcmp(name, AGPS_RIL_INTERFACE) == 0)
{
char baseband[PROPERTY_VALUE_MAX];
- property_get("ro.baseband", baseband, "msm");
+ platform_lib_abstraction_property_get("ro.baseband", baseband, "msm");
if (strcmp(baseband, "csfb") == 0)
{
ret_val = &sLocEngAGpsRilInterface;
diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp
index c3e82f8..4bc12b3 100644
--- a/loc_api/libloc_api_50001/loc_eng.cpp
+++ b/loc_api/libloc_api_50001/loc_eng.cpp
@@ -46,21 +46,6 @@
#include <time.h>
#include <new>
#include <LocEngAdapter.h>
-
-#ifdef _ANDROID
-#include <cutils/sched_policy.h>
-#include <cutils/properties.h>
-#else
-#include "fake_sched_policy.h"
-#include "fake_property_service.h"
-#endif
-
-#ifndef USE_GLIB
-#include <utils/SystemClock.h>
-#include <utils/Log.h>
-#endif /* USE_GLIB */
-
-
#if defined(USE_GLIB) && !defined(OFF_TARGET)
#include <glib.h>
#endif
@@ -69,7 +54,6 @@
#endif /* USE_GLIB */
#include <string.h>
-
#include <loc_eng.h>
#include <loc_eng_ni.h>
#include <loc_eng_dmn_conn.h>
@@ -78,8 +62,7 @@
#include <loc_eng_nmea.h>
#include <msg_q.h>
#include <loc.h>
-#include "log_util.h"
-#include "platform_lib_includes.h"
+#include <platform_lib_includes.h>
#include "loc_core_log.h"
#include "loc_eng_log.h"
diff --git a/loc_api/libloc_api_50001/loc_eng.h b/loc_api/libloc_api_50001/loc_eng.h
index 5935131..c1dc8af 100644
--- a/loc_api/libloc_api_50001/loc_eng.h
+++ b/loc_api/libloc_api_50001/loc_eng.h
@@ -54,7 +54,6 @@ typedef unsigned char boolean;
#include <loc_eng_agps.h>
#include <loc_cfg.h>
#include <loc_log.h>
-#include <log_util.h>
#include <loc_eng_agps.h>
#include <LocEngAdapter.h>
diff --git a/loc_api/libloc_api_50001/loc_eng_agps.cpp b/loc_api/libloc_api_50001/loc_eng_agps.cpp
index d6cc136..cf9fe82 100644
--- a/loc_api/libloc_api_50001/loc_eng_agps.cpp
+++ b/loc_api/libloc_api_50001/loc_eng_agps.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -32,7 +32,6 @@
#include <loc_eng_agps.h>
#include <loc_eng_log.h>
-#include <log_util.h>
#include <platform_lib_includes.h>
#include <loc_eng_dmn_conn_handler.h>
#include <loc_eng_dmn_conn.h>
diff --git a/loc_api/libloc_api_50001/loc_eng_agps.h b/loc_api/libloc_api_50001/loc_eng_agps.h
index 81a4133..d68970f 100644
--- a/loc_api/libloc_api_50001/loc_eng_agps.h
+++ b/loc_api/libloc_api_50001/loc_eng_agps.h
@@ -40,7 +40,7 @@
#include <linked_list.h>
#include <loc_timer.h>
#include <LocEngAdapter.h>
-
+#include <platform_lib_includes.h>
#if defined(USE_GLIB) && !defined(OFF_TARGET)
#include <glib.h>
#endif /* USE_GLIB */
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp b/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
index 918ae22..d24e0c9 100644
--- a/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -37,8 +37,7 @@
#include <grp.h>
#include <sys/stat.h>
-#include "log_util.h"
-#include "platform_lib_includes.h"
+#include <platform_lib_includes.h>
#include "loc_eng_dmn_conn_glue_msg.h"
#include "loc_eng_dmn_conn_handler.h"
#include "loc_eng_dmn_conn.h"
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
index a1076ff..e947fa1 100644
--- a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011,2014 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -31,8 +31,7 @@
#include <linux/types.h>
-#include "log_util.h"
-#include "platform_lib_includes.h"
+#include <platform_lib_includes.h>
#include "loc_eng_dmn_conn_glue_msg.h"
#include "loc_eng_dmn_conn_handler.h"
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
index 5d9a449..cbc4ea6 100644
--- a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -37,8 +37,7 @@
#include <sys/stat.h>
#include "loc_eng_dmn_conn_glue_pipe.h"
-#include "log_util.h"
-#include "platform_lib_includes.h"
+#include <platform_lib_includes.h>
/*===========================================================================
FUNCTION loc_eng_dmn_conn_glue_pipeget
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp b/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
index edd53f2..137f686 100644
--- a/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -31,8 +31,7 @@
#include <string.h>
#include <unistd.h>
-#include "log_util.h"
-#include "platform_lib_includes.h"
+#include <platform_lib_includes.h>
#include "loc_eng_msg.h"
#include "loc_eng_dmn_conn.h"
#include "loc_eng_dmn_conn_handler.h"
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c b/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
index 9fed9d4..b30f6d7 100644
--- a/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011,2014 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -28,8 +28,7 @@
*/
#include <stdio.h>
-#include "log_util.h"
-#include "platform_lib_includes.h"
+#include <platform_lib_includes.h>
#include "loc_eng_dmn_conn_thread_helper.h"
/*===========================================================================
diff --git a/loc_api/libloc_api_50001/loc_eng_msg.h b/loc_api/libloc_api_50001/loc_eng_msg.h
index f4ba2dc..9a8b0e4 100644
--- a/loc_api/libloc_api_50001/loc_eng_msg.h
+++ b/loc_api/libloc_api_50001/loc_eng_msg.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -34,11 +34,11 @@
#include <gps_extended.h>
#include <stdlib.h>
#include <string.h>
-#include <log_util.h>
#include <loc_eng_log.h>
#include <loc_eng.h>
#include <MsgTask.h>
#include <LocEngAdapter.h>
+#include <platform_lib_includes.h>
#ifndef SSID_BUF_SIZE
#define SSID_BUF_SIZE (32+1)
diff --git a/loc_api/libloc_api_50001/loc_eng_ni.cpp b/loc_api/libloc_api_50001/loc_eng_ni.cpp
index 74abfd4..cc89448 100644
--- a/loc_api/libloc_api_50001/loc_eng_ni.cpp
+++ b/loc_api/libloc_api_50001/loc_eng_ni.cpp
@@ -43,8 +43,7 @@
#include <loc_eng.h>
-#include "log_util.h"
-#include "platform_lib_includes.h"
+#include <platform_lib_includes.h>
using namespace loc_core;
diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/loc_api/libloc_api_50001/loc_eng_nmea.cpp
index 842eda1..8e99d94 100644
--- a/loc_api/libloc_api_50001/loc_eng_nmea.cpp
+++ b/loc_api/libloc_api_50001/loc_eng_nmea.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012,2014 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -36,7 +36,7 @@
#include <loc_eng.h>
#include <loc_eng_nmea.h>
#include <math.h>
-#include "log_util.h"
+#include <platform_lib_includes.h>
/*===========================================================================
FUNCTION loc_eng_nmea_send
diff --git a/loc_api/libloc_api_50001/loc_eng_xtra.cpp b/loc_api/libloc_api_50001/loc_eng_xtra.cpp
index 4582286..1459c4c 100644
--- a/loc_api/libloc_api_50001/loc_eng_xtra.cpp
+++ b/loc_api/libloc_api_50001/loc_eng_xtra.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -32,8 +32,7 @@
#include <loc_eng.h>
#include <MsgTask.h>
-#include "log_util.h"
-#include "platform_lib_includes.h"
+#include <platform_lib_includes.h>
using namespace loc_core;
diff --git a/platform_lib_abstractions/loc_pla/Makefile.am b/platform_lib_abstractions/loc_pla/Makefile.am
new file mode 100644
index 0000000..8996763
--- /dev/null
+++ b/platform_lib_abstractions/loc_pla/Makefile.am
@@ -0,0 +1,10 @@
+# Makefile.am for gps loc-pla
+#
+
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = src
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = loc-pla.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/platform_lib_abstractions/loc_pla/configure.ac b/platform_lib_abstractions/loc_pla/configure.ac
new file mode 100644
index 0000000..a8b892b
--- /dev/null
+++ b/platform_lib_abstractions/loc_pla/configure.ac
@@ -0,0 +1,61 @@
+# configure.ac -- Autoconf script for gps loc-pla
+#
+# Process this file with autoconf to produce a configure script
+
+# Requires autoconf tool later than 2.61
+AC_PREREQ(2.61)
+# Initialize the gps loc-pla package version 1.0.0
+AC_INIT([loc-pla],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([include/platform_lib_includes.h])
+# defines some macros variable to be included by source
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+
+# Checks for programs.
+AC_PROG_LIBTOOL
+AC_PROG_CXX
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_AWK
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+PKG_PROG_PKG_CONFIG
+
+# Checks for libraries.
+PKG_CHECK_MODULES([LOCSTUB], [loc-stub])
+AC_SUBST([LOCSTUB_CFLAGS])
+AC_SUBST([LOCSTUB_LIBS])
+
+AC_ARG_WITH([glib],
+ AC_HELP_STRING([--with-glib],
+ [enable glib, building HLOS systems which use glib]))
+
+if (test "x${with_glib}" = "xyes"); then
+ AC_DEFINE(ENABLE_USEGLIB, 1, [Define if HLOS systems uses glib])
+ PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
+ AC_MSG_ERROR(GThread >= 2.16 is required))
+ PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes,
+ AC_MSG_ERROR(GLib >= 2.16 is required))
+ GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
+ GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
+
+ AC_SUBST(GLIB_CFLAGS)
+ AC_SUBST(GLIB_LIBS)
+fi
+
+AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes")
+
+AC_CONFIG_FILES([ \
+ Makefile \
+ src/Makefile \
+ loc-pla.pc \
+ ])
+
+AC_OUTPUT
diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_android_runtime.h b/platform_lib_abstractions/loc_pla/include/platform_lib_android_runtime.h
new file mode 100644
index 0000000..9a954f0
--- /dev/null
+++ b/platform_lib_abstractions/loc_pla/include/platform_lib_android_runtime.h
@@ -0,0 +1,45 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PLATFORM_LIB_ANDROID_RUNTIME_H__
+#define __PLATFORM_LIB_ANDROID_RUNTIME_H__
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+pthread_t platform_lib_abstraction_createJavaThread(const char* name, void (*start)(void *), void* arg);
+#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION platform_lib_abstraction_createJavaThread
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /*__PLATFORM_LIB_ANDROID_RUNTIME_H__ */
diff --git a/platform_lib_abstractions/platform_lib_time.h b/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h
index 8bdffa9..9956937 100644
--- a/platform_lib_abstractions/platform_lib_time.h
+++ b/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -26,20 +26,16 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _PLATFORM_LIB_TIME_H_
-#define _PLATFORM_LIB_TIME_H_
+#ifndef __PLATFORM_LIB_GETTID_H__
+#define __PLATFORM_LIB_GETTID_H__
-#include <sys/time.h>
+#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
-
-int64_t systemTime(int clock);
-int64_t elapsedMillisSinceBoot();
-
+pid_t platform_lib_abstraction_gettid();
#ifdef __cplusplus
}
#endif /* __cplusplus */
-
-#endif
+#endif /* __PLATFORM_LIB_GETTID_H__ */
diff --git a/platform_lib_abstractions/platform_lib_time.cpp b/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h
index 45bb8e6..47c37df 100644
--- a/platform_lib_abstractions/platform_lib_time.cpp
+++ b/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -26,23 +26,15 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stdlib.h>
-#include <sys/time.h>
-#include "platform_lib_time.h"
-
-int64_t systemTime(int clock)
-{
- struct timeval t;
- t.tv_sec = t.tv_usec = 0;
- gettimeofday(&t, NULL);
- return t.tv_sec*1000000LL + t.tv_usec;
-}
-
-
-int64_t elapsedMillisSinceBoot()
-{
- int64_t t_us = systemTime(0);
- return (int64_t) t_us / 1000LL;
-}
+#ifndef __PLATFORM_LIB_INCLUDES_H__
+#define __PLATFORM_LIB_INCLUDES_H__
+#include "platform_lib_android_runtime.h"
+#include "platform_lib_gettid.h"
+#include "platform_lib_log_util.h"
+#include "platform_lib_macros.h"
+#include "platform_lib_property_service.h"
+#include "platform_lib_sched_policy.h"
+#include "platform_lib_time.h"
+#endif /* __PLATFORM_LIB_INCLUDES_H__ */
diff --git a/utils/log_util.h b/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
index 7fb0c78..f78303c 100644
--- a/utils/log_util.h
+++ b/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -24,26 +24,27 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
*/
-#ifndef __LOG_UTIL_H__
-#define __LOG_UTIL_H__
+#ifndef __PLATFORM_LIB_LOG_UTIL_H__
+#define __PLATFORM_LIB_LOG_UTIL_H__
+
+#include "platform_lib_macros.h"
#ifndef USE_GLIB
#include <utils/Log.h>
-#endif /* USE_GLIB */
-
-#ifdef USE_GLIB
+#else
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
+#include <time.h>
#include <unistd.h>
#ifndef LOG_TAG
#define LOG_TAG "GPS_UTILS"
-
-#endif // LOG_TAG
+#endif /* LOG_TAG */
#endif /* USE_GLIB */
@@ -86,8 +87,8 @@ extern const char ENTRY_TAG[];
* MODULE EXPORTED FUNCTIONS
*
*============================================================================*/
-extern void loc_logger_init(unsigned long debug, unsigned long timestamp);
-extern char* get_timestamp(char* str, unsigned long buf_size);
+void loc_logger_init(unsigned long debug, unsigned long timestamp);
+char* get_timestamp(char* str, unsigned long buf_size);
#ifndef DEBUG_DMN_LOC_API
@@ -168,4 +169,4 @@ else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/"__VA_ARGS__); }
}
#endif
-#endif // __LOG_UTIL_H__
+#endif /* __PLATFORM_LIB_LOG_UTIL_H__ */
diff --git a/platform_lib_abstractions/platform_lib_macros.h b/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h
index a1db21a..32035d2 100644
--- a/platform_lib_abstractions/platform_lib_macros.h
+++ b/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -29,14 +29,21 @@
#ifndef __PLATFORM_LIB_MACROS_H__
#define __PLATFORM_LIB_MACROS_H__
-#include <sys/time.h>
-#include <unistd.h>
-#include <sys/syscall.h>
-
#ifdef __cplusplus
extern "C" {
#endif
+#ifdef USE_GLIB
+#include <sys/time.h>
+#ifndef OFF_TARGET
+#include <glib.h>
+#define strlcat g_strlcat
+#define strlcpy g_strlcpy
+#else
+#define strlcat strncat
+#define strlcpy strncpy
+#endif
+
#define TS_PRINTF(format, x...) \
{ \
struct timeval tv; \
@@ -49,38 +56,16 @@ extern "C" {
fprintf(stdout,"%02d:%02d:%02d.%06ld]" format "\n", hh, mm, ss, tv.tv_usec,##x); \
}
-
-#ifdef USE_GLIB
-#ifndef OFF_TARGET
-#define strlcat g_strlcat
-#define strlcpy g_strlcpy
-#else
-#define strlcat strncat
-#define strlcpy strncpy
-#endif
#define ALOGE(format, x...) TS_PRINTF("E/%s (%d): " format , LOG_TAG, getpid(), ##x)
#define ALOGW(format, x...) TS_PRINTF("W/%s (%d): " format , LOG_TAG, getpid(), ##x)
#define ALOGI(format, x...) TS_PRINTF("I/%s (%d): " format , LOG_TAG, getpid(), ##x)
#define ALOGD(format, x...) TS_PRINTF("D/%s (%d): " format , LOG_TAG, getpid(), ##x)
#define ALOGV(format, x...) TS_PRINTF("V/%s (%d): " format , LOG_TAG, getpid(), ##x)
-#define GETTID_PLATFORM_LIB_ABSTRACTION (syscall(SYS_gettid))
-
-#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION createPthread
-#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (elapsedMillisSinceBoot())
-
-#else
-
-pid_t gettid(void);
-
-#define GETTID_PLATFORM_LIB_ABSTRACTION (gettid())
-#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION android::AndroidRuntime::createJavaThread
-#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (android::elapsedRealtime())
-
-#endif
+#endif /* USE_GLIB */
#ifdef __cplusplus
}
#endif /*__cplusplus */
-#endif
+#endif /* __PLATFORM_LIB_MACROS_H__ */
diff --git a/loc_api/fake_property_service.h b/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h
index 1c15a4e..006c94d 100644
--- a/loc_api/fake_property_service.h
+++ b/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -24,22 +24,20 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
*/
-#ifndef _FAKE_PROPERTY_SERVICE_H_
-#define _FAKE_PROPERTY_SERVICE_H
+#ifndef __PLATFORM_LIB_PROPERTY_SERVICE_H__
+#define __PLATFORM_LIB_PROPERTY_SERVICE_H__
#ifdef __cplusplus
extern "C" {
#endif
#define PROPERTY_VALUE_MAX 92
-int property_get(const char *key, char *value, const char *default_value);
+int platform_lib_abstraction_property_get(const char *key, char *value, const char *default_value);
#ifdef __cplusplus
}
-#endif
+#endif /* __cplusplus */
-
-#endif
+#endif /* __PLATFORM_LIB_PROPERTY_SERVICE_H__ */
diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h b/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h
new file mode 100644
index 0000000..d10f151
--- /dev/null
+++ b/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h
@@ -0,0 +1,46 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PLATFORM_LIB_SCHED_POLICY_H__
+#define __PLATFORM_LIB_SCHED_POLICY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef enum {
+ PLA_SP_BACKGROUND = 0,
+ PLA_SP_FOREGROUND = 1,
+} PLASchedPolicy;
+
+int platform_lib_abstraction_set_sched_policy(int tid, PLASchedPolicy policy);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __PLATFORM_LIB_SCHED_POLICY_H__ */
+
diff --git a/platform_lib_abstractions/platform_lib_includes.h b/platform_lib_abstractions/loc_pla/include/platform_lib_time.h
index 5858674..c05b15c 100644
--- a/platform_lib_abstractions/platform_lib_includes.h
+++ b/platform_lib_abstractions/loc_pla/include/platform_lib_time.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -26,10 +26,11 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _PLATFORM_LIB_INCLUDES_H_
-#define _PLATFORM_LIB_INCLUDES_H_
+#ifndef __PLATFORM_LIB_TIME_H__
+#define __PLATFORM_LIB_TIME_H__
-#include "platform_lib_time.h"
-#include "platform_lib_macros.h"
+#include <stdint.h>
-#endif
+int64_t platform_lib_abstraction_elapsed_millis_since_boot();
+
+#endif /* __PLATFORM_LIB_TIME_H__ */
diff --git a/platform_lib_abstractions/loc_pla/loc-pla.pc.in b/platform_lib_abstractions/loc_pla/loc-pla.pc.in
new file mode 100644
index 0000000..1aad2f4
--- /dev/null
+++ b/platform_lib_abstractions/loc_pla/loc-pla.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: loc-pla
+Description: QTI GPS Location Platform Library Abstractions
+Version: @VERSION@
+Libs: -L${libdir} -lloc_pla
+Cflags: -I${includedir}/loc-pla
diff --git a/platform_lib_abstractions/loc_pla/src/Makefile.am b/platform_lib_abstractions/loc_pla/src/Makefile.am
new file mode 100644
index 0000000..3936837
--- /dev/null
+++ b/platform_lib_abstractions/loc_pla/src/Makefile.am
@@ -0,0 +1,40 @@
+AM_CFLAGS = \
+ $(LOCSTUB_CFLAGS) \
+ -I../include \
+ -fno-short-enums
+
+h_sources = \
+ ../include/platform_lib_android_runtime.h \
+ ../include/platform_lib_gettid.h \
+ ../include/platform_lib_includes.h \
+ ../include/platform_lib_log_util.h \
+ ../include/platform_lib_macros.h \
+ ../include/platform_lib_property_service.h \
+ ../include/platform_lib_sched_policy.h \
+ ../include/platform_lib_time.h
+
+library_includedir = $(pkgincludedir)
+library_include_HEADERS = $(h_sources)
+
+libloc_pla_la_SOURCES = \
+ platform_lib_android_runtime.cpp \
+ platform_lib_gettid.cpp \
+ platform_lib_log_util.cpp \
+ platform_lib_property_service.cpp \
+ platform_lib_sched_policy.cpp \
+ platform_lib_time.cpp
+
+if USE_GLIB
+libloc_pla_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_pla_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_pla_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_pla_la_CFLAGS = $(AM_CFLAGS)
+libloc_pla_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_pla_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_pla_la_LIBADD = -lstdc++ -ldl -llog $(LOCSTUB_LIBS)
+
+#Create and Install libraries
+lib_LTLIBRARIES = libloc_pla.la
diff --git a/platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp b/platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp
new file mode 100644
index 0000000..447e02e
--- /dev/null
+++ b/platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp
@@ -0,0 +1,40 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "platform_lib_android_runtime.h"
+
+#ifdef USE_GLIB
+#include <loc_stub_android_runtime.h>
+#else
+#include <android/AndroidRuntime.h>
+#endif /* USE_GLIB */
+
+pthread_t platform_lib_abstraction_createJavaThread(const char* name, void (*start)(void *), void* arg)
+{
+ return android::AndroidRuntime::createJavaThread(name, start, arg);
+}
diff --git a/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp b/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp
new file mode 100644
index 0000000..8686327
--- /dev/null
+++ b/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp
@@ -0,0 +1,40 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "platform_lib_gettid.h"
+
+#ifdef USE_GLIB
+#include <loc_stub_gettid.h>
+#else
+#include <unistd.h>
+#endif /* USE_GLIB */
+
+pid_t platform_lib_abstraction_gettid()
+{
+ return gettid();
+}
diff --git a/core/fake_sched_policy.c b/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp
index ce99b93..37a5d4a 100644
--- a/core/fake_sched_policy.c
+++ b/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -24,28 +24,25 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
*/
+#include "platform_lib_log_util.h"
-#include "fake_sched_policy.h"
-
-/*===========================================================================
-FUNCTION set_sched_policy
-
-DESCRIPTION
- Local copy of this function which bypasses android set_sched_policy
-
-DEPENDENCIES
- None
-
-RETURN VALUE
- 0
-
-SIDE EFFECTS
- N/A
+void loc_logger_init(unsigned long debug, unsigned long timestamp)
+{
+ loc_logger.DEBUG_LEVEL = debug;
+ loc_logger.TIMESTAMP = timestamp;
+}
-===========================================================================*/
-int set_sched_policy(int tid, SchedPolicy policy)
+char * get_timestamp(char *str, unsigned long buf_size)
{
- return 0;
+ struct timeval tv;
+ struct timezone tz;
+ int hh, mm, ss;
+ gettimeofday(&tv, &tz);
+ hh = tv.tv_sec/3600%24;
+ mm = (tv.tv_sec%3600)/60;
+ ss = tv.tv_sec%60;
+ snprintf(str, buf_size, "%02d:%02d:%02d.%06ld", hh, mm, ss, tv.tv_usec);
+ return str;
}
+
diff --git a/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp b/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp
new file mode 100644
index 0000000..1cc63ab
--- /dev/null
+++ b/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp
@@ -0,0 +1,39 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "platform_lib_property_service.h"
+
+#ifdef USE_GLIB
+#include <loc_stub_property_service.h>
+#else
+#include <cutils/properties.h>
+#endif /* USE_GLIB */
+
+int platform_lib_abstraction_property_get(const char *key, char *value, const char *default_value)
+{
+ return property_get(key, value, default_value);
+}
diff --git a/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp b/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp
new file mode 100644
index 0000000..ba6b350
--- /dev/null
+++ b/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp
@@ -0,0 +1,41 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "platform_lib_sched_policy.h"
+
+#ifdef USE_GLIB
+#include <loc_stub_sched_policy.h>
+#else
+#include <cutils/sched_policy.h>
+#endif /* USE_GLIB */
+
+int platform_lib_abstraction_set_sched_policy(int tid, PLASchedPolicy policy)
+{
+ return set_sched_policy(tid, (SchedPolicy)policy);
+}
+
diff --git a/loc_api/fake_property_service.c b/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp
index 9d660fa..dc7dff1 100644
--- a/loc_api/fake_property_service.c
+++ b/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -24,22 +24,24 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
*/
+#include "platform_lib_time.h"
-#include <stdio.h>
#ifdef USE_GLIB
-#include <string.h>
-#endif
+#include <loc_stub_time.h>
+#else
+#include <utils/SystemClock.h>
+#endif /* USE_GLIB */
-int property_get(const char *key, char * value, const char *default_value)
+int64_t platform_lib_abstraction_elapsed_millis_since_boot()
{
- /* This will disable gps interface
- value[0] = '1';
- */
- if (strcmp(key, "ro.baseband") == 0) {
- memcpy(value, "msm", 4);
- }
- return 0;
-}
+#ifdef USE_GLIB
+
+ return elapsedMillisSinceBoot();
+#else
+
+ return android::elapsedRealtime();
+
+#endif
+}
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 0e7083e..5e71843 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -6,19 +6,15 @@ AM_CFLAGS = -Wundef \
-fno-short-enums \
-fpic \
-I./ \
- -I../platform_lib_abstractions
+ $(LOCPLA_CFLAGS)
libgps_utils_so_la_h_sources = \
- log_util.h \
msg_q.h \
linked_list.h \
loc_cfg.h \
loc_log.h \
loc_target.h \
- loc_timer.h \
- ../platform_lib_abstractions/platform_lib_includes.h \
- ../platform_lib_abstractions/platform_lib_time.h \
- ../platform_lib_abstractions/platform_lib_macros.h
+ loc_timer.h
libgps_utils_so_la_c_sources = \
linked_list.c \
@@ -26,8 +22,7 @@ libgps_utils_so_la_c_sources = \
loc_cfg.cpp \
loc_log.cpp \
loc_timer.c \
- loc_target.cpp \
- ../platform_lib_abstractions/platform_lib_time.cpp
+ loc_target.cpp
library_includedir = $(pkgincludedir)/utils
@@ -45,7 +40,7 @@ libgps_utils_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
-libgps_utils_so_la_LIBADD = -lstdc++ -llog
+libgps_utils_so_la_LIBADD = -lstdc++ -llog $(LOCPLA_LIBS)
#Create and Install libraries
lib_LTLIBRARIES = libgps_utils_so.la
diff --git a/utils/linked_list.c b/utils/linked_list.c
index 92617fe..1109acd 100644
--- a/utils/linked_list.c
+++ b/utils/linked_list.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011,2014 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -31,8 +31,7 @@
#include <string.h>
#define LOG_TAG "LocSvc_utils_ll"
-#include "log_util.h"
-#include "platform_lib_includes.h"
+#include <platform_lib_includes.h>
#include <stdlib.h>
#include <stdint.h>
diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp
index 037ffaf..8c76d1f 100644
--- a/utils/loc_cfg.cpp
+++ b/utils/loc_cfg.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -38,7 +38,7 @@
#include <unistd.h>
#include <time.h>
#include <loc_cfg.h>
-#include <log_util.h>
+#include <platform_lib_includes.h>
#if defined(USE_GLIB) && !defined(OFF_TARGET)
#include <glib.h>
#endif
diff --git a/utils/loc_log.cpp b/utils/loc_log.cpp
index 597b5b6..c64310e 100644
--- a/utils/loc_log.cpp
+++ b/utils/loc_log.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -34,11 +34,7 @@
#include <sys/time.h>
#include "loc_log.h"
#include "msg_q.h"
-#ifdef USE_GLIB
-#include <time.h>
-#endif /* USE_GLIB */
-#include "log_util.h"
-#include "platform_lib_includes.h"
+#include <platform_lib_includes.h>
#define BUFFER_SIZE 120
@@ -180,55 +176,3 @@ char *loc_get_time(char *time_string, unsigned long buf_size)
return time_string;
}
-
-
-/*===========================================================================
-FUNCTION loc_logger_init
-
-DESCRIPTION
- Initializes the state of DEBUG_LEVEL and TIMESTAMP
-
-DEPENDENCIES
- N/A
-
-RETURN VALUE
- None
-
-SIDE EFFECTS
- N/A
-===========================================================================*/
-void loc_logger_init(unsigned long debug, unsigned long timestamp)
-{
- loc_logger.DEBUG_LEVEL = debug;
- loc_logger.TIMESTAMP = timestamp;
-}
-
-
-/*===========================================================================
-FUNCTION get_timestamp
-
-DESCRIPTION
- Generates a timestamp using the current system time
-
-DEPENDENCIES
- N/A
-
-RETURN VALUE
- Char pointer to the parameter str
-
-SIDE EFFECTS
- N/A
-===========================================================================*/
-char * get_timestamp(char *str, unsigned long buf_size)
-{
- struct timeval tv;
- struct timezone tz;
- int hh, mm, ss;
- gettimeofday(&tv, &tz);
- hh = tv.tv_sec/3600%24;
- mm = (tv.tv_sec%3600)/60;
- ss = tv.tv_sec%60;
- snprintf(str, buf_size, "%02d:%02d:%02d.%06ld", hh, mm, ss, tv.tv_usec);
- return str;
-}
-
diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp
index 5eff171..b5a6297 100644
--- a/utils/loc_target.cpp
+++ b/utils/loc_target.cpp
@@ -38,7 +38,6 @@
#include <cutils/properties.h>
#include "loc_target.h"
#include "loc_log.h"
-#include "log_util.h"
#include <platform_lib_includes.h>
#define APQ8064_ID_1 "109"
@@ -109,7 +108,7 @@ static bool is_qca1530(void)
for (i = 0; i < QCA1530_DETECT_TIMEOUT; ++i)
{
- ret = property_get(qca1530_property_name, buf, NULL);
+ ret = platform_lib_abstraction_property_get(qca1530_property_name, buf, NULL);
if (ret < 0)
{
LOC_LOGV( "qca1530: property %s is not accessible, ret=%d",
@@ -165,7 +164,7 @@ unsigned int loc_get_target(void)
goto detected;
}
- property_get("ro.baseband", baseband, "");
+ platform_lib_abstraction_property_get("ro.baseband", baseband, "");
if (!access(hw_platform, F_OK)) {
read_a_line(hw_platform, rd_hw_platform, LINE_LEN);
} else {
diff --git a/utils/loc_timer.h b/utils/loc_timer.h
index 0034d27..5ca1586 100644
--- a/utils/loc_timer.h
+++ b/utils/loc_timer.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -34,7 +34,7 @@
extern "C" {
#endif /* __cplusplus */
#include<pthread.h>
-#include "log_util.h"
+#include <platform_lib_log_util.h>
/*
Return values:
diff --git a/utils/msg_q.c b/utils/msg_q.c
index f82d4c0..1555668 100644
--- a/utils/msg_q.c
+++ b/utils/msg_q.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -29,8 +29,7 @@
#include "msg_q.h"
#define LOG_TAG "LocSvc_utils_q"
-#include "log_util.h"
-#include "platform_lib_includes.h"
+#include <platform_lib_includes.h>
#include "linked_list.h"
#include <stdio.h>
#include <stdlib.h>