diff --git a/android/location_api/BatchingAPIClient.cpp b/android/location_api/BatchingAPIClient.cpp index 6022fbfa..73255926 100644 --- a/android/location_api/BatchingAPIClient.cpp +++ b/android/location_api/BatchingAPIClient.cpp @@ -157,7 +157,11 @@ void BatchingAPIClient::onBatchingCb(size_t count, Location* location) for (size_t i = 0; i < count; i++) { convertGnssLocation(location[i], locationVec[i]); } - mGnssBatchingCbIface->gnssLocationBatchCb(locationVec); + auto r = mGnssBatchingCbIface->gnssLocationBatchCb(locationVec); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssLocationBatchCb description=%s", + __func__, r.description().c_str()); + } } } diff --git a/android/location_api/GeofenceAPIClient.cpp b/android/location_api/GeofenceAPIClient.cpp index ee4bfc38..65bd6629 100644 --- a/android/location_api/GeofenceAPIClient.cpp +++ b/android/location_api/GeofenceAPIClient.cpp @@ -155,9 +155,13 @@ void GeofenceAPIClient::onGeofenceBreachCb(GeofenceBreachNotification geofenceBr continue; } - mGnssGeofencingCbIface->gnssGeofenceTransitionCb( + auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb( geofenceBreachNotification.ids[i], gnssLocation, transition, static_cast(geofenceBreachNotification.timestamp)); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssGeofenceTransitionCb description=%s", + __func__, r.description().c_str()); + } } } } @@ -173,7 +177,11 @@ void GeofenceAPIClient::onGeofenceStatusCb(GeofenceStatusNotification geofenceSt } GnssLocation gnssLocation; memset(&gnssLocation, 0, sizeof(GnssLocation)); - mGnssGeofencingCbIface->gnssGeofenceStatusCb(status, gnssLocation); + auto r = mGnssGeofencingCbIface->gnssGeofenceStatusCb(status, gnssLocation); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssGeofenceStatusCb description=%s", + __func__, r.description().c_str()); + } } } @@ -188,7 +196,11 @@ void GeofenceAPIClient::onAddGeofencesCb(size_t count, LocationError* errors, ui status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS; else if (errors[i] == LOCATION_ERROR_ID_EXISTS) status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_EXISTS; - mGnssGeofencingCbIface->gnssGeofenceAddCb(ids[i], status); + auto r = mGnssGeofencingCbIface->gnssGeofenceAddCb(ids[i], status); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssGeofenceAddCb description=%s", + __func__, r.description().c_str()); + } } } } @@ -204,7 +216,11 @@ void GeofenceAPIClient::onRemoveGeofencesCb(size_t count, LocationError* errors, status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS; else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN) status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN; - mGnssGeofencingCbIface->gnssGeofenceRemoveCb(ids[i], status); + auto r = mGnssGeofencingCbIface->gnssGeofenceRemoveCb(ids[i], status); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssGeofenceRemoveCb description=%s", + __func__, r.description().c_str()); + } } } } @@ -220,7 +236,11 @@ void GeofenceAPIClient::onPauseGeofencesCb(size_t count, LocationError* errors, status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS; else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN) status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN; - mGnssGeofencingCbIface->gnssGeofencePauseCb(ids[i], status); + auto r = mGnssGeofencingCbIface->gnssGeofencePauseCb(ids[i], status); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssGeofencePauseCb description=%s", + __func__, r.description().c_str()); + } } } } @@ -236,7 +256,11 @@ void GeofenceAPIClient::onResumeGeofencesCb(size_t count, LocationError* errors, status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS; else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN) status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN; - mGnssGeofencingCbIface->gnssGeofenceResumeCb(ids[i], status); + auto r = mGnssGeofencingCbIface->gnssGeofenceResumeCb(ids[i], status); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssGeofenceResumeCb description=%s", + __func__, r.description().c_str()); + } } } } diff --git a/android/location_api/GnssAPIClient.cpp b/android/location_api/GnssAPIClient.cpp index 99b801e9..9fff6954 100644 --- a/android/location_api/GnssAPIClient.cpp +++ b/android/location_api/GnssAPIClient.cpp @@ -248,7 +248,11 @@ void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) data |= IGnssCallback::Capabilities::MSB; if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSA_BIT) data |= IGnssCallback::Capabilities::MSA; - mGnssCbIface->gnssSetCapabilitesCb(data); + auto r = mGnssCbIface->gnssSetCapabilitesCb(data); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssSetCapabilitesCb description=%s", + __func__, r.description().c_str()); + } } if (mGnssCbIface != nullptr) { IGnssCallback::GnssSystemInfo gnssInfo; @@ -257,7 +261,11 @@ void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) gnssInfo.yearOfHw = 2017; } LOC_LOGV("%s:%d] set_system_info_cb (%d)", __FUNCTION__, __LINE__, gnssInfo.yearOfHw); - mGnssCbIface->gnssSetSystemInfoCb(gnssInfo); + auto r = mGnssCbIface->gnssSetSystemInfoCb(gnssInfo); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssSetSystemInfoCb description=%s", + __func__, r.description().c_str()); + } } } @@ -267,7 +275,11 @@ void GnssAPIClient::onTrackingCb(Location location) if (mGnssCbIface != nullptr) { GnssLocation gnssLocation; convertGnssLocation(location, gnssLocation); - mGnssCbIface->gnssLocationCb(gnssLocation); + auto r = mGnssCbIface->gnssLocationCb(gnssLocation); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssLocationCb description=%s", + __func__, r.description().c_str()); + } } } @@ -353,7 +365,11 @@ void GnssAPIClient::onGnssSvCb(GnssSvNotification gnssSvNotification) if (mGnssCbIface != nullptr) { IGnssCallback::GnssSvStatus svStatus; convertGnssSvStatus(gnssSvNotification, svStatus); - mGnssCbIface->gnssSvStatusCb(svStatus); + auto r = mGnssCbIface->gnssSvStatusCb(svStatus); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssSvStatusCb description=%s", + __func__, r.description().c_str()); + } } } @@ -362,8 +378,12 @@ void GnssAPIClient::onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification) if (mGnssCbIface != nullptr) { android::hardware::hidl_string nmeaString; nmeaString.setToExternal(gnssNmeaNotification.nmea, gnssNmeaNotification.length); - mGnssCbIface->gnssNmeaCb(static_cast(gnssNmeaNotification.timestamp), - nmeaString); + auto r = mGnssCbIface->gnssNmeaCb( + static_cast(gnssNmeaNotification.timestamp), nmeaString); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssNmeaCb nmea=%s length=%u description=%s", __func__, + gnssNmeaNotification.nmea, gnssNmeaNotification.length, r.description().c_str()); + } } } @@ -371,8 +391,16 @@ void GnssAPIClient::onStartTrackingCb(LocationError error) { LOC_LOGD("%s]: (%d)", __FUNCTION__, error); if (error == LOCATION_ERROR_SUCCESS && mGnssCbIface != nullptr) { - mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON); - mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_BEGIN); + auto r = mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssStatusCb ENGINE_ON description=%s", + __func__, r.description().c_str()); + } + r = mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_BEGIN); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssStatusCb SESSION_BEGIN description=%s", + __func__, r.description().c_str()); + } } } @@ -380,8 +408,16 @@ void GnssAPIClient::onStopTrackingCb(LocationError error) { LOC_LOGD("%s]: (%d)", __FUNCTION__, error); if (error == LOCATION_ERROR_SUCCESS && mGnssCbIface != nullptr) { - mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END); - mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_OFF); + auto r = mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssStatusCb SESSION_END description=%s", + __func__, r.description().c_str()); + } + r = mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_OFF); + if (!r.isOk()) { + LOC_LOGE("%s] Error from gnssStatusCb ENGINE_OFF description=%s", + __func__, r.description().c_str()); + } } } diff --git a/android/location_api/MeasurementAPIClient.cpp b/android/location_api/MeasurementAPIClient.cpp index 8e6f48c6..ea1171b0 100644 --- a/android/location_api/MeasurementAPIClient.cpp +++ b/android/location_api/MeasurementAPIClient.cpp @@ -146,7 +146,11 @@ void MeasurementAPIClient::onGnssMeasurementsCb( if (mGnssMeasurementCbIface != nullptr) { IGnssMeasurementCallback::GnssData gnssData; convertGnssData(gnssMeasurementsNotification, gnssData); - mGnssMeasurementCbIface->GnssMeasurementCb(gnssData); + auto r = mGnssMeasurementCbIface->GnssMeasurementCb(gnssData); + if (!r.isOk()) { + LOC_LOGE("%s] Error from GnssMeasurementCb description=%s", + __func__, r.description().c_str()); + } } pthread_mutex_unlock(&mLock); }