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:
parent
7def8dd105
commit
1de9dfed09
12 changed files with 107 additions and 6 deletions
|
@ -197,7 +197,10 @@ public:
|
|||
return mLBSProxy->getIzatDevId();
|
||||
}
|
||||
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_sap_cfg_s_type mSap_conf;
|
||||
static bool sIsEngineCapabilitiesKnown;
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#else
|
||||
#include <unordered_map>
|
||||
#endif
|
||||
#include <ContextBase.h>
|
||||
|
||||
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
|
||||
typedef EngineHubProxyBase* (getEngHubProxyFn)(
|
||||
const MsgTask * msgTask,
|
||||
const ContextBase * context,
|
||||
IOsObserver* osObserver,
|
||||
EngineServiceInfo& engServiceInfo,
|
||||
GnssAdapterReportEnginePositionsEventCb positionEventCb,
|
||||
|
|
|
@ -495,6 +495,8 @@ void LocApiBase::reportQwesCapabilities
|
|||
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.
|
||||
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportQwesCapabilities(featureMap));
|
||||
}
|
||||
|
|
|
@ -145,6 +145,8 @@ public:
|
|||
GnssSvMeasurementHeader& svMeasSetHeader __unused,
|
||||
GnssMeasurementsData& measurementData __unused) { return false; }
|
||||
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 {
|
||||
|
@ -187,6 +189,9 @@ public:
|
|||
mMsgTask->sendMsg(msg);
|
||||
}
|
||||
}
|
||||
inline MsgTask* getMsgTask() const {
|
||||
return mMsgTask;
|
||||
}
|
||||
inline void destroy() {
|
||||
close();
|
||||
struct LocKillMsg : public LocMsg {
|
||||
|
|
|
@ -1809,6 +1809,11 @@ bool SystemStatus::eventDataItemNotify(IDataItemCore* dataitem)
|
|||
ret = setIteminReport(mCache.mBtLeDeviceScanDetail, SystemStatusBtleDeviceScanDetail(
|
||||
*(static_cast<BtLeDeviceScanDetailsDataItem*>(dataitem))));
|
||||
break;
|
||||
case LOC_FEATURE_STATUS_DATA_ITEM_ID:
|
||||
ret = setIteminReport(mCache.mLocFeatureStatus,
|
||||
SystemStatusLocFeatureStatus(
|
||||
*(static_cast<LocFeatureStatusDataItem*>(dataitem))));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -2038,5 +2043,18 @@ void SystemStatus::setTracking(bool tracking) {
|
|||
mTracking = tracking;
|
||||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
******************************************************************************/
|
||||
|
@ -893,6 +909,7 @@ public:
|
|||
std::vector<SystemStatusMccMnc> mMccMnc;
|
||||
std::vector<SystemStatusBtDeviceScanDetail> mBtDeviceScanDetail;
|
||||
std::vector<SystemStatusBtleDeviceScanDetail> mBtLeDeviceScanDetail;
|
||||
std::vector<SystemStatusLocFeatureStatus> mLocFeatureStatus;
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -945,6 +962,7 @@ public:
|
|||
bool eventRegionStatus(bool region);
|
||||
bool eventInEmergencyCall(bool isEmergency);
|
||||
void setTracking(bool tracking);
|
||||
bool eventLocFeatureStatus(std::unordered_set<int> fids);
|
||||
};
|
||||
|
||||
} // namespace loc_core
|
||||
|
|
|
@ -128,6 +128,7 @@ SPDX-License-Identifier: BSD-3-Clause-Clear
|
|||
#define BATTERYLEVEL_FIELD_BATTERY_PCT "BATTERY_PCT"
|
||||
|
||||
#define IN_EMERGENCY_CALL_FIELD_NAME "IS_EMERGENCY"
|
||||
#define LOC_FEATURE_STATUS_FIELD_NAME "LOC_FEATURE_STATUS"
|
||||
|
||||
namespace loc_core
|
||||
{
|
||||
|
@ -959,4 +960,35 @@ int32_t InEmergencyCallDataItem::copyFrom(IDataItemCore* src) {
|
|||
EXIT_LOG("%d", 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
|
||||
|
|
|
@ -43,7 +43,7 @@ SPDX-License-Identifier: BSD-3-Clause-Clear
|
|||
#include <IDataItemCore.h>
|
||||
#include <gps_extended_c.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <unordered_set>
|
||||
#define MAC_ADDRESS_LENGTH 6
|
||||
// MAC address length in bytes
|
||||
// QMI_LOC_SRN_MAC_ADDR_LENGTH_V02
|
||||
|
@ -651,6 +651,17 @@ public:
|
|||
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
|
||||
|
||||
#endif //DATAITEM_CONCRETETYPES_H
|
||||
|
|
|
@ -73,6 +73,7 @@ typedef enum e_DataItemId {
|
|||
// 26 -
|
||||
BATTERY_LEVEL_DATA_ITEM_ID,
|
||||
IN_EMERGENCY_CALL_DATA_ITEM_ID,
|
||||
LOC_FEATURE_STATUS_DATA_ITEM_ID,
|
||||
|
||||
MAX_DATA_ITEM_ID_1_1,
|
||||
} DataItemId;
|
||||
|
|
|
@ -116,6 +116,9 @@ IDataItemCore* DataItemsFactoryProxy::createNewDataItem(IDataItemCore* dataItem)
|
|||
case BATTERY_LEVEL_DATA_ITEM_ID:
|
||||
mydi = new BatteryLevelDataItem(*((BatteryLevelDataItem*)dataItem));
|
||||
break;
|
||||
case LOC_FEATURE_STATUS_DATA_ITEM_ID:
|
||||
mydi = new LocFeatureStatusDataItem(*((LocFeatureStatusDataItem*)dataItem));
|
||||
break;
|
||||
case INVALID_DATA_ITEM_ID:
|
||||
case MAX_DATA_ITEM_ID:
|
||||
default:
|
||||
|
|
|
@ -5208,9 +5208,6 @@ bool GnssAdapter::reportQwesCapabilities(
|
|||
mAdapter(adapter),
|
||||
mFeatureMap(std::move(featureMap)) {}
|
||||
inline virtual void proc() const {
|
||||
LOC_LOGi("ReportQwesFeatureStatus before caps %" PRIx64 " ",
|
||||
mAdapter.getCapabilities());
|
||||
ContextBase::setQwesFeatureStatus(mFeatureMap);
|
||||
LOC_LOGi("ReportQwesFeatureStatus After caps %" PRIx64 " ",
|
||||
mAdapter.getCapabilities());
|
||||
mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
|
||||
|
@ -7164,6 +7161,7 @@ GnssAdapter::initEngHubProxy() {
|
|||
|
||||
GnssAdapterUpdateQwesFeatureStatusCb updateQwesFeatureStatusCb =
|
||||
[this] (const std::unordered_map<LocationQwesFeatureType, bool> &featureMap) {
|
||||
ContextBase::setQwesFeatureStatus(featureMap);
|
||||
reportQwesCapabilities(featureMap);
|
||||
};
|
||||
|
||||
|
@ -7171,7 +7169,8 @@ GnssAdapter::initEngHubProxy() {
|
|||
if(getter != nullptr) {
|
||||
// Wait for the script(rootdir/etc/init.qcom.rc) to create socket folder
|
||||
locUtilWaitForDir(SOCKET_DIR_EHUB);
|
||||
EngineHubProxyBase* hubProxy = (*getter) (mMsgTask, mSystemStatus->getOsObserver(),
|
||||
EngineHubProxyBase* hubProxy = (*getter) (mMsgTask, mContext,
|
||||
mSystemStatus->getOsObserver(),
|
||||
engServiceInfo, reportPositionEventCb, reqAidingDataCb,
|
||||
updateNHzRequirementCb, updateQwesFeatureStatusCb);
|
||||
if (hubProxy != nullptr) {
|
||||
|
|
|
@ -2460,6 +2460,13 @@ typedef uint64_t NetworkHandle;
|
|||
#define NETWORK_HANDLE_UNKNOWN ~0
|
||||
#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
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
Loading…
Reference in a new issue