Merge "Check the return value of HIDL Callbacks"
This commit is contained in:
commit
82687ac882
4 changed files with 86 additions and 18 deletions
|
@ -157,7 +157,11 @@ void BatchingAPIClient::onBatchingCb(size_t count, Location* location)
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
convertGnssLocation(location[i], locationVec[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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,9 +155,13 @@ void GeofenceAPIClient::onGeofenceBreachCb(GeofenceBreachNotification geofenceBr
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
|
auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
|
||||||
geofenceBreachNotification.ids[i], gnssLocation, transition,
|
geofenceBreachNotification.ids[i], gnssLocation, transition,
|
||||||
static_cast<GnssUtcTime>(geofenceBreachNotification.timestamp));
|
static_cast<GnssUtcTime>(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;
|
GnssLocation gnssLocation;
|
||||||
memset(&gnssLocation, 0, sizeof(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;
|
status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
|
||||||
else if (errors[i] == LOCATION_ERROR_ID_EXISTS)
|
else if (errors[i] == LOCATION_ERROR_ID_EXISTS)
|
||||||
status = IGnssGeofenceCallback::GeofenceStatus::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;
|
status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
|
||||||
else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
|
else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
|
||||||
status = IGnssGeofenceCallback::GeofenceStatus::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;
|
status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
|
||||||
else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
|
else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
|
||||||
status = IGnssGeofenceCallback::GeofenceStatus::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;
|
status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
|
||||||
else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
|
else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
|
||||||
status = IGnssGeofenceCallback::GeofenceStatus::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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,7 +248,11 @@ void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
||||||
data |= IGnssCallback::Capabilities::MSB;
|
data |= IGnssCallback::Capabilities::MSB;
|
||||||
if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)
|
if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)
|
||||||
data |= IGnssCallback::Capabilities::MSA;
|
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) {
|
if (mGnssCbIface != nullptr) {
|
||||||
IGnssCallback::GnssSystemInfo gnssInfo;
|
IGnssCallback::GnssSystemInfo gnssInfo;
|
||||||
|
@ -257,7 +261,11 @@ void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
||||||
gnssInfo.yearOfHw = 2017;
|
gnssInfo.yearOfHw = 2017;
|
||||||
}
|
}
|
||||||
LOC_LOGV("%s:%d] set_system_info_cb (%d)", __FUNCTION__, __LINE__, gnssInfo.yearOfHw);
|
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) {
|
if (mGnssCbIface != nullptr) {
|
||||||
GnssLocation gnssLocation;
|
GnssLocation gnssLocation;
|
||||||
convertGnssLocation(location, 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) {
|
if (mGnssCbIface != nullptr) {
|
||||||
IGnssCallback::GnssSvStatus svStatus;
|
IGnssCallback::GnssSvStatus svStatus;
|
||||||
convertGnssSvStatus(gnssSvNotification, 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) {
|
if (mGnssCbIface != nullptr) {
|
||||||
android::hardware::hidl_string nmeaString;
|
android::hardware::hidl_string nmeaString;
|
||||||
nmeaString.setToExternal(gnssNmeaNotification.nmea, gnssNmeaNotification.length);
|
nmeaString.setToExternal(gnssNmeaNotification.nmea, gnssNmeaNotification.length);
|
||||||
mGnssCbIface->gnssNmeaCb(static_cast<GnssUtcTime>(gnssNmeaNotification.timestamp),
|
auto r = mGnssCbIface->gnssNmeaCb(
|
||||||
nmeaString);
|
static_cast<GnssUtcTime>(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);
|
LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
|
||||||
if (error == LOCATION_ERROR_SUCCESS && mGnssCbIface != nullptr) {
|
if (error == LOCATION_ERROR_SUCCESS && mGnssCbIface != nullptr) {
|
||||||
mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON);
|
auto r = mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON);
|
||||||
mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_BEGIN);
|
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);
|
LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
|
||||||
if (error == LOCATION_ERROR_SUCCESS && mGnssCbIface != nullptr) {
|
if (error == LOCATION_ERROR_SUCCESS && mGnssCbIface != nullptr) {
|
||||||
mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END);
|
auto r = mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END);
|
||||||
mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_OFF);
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,11 @@ void MeasurementAPIClient::onGnssMeasurementsCb(
|
||||||
if (mGnssMeasurementCbIface != nullptr) {
|
if (mGnssMeasurementCbIface != nullptr) {
|
||||||
IGnssMeasurementCallback::GnssData gnssData;
|
IGnssMeasurementCallback::GnssData gnssData;
|
||||||
convertGnssData(gnssMeasurementsNotification, 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);
|
pthread_mutex_unlock(&mLock);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue