summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2019-08-31 08:33:04 -0700
committerLinux Build Service Account <lnxbuild@localhost>2019-08-31 08:33:04 -0700
commite0361a8c9a9b7f4e000966c8b78468aef8c18c95 (patch)
tree940f238e62741f3f20fa1b1dfbbb909dab6c839b
parente38b50370b18bf8056c8120ef21e43223f60bc23 (diff)
parent5ee0b62e8c53ba6a57300541dbbae6b2e9cf9a8a (diff)
downloadgps-e0361a8c9a9b7f4e000966c8b78468aef8c18c95.tar.gz
Merge 5ee0b62e8c53ba6a57300541dbbae6b2e9cf9a8a on remote branch
Change-Id: I1d13d8eb58d08739700ec5bef4221b274dcc630d
-rw-r--r--core/LocApiBase.cpp14
-rw-r--r--core/LocApiBase.h9
-rw-r--r--etc/gps.conf7
-rw-r--r--utils/Makefile.am1
-rw-r--r--utils/gps_extended_c.h21
-rw-r--r--utils/loc_nmea.cpp8
6 files changed, 44 insertions, 16 deletions
diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp
index ef204ec..14472fa 100644
--- a/core/LocApiBase.cpp
+++ b/core/LocApiBase.cpp
@@ -148,7 +148,8 @@ struct LocCloseMsg : public LocMsg {
}
};
-MsgTask* LocApiBase::mMsgTask;
+MsgTask* LocApiBase::mMsgTask = nullptr;
+volatile int32_t LocApiBase::mMsgTaskRefCount = 0;
LocApiBase::LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
ContextBase* context) :
@@ -157,6 +158,7 @@ LocApiBase::LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
{
memset(mLocAdapters, 0, sizeof(mLocAdapters));
+ android_atomic_inc(&mMsgTaskRefCount);
if (nullptr == mMsgTask) {
mMsgTask = new MsgTask("LocApiMsgTask", false);
}
@@ -230,7 +232,7 @@ void LocApiBase::addAdapter(LocAdapterBase* adapter)
for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
if (mLocAdapters[i] == NULL) {
mLocAdapters[i] = adapter;
- mMsgTask->sendMsg(new LocOpenMsg(this, adapter));
+ sendMsg(new LocOpenMsg(this, adapter));
break;
}
}
@@ -263,10 +265,10 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter)
// if we have an empty list of adapters
if (0 == i) {
- mMsgTask->sendMsg(new LocCloseMsg(this));
+ sendMsg(new LocCloseMsg(this));
} else {
// else we need to remove the bit
- mMsgTask->sendMsg(new LocOpenMsg(this));
+ sendMsg(new LocOpenMsg(this));
}
}
}
@@ -274,7 +276,7 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter)
void LocApiBase::updateEvtMask()
{
- mMsgTask->sendMsg(new LocOpenMsg(this));
+ sendMsg(new LocOpenMsg(this));
}
void LocApiBase::updateNmeaMask(uint32_t mask)
@@ -298,7 +300,7 @@ void LocApiBase::updateNmeaMask(uint32_t mask)
}
};
- mMsgTask->sendMsg(new LocSetNmeaMsg(this, mask));
+ sendMsg(new LocSetNmeaMsg(this, mask));
}
void LocApiBase::handleEngineUpEvent()
diff --git a/core/LocApiBase.h b/core/LocApiBase.h
index 8c885f7..6dac585 100644
--- a/core/LocApiBase.h
+++ b/core/LocApiBase.h
@@ -34,6 +34,7 @@
#include <gps_extended.h>
#include <LocationAPI.h>
#include <MsgTask.h>
+#include <LocSharedLock.h>
#include <log_util.h>
namespace loc_core {
@@ -107,6 +108,7 @@ class LocApiBase {
friend struct LocKillMsg;
friend class ContextBase;
static MsgTask* mMsgTask;
+ static volatile int32_t mMsgTaskRefCount;
LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
protected:
@@ -121,7 +123,8 @@ protected:
LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
ContextBase* context = NULL);
inline virtual ~LocApiBase() {
- if (nullptr != mMsgTask) {
+ android_atomic_dec(&mMsgTaskRefCount);
+ if (nullptr != mMsgTask && 0 == mMsgTaskRefCount) {
mMsgTask->destroy();
mMsgTask = nullptr;
}
@@ -132,7 +135,9 @@ protected:
public:
inline void sendMsg(const LocMsg* msg) const {
- mMsgTask->sendMsg(msg);
+ if (nullptr != mMsgTask) {
+ mMsgTask->sendMsg(msg);
+ }
}
inline void destroy() {
close();
diff --git a/etc/gps.conf b/etc/gps.conf
index 35a0a7e..37b67d9 100644
--- a/etc/gps.conf
+++ b/etc/gps.conf
@@ -24,13 +24,6 @@ DEBUG_LEVEL = 3
# Intermediate position report, 1=enable, 0=disable
INTERMEDIATE_POS=0
-# Below bit mask configures how GPS functionalities
-# should be locked when user turns off GPS on Settings
-# Set bit 0x1 if MO GPS functionalities are to be locked
-# Set bit 0x2 if NI GPS functionalities are to be locked
-# default – both MO and NI locked for maximal privacy
-#GPS_LOCK = 3
-
# supl version 1.0
SUPL_VER=0x10000
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 807916d..9a9c67e 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -29,6 +29,7 @@ libgps_utils_la_h_sources = \
gps_extended.h \
loc_gps.h \
log_util.h \
+ LocSharedLock.h \
LocUnorderedSetMap.h
libgps_utils_la_c_sources = \
diff --git a/utils/gps_extended_c.h b/utils/gps_extended_c.h
index b749783..e49b088 100644
--- a/utils/gps_extended_c.h
+++ b/utils/gps_extended_c.h
@@ -826,6 +826,20 @@ typedef uint32_t NmeaSentenceTypesMask;
#define LOC_NMEA_MASK_PQGSA_V02 ((NmeaSentenceTypesMask)0x00008000) /**< Enable PQGSA type */
#define LOC_NMEA_MASK_PQGSV_V02 ((NmeaSentenceTypesMask)0x00010000) /**< Enable PQGSV type */
#define LOC_NMEA_MASK_DEBUG_V02 ((NmeaSentenceTypesMask)0x00020000) /**< Enable DEBUG type */
+#define LOC_NMEA_MASK_GPDTM_V02 ((NmeaSentenceTypesMask)0x00040000) /**< Enable GPDTM type */
+#define LOC_NMEA_MASK_GNGGA_V02 ((NmeaSentenceTypesMask)0x00080000) /**< Enable GNGGA type */
+#define LOC_NMEA_MASK_GNRMC_V02 ((NmeaSentenceTypesMask)0x00100000) /**< Enable GNRMC type */
+#define LOC_NMEA_MASK_GNVTG_V02 ((NmeaSentenceTypesMask)0x00200000) /**< Enable GNVTG type */
+#define LOC_NMEA_MASK_GAGNS_V02 ((NmeaSentenceTypesMask)0x00400000) /**< Enable GAGNS type */
+#define LOC_NMEA_MASK_GBGGA_V02 ((NmeaSentenceTypesMask)0x00800000) /**< Enable GBGGA type */
+#define LOC_NMEA_MASK_GBGSA_V02 ((NmeaSentenceTypesMask)0x01000000) /**< Enable GBGSA type */
+#define LOC_NMEA_MASK_GBGSV_V02 ((NmeaSentenceTypesMask)0x02000000) /**< Enable GBGSV type */
+#define LOC_NMEA_MASK_GBRMC_V02 ((NmeaSentenceTypesMask)0x04000000) /**< Enable GBRMC type */
+#define LOC_NMEA_MASK_GBVTG_V02 ((NmeaSentenceTypesMask)0x08000000) /**< Enable GBVTG type */
+#define LOC_NMEA_MASK_GQGSV_V02 ((NmeaSentenceTypesMask)0x10000000) /**< Enable GQGSV type */
+#define LOC_NMEA_MASK_GIGSV_V02 ((NmeaSentenceTypesMask)0x20000000) /**< Enable GIGSV type */
+#define LOC_NMEA_MASK_GNDTM_V02 ((NmeaSentenceTypesMask)0x40000000) /**< Enable GNDTM type */
+
// all bitmasks of general supported NMEA sentenses - debug is not part of this
#define LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK (LOC_NMEA_MASK_GGA_V02 | LOC_NMEA_MASK_RMC_V02 | \
@@ -833,7 +847,12 @@ typedef uint32_t NmeaSentenceTypesMask;
LOC_NMEA_MASK_PQXFI_V02 | LOC_NMEA_MASK_PSTIS_V02 | LOC_NMEA_MASK_GLGSV_V02 | \
LOC_NMEA_MASK_GNGSA_V02 | LOC_NMEA_MASK_GNGNS_V02 | LOC_NMEA_MASK_GARMC_V02 | \
LOC_NMEA_MASK_GAGSV_V02 | LOC_NMEA_MASK_GAGSA_V02 | LOC_NMEA_MASK_GAVTG_V02 | \
- LOC_NMEA_MASK_GAGGA_V02 | LOC_NMEA_MASK_PQGSA_V02 | LOC_NMEA_MASK_PQGSV_V02)
+ LOC_NMEA_MASK_GAGGA_V02 | LOC_NMEA_MASK_PQGSA_V02 | LOC_NMEA_MASK_PQGSV_V02 | \
+ LOC_NMEA_MASK_GPDTM_V02 | LOC_NMEA_MASK_GNGGA_V02 | LOC_NMEA_MASK_GNRMC_V02 | \
+ LOC_NMEA_MASK_GNVTG_V02 | LOC_NMEA_MASK_GAGNS_V02 | LOC_NMEA_MASK_GBGGA_V02 | \
+ LOC_NMEA_MASK_GBGSA_V02 | LOC_NMEA_MASK_GBGSV_V02 | LOC_NMEA_MASK_GBRMC_V02 | \
+ LOC_NMEA_MASK_GBVTG_V02 | LOC_NMEA_MASK_GQGSV_V02 | LOC_NMEA_MASK_GIGSV_V02 | \
+ LOC_NMEA_MASK_GNDTM_V02)
typedef enum {
LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC = 0,
diff --git a/utils/loc_nmea.cpp b/utils/loc_nmea.cpp
index 2074e3e..41a707d 100644
--- a/utils/loc_nmea.cpp
+++ b/utils/loc_nmea.cpp
@@ -2076,5 +2076,13 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU,
GNSS_SIGNAL_BEIDOU_B2AI,false), nmeaArraystr);
+ // -----------------------------
+ // ------$GIGSV (NAVIC:L5)------
+ // -----------------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_NAVIC,
+ GNSS_SIGNAL_NAVIC_L5,false), nmeaArraystr);
+
EXIT_LOG(%d, 0);
}