Merge "Concurrent position report: report out SPE fix promptly"
This commit is contained in:
commit
381bde3fcb
2 changed files with 37 additions and 19 deletions
|
@ -2086,7 +2086,9 @@ GnssAdapter::updateClientsEventMask()
|
||||||
{
|
{
|
||||||
LOC_API_ADAPTER_EVENT_MASK_T mask = 0;
|
LOC_API_ADAPTER_EVENT_MASK_T mask = 0;
|
||||||
for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
|
for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
|
||||||
if (it->second.trackingCb != nullptr || it->second.gnssLocationInfoCb != nullptr) {
|
if (it->second.trackingCb != nullptr ||
|
||||||
|
it->second.gnssLocationInfoCb != nullptr ||
|
||||||
|
it->second.engineLocationsInfoCb != nullptr) {
|
||||||
mask |= LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT;
|
mask |= LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT;
|
||||||
}
|
}
|
||||||
if (it->second.gnssSvCb != nullptr) {
|
if (it->second.gnssSvCb != nullptr) {
|
||||||
|
@ -2259,13 +2261,6 @@ GnssAdapter::notifyClientOfCachedLocationSystemInfo(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
GnssAdapter::hasTrackingCallback(LocationAPI* client)
|
|
||||||
{
|
|
||||||
auto it = mClientData.find(client);
|
|
||||||
return (it != mClientData.end() && (it->second.trackingCb || it->second.gnssLocationInfoCb));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
GnssAdapter::isTimeBasedTrackingSession(LocationAPI* client, uint32_t sessionId)
|
GnssAdapter::isTimeBasedTrackingSession(LocationAPI* client, uint32_t sessionId)
|
||||||
{
|
{
|
||||||
|
@ -2281,10 +2276,21 @@ GnssAdapter::isDistanceBasedTrackingSession(LocationAPI* client, uint32_t sessio
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
GnssAdapter::hasMeasurementsCallback(LocationAPI* client)
|
GnssAdapter::hasCallbacksToStartTracking(LocationAPI* client)
|
||||||
{
|
{
|
||||||
|
bool allowed = false;
|
||||||
auto it = mClientData.find(client);
|
auto it = mClientData.find(client);
|
||||||
return (it != mClientData.end() && it->second.gnssMeasurementsCb);
|
if (it != mClientData.end()) {
|
||||||
|
if (it->second.trackingCb || it->second.gnssLocationInfoCb ||
|
||||||
|
it->second.engineLocationsInfoCb || it->second.gnssMeasurementsCb) {
|
||||||
|
allowed = true;
|
||||||
|
} else {
|
||||||
|
LOC_LOGi("missing right callback to start tracking")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOC_LOGi("client %p not found", client)
|
||||||
|
}
|
||||||
|
return allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -2452,8 +2458,7 @@ GnssAdapter::startTrackingCommand(LocationAPI* client, TrackingOptions& options)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LocationError err = LOCATION_ERROR_SUCCESS;
|
LocationError err = LOCATION_ERROR_SUCCESS;
|
||||||
if (!mAdapter.hasTrackingCallback(mClient) &&
|
if (!mAdapter.hasCallbacksToStartTracking(mClient)) {
|
||||||
!mAdapter.hasMeasurementsCallback(mClient)) {
|
|
||||||
err = LOCATION_ERROR_CALLBACK_MISSING;
|
err = LOCATION_ERROR_CALLBACK_MISSING;
|
||||||
} else if (0 == mOptions.size) {
|
} else if (0 == mOptions.size) {
|
||||||
err = LOCATION_ERROR_INVALID_PARAMETER;
|
err = LOCATION_ERROR_INVALID_PARAMETER;
|
||||||
|
@ -3137,21 +3142,35 @@ GnssAdapter::reportPositionEvent(const UlpLocation& ulpLocation,
|
||||||
int msInWeek)
|
int msInWeek)
|
||||||
{
|
{
|
||||||
// this position is from QMI LOC API, then send report to engine hub
|
// this position is from QMI LOC API, then send report to engine hub
|
||||||
// if sending is successful, we return as we will wait for final report from engine hub
|
// also, send out SPE fix promptly to the clients that have registered
|
||||||
// if the position is called from engine hub, then send it out directly
|
// with SPE report
|
||||||
|
LOC_LOGd("reportPositionEvent, eng type: %d, unpro %d, sess status %d",
|
||||||
|
locationExtended.locOutputEngType, ulpLocation.unpropagatedPosition,
|
||||||
|
status);
|
||||||
|
|
||||||
if (true == initEngHubProxy()){
|
if (true == initEngHubProxy()){
|
||||||
|
// send the SPE fix to engine hub
|
||||||
mEngHubProxy->gnssReportPosition(ulpLocation, locationExtended, status);
|
mEngHubProxy->gnssReportPosition(ulpLocation, locationExtended, status);
|
||||||
|
// report out all SPE fix if it is not propagated, even for failed fix
|
||||||
|
if (false == ulpLocation.unpropagatedPosition) {
|
||||||
|
EngineLocationInfo engLocationInfo = {};
|
||||||
|
engLocationInfo.location = ulpLocation;
|
||||||
|
engLocationInfo.locationExtended = locationExtended;
|
||||||
|
engLocationInfo.sessionStatus = status;
|
||||||
|
reportEnginePositionsEvent(1, &engLocationInfo);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// unpropagated report: is only for engine hub to consume and no need
|
||||||
|
// to send out to the clients
|
||||||
if (true == ulpLocation.unpropagatedPosition) {
|
if (true == ulpLocation.unpropagatedPosition) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix is from QMI, and it is not an
|
// Fix is from QMI, and it is not an unpropagated position and engine hub
|
||||||
// unpropagated position and engine hub is not loaded, queue the msg
|
// is not loaded, queue the message when message is processed, the position
|
||||||
// when message is queued, the position can be dispatched to requesting client
|
// can be dispatched to requesting client that registers for SPE report
|
||||||
struct MsgReportPosition : public LocMsg {
|
struct MsgReportPosition : public LocMsg {
|
||||||
GnssAdapter& mAdapter;
|
GnssAdapter& mAdapter;
|
||||||
const UlpLocation mUlpLocation;
|
const UlpLocation mUlpLocation;
|
||||||
|
|
|
@ -246,10 +246,9 @@ public:
|
||||||
/* ======== RESPONSES ================================================================== */
|
/* ======== RESPONSES ================================================================== */
|
||||||
void reportResponse(LocationAPI* client, LocationError err, uint32_t sessionId);
|
void reportResponse(LocationAPI* client, LocationError err, uint32_t sessionId);
|
||||||
/* ======== UTILITIES ================================================================== */
|
/* ======== UTILITIES ================================================================== */
|
||||||
bool hasTrackingCallback(LocationAPI* client);
|
|
||||||
bool isTimeBasedTrackingSession(LocationAPI* client, uint32_t sessionId);
|
bool isTimeBasedTrackingSession(LocationAPI* client, uint32_t sessionId);
|
||||||
bool isDistanceBasedTrackingSession(LocationAPI* client, uint32_t sessionId);
|
bool isDistanceBasedTrackingSession(LocationAPI* client, uint32_t sessionId);
|
||||||
bool hasMeasurementsCallback(LocationAPI* client);
|
bool hasCallbacksToStartTracking(LocationAPI* client);
|
||||||
bool isTrackingSession(LocationAPI* client, uint32_t sessionId);
|
bool isTrackingSession(LocationAPI* client, uint32_t sessionId);
|
||||||
void saveTrackingSession(LocationAPI* client, uint32_t sessionId,
|
void saveTrackingSession(LocationAPI* client, uint32_t sessionId,
|
||||||
const TrackingOptions& trackingOptions);
|
const TrackingOptions& trackingOptions);
|
||||||
|
|
Loading…
Reference in a new issue