diff --git a/android/Android.mk b/android/Android.mk index e359e88f..b493f5e7 100644 --- a/android/Android.mk +++ b/android/Android.mk @@ -17,8 +17,8 @@ LOCAL_SRC_FILES += \ location_api/LocationUtil.cpp \ location_api/GnssAPIClient.cpp \ location_api/GeofenceAPIClient.cpp \ - location_api/FlpAPIClient.cpp \ - location_api/GnssMeasurementAPIClient.cpp \ + location_api/BatchingAPIClient.cpp \ + location_api/MeasurementAPIClient.cpp \ LOCAL_C_INCLUDES:= \ $(LOCAL_PATH)/location_api \ diff --git a/android/GnssBatching.cpp b/android/GnssBatching.cpp index 5eff8199..a78989cd 100644 --- a/android/GnssBatching.cpp +++ b/android/GnssBatching.cpp @@ -21,7 +21,7 @@ #define LOG_TAG "LocSvc_GnssBatchingInterface" #include -#include +#include #include "GnssBatching.h" namespace android { @@ -59,7 +59,7 @@ Return GnssBatching::init(const sp& callback) { return false; } - mApi = new FlpAPIClient(callback); + mApi = new BatchingAPIClient(callback); if (mApi == nullptr) { LOC_LOGE("%s]: failed to create mApi", __FUNCTION__); return false; @@ -81,7 +81,7 @@ Return GnssBatching::getBatchSize() { if (mApi == nullptr) { LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__); } else { - ret = mApi->flpGetBatchSize(); + ret = mApi->getBatchSize(); } return ret; } @@ -91,7 +91,7 @@ Return GnssBatching::start(const IGnssBatching::Options& options) { if (mApi == nullptr) { LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__); } else { - ret = mApi->flpStartSession(options); + ret = mApi->startSession(options); } return ret; } @@ -100,7 +100,7 @@ Return GnssBatching::flush() { if (mApi == nullptr) { LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__); } else { - mApi->flpFlushBatchedLocations(); + mApi->flushBatchedLocations(); } return Void(); } @@ -110,7 +110,7 @@ Return GnssBatching::stop() { if (mApi == nullptr) { LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__); } else { - ret = mApi->flpStopSession(); + ret = mApi->stopSession(); } return ret; } diff --git a/android/GnssBatching.h b/android/GnssBatching.h index b46fae8e..de5d5c37 100644 --- a/android/GnssBatching.h +++ b/android/GnssBatching.h @@ -42,7 +42,7 @@ using ::android::hardware::Return; using ::android::hardware::Void; using ::android::sp; -class FlpAPIClient; +class BatchingAPIClient; struct GnssBatching : public IGnssBatching { GnssBatching(); ~GnssBatching(); @@ -68,7 +68,7 @@ struct GnssBatching : public IGnssBatching { private: sp mGnssBatchingDeathRecipient = nullptr; sp mGnssBatchingCbIface = nullptr; - FlpAPIClient* mApi = nullptr; + BatchingAPIClient* mApi = nullptr; }; } // namespace implementation diff --git a/android/GnssMeasurement.cpp b/android/GnssMeasurement.cpp index bc07265c..8cbfabdf 100644 --- a/android/GnssMeasurement.cpp +++ b/android/GnssMeasurement.cpp @@ -21,7 +21,7 @@ #define LOG_TAG "LocSvc_GnssMeasurementInterface" #include -#include +#include #include "GnssMeasurement.h" namespace android { @@ -41,7 +41,7 @@ void GnssMeasurement::GnssMeasurementDeathRecipient::serviceDied( GnssMeasurement::GnssMeasurement() { mGnssMeasurementDeathRecipient = new GnssMeasurementDeathRecipient(this); - mApi = new GnssMeasurementAPIClient(); + mApi = new MeasurementAPIClient(); } GnssMeasurement::~GnssMeasurement() { @@ -74,7 +74,7 @@ Return GnssMeasurement::setCallback( mGnssMeasurementCbIface = callback; mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0 /*cookie*/); - return mApi->gnssMeasurementSetCallback(callback); + return mApi->measurementSetCallback(callback); } Return GnssMeasurement::close() { @@ -87,7 +87,7 @@ Return GnssMeasurement::close() { mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient); mGnssMeasurementCbIface = nullptr; } - mApi->gnssMeasurementClose(); + mApi->measurementClose(); return Void(); } diff --git a/android/GnssMeasurement.h b/android/GnssMeasurement.h index cd364c3a..5073169f 100644 --- a/android/GnssMeasurement.h +++ b/android/GnssMeasurement.h @@ -38,7 +38,7 @@ using ::android::hardware::hidl_vec; using ::android::hardware::hidl_string; using ::android::sp; -class GnssMeasurementAPIClient; +class MeasurementAPIClient; struct GnssMeasurement : public IGnssMeasurement { GnssMeasurement(); ~GnssMeasurement(); @@ -64,7 +64,7 @@ struct GnssMeasurement : public IGnssMeasurement { private: sp mGnssMeasurementDeathRecipient = nullptr; sp mGnssMeasurementCbIface = nullptr; - GnssMeasurementAPIClient* mApi; + MeasurementAPIClient* mApi; }; } // namespace implementation diff --git a/android/location_api/FlpAPIClient.cpp b/android/location_api/BatchingAPIClient.cpp similarity index 88% rename from android/location_api/FlpAPIClient.cpp rename to android/location_api/BatchingAPIClient.cpp index 2fb8caa4..6022fbfa 100644 --- a/android/location_api/FlpAPIClient.cpp +++ b/android/location_api/BatchingAPIClient.cpp @@ -28,13 +28,13 @@ */ #define LOG_NDDEBUG 0 -#define LOG_TAG "LocSvc_FlpAPIClient" +#define LOG_TAG "LocSvc_BatchingAPIClient" #include #include #include "LocationUtil.h" -#include "FlpAPIClient.h" +#include "BatchingAPIClient.h" namespace android { namespace hardware { @@ -45,7 +45,7 @@ namespace implementation { static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out, LocationCapabilitiesMask mask); -FlpAPIClient::FlpAPIClient(const sp& callback) : +BatchingAPIClient::BatchingAPIClient(const sp& callback) : LocationAPIClientBase(), mGnssBatchingCbIface(callback), mDefaultId(42), @@ -74,18 +74,18 @@ FlpAPIClient::FlpAPIClient(const sp& callback) : locAPISetCallbacks(locationCallbacks); } -FlpAPIClient::~FlpAPIClient() +BatchingAPIClient::~BatchingAPIClient() { LOC_LOGD("%s]: ()", __FUNCTION__); } -int FlpAPIClient::flpGetBatchSize() +int BatchingAPIClient::getBatchSize() { LOC_LOGD("%s]: ()", __FUNCTION__); return locAPIGetBatchSize(); } -int FlpAPIClient::flpStartSession(const IGnssBatching::Options& opts) +int BatchingAPIClient::startSession(const IGnssBatching::Options& opts) { LOC_LOGD("%s]: (%lld %d)", __FUNCTION__, static_cast(opts.periodNanos), static_cast(opts.flags)); @@ -102,7 +102,7 @@ int FlpAPIClient::flpStartSession(const IGnssBatching::Options& opts) return retVal; } -int FlpAPIClient::flpUpdateSessionOptions(const IGnssBatching::Options& opts) +int BatchingAPIClient::updateSessionOptions(const IGnssBatching::Options& opts) { LOC_LOGD("%s]: (%lld %d)", __FUNCTION__, static_cast(opts.periodNanos), static_cast(opts.flags)); @@ -120,7 +120,7 @@ int FlpAPIClient::flpUpdateSessionOptions(const IGnssBatching::Options& opts) return retVal; } -int FlpAPIClient::flpStopSession() +int BatchingAPIClient::stopSession() { LOC_LOGD("%s]: ", __FUNCTION__); int retVal = -1; @@ -130,25 +130,25 @@ int FlpAPIClient::flpStopSession() return retVal; } -void FlpAPIClient::flpGetBatchedLocation(int last_n_locations) +void BatchingAPIClient::getBatchedLocation(int last_n_locations) { LOC_LOGD("%s]: (%d)", __FUNCTION__, last_n_locations); locAPIGetBatchedLocations(last_n_locations); } -void FlpAPIClient::flpFlushBatchedLocations() +void BatchingAPIClient::flushBatchedLocations() { LOC_LOGD("%s]: ()", __FUNCTION__); locAPIGetBatchedLocations(SIZE_MAX); } -void FlpAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) +void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) { LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask); mLocationCapabilitiesMask = capabilitiesMask; } -void FlpAPIClient::onBatchingCb(size_t count, Location* location) +void BatchingAPIClient::onBatchingCb(size_t count, Location* location) { LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, count); if (mGnssBatchingCbIface != nullptr && count > 0) { diff --git a/android/location_api/FlpAPIClient.h b/android/location_api/BatchingAPIClient.h similarity index 78% rename from android/location_api/FlpAPIClient.h rename to android/location_api/BatchingAPIClient.h index 9f9be1e3..a34c211e 100644 --- a/android/location_api/FlpAPIClient.h +++ b/android/location_api/BatchingAPIClient.h @@ -27,8 +27,8 @@ * */ -#ifndef FLP_API_CLINET_H -#define FLP_API_CLINET_H +#ifndef BATCHING_API_CLINET_H +#define BATCHING_API_CLINET_H #include #include @@ -36,27 +36,25 @@ #include -#define FLP_CONF_FILE "/etc/flp.conf" - namespace android { namespace hardware { namespace gnss { namespace V1_0 { namespace implementation { -class FlpAPIClient : public LocationAPIClientBase +class BatchingAPIClient : public LocationAPIClientBase { public: - FlpAPIClient(const sp& callback); - ~FlpAPIClient(); - int flpGetBatchSize(); - int flpStartSession(const IGnssBatching::Options& options); - int flpUpdateSessionOptions(const IGnssBatching::Options& options); - int flpStopSession(); - void flpGetBatchedLocation(int last_n_locations); - void flpFlushBatchedLocations(); + BatchingAPIClient(const sp& callback); + ~BatchingAPIClient(); + int getBatchSize(); + int startSession(const IGnssBatching::Options& options); + int updateSessionOptions(const IGnssBatching::Options& options); + int stopSession(); + void getBatchedLocation(int last_n_locations); + void flushBatchedLocations(); - inline LocationCapabilitiesMask flpGetCapabilities() { return mLocationCapabilitiesMask; } + inline LocationCapabilitiesMask getCapabilities() { return mLocationCapabilitiesMask; } // callbacks void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final; @@ -74,4 +72,4 @@ private: } // namespace gnss } // namespace hardware } // namespace android -#endif // FLP_API_CLINET_H +#endif // BATCHING_API_CLINET_H diff --git a/android/location_api/GnssMeasurementAPIClient.cpp b/android/location_api/MeasurementAPIClient.cpp similarity index 96% rename from android/location_api/GnssMeasurementAPIClient.cpp rename to android/location_api/MeasurementAPIClient.cpp index 32016251..30e7b40a 100644 --- a/android/location_api/GnssMeasurementAPIClient.cpp +++ b/android/location_api/MeasurementAPIClient.cpp @@ -28,13 +28,13 @@ */ #define LOG_NDDEBUG 0 -#define LOG_TAG "LocSvc_GnssMeasurementAPIClient" +#define LOG_TAG "LocSvc_MeasurementAPIClient" #include #include #include "LocationUtil.h" -#include "GnssMeasurementAPIClient.h" +#include "MeasurementAPIClient.h" namespace android { namespace hardware { @@ -48,7 +48,7 @@ static void convertGnssMeasurement(GnssMeasurementsData& in, IGnssMeasurementCallback::GnssMeasurement& out); static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out); -GnssMeasurementAPIClient::GnssMeasurementAPIClient() : +MeasurementAPIClient::MeasurementAPIClient() : mGnssMeasurementCbIface(nullptr), mLocationCapabilitiesMask(0) { @@ -64,7 +64,7 @@ GnssMeasurementAPIClient::GnssMeasurementAPIClient() : mLocationOptions.mode = GNSS_SUPL_MODE_STANDALONE; } -GnssMeasurementAPIClient::~GnssMeasurementAPIClient() +MeasurementAPIClient::~MeasurementAPIClient() { LOC_LOGD("%s]: ()", __FUNCTION__); pthread_cond_destroy(&mCond); @@ -73,7 +73,7 @@ GnssMeasurementAPIClient::~GnssMeasurementAPIClient() // for GpsInterface Return -GnssMeasurementAPIClient::gnssMeasurementSetCallback(const sp& callback) +MeasurementAPIClient::measurementSetCallback(const sp& callback) { LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback); @@ -118,7 +118,7 @@ GnssMeasurementAPIClient::gnssMeasurementSetCallback(const sp @@ -45,18 +45,18 @@ namespace implementation { using ::android::hardware::gnss::V1_0::IGnssMeasurement; using ::android::sp; -class GnssMeasurementAPIClient : public LocationAPIClientBase +class MeasurementAPIClient : public LocationAPIClientBase { public: - GnssMeasurementAPIClient(); - virtual ~GnssMeasurementAPIClient(); - GnssMeasurementAPIClient(const GnssMeasurementAPIClient&) = delete; - GnssMeasurementAPIClient& operator=(const GnssMeasurementAPIClient&) = delete; + MeasurementAPIClient(); + virtual ~MeasurementAPIClient(); + MeasurementAPIClient(const MeasurementAPIClient&) = delete; + MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete; // for GpsMeasurementInterface - Return gnssMeasurementSetCallback( + Return measurementSetCallback( const sp& callback); - void gnssMeasurementClose(); + void measurementClose(); // callbacks we are interested in void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final; @@ -78,4 +78,4 @@ private: } // namespace gnss } // namespace hardware } // namespace android -#endif // GNSS_MEASUREMENT_API_CLINET_H +#endif // MEASUREMENT_API_CLINET_H diff --git a/location/LocationAPIClientBase.cpp b/location/LocationAPIClientBase.cpp index 3413d3ef..da56440b 100644 --- a/location/LocationAPIClientBase.cpp +++ b/location/LocationAPIClientBase.cpp @@ -33,7 +33,7 @@ #include #include "LocationAPIClientBase.h" -#define FLP_CONF_FILE "/etc/flp.conf" +#define BATCHING_CONF_FILE "/etc/flp.conf" LocationAPIClientBase::LocationAPIClientBase() : mTrackingCallback(nullptr), @@ -183,11 +183,11 @@ void LocationAPIClientBase::locAPIUpdateTrackingOptions(LocationOptions& options int32_t LocationAPIClientBase::locAPIGetBatchSize() { if (mBatchSize == -1) { - const loc_param_s_type flp_conf_param_table[] = + const loc_param_s_type batching_conf_param_table[] = { {"BATCH_SIZE", &mBatchSize, nullptr, 'n'}, }; - UTIL_READ_CONF(FLP_CONF_FILE, flp_conf_param_table); + UTIL_READ_CONF(BATCHING_CONF_FILE, batching_conf_param_table); if (mBatchSize < 0) { // set mBatchSize to 0 if we got an illegal value from config file mBatchSize = 0;