new apis for control xtra throttle
added register and unregister apis of a callback that listens to XTRA client throttle enablement commands. Change-Id: Id50e7311516593018113203b5dfa700f0fdc037b CRs-fixed: 2092629
This commit is contained in:
parent
b0982b4476
commit
35804b9131
6 changed files with 43 additions and 4 deletions
|
@ -931,6 +931,26 @@ GnssAdapter::gnssDeleteAidingDataCommand(GnssAidingData& data)
|
|||
return sessionId;
|
||||
}
|
||||
|
||||
void
|
||||
GnssAdapter::gnssUpdateXtraThrottleCommand(const bool enabled)
|
||||
{
|
||||
LOC_LOGD("%s] enabled:%d", __func__, enabled);
|
||||
|
||||
struct UpdateXtraThrottleMsg : public LocMsg {
|
||||
GnssAdapter& mAdapter;
|
||||
const bool mEnabled;
|
||||
inline UpdateXtraThrottleMsg(GnssAdapter& adapter, const bool enabled) :
|
||||
LocMsg(),
|
||||
mAdapter(adapter),
|
||||
mEnabled(enabled) {}
|
||||
inline virtual void proc() const {
|
||||
mAdapter.mXtraObserver.updateXtraThrottle(mEnabled);
|
||||
}
|
||||
};
|
||||
|
||||
sendMsg(new UpdateXtraThrottleMsg(*this, enabled));
|
||||
}
|
||||
|
||||
void
|
||||
GnssAdapter::injectLocationCommand(double latitude, double longitude, float accuracy)
|
||||
{
|
||||
|
|
|
@ -200,6 +200,7 @@ public:
|
|||
void setConfigCommand();
|
||||
uint32_t* gnssUpdateConfigCommand(GnssConfig config);
|
||||
uint32_t gnssDeleteAidingDataCommand(GnssAidingData& data);
|
||||
void gnssUpdateXtraThrottleCommand(const bool enabled);
|
||||
|
||||
void initDefaultAgpsCommand();
|
||||
void initAgpsCommand(const AgpsCbInfo& cbInfo);
|
||||
|
|
|
@ -84,6 +84,13 @@ bool XtraSystemStatusObserver::updateMccMnc(const string& mccmnc) {
|
|||
return ( send(LOC_IPC_XTRA, ss.str()) );
|
||||
}
|
||||
|
||||
bool XtraSystemStatusObserver::updateXtraThrottle(const bool enabled) {
|
||||
stringstream ss;
|
||||
ss << "xtrathrottle";
|
||||
ss << " " << (enabled ? 1 : 0);
|
||||
return ( send(LOC_IPC_XTRA, ss.str()) );
|
||||
}
|
||||
|
||||
void XtraSystemStatusObserver::onReceive(const std::string& data) {
|
||||
if (!strncmp(data.c_str(), "ping", sizeof("ping") - 1)) {
|
||||
LOC_LOGd("ping received");
|
||||
|
@ -121,11 +128,11 @@ void XtraSystemStatusObserver::getName(string& name)
|
|||
|
||||
void XtraSystemStatusObserver::notify(const list<IDataItemCore*>& dlist)
|
||||
{
|
||||
struct handleOsObserverUpdateMsg : public LocMsg {
|
||||
struct HandleOsObserverUpdateMsg : public LocMsg {
|
||||
XtraSystemStatusObserver* mXtraSysStatObj;
|
||||
list <IDataItemCore*> mDataItemList;
|
||||
|
||||
inline handleOsObserverUpdateMsg(XtraSystemStatusObserver* xtraSysStatObs,
|
||||
inline HandleOsObserverUpdateMsg(XtraSystemStatusObserver* xtraSysStatObs,
|
||||
const list<IDataItemCore*>& dataItemList) :
|
||||
mXtraSysStatObj(xtraSysStatObs) {
|
||||
for (auto eachItem : dataItemList) {
|
||||
|
@ -141,7 +148,7 @@ void XtraSystemStatusObserver::notify(const list<IDataItemCore*>& dlist)
|
|||
}
|
||||
}
|
||||
|
||||
inline ~handleOsObserverUpdateMsg() {
|
||||
inline ~HandleOsObserverUpdateMsg() {
|
||||
for (auto each : mDataItemList) {
|
||||
delete each;
|
||||
}
|
||||
|
@ -182,7 +189,7 @@ void XtraSystemStatusObserver::notify(const list<IDataItemCore*>& dlist)
|
|||
}
|
||||
}
|
||||
};
|
||||
mMsgTask->sendMsg(new (nothrow) handleOsObserverUpdateMsg(this, dlist));
|
||||
mMsgTask->sendMsg(new (nothrow) HandleOsObserverUpdateMsg(this, dlist));
|
||||
}
|
||||
|
||||
#ifdef USE_GLIB
|
||||
|
|
|
@ -125,6 +125,7 @@ public :
|
|||
bool updateConnectionStatus(bool connected, int32_t type);
|
||||
bool updateTac(const string& tac);
|
||||
bool updateMccMnc(const string& mccmnc);
|
||||
bool updateXtraThrottle(const bool enabled);
|
||||
inline const MsgTask* getMsgTask() { return mMsgTask; }
|
||||
void subscribe(bool yes);
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ static void stopTracking(LocationAPI* client, uint32_t id);
|
|||
|
||||
static void gnssNiResponse(LocationAPI* client, uint32_t id, GnssNiResponse response);
|
||||
static uint32_t gnssDeleteAidingData(GnssAidingData& data);
|
||||
static void gnssUpdateXtraThrottle(const bool enabled);
|
||||
|
||||
static void setControlCallbacks(LocationControlCallbacks& controlCallbacks);
|
||||
static uint32_t enable(LocationTechnologyType techType);
|
||||
|
@ -77,6 +78,7 @@ static const GnssInterface gGnssInterface = {
|
|||
disable,
|
||||
gnssUpdateConfig,
|
||||
gnssDeleteAidingData,
|
||||
gnssUpdateXtraThrottle,
|
||||
injectLocation,
|
||||
injectTime,
|
||||
agpsInit,
|
||||
|
@ -203,6 +205,13 @@ static uint32_t gnssDeleteAidingData(GnssAidingData& data)
|
|||
}
|
||||
}
|
||||
|
||||
static void gnssUpdateXtraThrottle(const bool enabled)
|
||||
{
|
||||
if (NULL != gGnssAdapter) {
|
||||
gGnssAdapter->gnssUpdateXtraThrottleCommand(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
static void injectLocation(double latitude, double longitude, float accuracy)
|
||||
{
|
||||
if (NULL != gGnssAdapter) {
|
||||
|
|
|
@ -48,6 +48,7 @@ struct GnssInterface {
|
|||
void (*disable)(uint32_t id);
|
||||
uint32_t* (*gnssUpdateConfig)(GnssConfig config);
|
||||
uint32_t (*gnssDeleteAidingData)(GnssAidingData& data);
|
||||
void (*gnssUpdateXtraThrottle)(const bool enabled);
|
||||
void (*injectLocation)(double latitude, double longitude, float accuracy);
|
||||
void (*injectTime)(int64_t time, int64_t timeReference, int32_t uncertainty);
|
||||
void (*agpsInit)(const AgpsCbInfo& cbInfo);
|
||||
|
|
Loading…
Reference in a new issue