Merge "Add storing dataitem in systemstatus report"
This commit is contained in:
commit
39419a62e7
6 changed files with 638 additions and 568 deletions
|
@ -29,6 +29,8 @@
|
|||
#include <string>
|
||||
#include "Gnss.h"
|
||||
#include "AGnssRil.h"
|
||||
#include <DataItemConcreteTypesBase.h>
|
||||
|
||||
typedef void* (getLocationInterface)();
|
||||
|
||||
namespace android {
|
||||
|
@ -51,7 +53,35 @@ Return<bool> AGnssRil::updateNetworkState(bool connected, NetworkType type, bool
|
|||
|
||||
// for XTRA
|
||||
if (nullptr != mGnss && ( nullptr != mGnss->getGnssInterface() )) {
|
||||
mGnss->getGnssInterface()->updateConnectionStatus(connected, (int8_t)type);
|
||||
int8_t typeout = loc_core::NetworkInfoDataItemBase::TYPE_UNKNOWN;
|
||||
switch(type)
|
||||
{
|
||||
case IAGnssRil::NetworkType::MOBILE:
|
||||
typeout = loc_core::NetworkInfoDataItemBase::TYPE_MOBILE;
|
||||
break;
|
||||
case IAGnssRil::NetworkType::WIFI:
|
||||
typeout = loc_core::NetworkInfoDataItemBase::TYPE_WIFI;
|
||||
break;
|
||||
case IAGnssRil::NetworkType::MMS:
|
||||
typeout = loc_core::NetworkInfoDataItemBase::TYPE_MMS;
|
||||
break;
|
||||
case IAGnssRil::NetworkType::SUPL:
|
||||
typeout = loc_core::NetworkInfoDataItemBase::TYPE_SUPL;
|
||||
break;
|
||||
case IAGnssRil::NetworkType::DUN:
|
||||
typeout = loc_core::NetworkInfoDataItemBase::TYPE_DUN;
|
||||
break;
|
||||
case IAGnssRil::NetworkType::HIPRI:
|
||||
typeout = loc_core::NetworkInfoDataItemBase::TYPE_HIPRI;
|
||||
break;
|
||||
case IAGnssRil::NetworkType::WIMAX:
|
||||
typeout = loc_core::NetworkInfoDataItemBase::TYPE_WIMAX;
|
||||
break;
|
||||
default:
|
||||
typeout = loc_core::NetworkInfoDataItemBase::TYPE_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
mGnss->getGnssInterface()->updateConnectionStatus(connected, typeout);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -714,7 +714,7 @@ SystemStatusTimeAndClock::SystemStatusTimeAndClock(const SystemStatusPQWM1& nmea
|
|||
{
|
||||
}
|
||||
|
||||
bool SystemStatusTimeAndClock::equals(SystemStatusTimeAndClock& peer)
|
||||
bool SystemStatusTimeAndClock::equals(const SystemStatusTimeAndClock& peer)
|
||||
{
|
||||
if ((mGpsWeek != peer.mGpsWeek) ||
|
||||
(mGpsTowMs != peer.mGpsTowMs) ||
|
||||
|
@ -754,7 +754,7 @@ SystemStatusXoState::SystemStatusXoState(const SystemStatusPQWM1& nmea) :
|
|||
{
|
||||
}
|
||||
|
||||
bool SystemStatusXoState::equals(SystemStatusXoState& peer)
|
||||
bool SystemStatusXoState::equals(const SystemStatusXoState& peer)
|
||||
{
|
||||
if (mXoState != peer.mXoState) {
|
||||
return false;
|
||||
|
@ -796,7 +796,7 @@ SystemStatusRfAndParams::SystemStatusRfAndParams(const SystemStatusPQWM1& nmea)
|
|||
{
|
||||
}
|
||||
|
||||
bool SystemStatusRfAndParams::equals(SystemStatusRfAndParams& peer)
|
||||
bool SystemStatusRfAndParams::equals(const SystemStatusRfAndParams& peer)
|
||||
{
|
||||
if ((mPgaGain != peer.mPgaGain) ||
|
||||
(mGpsBpAmpI != peer.mGpsBpAmpI) ||
|
||||
|
@ -852,7 +852,7 @@ SystemStatusErrRecovery::SystemStatusErrRecovery(const SystemStatusPQWM1& nmea)
|
|||
{
|
||||
}
|
||||
|
||||
bool SystemStatusErrRecovery::equals(SystemStatusErrRecovery& peer)
|
||||
bool SystemStatusErrRecovery::equals(const SystemStatusErrRecovery& peer)
|
||||
{
|
||||
if (mRecErrorRecovery != peer.mRecErrorRecovery) {
|
||||
return false;
|
||||
|
@ -882,7 +882,7 @@ SystemStatusInjectedPosition::SystemStatusInjectedPosition(const SystemStatusPQW
|
|||
{
|
||||
}
|
||||
|
||||
bool SystemStatusInjectedPosition::equals(SystemStatusInjectedPosition& peer)
|
||||
bool SystemStatusInjectedPosition::equals(const SystemStatusInjectedPosition& peer)
|
||||
{
|
||||
if ((mEpiValidity != peer.mEpiValidity) ||
|
||||
(mEpiLat != peer.mEpiLat) ||
|
||||
|
@ -923,7 +923,7 @@ SystemStatusBestPosition::SystemStatusBestPosition(const SystemStatusPQWP2& nmea
|
|||
{
|
||||
}
|
||||
|
||||
bool SystemStatusBestPosition::equals(SystemStatusBestPosition& peer)
|
||||
bool SystemStatusBestPosition::equals(const SystemStatusBestPosition& peer)
|
||||
{
|
||||
if ((mBestLat != peer.mBestLat) ||
|
||||
(mBestLon != peer.mBestLon) ||
|
||||
|
@ -965,7 +965,7 @@ SystemStatusXtra::SystemStatusXtra(const SystemStatusPQWP3& nmea) :
|
|||
{
|
||||
}
|
||||
|
||||
bool SystemStatusXtra::equals(SystemStatusXtra& peer)
|
||||
bool SystemStatusXtra::equals(const SystemStatusXtra& peer)
|
||||
{
|
||||
if ((mXtraValidMask != peer.mXtraValidMask) ||
|
||||
(mGpsXtraAge != peer.mGpsXtraAge) ||
|
||||
|
@ -1013,7 +1013,7 @@ SystemStatusEphemeris::SystemStatusEphemeris(const SystemStatusPQWP4& nmea) :
|
|||
{
|
||||
}
|
||||
|
||||
bool SystemStatusEphemeris::equals(SystemStatusEphemeris& peer)
|
||||
bool SystemStatusEphemeris::equals(const SystemStatusEphemeris& peer)
|
||||
{
|
||||
if ((mGpsEpheValid != peer.mGpsEpheValid) ||
|
||||
(mGloEpheValid != peer.mGloEpheValid) ||
|
||||
|
@ -1059,7 +1059,7 @@ SystemStatusSvHealth::SystemStatusSvHealth(const SystemStatusPQWP5& nmea) :
|
|||
{
|
||||
}
|
||||
|
||||
bool SystemStatusSvHealth::equals(SystemStatusSvHealth& peer)
|
||||
bool SystemStatusSvHealth::equals(const SystemStatusSvHealth& peer)
|
||||
{
|
||||
if ((mGpsUnknownMask != peer.mGpsUnknownMask) ||
|
||||
(mGloUnknownMask != peer.mGloUnknownMask) ||
|
||||
|
@ -1114,7 +1114,7 @@ SystemStatusPdr::SystemStatusPdr(const SystemStatusPQWP6& nmea) :
|
|||
{
|
||||
}
|
||||
|
||||
bool SystemStatusPdr::equals(SystemStatusPdr& peer)
|
||||
bool SystemStatusPdr::equals(const SystemStatusPdr& peer)
|
||||
{
|
||||
if (mFixInfoMask != peer.mFixInfoMask) {
|
||||
return false;
|
||||
|
@ -1140,7 +1140,7 @@ SystemStatusNavData::SystemStatusNavData(const SystemStatusPQWP7& nmea)
|
|||
}
|
||||
}
|
||||
|
||||
bool SystemStatusNavData::equals(SystemStatusNavData& peer)
|
||||
bool SystemStatusNavData::equals(const SystemStatusNavData& peer)
|
||||
{
|
||||
for (uint32_t i=0; i<SV_ALL_NUM; i++) {
|
||||
if ((mNav[i].mType != peer.mNav[i].mType) ||
|
||||
|
@ -1172,7 +1172,7 @@ SystemStatusPositionFailure::SystemStatusPositionFailure(const SystemStatusPQWS1
|
|||
{
|
||||
}
|
||||
|
||||
bool SystemStatusPositionFailure::equals(SystemStatusPositionFailure& peer)
|
||||
bool SystemStatusPositionFailure::equals(const SystemStatusPositionFailure& peer)
|
||||
{
|
||||
if ((mFixInfoMask != peer.mFixInfoMask) ||
|
||||
(mHepeLimit != peer.mHepeLimit)) {
|
||||
|
@ -1193,7 +1193,7 @@ void SystemStatusPositionFailure::dump()
|
|||
/******************************************************************************
|
||||
SystemStatusLocation
|
||||
******************************************************************************/
|
||||
bool SystemStatusLocation::equals(SystemStatusLocation& peer)
|
||||
bool SystemStatusLocation::equals(const SystemStatusLocation& peer)
|
||||
{
|
||||
if ((mLocation.gpsLocation.latitude != peer.mLocation.gpsLocation.latitude) ||
|
||||
(mLocation.gpsLocation.longitude != peer.mLocation.gpsLocation.longitude) ||
|
||||
|
@ -1250,7 +1250,7 @@ IOsObserver* SystemStatus::getOsObserver()
|
|||
}
|
||||
|
||||
SystemStatus::SystemStatus(const MsgTask* msgTask) :
|
||||
mSysStatusObsvr(msgTask),
|
||||
mSysStatusObsvr(this, msgTask),
|
||||
mConnected(false)
|
||||
{
|
||||
int result = 0;
|
||||
|
@ -1272,208 +1272,79 @@ SystemStatus::SystemStatus(const MsgTask* msgTask) :
|
|||
|
||||
mCache.mPositionFailure.clear();
|
||||
|
||||
mCache.mAirplaneMode.clear();
|
||||
mCache.mENH.clear();
|
||||
mCache.mGPSState.clear();
|
||||
mCache.mNLPStatus.clear();
|
||||
mCache.mWifiHardwareState.clear();
|
||||
mCache.mNetworkInfo.clear();
|
||||
mCache.mRilServiceInfo.clear();
|
||||
mCache.mRilCellInfo.clear();
|
||||
mCache.mServiceStatus.clear();
|
||||
mCache.mModel.clear();
|
||||
mCache.mManufacturer.clear();
|
||||
mCache.mAssistedGps.clear();
|
||||
mCache.mScreenState.clear();
|
||||
mCache.mPowerConnectState.clear();
|
||||
mCache.mTimeZoneChange.clear();
|
||||
mCache.mTimeChange.clear();
|
||||
mCache.mWifiSupplicantStatus.clear();
|
||||
mCache.mShutdownState.clear();
|
||||
mCache.mTac.clear();
|
||||
mCache.mMccMnc.clear();
|
||||
mCache.mBtDeviceScanDetail.clear();
|
||||
mCache.mBtLeDeviceScanDetail.clear();
|
||||
|
||||
EXIT_LOG_WITH_ERROR ("%d",result);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
SystemStatus - M1 functions
|
||||
******************************************************************************/
|
||||
bool SystemStatus::setTimeAndCLock(const SystemStatusPQWM1& nmea)
|
||||
{
|
||||
SystemStatusTimeAndClock s(nmea);
|
||||
if (!mCache.mTimeAndClock.empty() && mCache.mTimeAndClock.back().equals(s)) {
|
||||
mCache.mTimeAndClock.back().mUtcReported = s.mUtcReported;
|
||||
} else {
|
||||
mCache.mTimeAndClock.push_back(s);
|
||||
if (mCache.mTimeAndClock.size() > maxTimeAndClock) {
|
||||
mCache.mTimeAndClock.erase(mCache.mTimeAndClock.begin());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SystemStatus::setXoState(const SystemStatusPQWM1& nmea)
|
||||
{
|
||||
SystemStatusXoState s(nmea);
|
||||
if (!mCache.mXoState.empty() && mCache.mXoState.back().equals(s)) {
|
||||
mCache.mXoState.back().mUtcReported = s.mUtcReported;
|
||||
} else {
|
||||
mCache.mXoState.push_back(s);
|
||||
if (mCache.mXoState.size() > maxXoState) {
|
||||
mCache.mXoState.erase(mCache.mXoState.begin());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SystemStatus::setRfAndParams(const SystemStatusPQWM1& nmea)
|
||||
{
|
||||
SystemStatusRfAndParams s(nmea);
|
||||
if (!mCache.mRfAndParams.empty() && mCache.mRfAndParams.back().equals(s)) {
|
||||
mCache.mRfAndParams.back().mUtcReported = s.mUtcReported;
|
||||
} else {
|
||||
mCache.mRfAndParams.push_back(s);
|
||||
if (mCache.mRfAndParams.size() > maxRfAndParams) {
|
||||
mCache.mRfAndParams.erase(mCache.mRfAndParams.begin());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SystemStatus::setErrRecovery(const SystemStatusPQWM1& nmea)
|
||||
{
|
||||
SystemStatusErrRecovery s(nmea);
|
||||
if (!mCache.mErrRecovery.empty() && mCache.mErrRecovery.back().equals(s)) {
|
||||
mCache.mErrRecovery.back().mUtcReported = s.mUtcReported;
|
||||
} else {
|
||||
mCache.mErrRecovery.push_back(s);
|
||||
if (mCache.mErrRecovery.size() > maxErrRecovery) {
|
||||
mCache.mErrRecovery.erase(mCache.mErrRecovery.begin());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
SystemStatus - Px functions
|
||||
******************************************************************************/
|
||||
bool SystemStatus::setInjectedPosition(const SystemStatusPQWP1& nmea)
|
||||
{
|
||||
SystemStatusInjectedPosition s(nmea);
|
||||
if (!mCache.mInjectedPosition.empty() && mCache.mInjectedPosition.back().equals(s)) {
|
||||
mCache.mInjectedPosition.back().mUtcReported = s.mUtcReported;
|
||||
} else {
|
||||
mCache.mInjectedPosition.push_back(s);
|
||||
if (mCache.mInjectedPosition.size() > maxInjectedPosition) {
|
||||
mCache.mInjectedPosition.erase(mCache.mInjectedPosition.begin());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SystemStatus::setBestPosition(const SystemStatusPQWP2& nmea)
|
||||
{
|
||||
SystemStatusBestPosition s(nmea);
|
||||
if (!mCache.mBestPosition.empty() && mCache.mBestPosition.back().equals(s)) {
|
||||
mCache.mBestPosition.back().mUtcReported = s.mUtcReported;
|
||||
} else {
|
||||
mCache.mBestPosition.push_back(s);
|
||||
if (mCache.mBestPosition.size() > maxBestPosition) {
|
||||
mCache.mBestPosition.erase(mCache.mBestPosition.begin());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SystemStatus::setXtra(const SystemStatusPQWP3& nmea)
|
||||
{
|
||||
SystemStatusXtra s(nmea);
|
||||
if (!mCache.mXtra.empty() && mCache.mXtra.back().equals(s)) {
|
||||
mCache.mXtra.back().mUtcReported = s.mUtcReported;
|
||||
} else {
|
||||
mCache.mXtra.push_back(s);
|
||||
if (mCache.mXtra.size() > maxXtra) {
|
||||
mCache.mXtra.erase(mCache.mXtra.begin());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SystemStatus::setEphemeris(const SystemStatusPQWP4& nmea)
|
||||
{
|
||||
SystemStatusEphemeris s(nmea);
|
||||
if (!mCache.mEphemeris.empty() && mCache.mEphemeris.back().equals(s)) {
|
||||
mCache.mEphemeris.back().mUtcReported = s.mUtcReported;
|
||||
} else {
|
||||
mCache.mEphemeris.push_back(s);
|
||||
if (mCache.mEphemeris.size() > maxEphemeris) {
|
||||
mCache.mEphemeris.erase(mCache.mEphemeris.begin());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SystemStatus::setSvHealth(const SystemStatusPQWP5& nmea)
|
||||
{
|
||||
SystemStatusSvHealth s(nmea);
|
||||
if (!mCache.mSvHealth.empty() && mCache.mSvHealth.back().equals(s)) {
|
||||
mCache.mSvHealth.back().mUtcReported = s.mUtcReported;
|
||||
} else {
|
||||
mCache.mSvHealth.push_back(s);
|
||||
if (mCache.mSvHealth.size() > maxSvHealth) {
|
||||
mCache.mSvHealth.erase(mCache.mSvHealth.begin());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SystemStatus::setPdr(const SystemStatusPQWP6& nmea)
|
||||
{
|
||||
SystemStatusPdr s(nmea);
|
||||
if (!mCache.mPdr.empty() && mCache.mPdr.back().equals(s)) {
|
||||
mCache.mPdr.back().mUtcReported = s.mUtcReported;
|
||||
} else {
|
||||
mCache.mPdr.push_back(s);
|
||||
if (mCache.mPdr.size() > maxPdr) {
|
||||
mCache.mPdr.erase(mCache.mPdr.begin());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SystemStatus::setNavData(const SystemStatusPQWP7& nmea)
|
||||
{
|
||||
SystemStatusNavData s(nmea);
|
||||
if (!mCache.mNavData.empty() && mCache.mNavData.back().equals(s)) {
|
||||
mCache.mNavData.back().mUtcReported = s.mUtcReported;
|
||||
} else {
|
||||
mCache.mNavData.push_back(s);
|
||||
if (mCache.mNavData.size() > maxNavData) {
|
||||
mCache.mNavData.erase(mCache.mNavData.begin());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
SystemStatus - Sx functions
|
||||
******************************************************************************/
|
||||
bool SystemStatus::setPositionFailure(const SystemStatusPQWS1& nmea)
|
||||
{
|
||||
SystemStatusPositionFailure s(nmea);
|
||||
if (!mCache.mPositionFailure.empty() && mCache.mPositionFailure.back().equals(s)) {
|
||||
mCache.mPositionFailure.back().mUtcReported = s.mUtcReported;
|
||||
} else {
|
||||
mCache.mPositionFailure.push_back(s);
|
||||
if (mCache.mPositionFailure.size() > maxPositionFailure) {
|
||||
mCache.mPositionFailure.erase(mCache.mPositionFailure.begin());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
SystemStatus - storing dataitems
|
||||
******************************************************************************/
|
||||
bool SystemStatus::setNetworkInfo(IDataItemCore* dataitem)
|
||||
bool SystemStatus::setNetworkInfo(const SystemStatusNetworkInfo& s)
|
||||
{
|
||||
NetworkInfoDataItemBase* data = reinterpret_cast<NetworkInfoDataItemBase*>(dataitem);
|
||||
SystemStatusNetworkInfo s(data->mType,data->mTypeName,data->mSubTypeName,
|
||||
data->mAvailable,data->mConnected,data->mRoaming);
|
||||
s.dump();
|
||||
mConnected = data->mConnected;
|
||||
|
||||
if (!mCache.mNetworkInfo.empty() && mCache.mNetworkInfo.back().equals(s)) {
|
||||
mCache.mNetworkInfo.back().mUtcReported = s.mUtcReported;
|
||||
} else {
|
||||
mCache.mNetworkInfo.push_back(s);
|
||||
if (mCache.mNetworkInfo.size() > maxNetworkInfo) {
|
||||
mCache.mNetworkInfo.erase(mCache.mNetworkInfo.begin());
|
||||
mConnected = s.mConnected;
|
||||
SystemStatusNetworkInfo sout = s;
|
||||
sout.mType = s.getType();
|
||||
return setIteminReport(mCache.mNetworkInfo, sout);
|
||||
}
|
||||
|
||||
template <typename TYPE_REPORT, typename TYPE_ITEM>
|
||||
bool SystemStatus::setIteminReport(TYPE_REPORT& report, const TYPE_ITEM& s)
|
||||
{
|
||||
if (!report.empty() && report.back().equals(s)) {
|
||||
// there is no change - just update reported timestamp
|
||||
report.back().mUtcReported = s.mUtcReported;
|
||||
return false;
|
||||
}
|
||||
|
||||
// first event or updated
|
||||
report.push_back(s);
|
||||
if (report.size() > s.maxItem) {
|
||||
report.erase(report.begin());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename TYPE_REPORT, typename TYPE_ITEM>
|
||||
void SystemStatus::setDefaultIteminReport(TYPE_REPORT& report, const TYPE_ITEM& s)
|
||||
{
|
||||
report.push_back(s);
|
||||
if (report.size() > s.maxItem) {
|
||||
report.erase(report.begin());
|
||||
}
|
||||
}
|
||||
|
||||
template <typename TYPE_REPORT, typename TYPE_ITEM>
|
||||
void SystemStatus::getIteminReport(TYPE_REPORT& reportout, const TYPE_ITEM& c) const
|
||||
{
|
||||
reportout.clear();
|
||||
if (c.size() >= 1) {
|
||||
reportout.push_back(c.back());
|
||||
reportout.back().dump();
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@brief API to set report data into internal buffer
|
||||
|
||||
|
@ -1482,17 +1353,6 @@ bool SystemStatus::setNetworkInfo(IDataItemCore* dataitem)
|
|||
|
||||
@return true when successfully done
|
||||
******************************************************************************/
|
||||
static uint32_t cnt = 0;
|
||||
static uint32_t cnt_m1 = 0;
|
||||
static uint32_t cnt_p1 = 0;
|
||||
static uint32_t cnt_p2 = 0;
|
||||
static uint32_t cnt_p3 = 0;
|
||||
static uint32_t cnt_p4 = 0;
|
||||
static uint32_t cnt_p5 = 0;
|
||||
static uint32_t cnt_p6 = 0;
|
||||
static uint32_t cnt_p7 = 0;
|
||||
static uint32_t cnt_s1 = 0;
|
||||
|
||||
bool SystemStatus::setNmeaString(const char *data, uint32_t len)
|
||||
{
|
||||
bool ret = false;
|
||||
|
@ -1508,59 +1368,46 @@ bool SystemStatus::setNmeaString(const char *data, uint32_t len)
|
|||
// parse the received nmea strings here
|
||||
if (0 == strncmp(data, "$PQWM1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||
SystemStatusPQWM1 s = SystemStatusPQWM1parser(buf, len).get();
|
||||
ret = setTimeAndCLock(s);
|
||||
ret |= setXoState(s);
|
||||
ret |= setRfAndParams(s);
|
||||
ret |= setErrRecovery(s);
|
||||
cnt_m1++;
|
||||
ret |= setIteminReport(mCache.mTimeAndClock, SystemStatusTimeAndClock(s));
|
||||
ret |= setIteminReport(mCache.mXoState, SystemStatusXoState(s));
|
||||
ret |= setIteminReport(mCache.mRfAndParams, SystemStatusRfAndParams(s));
|
||||
ret |= setIteminReport(mCache.mErrRecovery, SystemStatusErrRecovery(s));
|
||||
}
|
||||
else if (0 == strncmp(data, "$PQWP1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||
ret = setInjectedPosition(SystemStatusPQWP1parser(buf, len).get());
|
||||
cnt_p1++;
|
||||
ret = setIteminReport(mCache.mInjectedPosition,
|
||||
SystemStatusInjectedPosition(SystemStatusPQWP1parser(buf, len).get()));
|
||||
}
|
||||
else if (0 == strncmp(data, "$PQWP2", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||
ret = setBestPosition(SystemStatusPQWP2parser(buf, len).get());
|
||||
cnt_p2++;
|
||||
ret = setIteminReport(mCache.mBestPosition,
|
||||
SystemStatusBestPosition(SystemStatusPQWP2parser(buf, len).get()));
|
||||
}
|
||||
else if (0 == strncmp(data, "$PQWP3", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||
ret = setXtra(SystemStatusPQWP3parser(buf, len).get());
|
||||
cnt_p3++;
|
||||
ret = setIteminReport(mCache.mXtra,
|
||||
SystemStatusXtra(SystemStatusPQWP3parser(buf, len).get()));
|
||||
}
|
||||
else if (0 == strncmp(data, "$PQWP4", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||
ret = setEphemeris(SystemStatusPQWP4parser(buf, len).get());
|
||||
cnt_p4++;
|
||||
ret = setIteminReport(mCache.mEphemeris,
|
||||
SystemStatusEphemeris(SystemStatusPQWP4parser(buf, len).get()));
|
||||
}
|
||||
else if (0 == strncmp(data, "$PQWP5", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||
ret = setSvHealth(SystemStatusPQWP5parser(buf, len).get());
|
||||
cnt_p5++;
|
||||
ret = setIteminReport(mCache.mSvHealth,
|
||||
SystemStatusSvHealth(SystemStatusPQWP5parser(buf, len).get()));
|
||||
}
|
||||
else if (0 == strncmp(data, "$PQWP6", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||
ret = setPdr(SystemStatusPQWP6parser(buf, len).get());
|
||||
cnt_p6++;
|
||||
ret = setIteminReport(mCache.mPdr,
|
||||
SystemStatusPdr(SystemStatusPQWP6parser(buf, len).get()));
|
||||
}
|
||||
else if (0 == strncmp(data, "$PQWP7", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||
ret = setNavData(SystemStatusPQWP7parser(buf, len).get());
|
||||
cnt_p7++;
|
||||
ret = setIteminReport(mCache.mNavData,
|
||||
SystemStatusNavData(SystemStatusPQWP7parser(buf, len).get()));
|
||||
}
|
||||
else if (0 == strncmp(data, "$PQWS1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||
ret = setPositionFailure(SystemStatusPQWS1parser(buf, len).get());
|
||||
cnt_s1++;
|
||||
ret = setIteminReport(mCache.mPositionFailure,
|
||||
SystemStatusPositionFailure(SystemStatusPQWS1parser(buf, len).get()));
|
||||
}
|
||||
else {
|
||||
// do nothing
|
||||
}
|
||||
cnt++;
|
||||
LOC_LOGV("setNmeaString: cnt=%d M:%d 1:%d 2:%d 3:%d 4:%d 5:%d 6:%d 7:%d S:%d",
|
||||
cnt,
|
||||
cnt_m1,
|
||||
cnt_p1,
|
||||
cnt_p2,
|
||||
cnt_p3,
|
||||
cnt_p4,
|
||||
cnt_p5,
|
||||
cnt_p6,
|
||||
cnt_p7,
|
||||
cnt_s1);
|
||||
|
||||
pthread_mutex_unlock(&mMutexSystemStatus);
|
||||
return ret;
|
||||
|
@ -1576,22 +1423,18 @@ bool SystemStatus::setNmeaString(const char *data, uint32_t len)
|
|||
bool SystemStatus::eventPosition(const UlpLocation& location,
|
||||
const GpsLocationExtended& locationEx)
|
||||
{
|
||||
SystemStatusLocation s(location, locationEx);
|
||||
if (!mCache.mLocation.empty() && mCache.mLocation.back().equals(s)) {
|
||||
mCache.mLocation.back().mUtcReported = s.mUtcReported;
|
||||
}
|
||||
else {
|
||||
mCache.mLocation.push_back(s);
|
||||
if (mCache.mLocation.size() > maxLocation) {
|
||||
mCache.mLocation.erase(mCache.mLocation.begin());
|
||||
}
|
||||
}
|
||||
bool ret = false;
|
||||
pthread_mutex_lock(&mMutexSystemStatus);
|
||||
|
||||
ret = setIteminReport(mCache.mLocation, SystemStatusLocation(location, locationEx));
|
||||
LOC_LOGV("eventPosition - lat=%f lon=%f alt=%f speed=%f",
|
||||
s.mLocation.gpsLocation.latitude,
|
||||
s.mLocation.gpsLocation.longitude,
|
||||
s.mLocation.gpsLocation.altitude,
|
||||
s.mLocation.gpsLocation.speed);
|
||||
return true;
|
||||
location.gpsLocation.latitude,
|
||||
location.gpsLocation.longitude,
|
||||
location.gpsLocation.altitude,
|
||||
location.gpsLocation.speed);
|
||||
|
||||
pthread_mutex_unlock(&mMutexSystemStatus);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -1599,19 +1442,108 @@ bool SystemStatus::eventPosition(const UlpLocation& location,
|
|||
|
||||
@param[In] DataItem
|
||||
|
||||
@return true when successfully done
|
||||
@return true when info is updatated
|
||||
******************************************************************************/
|
||||
bool SystemStatus::eventDataItemNotify(IDataItemCore* dataitem)
|
||||
{
|
||||
bool ret = false;
|
||||
pthread_mutex_lock(&mMutexSystemStatus);
|
||||
switch(dataitem->getId())
|
||||
{
|
||||
case AIRPLANEMODE_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mAirplaneMode,
|
||||
*(static_cast<SystemStatusAirplaneMode*>(dataitem)));
|
||||
break;
|
||||
case ENH_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mENH,
|
||||
*(static_cast<SystemStatusENH*>(dataitem)));
|
||||
break;
|
||||
case GPSSTATE_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mGPSState,
|
||||
*(static_cast<SystemStatusGpsState*>(dataitem)));
|
||||
break;
|
||||
case NLPSTATUS_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mNLPStatus,
|
||||
*(static_cast<SystemStatusNLPStatus*>(dataitem)));
|
||||
break;
|
||||
case WIFIHARDWARESTATE_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mWifiHardwareState,
|
||||
*(static_cast<SystemStatusWifiHardwareState*>(dataitem)));
|
||||
break;
|
||||
case NETWORKINFO_DATA_ITEM_ID:
|
||||
setNetworkInfo(dataitem);
|
||||
// need special handling for this item to map emums
|
||||
ret = setNetworkInfo(
|
||||
*(static_cast<SystemStatusNetworkInfo*>(dataitem)));
|
||||
break;
|
||||
case RILSERVICEINFO_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mRilServiceInfo,
|
||||
*(static_cast<SystemStatusServiceInfo*>(dataitem)));
|
||||
break;
|
||||
case RILCELLINFO_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mRilCellInfo,
|
||||
*(static_cast<SystemStatusRilCellInfo*>(dataitem)));
|
||||
break;
|
||||
case SERVICESTATUS_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mServiceStatus,
|
||||
*(static_cast<SystemStatusServiceStatus*>(dataitem)));
|
||||
break;
|
||||
case MODEL_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mModel,
|
||||
*(static_cast<SystemStatusModel*>(dataitem)));
|
||||
break;
|
||||
case MANUFACTURER_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mManufacturer,
|
||||
*(static_cast<SystemStatusManufacturer*>(dataitem)));
|
||||
break;
|
||||
case ASSISTED_GPS_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mAssistedGps,
|
||||
*(static_cast<SystemStatusAssistedGps*>(dataitem)));
|
||||
break;
|
||||
case SCREEN_STATE_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mScreenState,
|
||||
*(static_cast<SystemStatusScreenState*>(dataitem)));
|
||||
break;
|
||||
case POWER_CONNECTED_STATE_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mPowerConnectState,
|
||||
*(static_cast<SystemStatusPowerConnectState*>(dataitem)));
|
||||
break;
|
||||
case TIMEZONE_CHANGE_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mTimeZoneChange,
|
||||
*(static_cast<SystemStatusTimeZoneChange*>(dataitem)));
|
||||
break;
|
||||
case TIME_CHANGE_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mTimeChange,
|
||||
*(static_cast<SystemStatusTimeChange*>(dataitem)));
|
||||
break;
|
||||
case WIFI_SUPPLICANT_STATUS_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mWifiSupplicantStatus,
|
||||
*(static_cast<SystemStatusWifiSupplicantStatus*>(dataitem)));
|
||||
break;
|
||||
case SHUTDOWN_STATE_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mShutdownState,
|
||||
*(static_cast<SystemStatusShutdownState*>(dataitem)));
|
||||
break;
|
||||
case TAC_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mTac,
|
||||
*(static_cast<SystemStatusTac*>(dataitem)));
|
||||
break;
|
||||
case MCCMNC_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mMccMnc,
|
||||
*(static_cast<SystemStatusMccMnc*>(dataitem)));
|
||||
break;
|
||||
case BTLE_SCAN_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mBtDeviceScanDetail,
|
||||
*(static_cast<SystemStatusBtDeviceScanDetail*>(dataitem)));
|
||||
break;
|
||||
case BT_SCAN_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mBtLeDeviceScanDetail,
|
||||
*(static_cast<SystemStatusBtleDeviceScanDetail*>(dataitem)));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pthread_mutex_unlock(&mMutexSystemStatus);
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -1628,74 +1560,45 @@ bool SystemStatus::getReport(SystemStatusReports& report, bool isLatestOnly) con
|
|||
|
||||
if (isLatestOnly) {
|
||||
// push back only the latest report and return it
|
||||
report.mLocation.clear();
|
||||
if (mCache.mLocation.size() >= 1) {
|
||||
report.mLocation.push_back(mCache.mLocation.back());
|
||||
report.mLocation.back().dump();
|
||||
}
|
||||
getIteminReport(report.mLocation, mCache.mLocation);
|
||||
|
||||
report.mTimeAndClock.clear();
|
||||
if (mCache.mTimeAndClock.size() >= 1) {
|
||||
report.mTimeAndClock.push_back(mCache.mTimeAndClock.back());
|
||||
report.mTimeAndClock.back().dump();
|
||||
}
|
||||
report.mXoState.clear();
|
||||
if (mCache.mXoState.size() >= 1) {
|
||||
report.mXoState.push_back(mCache.mXoState.back());
|
||||
report.mXoState.back().dump();
|
||||
}
|
||||
report.mRfAndParams.clear();
|
||||
if (mCache.mRfAndParams.size() >= 1) {
|
||||
report.mRfAndParams.push_back(mCache.mRfAndParams.back());
|
||||
report.mRfAndParams.back().dump();
|
||||
}
|
||||
report.mErrRecovery.clear();
|
||||
if (mCache.mErrRecovery.size() >= 1) {
|
||||
report.mErrRecovery.push_back(mCache.mErrRecovery.back());
|
||||
report.mErrRecovery.back().dump();
|
||||
}
|
||||
getIteminReport(report.mTimeAndClock, mCache.mTimeAndClock);
|
||||
getIteminReport(report.mXoState, mCache.mXoState);
|
||||
getIteminReport(report.mRfAndParams, mCache.mRfAndParams);
|
||||
getIteminReport(report.mErrRecovery, mCache.mErrRecovery);
|
||||
|
||||
report.mInjectedPosition.clear();
|
||||
if (mCache.mInjectedPosition.size() >= 1) {
|
||||
report.mInjectedPosition.push_back(mCache.mInjectedPosition.back());
|
||||
report.mInjectedPosition.back().dump();
|
||||
}
|
||||
report.mBestPosition.clear();
|
||||
if (mCache.mBestPosition.size() >= 1) {
|
||||
report.mBestPosition.push_back(mCache.mBestPosition.back());
|
||||
report.mBestPosition.back().dump();
|
||||
}
|
||||
report.mXtra.clear();
|
||||
if (mCache.mXtra.size() >= 1) {
|
||||
report.mXtra.push_back(mCache.mXtra.back());
|
||||
report.mXtra.back().dump();
|
||||
}
|
||||
report.mEphemeris.clear();
|
||||
if (mCache.mEphemeris.size() >= 1) {
|
||||
report.mEphemeris.push_back(mCache.mEphemeris.back());
|
||||
report.mEphemeris.back().dump();
|
||||
}
|
||||
report.mSvHealth.clear();
|
||||
if (mCache.mSvHealth.size() >= 1) {
|
||||
report.mSvHealth.push_back(mCache.mSvHealth.back());
|
||||
report.mSvHealth.back().dump();
|
||||
}
|
||||
report.mPdr.clear();
|
||||
if (mCache.mPdr.size() >= 1) {
|
||||
report.mPdr.push_back(mCache.mPdr.back());
|
||||
report.mPdr.back().dump();
|
||||
}
|
||||
report.mNavData.clear();
|
||||
if (mCache.mNavData.size() >= 1) {
|
||||
report.mNavData.push_back(mCache.mNavData.back());
|
||||
report.mNavData.back().dump();
|
||||
}
|
||||
getIteminReport(report.mInjectedPosition, mCache.mInjectedPosition);
|
||||
getIteminReport(report.mBestPosition, mCache.mBestPosition);
|
||||
getIteminReport(report.mXtra, mCache.mXtra);
|
||||
getIteminReport(report.mEphemeris, mCache.mEphemeris);
|
||||
getIteminReport(report.mSvHealth, mCache.mSvHealth);
|
||||
getIteminReport(report.mPdr, mCache.mPdr);
|
||||
getIteminReport(report.mNavData, mCache.mNavData);
|
||||
|
||||
report.mPositionFailure.clear();
|
||||
if (mCache.mPositionFailure.size() >= 1) {
|
||||
report.mPositionFailure.push_back(mCache.mPositionFailure.back());
|
||||
report.mPositionFailure.back().dump();
|
||||
}
|
||||
getIteminReport(report.mPositionFailure, mCache.mPositionFailure);
|
||||
|
||||
getIteminReport(report.mAirplaneMode, mCache.mAirplaneMode);
|
||||
getIteminReport(report.mENH, mCache.mENH);
|
||||
getIteminReport(report.mGPSState, mCache.mGPSState);
|
||||
getIteminReport(report.mNLPStatus, mCache.mNLPStatus);
|
||||
getIteminReport(report.mWifiHardwareState, mCache.mWifiHardwareState);
|
||||
getIteminReport(report.mNetworkInfo, mCache.mNetworkInfo);
|
||||
getIteminReport(report.mRilServiceInfo, mCache.mRilServiceInfo);
|
||||
getIteminReport(report.mRilCellInfo, mCache.mRilCellInfo);
|
||||
getIteminReport(report.mServiceStatus, mCache.mServiceStatus);
|
||||
getIteminReport(report.mModel, mCache.mModel);
|
||||
getIteminReport(report.mManufacturer, mCache.mManufacturer);
|
||||
getIteminReport(report.mAssistedGps, mCache.mAssistedGps);
|
||||
getIteminReport(report.mScreenState, mCache.mScreenState);
|
||||
getIteminReport(report.mPowerConnectState, mCache.mPowerConnectState);
|
||||
getIteminReport(report.mTimeZoneChange, mCache.mTimeZoneChange);
|
||||
getIteminReport(report.mTimeChange, mCache.mTimeChange);
|
||||
getIteminReport(report.mWifiSupplicantStatus, mCache.mWifiSupplicantStatus);
|
||||
getIteminReport(report.mShutdownState, mCache.mShutdownState);
|
||||
getIteminReport(report.mTac, mCache.mTac);
|
||||
getIteminReport(report.mMccMnc, mCache.mMccMnc);
|
||||
getIteminReport(report.mBtDeviceScanDetail, mCache.mBtDeviceScanDetail);
|
||||
getIteminReport(report.mBtLeDeviceScanDetail, mCache.mBtLeDeviceScanDetail);
|
||||
}
|
||||
else {
|
||||
// copy entire reports and return them
|
||||
|
@ -1715,6 +1618,30 @@ bool SystemStatus::getReport(SystemStatusReports& report, bool isLatestOnly) con
|
|||
report.mNavData.clear();
|
||||
|
||||
report.mPositionFailure.clear();
|
||||
|
||||
report.mAirplaneMode.clear();
|
||||
report.mENH.clear();
|
||||
report.mGPSState.clear();
|
||||
report.mNLPStatus.clear();
|
||||
report.mWifiHardwareState.clear();
|
||||
report.mNetworkInfo.clear();
|
||||
report.mRilServiceInfo.clear();
|
||||
report.mRilCellInfo.clear();
|
||||
report.mServiceStatus.clear();
|
||||
report.mModel.clear();
|
||||
report.mManufacturer.clear();
|
||||
report.mAssistedGps.clear();
|
||||
report.mScreenState.clear();
|
||||
report.mPowerConnectState.clear();
|
||||
report.mTimeZoneChange.clear();
|
||||
report.mTimeChange.clear();
|
||||
report.mWifiSupplicantStatus.clear();
|
||||
report.mShutdownState.clear();
|
||||
report.mTac.clear();
|
||||
report.mMccMnc.clear();
|
||||
report.mBtDeviceScanDetail.clear();
|
||||
report.mBtLeDeviceScanDetail.clear();
|
||||
|
||||
report = mCache;
|
||||
}
|
||||
|
||||
|
@ -1733,61 +1660,45 @@ bool SystemStatus::setDefaultReport(void)
|
|||
{
|
||||
pthread_mutex_lock(&mMutexSystemStatus);
|
||||
|
||||
mCache.mLocation.push_back(SystemStatusLocation());
|
||||
if (mCache.mLocation.size() > maxLocation) {
|
||||
mCache.mLocation.erase(mCache.mLocation.begin());
|
||||
}
|
||||
setDefaultIteminReport(mCache.mLocation, SystemStatusLocation());
|
||||
|
||||
mCache.mTimeAndClock.push_back(SystemStatusTimeAndClock());
|
||||
if (mCache.mTimeAndClock.size() > maxTimeAndClock) {
|
||||
mCache.mTimeAndClock.erase(mCache.mTimeAndClock.begin());
|
||||
}
|
||||
mCache.mXoState.push_back(SystemStatusXoState());
|
||||
if (mCache.mXoState.size() > maxXoState) {
|
||||
mCache.mXoState.erase(mCache.mXoState.begin());
|
||||
}
|
||||
mCache.mRfAndParams.push_back(SystemStatusRfAndParams());
|
||||
if (mCache.mRfAndParams.size() > maxRfAndParams) {
|
||||
mCache.mRfAndParams.erase(mCache.mRfAndParams.begin());
|
||||
}
|
||||
mCache.mErrRecovery.push_back(SystemStatusErrRecovery());
|
||||
if (mCache.mErrRecovery.size() > maxErrRecovery) {
|
||||
mCache.mErrRecovery.erase(mCache.mErrRecovery.begin());
|
||||
}
|
||||
setDefaultIteminReport(mCache.mTimeAndClock, SystemStatusTimeAndClock());
|
||||
setDefaultIteminReport(mCache.mXoState, SystemStatusXoState());
|
||||
setDefaultIteminReport(mCache.mRfAndParams, SystemStatusRfAndParams());
|
||||
setDefaultIteminReport(mCache.mErrRecovery, SystemStatusErrRecovery());
|
||||
|
||||
mCache.mInjectedPosition.push_back(SystemStatusInjectedPosition());
|
||||
if (mCache.mInjectedPosition.size() > maxInjectedPosition) {
|
||||
mCache.mInjectedPosition.erase(mCache.mInjectedPosition.begin());
|
||||
}
|
||||
mCache.mBestPosition.push_back(SystemStatusBestPosition());
|
||||
if (mCache.mBestPosition.size() > maxBestPosition) {
|
||||
mCache.mBestPosition.erase(mCache.mBestPosition.begin());
|
||||
}
|
||||
mCache.mXtra.push_back(SystemStatusXtra());
|
||||
if (mCache.mXtra.size() > maxXtra) {
|
||||
mCache.mXtra.erase(mCache.mXtra.begin());
|
||||
}
|
||||
mCache.mEphemeris.push_back(SystemStatusEphemeris());
|
||||
if (mCache.mEphemeris.size() > maxEphemeris) {
|
||||
mCache.mEphemeris.erase(mCache.mEphemeris.begin());
|
||||
}
|
||||
mCache.mSvHealth.push_back(SystemStatusSvHealth());
|
||||
if (mCache.mSvHealth.size() > maxSvHealth) {
|
||||
mCache.mSvHealth.erase(mCache.mSvHealth.begin());
|
||||
}
|
||||
mCache.mPdr.push_back(SystemStatusPdr());
|
||||
if (mCache.mPdr.size() > maxPdr) {
|
||||
mCache.mPdr.erase(mCache.mPdr.begin());
|
||||
}
|
||||
mCache.mNavData.push_back(SystemStatusNavData());
|
||||
if (mCache.mNavData.size() > maxNavData) {
|
||||
mCache.mNavData.erase(mCache.mNavData.begin());
|
||||
}
|
||||
setDefaultIteminReport(mCache.mInjectedPosition, SystemStatusInjectedPosition());
|
||||
setDefaultIteminReport(mCache.mBestPosition, SystemStatusBestPosition());
|
||||
setDefaultIteminReport(mCache.mXtra, SystemStatusXtra());
|
||||
setDefaultIteminReport(mCache.mEphemeris, SystemStatusEphemeris());
|
||||
setDefaultIteminReport(mCache.mSvHealth, SystemStatusSvHealth());
|
||||
setDefaultIteminReport(mCache.mPdr, SystemStatusPdr());
|
||||
setDefaultIteminReport(mCache.mNavData, SystemStatusNavData());
|
||||
|
||||
mCache.mPositionFailure.push_back(SystemStatusPositionFailure());
|
||||
if (mCache.mPositionFailure.size() > maxPositionFailure) {
|
||||
mCache.mPositionFailure.erase(mCache.mPositionFailure.begin());
|
||||
}
|
||||
setDefaultIteminReport(mCache.mPositionFailure, SystemStatusPositionFailure());
|
||||
|
||||
setDefaultIteminReport(mCache.mAirplaneMode, SystemStatusAirplaneMode());
|
||||
setDefaultIteminReport(mCache.mENH, SystemStatusENH());
|
||||
setDefaultIteminReport(mCache.mGPSState, SystemStatusGpsState());
|
||||
setDefaultIteminReport(mCache.mNLPStatus, SystemStatusNLPStatus());
|
||||
setDefaultIteminReport(mCache.mWifiHardwareState, SystemStatusWifiHardwareState());
|
||||
setDefaultIteminReport(mCache.mNetworkInfo, SystemStatusNetworkInfo());
|
||||
setDefaultIteminReport(mCache.mRilServiceInfo, SystemStatusServiceInfo());
|
||||
setDefaultIteminReport(mCache.mRilCellInfo, SystemStatusRilCellInfo());
|
||||
setDefaultIteminReport(mCache.mServiceStatus, SystemStatusServiceStatus());
|
||||
setDefaultIteminReport(mCache.mModel, SystemStatusModel());
|
||||
setDefaultIteminReport(mCache.mManufacturer, SystemStatusManufacturer());
|
||||
setDefaultIteminReport(mCache.mAssistedGps, SystemStatusAssistedGps());
|
||||
setDefaultIteminReport(mCache.mScreenState, SystemStatusScreenState());
|
||||
setDefaultIteminReport(mCache.mPowerConnectState, SystemStatusPowerConnectState());
|
||||
setDefaultIteminReport(mCache.mTimeZoneChange, SystemStatusTimeZoneChange());
|
||||
setDefaultIteminReport(mCache.mTimeChange, SystemStatusTimeChange());
|
||||
setDefaultIteminReport(mCache.mWifiSupplicantStatus, SystemStatusWifiSupplicantStatus());
|
||||
setDefaultIteminReport(mCache.mShutdownState, SystemStatusShutdownState());
|
||||
setDefaultIteminReport(mCache.mTac, SystemStatusTac());
|
||||
setDefaultIteminReport(mCache.mMccMnc, SystemStatusMccMnc());
|
||||
setDefaultIteminReport(mCache.mBtDeviceScanDetail, SystemStatusBtDeviceScanDetail());
|
||||
setDefaultIteminReport(mCache.mBtLeDeviceScanDetail, SystemStatusBtleDeviceScanDetail());
|
||||
|
||||
pthread_mutex_unlock(&mMutexSystemStatus);
|
||||
return true;
|
||||
|
@ -1807,15 +1718,8 @@ bool SystemStatus::eventConnectionStatus(bool connected, int8_t type)
|
|||
|
||||
// send networkinof dataitem to systemstatus observer clients
|
||||
SystemStatusNetworkInfo s(type, "", "", false, connected, false);
|
||||
IDataItemCore *networkinfo =
|
||||
DataItemsFactoryProxy::createNewDataItem(NETWORKINFO_DATA_ITEM_ID);
|
||||
if (nullptr == networkinfo) {
|
||||
LOC_LOGE("Unable to create dataitemd");
|
||||
return false;
|
||||
}
|
||||
networkinfo->copy(&s);
|
||||
list<IDataItemCore*> dl(0);
|
||||
dl.push_back(networkinfo);
|
||||
dl.push_back(&s);
|
||||
mSysStatusObsvr.notify(dl);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <MsgTask.h>
|
||||
#include <IDataItemCore.h>
|
||||
#include <IOsObserver.h>
|
||||
#include <DataItemConcreteTypesBase.h>
|
||||
#include <SystemStatusOsObserver.h>
|
||||
|
||||
#include <gps_extended_c.h>
|
||||
|
@ -66,6 +67,7 @@ class SystemStatusItemBase
|
|||
public:
|
||||
timespec mUtcTime; // UTC timestamp when this info was last updated
|
||||
timespec mUtcReported; // UTC timestamp when this info was reported
|
||||
static const uint32_t maxItem = 5;
|
||||
|
||||
SystemStatusItemBase() {
|
||||
timeval tv;
|
||||
|
@ -91,7 +93,7 @@ public:
|
|||
mValid(true),
|
||||
mLocation(location),
|
||||
mLocationEx(locationEx) { }
|
||||
bool equals(SystemStatusLocation& peer);
|
||||
bool equals(const SystemStatusLocation& peer);
|
||||
void dump(void);
|
||||
};
|
||||
|
||||
|
@ -119,7 +121,7 @@ public:
|
|||
mLeapSeconds(0),
|
||||
mLeapSecUnc(0) {}
|
||||
inline SystemStatusTimeAndClock(const SystemStatusPQWM1& nmea);
|
||||
bool equals(SystemStatusTimeAndClock& peer);
|
||||
bool equals(const SystemStatusTimeAndClock& peer);
|
||||
void dump(void);
|
||||
};
|
||||
|
||||
|
@ -130,7 +132,7 @@ public:
|
|||
inline SystemStatusXoState() :
|
||||
mXoState(0) {}
|
||||
inline SystemStatusXoState(const SystemStatusPQWM1& nmea);
|
||||
bool equals(SystemStatusXoState& peer);
|
||||
bool equals(const SystemStatusXoState& peer);
|
||||
void dump(void);
|
||||
};
|
||||
|
||||
|
@ -177,7 +179,7 @@ public:
|
|||
mGalBpAmpI(0),
|
||||
mGalBpAmpQ(0) {}
|
||||
inline SystemStatusRfAndParams(const SystemStatusPQWM1& nmea);
|
||||
bool equals(SystemStatusRfAndParams& peer);
|
||||
bool equals(const SystemStatusRfAndParams& peer);
|
||||
void dump(void);
|
||||
};
|
||||
|
||||
|
@ -188,7 +190,7 @@ public:
|
|||
inline SystemStatusErrRecovery() :
|
||||
mRecErrorRecovery(0) {};
|
||||
inline SystemStatusErrRecovery(const SystemStatusPQWM1& nmea);
|
||||
bool equals(SystemStatusErrRecovery& peer);
|
||||
bool equals(const SystemStatusErrRecovery& peer);
|
||||
void dump(void);
|
||||
};
|
||||
|
||||
|
@ -212,7 +214,7 @@ public:
|
|||
mEpiAltUnc(0),
|
||||
mEpiSrc(0) {}
|
||||
inline SystemStatusInjectedPosition(const SystemStatusPQWP1& nmea);
|
||||
bool equals(SystemStatusInjectedPosition& peer);
|
||||
bool equals(const SystemStatusInjectedPosition& peer);
|
||||
void dump(void);
|
||||
};
|
||||
|
||||
|
@ -234,7 +236,7 @@ public:
|
|||
mBestHepe(0),
|
||||
mBestAltUnc(0) {}
|
||||
inline SystemStatusBestPosition(const SystemStatusPQWP2& nmea);
|
||||
bool equals(SystemStatusBestPosition& peer);
|
||||
bool equals(const SystemStatusBestPosition& peer);
|
||||
void dump(void);
|
||||
};
|
||||
|
||||
|
@ -266,7 +268,7 @@ public:
|
|||
mGalXtraValid(0ULL),
|
||||
mQzssXtraValid(0) {}
|
||||
inline SystemStatusXtra(const SystemStatusPQWP3& nmea);
|
||||
bool equals(SystemStatusXtra& peer);
|
||||
bool equals(const SystemStatusXtra& peer);
|
||||
void dump(void);
|
||||
};
|
||||
|
||||
|
@ -286,7 +288,7 @@ public:
|
|||
mGalEpheValid(0ULL),
|
||||
mQzssEpheValid(0) {}
|
||||
inline SystemStatusEphemeris(const SystemStatusPQWP4& nmea);
|
||||
bool equals(SystemStatusEphemeris& peer);
|
||||
bool equals(const SystemStatusEphemeris& peer);
|
||||
void dump(void);
|
||||
};
|
||||
|
||||
|
@ -326,7 +328,7 @@ public:
|
|||
mGalBadMask(0ULL),
|
||||
mQzssBadMask(0) {}
|
||||
inline SystemStatusSvHealth(const SystemStatusPQWP5& nmea);
|
||||
bool equals(SystemStatusSvHealth& peer);
|
||||
bool equals(const SystemStatusSvHealth& peer);
|
||||
void dump(void);
|
||||
};
|
||||
|
||||
|
@ -338,7 +340,7 @@ public:
|
|||
inline SystemStatusPdr() :
|
||||
mFixInfoMask(0) {}
|
||||
inline SystemStatusPdr(const SystemStatusPQWP6& nmea);
|
||||
bool equals(SystemStatusPdr& peer);
|
||||
bool equals(const SystemStatusPdr& peer);
|
||||
void dump(void);
|
||||
};
|
||||
|
||||
|
@ -362,7 +364,7 @@ public:
|
|||
}
|
||||
}
|
||||
inline SystemStatusNavData(const SystemStatusPQWP7& nmea);
|
||||
bool equals(SystemStatusNavData& peer);
|
||||
bool equals(const SystemStatusNavData& peer);
|
||||
void dump(void);
|
||||
};
|
||||
|
||||
|
@ -376,168 +378,294 @@ public:
|
|||
mFixInfoMask(0),
|
||||
mHepeLimit(0) {}
|
||||
inline SystemStatusPositionFailure(const SystemStatusPQWS1& nmea);
|
||||
bool equals(SystemStatusPositionFailure& peer);
|
||||
bool equals(const SystemStatusPositionFailure& peer);
|
||||
void dump(void);
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
SystemStatus report data structure - from DataItem observer
|
||||
******************************************************************************/
|
||||
class SystemStatusGpsState : public SystemStatusItemBase, public IDataItemCore
|
||||
class SystemStatusAirplaneMode : public SystemStatusItemBase,
|
||||
public AirplaneModeDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusGpsState() :
|
||||
mEnabled(false) {}
|
||||
inline SystemStatusGpsState(bool enabled) :
|
||||
mEnabled(enabled) {}
|
||||
inline SystemStatusAirplaneMode(bool mode=false) :
|
||||
AirplaneModeDataItemBase(mode) {}
|
||||
inline bool equals(const SystemStatusAirplaneMode& peer) {
|
||||
return (mMode == peer.mMode);
|
||||
}
|
||||
};
|
||||
|
||||
bool mEnabled;
|
||||
|
||||
inline bool equals(SystemStatusGpsState& peer) {
|
||||
class SystemStatusENH : public SystemStatusItemBase,
|
||||
public ENHDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusENH(bool enabled=false) :
|
||||
ENHDataItemBase(enabled) {}
|
||||
inline bool equals(const SystemStatusENH& peer) {
|
||||
return (mEnabled == peer.mEnabled);
|
||||
}
|
||||
inline void dump(void) {
|
||||
};
|
||||
|
||||
class SystemStatusGpsState : public SystemStatusItemBase,
|
||||
public GPSStateDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusGpsState(bool enabled=false) :
|
||||
GPSStateDataItemBase(enabled) {}
|
||||
inline bool equals(const SystemStatusGpsState& peer) {
|
||||
return (mEnabled == peer.mEnabled);
|
||||
}
|
||||
inline void dump(void) override {
|
||||
LOC_LOGD("GpsState: state=%u", mEnabled);
|
||||
}
|
||||
inline DataItemId getId() {
|
||||
return GPSSTATE_DATA_ITEM_ID;
|
||||
}
|
||||
inline void stringify(string& valueStr) {
|
||||
valueStr.clear();
|
||||
valueStr += "GpsState: enabled=";
|
||||
valueStr += to_string(mEnabled);
|
||||
}
|
||||
inline int32_t copy(IDataItemCore* src, bool* dataItemCopied = nullptr) {
|
||||
SystemStatusGpsState* gpsstate = static_cast<SystemStatusGpsState*>(src);
|
||||
mEnabled = gpsstate->mEnabled;
|
||||
if (dataItemCopied) {
|
||||
*dataItemCopied = true;
|
||||
}
|
||||
return 1;
|
||||
};
|
||||
|
||||
class SystemStatusNLPStatus : public SystemStatusItemBase,
|
||||
public NLPStatusDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusNLPStatus(bool enabled=false) :
|
||||
NLPStatusDataItemBase(enabled) {}
|
||||
inline bool equals(const SystemStatusNLPStatus& peer) {
|
||||
return (mEnabled == peer.mEnabled);
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusNetworkInfo : public SystemStatusItemBase, public IDataItemCore
|
||||
class SystemStatusWifiHardwareState : public SystemStatusItemBase,
|
||||
public WifiHardwareStateDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusNetworkInfo() :
|
||||
mType(0),
|
||||
mTypeName(""),
|
||||
mSubTypeName(""),
|
||||
mAvailable(false),
|
||||
mConnected(false),
|
||||
mRoaming(false) {}
|
||||
inline SystemStatusNetworkInfo(
|
||||
int32_t type,
|
||||
std::string typeName,
|
||||
std::string subTypeName,
|
||||
bool available,
|
||||
bool connected,
|
||||
bool roaming) :
|
||||
mType(type),
|
||||
mTypeName(typeName),
|
||||
mSubTypeName(subTypeName),
|
||||
mAvailable(available),
|
||||
mConnected(connected),
|
||||
mRoaming(roaming) {}
|
||||
|
||||
int32_t mType;
|
||||
std::string mTypeName;
|
||||
std::string mSubTypeName;
|
||||
bool mAvailable;
|
||||
bool mConnected;
|
||||
bool mRoaming;
|
||||
|
||||
inline bool equals(SystemStatusNetworkInfo& peer) {
|
||||
if ((mType != peer.mType) ||
|
||||
(mTypeName != peer.mTypeName) ||
|
||||
(mSubTypeName != peer.mSubTypeName) ||
|
||||
(mAvailable != peer.mAvailable) ||
|
||||
(mConnected != peer.mConnected) ||
|
||||
(mRoaming != peer.mRoaming)) {
|
||||
return false;
|
||||
inline SystemStatusWifiHardwareState(bool enabled=false) :
|
||||
WifiHardwareStateDataItemBase(enabled) {}
|
||||
inline bool equals(const SystemStatusWifiHardwareState& peer) {
|
||||
return (mEnabled == peer.mEnabled);
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusNetworkInfo : public SystemStatusItemBase,
|
||||
public NetworkInfoDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusNetworkInfo(
|
||||
int32_t type=0,
|
||||
std::string typeName="",
|
||||
string subTypeName="",
|
||||
bool available=false,
|
||||
bool connected=false,
|
||||
bool roaming=false) :
|
||||
NetworkInfoDataItemBase(
|
||||
type,
|
||||
typeName,
|
||||
subTypeName,
|
||||
available,
|
||||
connected,
|
||||
roaming) {}
|
||||
inline bool equals(const SystemStatusNetworkInfo& peer) {
|
||||
if ((mType == peer.mType) &&
|
||||
(mTypeName == peer.mTypeName) &&
|
||||
(mSubTypeName == peer.mSubTypeName) &&
|
||||
(mAvailable == peer.mAvailable) &&
|
||||
(mConnected == peer.mConnected) &&
|
||||
(mRoaming == peer.mRoaming)) {
|
||||
return true;
|
||||
}
|
||||
inline void dump(void) {
|
||||
return false;
|
||||
}
|
||||
inline void dump(void) override {
|
||||
LOC_LOGD("NetworkInfo: type=%u connected=%u", mType, mConnected);
|
||||
}
|
||||
inline DataItemId getId() {
|
||||
return NETWORKINFO_DATA_ITEM_ID;
|
||||
}
|
||||
inline void stringify(string& /*valueStr*/) { }
|
||||
inline int32_t copy(IDataItemCore* src, bool* dataItemCopied = nullptr) {
|
||||
SystemStatusNetworkInfo* networkinfo = static_cast<SystemStatusNetworkInfo*>(src);
|
||||
mType = networkinfo->mType;
|
||||
mTypeName = networkinfo->mTypeName;
|
||||
mSubTypeName = networkinfo->mSubTypeName;
|
||||
mAvailable = networkinfo->mAvailable;
|
||||
mConnected = networkinfo->mConnected;
|
||||
mRoaming = networkinfo->mRoaming;
|
||||
if (dataItemCopied) {
|
||||
*dataItemCopied = true;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusTac : public SystemStatusItemBase, public IDataItemCore
|
||||
class SystemStatusServiceInfo : public SystemStatusItemBase,
|
||||
public RilServiceInfoDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusTac() :
|
||||
mValue("") {}
|
||||
inline SystemStatusTac(std::string value) :
|
||||
mValue(value) {}
|
||||
inline SystemStatusServiceInfo() :
|
||||
RilServiceInfoDataItemBase() {}
|
||||
inline bool equals(const SystemStatusServiceInfo& /*peer*/) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
std::string mValue;
|
||||
class SystemStatusRilCellInfo : public SystemStatusItemBase,
|
||||
public RilCellInfoDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusRilCellInfo() :
|
||||
RilCellInfoDataItemBase() {}
|
||||
inline bool equals(const SystemStatusRilCellInfo& /*peer*/) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
inline bool equals(SystemStatusTac& peer) {
|
||||
class SystemStatusServiceStatus : public SystemStatusItemBase,
|
||||
public ServiceStatusDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusServiceStatus(int32_t mServiceState=0) :
|
||||
ServiceStatusDataItemBase(mServiceState) {}
|
||||
inline bool equals(const SystemStatusServiceStatus& peer) {
|
||||
return (mServiceState == peer.mServiceState);
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusModel : public SystemStatusItemBase,
|
||||
public ModelDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusModel(string name="") :
|
||||
ModelDataItemBase(name) {}
|
||||
inline bool equals(const SystemStatusModel& peer) {
|
||||
return (mModel == peer.mModel);
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusManufacturer : public SystemStatusItemBase,
|
||||
public ManufacturerDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusManufacturer(string name="") :
|
||||
ManufacturerDataItemBase(name) {}
|
||||
inline bool equals(const SystemStatusManufacturer& peer) {
|
||||
return (mManufacturer == peer.mManufacturer);
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusAssistedGps : public SystemStatusItemBase,
|
||||
public AssistedGpsDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusAssistedGps(bool enabled=false) :
|
||||
AssistedGpsDataItemBase(enabled) {}
|
||||
inline bool equals(const SystemStatusAssistedGps& peer) {
|
||||
return (mEnabled == peer.mEnabled);
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusScreenState : public SystemStatusItemBase,
|
||||
public ScreenStateDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusScreenState(bool state=false) :
|
||||
ScreenStateDataItemBase(state) {}
|
||||
inline bool equals(const SystemStatusScreenState& peer) {
|
||||
return (mState == peer.mState);
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusPowerConnectState : public SystemStatusItemBase,
|
||||
public PowerConnectStateDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusPowerConnectState(bool state=false) :
|
||||
PowerConnectStateDataItemBase(state) {}
|
||||
inline bool equals(const SystemStatusPowerConnectState& peer) {
|
||||
return (mState == peer.mState);
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusTimeZoneChange : public SystemStatusItemBase,
|
||||
public TimeZoneChangeDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusTimeZoneChange(
|
||||
int64_t currTimeMillis=0ULL, int32_t rawOffset=0, int32_t dstOffset=0) :
|
||||
TimeZoneChangeDataItemBase(currTimeMillis, rawOffset, dstOffset) {}
|
||||
inline bool equals(const SystemStatusTimeZoneChange& peer) {
|
||||
return ((mCurrTimeMillis == peer.mCurrTimeMillis) &&
|
||||
(mRawOffsetTZ == peer.mRawOffsetTZ) &&
|
||||
(mDstOffsetTZ == peer.mDstOffsetTZ));
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusTimeChange : public SystemStatusItemBase,
|
||||
public TimeChangeDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusTimeChange(
|
||||
int64_t currTimeMillis=0ULL, int32_t rawOffset=0, int32_t dstOffset=0) :
|
||||
TimeChangeDataItemBase(currTimeMillis, rawOffset, dstOffset) {}
|
||||
inline bool equals(const SystemStatusTimeChange& peer) {
|
||||
return ((mCurrTimeMillis == peer.mCurrTimeMillis) &&
|
||||
(mRawOffsetTZ == peer.mRawOffsetTZ) &&
|
||||
(mDstOffsetTZ == peer.mDstOffsetTZ));
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusWifiSupplicantStatus : public SystemStatusItemBase,
|
||||
public WifiSupplicantStatusDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusWifiSupplicantStatus() :
|
||||
WifiSupplicantStatusDataItemBase() {}
|
||||
inline bool equals(const SystemStatusWifiSupplicantStatus& peer) {
|
||||
return ((mState == peer.mState) &&
|
||||
(mApMacAddressValid == peer.mApMacAddressValid) &&
|
||||
(mWifiApSsidValid == peer.mWifiApSsidValid) &&
|
||||
(mWifiApSsid == peer.mWifiApSsid));
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusShutdownState : public SystemStatusItemBase,
|
||||
public ShutdownStateDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusShutdownState(bool state=false) :
|
||||
ShutdownStateDataItemBase(state) {}
|
||||
inline bool equals(const SystemStatusShutdownState& peer) {
|
||||
return (mState == peer.mState);
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusTac : public SystemStatusItemBase,
|
||||
public TacDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusTac(std::string value="") :
|
||||
TacDataItemBase(value) {}
|
||||
|
||||
inline bool equals(const SystemStatusTac& peer) {
|
||||
return (mValue == peer.mValue);
|
||||
}
|
||||
inline void dump(void) {
|
||||
LOC_LOGD("Tac: value=%s", mValue.c_str());
|
||||
}
|
||||
inline DataItemId getId() {
|
||||
return TAC_DATA_ITEM_ID;
|
||||
}
|
||||
inline void stringify(string& /*valueStr*/) { }
|
||||
inline int32_t copy(IDataItemCore* src, bool* dataItemCopied = nullptr) {
|
||||
SystemStatusTac* tac = static_cast<SystemStatusTac*>(src);
|
||||
mValue = tac->mValue;
|
||||
if (dataItemCopied) {
|
||||
*dataItemCopied = true;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
class SystemStatusMccMnc : public SystemStatusItemBase, public IDataItemCore
|
||||
class SystemStatusMccMnc : public SystemStatusItemBase,
|
||||
public MccmncDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusMccMnc() :
|
||||
mValue("") {}
|
||||
inline SystemStatusMccMnc(std::string value) :
|
||||
mValue(value) {}
|
||||
|
||||
std::string mValue;
|
||||
|
||||
inline bool equals(SystemStatusMccMnc& peer) {
|
||||
inline SystemStatusMccMnc(std::string value="") :
|
||||
MccmncDataItemBase(value) {}
|
||||
inline bool equals(const SystemStatusMccMnc& peer) {
|
||||
return (mValue == peer.mValue);
|
||||
}
|
||||
inline void dump(void) {
|
||||
LOC_LOGD("TacMccMnc value=%s", mValue.c_str());
|
||||
}
|
||||
inline DataItemId getId() {
|
||||
return MCCMNC_DATA_ITEM_ID;
|
||||
};
|
||||
|
||||
class SystemStatusBtDeviceScanDetail : public SystemStatusItemBase,
|
||||
public BtDeviceScanDetailsDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusBtDeviceScanDetail() :
|
||||
BtDeviceScanDetailsDataItemBase() {}
|
||||
inline bool equals(const SystemStatusBtDeviceScanDetail& /*peer*/) {
|
||||
return true;
|
||||
}
|
||||
inline void stringify(string& /*valueStr*/) { }
|
||||
inline int32_t copy(IDataItemCore* src, bool* dataItemCopied = nullptr) {
|
||||
SystemStatusMccMnc* mccmnc = static_cast<SystemStatusMccMnc*>(src);
|
||||
mValue = mccmnc->mValue;
|
||||
if (dataItemCopied) {
|
||||
*dataItemCopied = true;
|
||||
}
|
||||
return 1;
|
||||
};
|
||||
|
||||
class SystemStatusBtleDeviceScanDetail : public SystemStatusItemBase,
|
||||
public BtLeDeviceScanDetailsDataItemBase
|
||||
{
|
||||
public:
|
||||
inline SystemStatusBtleDeviceScanDetail() :
|
||||
BtLeDeviceScanDetailsDataItemBase() {}
|
||||
inline bool equals(const SystemStatusBtleDeviceScanDetail& /*peer*/) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -569,10 +697,28 @@ public:
|
|||
std::vector<SystemStatusPositionFailure> mPositionFailure;
|
||||
|
||||
// from dataitems observer
|
||||
std::vector<SystemStatusGpsState> mGpsState;
|
||||
std::vector<SystemStatusAirplaneMode> mAirplaneMode;
|
||||
std::vector<SystemStatusENH> mENH;
|
||||
std::vector<SystemStatusGpsState> mGPSState;
|
||||
std::vector<SystemStatusNLPStatus> mNLPStatus;
|
||||
std::vector<SystemStatusWifiHardwareState> mWifiHardwareState;
|
||||
std::vector<SystemStatusNetworkInfo> mNetworkInfo;
|
||||
std::vector<SystemStatusServiceInfo> mRilServiceInfo;
|
||||
std::vector<SystemStatusRilCellInfo> mRilCellInfo;
|
||||
std::vector<SystemStatusServiceStatus> mServiceStatus;
|
||||
std::vector<SystemStatusModel> mModel;
|
||||
std::vector<SystemStatusManufacturer> mManufacturer;
|
||||
std::vector<SystemStatusAssistedGps> mAssistedGps;
|
||||
std::vector<SystemStatusScreenState> mScreenState;
|
||||
std::vector<SystemStatusPowerConnectState> mPowerConnectState;
|
||||
std::vector<SystemStatusTimeZoneChange> mTimeZoneChange;
|
||||
std::vector<SystemStatusTimeChange> mTimeChange;
|
||||
std::vector<SystemStatusWifiSupplicantStatus> mWifiSupplicantStatus;
|
||||
std::vector<SystemStatusShutdownState> mShutdownState;
|
||||
std::vector<SystemStatusTac> mTac;
|
||||
std::vector<SystemStatusMccMnc> mMccMnc;
|
||||
std::vector<SystemStatusBtDeviceScanDetail> mBtDeviceScanDetail;
|
||||
std::vector<SystemStatusBtleDeviceScanDetail> mBtLeDeviceScanDetail;
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -590,50 +736,21 @@ private:
|
|||
|
||||
// Data members
|
||||
static pthread_mutex_t mMutexSystemStatus;
|
||||
|
||||
static const uint32_t maxLocation = 5;
|
||||
|
||||
static const uint32_t maxTimeAndClock = 5;
|
||||
static const uint32_t maxXoState = 5;
|
||||
static const uint32_t maxRfAndParams = 5;
|
||||
static const uint32_t maxErrRecovery = 5;
|
||||
|
||||
static const uint32_t maxInjectedPosition = 5;
|
||||
static const uint32_t maxBestPosition = 5;
|
||||
static const uint32_t maxXtra = 5;
|
||||
static const uint32_t maxEphemeris = 5;
|
||||
static const uint32_t maxSvHealth = 5;
|
||||
static const uint32_t maxPdr = 5;
|
||||
static const uint32_t maxNavData = 5;
|
||||
|
||||
static const uint32_t maxPositionFailure = 5;
|
||||
|
||||
static const uint32_t maxGpsState = 5;
|
||||
static const uint32_t maxNetworkInfo = 5;
|
||||
static const uint32_t maxTac = 5;
|
||||
static const uint32_t maxMccMnc = 5;
|
||||
|
||||
SystemStatusReports mCache;
|
||||
bool mConnected;
|
||||
|
||||
bool setLocation(const UlpLocation& location);
|
||||
// set dataitem derived item in report cache
|
||||
bool setNetworkInfo(const SystemStatusNetworkInfo& s);
|
||||
|
||||
bool setTimeAndCLock(const SystemStatusPQWM1& nmea);
|
||||
bool setXoState(const SystemStatusPQWM1& nmea);
|
||||
bool setRfAndParams(const SystemStatusPQWM1& nmea);
|
||||
bool setErrRecovery(const SystemStatusPQWM1& nmea);
|
||||
template <typename TYPE_REPORT, typename TYPE_ITEM>
|
||||
bool setIteminReport(TYPE_REPORT& report, const TYPE_ITEM& s);
|
||||
|
||||
bool setInjectedPosition(const SystemStatusPQWP1& nmea);
|
||||
bool setBestPosition(const SystemStatusPQWP2& nmea);
|
||||
bool setXtra(const SystemStatusPQWP3& nmea);
|
||||
bool setEphemeris(const SystemStatusPQWP4& nmea);
|
||||
bool setSvHealth(const SystemStatusPQWP5& nmea);
|
||||
bool setPdr(const SystemStatusPQWP6& nmea);
|
||||
bool setNavData(const SystemStatusPQWP7& nmea);
|
||||
// set default dataitem derived item in report cache
|
||||
template <typename TYPE_REPORT, typename TYPE_ITEM>
|
||||
void setDefaultIteminReport(TYPE_REPORT& report, const TYPE_ITEM& s);
|
||||
|
||||
bool setPositionFailure(const SystemStatusPQWS1& nmea);
|
||||
|
||||
bool setNetworkInfo(IDataItemCore* dataitem);
|
||||
template <typename TYPE_REPORT, typename TYPE_ITEM>
|
||||
void getIteminReport(TYPE_REPORT& reportout, const TYPE_ITEM& c) const;
|
||||
|
||||
public:
|
||||
// Static methods
|
||||
|
|
|
@ -39,7 +39,9 @@
|
|||
|
||||
namespace loc_core
|
||||
{
|
||||
SystemStatusOsObserver::SystemStatusOsObserver(const MsgTask* msgTask) :
|
||||
SystemStatusOsObserver::SystemStatusOsObserver(
|
||||
SystemStatus* systemstatus, const MsgTask* msgTask) :
|
||||
mSystemStatus(systemstatus),
|
||||
mAddress("SystemStatusOsObserver"),
|
||||
#ifdef USE_GLIB
|
||||
mBackHaulConnectReqCount(0),
|
||||
|
@ -369,11 +371,11 @@ void SystemStatusOsObserver::notify(const list<IDataItemCore*>& dlist)
|
|||
|
||||
// Copy contents into the newly created data item
|
||||
di->copy(each);
|
||||
dataItemList.push_back(di);
|
||||
|
||||
// Request systemstatus to record this dataitem in its cache
|
||||
SystemStatus* systemstatus = SystemStatus::getInstance(mContext.mMsgTask);
|
||||
if(nullptr != systemstatus) {
|
||||
systemstatus->eventDataItemNotify(di);
|
||||
if (mSystemStatus->eventDataItemNotify(di)) {
|
||||
// add this dataitem if updated from last one
|
||||
dataItemList.push_back(di);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,12 +70,13 @@ typedef map<IDataItemObserver*, list<DataItemId>> ObserverReqCache;
|
|||
// subscribe with OSObserver using IDataItemSubscription interface.
|
||||
// Such clients would need to implement IDataItemObserver interface
|
||||
// to receive data when it becomes available.
|
||||
class SystemStatus;
|
||||
class SystemStatusOsObserver : public IOsObserver {
|
||||
|
||||
public:
|
||||
// ctor
|
||||
SystemStatusOsObserver(const MsgTask* msgTask);
|
||||
|
||||
SystemStatusOsObserver(
|
||||
SystemStatus* systemstatus, const MsgTask* msgTask);
|
||||
// dtor
|
||||
~SystemStatusOsObserver();
|
||||
|
||||
|
@ -115,6 +116,7 @@ public:
|
|||
#endif
|
||||
|
||||
private:
|
||||
SystemStatus* mSystemStatus;
|
||||
SystemContext mContext;
|
||||
const string mAddress;
|
||||
IClientIndex<IDataItemObserver*, DataItemId>* mClientIndex;
|
||||
|
|
|
@ -235,6 +235,21 @@ public:
|
|||
inline virtual DataItemId getId() { return mId; }
|
||||
virtual void stringify(string& /*valueStr*/) {}
|
||||
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
|
||||
enum NetworkType {
|
||||
TYPE_UNKNOWN,
|
||||
TYPE_MOBILE,
|
||||
TYPE_WIFI,
|
||||
TYPE_ETHERNET,
|
||||
TYPE_BLUETOOTH,
|
||||
TYPE_MMS,
|
||||
TYPE_SUPL,
|
||||
TYPE_DUN,
|
||||
TYPE_HIPRI,
|
||||
TYPE_WIMAX
|
||||
};
|
||||
inline virtual NetworkType getType(void) const {
|
||||
return (NetworkType)mType;
|
||||
}
|
||||
// Data members
|
||||
int32_t mType;
|
||||
string mTypeName;
|
||||
|
|
Loading…
Reference in a new issue