sm8450-common: gps: Loc QWES check unify
1 Add context call to get location qwes feature status directly. 2 Add data item to dispatch location qwes feature status. 3 EngineHub uses context call to get location qwes feature status. 4 xtwifi uses data item registration to get location qwes feature status. Change-Id: I489b7fadf2b06a4517ac4b362b6ff4d204f94080 CRs-Fixed: 3435284
This commit is contained in:

committed by
Arian

orang tua
7def8dd105
melakukan
1de9dfed09
@@ -197,7 +197,10 @@ public:
|
|||||||
return mLBSProxy->getIzatDevId();
|
return mLBSProxy->getIzatDevId();
|
||||||
}
|
}
|
||||||
inline void sendMsg(const LocMsg *msg) { getMsgTask()->sendMsg(msg); }
|
inline void sendMsg(const LocMsg *msg) { getMsgTask()->sendMsg(msg); }
|
||||||
|
inline bool checkFeatureStatus(int* fids,
|
||||||
|
LocFeatureStatus* status, uint32_t idCount, bool directQwesCall = false) const {
|
||||||
|
return mLocApiProxy->checkFeatureStatus(fids, status, idCount, directQwesCall);
|
||||||
|
}
|
||||||
static loc_gps_cfg_s_type mGps_conf;
|
static loc_gps_cfg_s_type mGps_conf;
|
||||||
static loc_sap_cfg_s_type mSap_conf;
|
static loc_sap_cfg_s_type mSap_conf;
|
||||||
static bool sIsEngineCapabilitiesKnown;
|
static bool sIsEngineCapabilitiesKnown;
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#endif
|
#endif
|
||||||
|
#include <ContextBase.h>
|
||||||
|
|
||||||
namespace loc_core {
|
namespace loc_core {
|
||||||
|
|
||||||
@@ -151,6 +152,7 @@ typedef std::function<void(const std::unordered_map<LocationQwesFeatureType, boo
|
|||||||
// callback function to report back dr and ppe position and sv report
|
// callback function to report back dr and ppe position and sv report
|
||||||
typedef EngineHubProxyBase* (getEngHubProxyFn)(
|
typedef EngineHubProxyBase* (getEngHubProxyFn)(
|
||||||
const MsgTask * msgTask,
|
const MsgTask * msgTask,
|
||||||
|
const ContextBase * context,
|
||||||
IOsObserver* osObserver,
|
IOsObserver* osObserver,
|
||||||
EngineServiceInfo& engServiceInfo,
|
EngineServiceInfo& engServiceInfo,
|
||||||
GnssAdapterReportEnginePositionsEventCb positionEventCb,
|
GnssAdapterReportEnginePositionsEventCb positionEventCb,
|
||||||
|
@@ -495,6 +495,8 @@ void LocApiBase::reportQwesCapabilities
|
|||||||
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
|
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
//Set Qwes feature status map in ContextBase
|
||||||
|
ContextBase::setQwesFeatureStatus(featureMap);
|
||||||
// loop through adapters, and deliver to all adapters.
|
// loop through adapters, and deliver to all adapters.
|
||||||
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportQwesCapabilities(featureMap));
|
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportQwesCapabilities(featureMap));
|
||||||
}
|
}
|
||||||
|
@@ -145,6 +145,8 @@ public:
|
|||||||
GnssSvMeasurementHeader& svMeasSetHeader __unused,
|
GnssSvMeasurementHeader& svMeasSetHeader __unused,
|
||||||
GnssMeasurementsData& measurementData __unused) { return false; }
|
GnssMeasurementsData& measurementData __unused) { return false; }
|
||||||
inline virtual float getGeoidalSeparation(double latitude __unused, double longitude __unused) { return 0.0; }
|
inline virtual float getGeoidalSeparation(double latitude __unused, double longitude __unused) { return 0.0; }
|
||||||
|
inline virtual bool checkFeatureStatus(int* fids, LocFeatureStatus* status,
|
||||||
|
uint32_t idCount, bool directQwesCall = false) {return false;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class LocApiBase {
|
class LocApiBase {
|
||||||
@@ -187,6 +189,9 @@ public:
|
|||||||
mMsgTask->sendMsg(msg);
|
mMsgTask->sendMsg(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
inline MsgTask* getMsgTask() const {
|
||||||
|
return mMsgTask;
|
||||||
|
}
|
||||||
inline void destroy() {
|
inline void destroy() {
|
||||||
close();
|
close();
|
||||||
struct LocKillMsg : public LocMsg {
|
struct LocKillMsg : public LocMsg {
|
||||||
|
@@ -1809,6 +1809,11 @@ bool SystemStatus::eventDataItemNotify(IDataItemCore* dataitem)
|
|||||||
ret = setIteminReport(mCache.mBtLeDeviceScanDetail, SystemStatusBtleDeviceScanDetail(
|
ret = setIteminReport(mCache.mBtLeDeviceScanDetail, SystemStatusBtleDeviceScanDetail(
|
||||||
*(static_cast<BtLeDeviceScanDetailsDataItem*>(dataitem))));
|
*(static_cast<BtLeDeviceScanDetailsDataItem*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
|
case LOC_FEATURE_STATUS_DATA_ITEM_ID:
|
||||||
|
ret = setIteminReport(mCache.mLocFeatureStatus,
|
||||||
|
SystemStatusLocFeatureStatus(
|
||||||
|
*(static_cast<LocFeatureStatusDataItem*>(dataitem))));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2038,5 +2043,18 @@ void SystemStatus::setTracking(bool tracking) {
|
|||||||
mTracking = tracking;
|
mTracking = tracking;
|
||||||
pthread_mutex_unlock(&mMutexSystemStatus);
|
pthread_mutex_unlock(&mMutexSystemStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
@brief API to update Location feature QWES status
|
||||||
|
|
||||||
|
@param[In] Location feature QWES status
|
||||||
|
|
||||||
|
@return true when successfully done
|
||||||
|
******************************************************************************/
|
||||||
|
bool SystemStatus::eventLocFeatureStatus(std::unordered_set<int> fids) {
|
||||||
|
SystemStatusLocFeatureStatus s(fids);
|
||||||
|
mSysStatusObsvr.notify({&s.mDataItem});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
||||||
|
@@ -842,6 +842,22 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SystemStatusLocFeatureStatus : public SystemStatusItemBase {
|
||||||
|
public:
|
||||||
|
LocFeatureStatusDataItem mDataItem;
|
||||||
|
inline SystemStatusLocFeatureStatus(std::unordered_set<int> fids) : mDataItem(fids) {}
|
||||||
|
inline SystemStatusLocFeatureStatus(const LocFeatureStatusDataItem& itemBase):
|
||||||
|
mDataItem(itemBase) {}
|
||||||
|
inline bool equals(const SystemStatusItemBase& peer) override {
|
||||||
|
return mDataItem.mFids ==
|
||||||
|
((const SystemStatusLocFeatureStatus&)peer).mDataItem.mFids;
|
||||||
|
}
|
||||||
|
inline void dump(void) override {
|
||||||
|
string str;
|
||||||
|
mDataItem.stringify(str);
|
||||||
|
LOC_LOGd("Location feature qwes status: %s", str.c_str());
|
||||||
|
}
|
||||||
|
};
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
SystemStatusReports
|
SystemStatusReports
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
@@ -893,6 +909,7 @@ public:
|
|||||||
std::vector<SystemStatusMccMnc> mMccMnc;
|
std::vector<SystemStatusMccMnc> mMccMnc;
|
||||||
std::vector<SystemStatusBtDeviceScanDetail> mBtDeviceScanDetail;
|
std::vector<SystemStatusBtDeviceScanDetail> mBtDeviceScanDetail;
|
||||||
std::vector<SystemStatusBtleDeviceScanDetail> mBtLeDeviceScanDetail;
|
std::vector<SystemStatusBtleDeviceScanDetail> mBtLeDeviceScanDetail;
|
||||||
|
std::vector<SystemStatusLocFeatureStatus> mLocFeatureStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -945,6 +962,7 @@ public:
|
|||||||
bool eventRegionStatus(bool region);
|
bool eventRegionStatus(bool region);
|
||||||
bool eventInEmergencyCall(bool isEmergency);
|
bool eventInEmergencyCall(bool isEmergency);
|
||||||
void setTracking(bool tracking);
|
void setTracking(bool tracking);
|
||||||
|
bool eventLocFeatureStatus(std::unordered_set<int> fids);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
@@ -128,6 +128,7 @@ SPDX-License-Identifier: BSD-3-Clause-Clear
|
|||||||
#define BATTERYLEVEL_FIELD_BATTERY_PCT "BATTERY_PCT"
|
#define BATTERYLEVEL_FIELD_BATTERY_PCT "BATTERY_PCT"
|
||||||
|
|
||||||
#define IN_EMERGENCY_CALL_FIELD_NAME "IS_EMERGENCY"
|
#define IN_EMERGENCY_CALL_FIELD_NAME "IS_EMERGENCY"
|
||||||
|
#define LOC_FEATURE_STATUS_FIELD_NAME "LOC_FEATURE_STATUS"
|
||||||
|
|
||||||
namespace loc_core
|
namespace loc_core
|
||||||
{
|
{
|
||||||
@@ -959,4 +960,35 @@ int32_t InEmergencyCallDataItem::copyFrom(IDataItemCore* src) {
|
|||||||
EXIT_LOG("%d", result);
|
EXIT_LOG("%d", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocFeatureStatusDataItem::stringify(string& valueStr) {
|
||||||
|
int32_t result = 0;
|
||||||
|
ENTRY_LOG();
|
||||||
|
do {
|
||||||
|
STRINGIFY_ERROR_CHECK_AND_DOWN_CAST(
|
||||||
|
LocFeatureStatusDataItem, LOC_FEATURE_STATUS_DATA_ITEM_ID);
|
||||||
|
valueStr.clear ();
|
||||||
|
valueStr += LOC_FEATURE_STATUS_FIELD_NAME;
|
||||||
|
valueStr += ": {";
|
||||||
|
for (int item : d->mFids) {
|
||||||
|
valueStr += std::to_string(item) + ", ";
|
||||||
|
}
|
||||||
|
valueStr += "}";
|
||||||
|
} while (0);
|
||||||
|
EXIT_LOG_WITH_ERROR("%d", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t LocFeatureStatusDataItem::copyFrom(IDataItemCore* src) {
|
||||||
|
int32_t result = -1;
|
||||||
|
ENTRY_LOG();
|
||||||
|
do {
|
||||||
|
COPIER_ERROR_CHECK_AND_DOWN_CAST(
|
||||||
|
LocFeatureStatusDataItem, LOC_FEATURE_STATUS_DATA_ITEM_ID);
|
||||||
|
s->mFids = d->mFids;
|
||||||
|
result = 0;
|
||||||
|
} while (0);
|
||||||
|
EXIT_LOG("%d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
} //namespace loc_core
|
} //namespace loc_core
|
||||||
|
@@ -43,7 +43,7 @@ SPDX-License-Identifier: BSD-3-Clause-Clear
|
|||||||
#include <IDataItemCore.h>
|
#include <IDataItemCore.h>
|
||||||
#include <gps_extended_c.h>
|
#include <gps_extended_c.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <unordered_set>
|
||||||
#define MAC_ADDRESS_LENGTH 6
|
#define MAC_ADDRESS_LENGTH 6
|
||||||
// MAC address length in bytes
|
// MAC address length in bytes
|
||||||
// QMI_LOC_SRN_MAC_ADDR_LENGTH_V02
|
// QMI_LOC_SRN_MAC_ADDR_LENGTH_V02
|
||||||
@@ -651,6 +651,17 @@ public:
|
|||||||
bool mIsEmergency;
|
bool mIsEmergency;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class LocFeatureStatusDataItem: public IDataItemCore {
|
||||||
|
public:
|
||||||
|
LocFeatureStatusDataItem(std::unordered_set<int> fids) :
|
||||||
|
mFids(fids) {mId = LOC_FEATURE_STATUS_DATA_ITEM_ID;}
|
||||||
|
virtual ~LocFeatureStatusDataItem() {}
|
||||||
|
virtual void stringify(string& /*valueStr*/) override;
|
||||||
|
virtual int32_t copyFrom(IDataItemCore* /*src*/) override;
|
||||||
|
// Data members
|
||||||
|
std::unordered_set<int> mFids;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
||||||
#endif //DATAITEM_CONCRETETYPES_H
|
#endif //DATAITEM_CONCRETETYPES_H
|
||||||
|
@@ -73,6 +73,7 @@ typedef enum e_DataItemId {
|
|||||||
// 26 -
|
// 26 -
|
||||||
BATTERY_LEVEL_DATA_ITEM_ID,
|
BATTERY_LEVEL_DATA_ITEM_ID,
|
||||||
IN_EMERGENCY_CALL_DATA_ITEM_ID,
|
IN_EMERGENCY_CALL_DATA_ITEM_ID,
|
||||||
|
LOC_FEATURE_STATUS_DATA_ITEM_ID,
|
||||||
|
|
||||||
MAX_DATA_ITEM_ID_1_1,
|
MAX_DATA_ITEM_ID_1_1,
|
||||||
} DataItemId;
|
} DataItemId;
|
||||||
|
@@ -116,6 +116,9 @@ IDataItemCore* DataItemsFactoryProxy::createNewDataItem(IDataItemCore* dataItem)
|
|||||||
case BATTERY_LEVEL_DATA_ITEM_ID:
|
case BATTERY_LEVEL_DATA_ITEM_ID:
|
||||||
mydi = new BatteryLevelDataItem(*((BatteryLevelDataItem*)dataItem));
|
mydi = new BatteryLevelDataItem(*((BatteryLevelDataItem*)dataItem));
|
||||||
break;
|
break;
|
||||||
|
case LOC_FEATURE_STATUS_DATA_ITEM_ID:
|
||||||
|
mydi = new LocFeatureStatusDataItem(*((LocFeatureStatusDataItem*)dataItem));
|
||||||
|
break;
|
||||||
case INVALID_DATA_ITEM_ID:
|
case INVALID_DATA_ITEM_ID:
|
||||||
case MAX_DATA_ITEM_ID:
|
case MAX_DATA_ITEM_ID:
|
||||||
default:
|
default:
|
||||||
|
@@ -5208,9 +5208,6 @@ bool GnssAdapter::reportQwesCapabilities(
|
|||||||
mAdapter(adapter),
|
mAdapter(adapter),
|
||||||
mFeatureMap(std::move(featureMap)) {}
|
mFeatureMap(std::move(featureMap)) {}
|
||||||
inline virtual void proc() const {
|
inline virtual void proc() const {
|
||||||
LOC_LOGi("ReportQwesFeatureStatus before caps %" PRIx64 " ",
|
|
||||||
mAdapter.getCapabilities());
|
|
||||||
ContextBase::setQwesFeatureStatus(mFeatureMap);
|
|
||||||
LOC_LOGi("ReportQwesFeatureStatus After caps %" PRIx64 " ",
|
LOC_LOGi("ReportQwesFeatureStatus After caps %" PRIx64 " ",
|
||||||
mAdapter.getCapabilities());
|
mAdapter.getCapabilities());
|
||||||
mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
|
mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
|
||||||
@@ -7164,6 +7161,7 @@ GnssAdapter::initEngHubProxy() {
|
|||||||
|
|
||||||
GnssAdapterUpdateQwesFeatureStatusCb updateQwesFeatureStatusCb =
|
GnssAdapterUpdateQwesFeatureStatusCb updateQwesFeatureStatusCb =
|
||||||
[this] (const std::unordered_map<LocationQwesFeatureType, bool> &featureMap) {
|
[this] (const std::unordered_map<LocationQwesFeatureType, bool> &featureMap) {
|
||||||
|
ContextBase::setQwesFeatureStatus(featureMap);
|
||||||
reportQwesCapabilities(featureMap);
|
reportQwesCapabilities(featureMap);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -7171,7 +7169,8 @@ GnssAdapter::initEngHubProxy() {
|
|||||||
if(getter != nullptr) {
|
if(getter != nullptr) {
|
||||||
// Wait for the script(rootdir/etc/init.qcom.rc) to create socket folder
|
// Wait for the script(rootdir/etc/init.qcom.rc) to create socket folder
|
||||||
locUtilWaitForDir(SOCKET_DIR_EHUB);
|
locUtilWaitForDir(SOCKET_DIR_EHUB);
|
||||||
EngineHubProxyBase* hubProxy = (*getter) (mMsgTask, mSystemStatus->getOsObserver(),
|
EngineHubProxyBase* hubProxy = (*getter) (mMsgTask, mContext,
|
||||||
|
mSystemStatus->getOsObserver(),
|
||||||
engServiceInfo, reportPositionEventCb, reqAidingDataCb,
|
engServiceInfo, reportPositionEventCb, reqAidingDataCb,
|
||||||
updateNHzRequirementCb, updateQwesFeatureStatusCb);
|
updateNHzRequirementCb, updateQwesFeatureStatusCb);
|
||||||
if (hubProxy != nullptr) {
|
if (hubProxy != nullptr) {
|
||||||
|
@@ -2460,6 +2460,13 @@ typedef uint64_t NetworkHandle;
|
|||||||
#define NETWORK_HANDLE_UNKNOWN ~0
|
#define NETWORK_HANDLE_UNKNOWN ~0
|
||||||
#define MAX_NETWORK_HANDLES 10
|
#define MAX_NETWORK_HANDLES 10
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LOC_FEATURE_STATUS_UNKNOWN = 0,
|
||||||
|
LOC_FEATURE_STATUS_NONE = 1,
|
||||||
|
LOC_FEATURE_STATUS_OK = 2,
|
||||||
|
LOC_FEATURE_STATUS_EXPIRED = 3
|
||||||
|
} LocFeatureStatus;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
Reference in New Issue
Block a user