Rename FlpAPIClient and GnssMeasurementAPIClient
FlpAPIClient renamed to BatchingAPIClient GnssMeasurementAPIClient renamed to MeasurementAPIClient Change-Id: Ic0fae37fd1d798796cb918ddcf141913c6cc3c6e CRs-fixed: 1112712
This commit is contained in:
parent
52b413eb44
commit
545f52f6b5
10 changed files with 62 additions and 64 deletions
|
@ -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 \
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define LOG_TAG "LocSvc_GnssBatchingInterface"
|
||||
|
||||
#include <log_util.h>
|
||||
#include <FlpAPIClient.h>
|
||||
#include <BatchingAPIClient.h>
|
||||
#include "GnssBatching.h"
|
||||
|
||||
namespace android {
|
||||
|
@ -59,7 +59,7 @@ Return<bool> GnssBatching::init(const sp<IGnssBatchingCallback>& 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<uint16_t> 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<bool> 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<void> GnssBatching::flush() {
|
|||
if (mApi == nullptr) {
|
||||
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
|
||||
} else {
|
||||
mApi->flpFlushBatchedLocations();
|
||||
mApi->flushBatchedLocations();
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ Return<bool> GnssBatching::stop() {
|
|||
if (mApi == nullptr) {
|
||||
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
|
||||
} else {
|
||||
ret = mApi->flpStopSession();
|
||||
ret = mApi->stopSession();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -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<GnssBatchingDeathRecipient> mGnssBatchingDeathRecipient = nullptr;
|
||||
sp<IGnssBatchingCallback> mGnssBatchingCbIface = nullptr;
|
||||
FlpAPIClient* mApi = nullptr;
|
||||
BatchingAPIClient* mApi = nullptr;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define LOG_TAG "LocSvc_GnssMeasurementInterface"
|
||||
|
||||
#include <log_util.h>
|
||||
#include <GnssMeasurementAPIClient.h>
|
||||
#include <MeasurementAPIClient.h>
|
||||
#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<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
|
|||
mGnssMeasurementCbIface = callback;
|
||||
mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0 /*cookie*/);
|
||||
|
||||
return mApi->gnssMeasurementSetCallback(callback);
|
||||
return mApi->measurementSetCallback(callback);
|
||||
}
|
||||
|
||||
Return<void> GnssMeasurement::close() {
|
||||
|
@ -87,7 +87,7 @@ Return<void> GnssMeasurement::close() {
|
|||
mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient);
|
||||
mGnssMeasurementCbIface = nullptr;
|
||||
}
|
||||
mApi->gnssMeasurementClose();
|
||||
mApi->measurementClose();
|
||||
|
||||
return Void();
|
||||
}
|
||||
|
|
|
@ -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<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
|
||||
sp<IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
|
||||
GnssMeasurementAPIClient* mApi;
|
||||
MeasurementAPIClient* mApi;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
*/
|
||||
|
||||
#define LOG_NDDEBUG 0
|
||||
#define LOG_TAG "LocSvc_FlpAPIClient"
|
||||
#define LOG_TAG "LocSvc_BatchingAPIClient"
|
||||
|
||||
#include <log_util.h>
|
||||
#include <loc_cfg.h>
|
||||
|
||||
#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<IGnssBatchingCallback>& callback) :
|
||||
BatchingAPIClient::BatchingAPIClient(const sp<IGnssBatchingCallback>& callback) :
|
||||
LocationAPIClientBase(),
|
||||
mGnssBatchingCbIface(callback),
|
||||
mDefaultId(42),
|
||||
|
@ -74,18 +74,18 @@ FlpAPIClient::FlpAPIClient(const sp<IGnssBatchingCallback>& 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<long long>(opts.periodNanos), static_cast<uint8_t>(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<long long>(opts.periodNanos), static_cast<uint8_t>(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) {
|
|
@ -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 <android/hardware/gnss/1.0/IGnssBatching.h>
|
||||
#include <android/hardware/gnss/1.0/IGnssBatchingCallback.h>
|
||||
|
@ -36,27 +36,25 @@
|
|||
|
||||
#include <LocationAPIClientBase.h>
|
||||
|
||||
#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<IGnssBatchingCallback>& 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<IGnssBatchingCallback>& 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
|
|
@ -28,13 +28,13 @@
|
|||
*/
|
||||
|
||||
#define LOG_NDDEBUG 0
|
||||
#define LOG_TAG "LocSvc_GnssMeasurementAPIClient"
|
||||
#define LOG_TAG "LocSvc_MeasurementAPIClient"
|
||||
|
||||
#include <log_util.h>
|
||||
#include <loc_cfg.h>
|
||||
|
||||
#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<IGnssMeasurement::GnssMeasurementStatus>
|
||||
GnssMeasurementAPIClient::gnssMeasurementSetCallback(const sp<IGnssMeasurementCallback>& callback)
|
||||
MeasurementAPIClient::measurementSetCallback(const sp<IGnssMeasurementCallback>& callback)
|
||||
{
|
||||
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
|
||||
|
||||
|
@ -118,7 +118,7 @@ GnssMeasurementAPIClient::gnssMeasurementSetCallback(const sp<IGnssMeasurementCa
|
|||
}
|
||||
|
||||
// for GpsMeasurementInterface
|
||||
void GnssMeasurementAPIClient::gnssMeasurementClose() {
|
||||
void MeasurementAPIClient::measurementClose() {
|
||||
LOC_LOGD("%s]: ()", __FUNCTION__);
|
||||
pthread_mutex_lock(&mLock);
|
||||
mGnssMeasurementCbIface = nullptr;
|
||||
|
@ -126,7 +126,7 @@ void GnssMeasurementAPIClient::gnssMeasurementClose() {
|
|||
}
|
||||
|
||||
// callbacks
|
||||
void GnssMeasurementAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
||||
void MeasurementAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
||||
{
|
||||
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
|
||||
mLocationCapabilitiesMask = capabilitiesMask;
|
||||
|
@ -135,7 +135,7 @@ void GnssMeasurementAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabil
|
|||
pthread_mutex_unlock(&mLock);
|
||||
}
|
||||
|
||||
void GnssMeasurementAPIClient::onGnssMeasurementsCb(
|
||||
void MeasurementAPIClient::onGnssMeasurementsCb(
|
||||
GnssMeasurementsNotification gnssMeasurementsNotification)
|
||||
{
|
||||
LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, gnssMeasurementsNotification.count);
|
|
@ -27,8 +27,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef GNSS_MEASUREMENT_API_CLINET_H
|
||||
#define GNSS_MEASUREMENT_API_CLINET_H
|
||||
#ifndef MEASUREMENT_API_CLINET_H
|
||||
#define MEASUREMENT_API_CLINET_H
|
||||
|
||||
|
||||
#include <android/hardware/gnss/1.0/IGnssMeasurement.h>
|
||||
|
@ -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<IGnssMeasurement::GnssMeasurementStatus> gnssMeasurementSetCallback(
|
||||
Return<IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
|
||||
const sp<IGnssMeasurementCallback>& 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
|
|
@ -33,7 +33,7 @@
|
|||
#include <loc_cfg.h>
|
||||
#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;
|
||||
|
|
Loading…
Reference in a new issue