Merge "GPS HAL: send platform power state event to modem"
This commit is contained in:
commit
826c41ec8e
7 changed files with 59 additions and 3 deletions
|
@ -873,5 +873,7 @@ DEFAULT_IMPL()
|
||||||
void LocApiBase::addToCallQueue(LocApiResponse* /*adapterResponse*/)
|
void LocApiBase::addToCallQueue(LocApiResponse* /*adapterResponse*/)
|
||||||
DEFAULT_IMPL()
|
DEFAULT_IMPL()
|
||||||
|
|
||||||
|
void LocApiBase::updateSystemPowerState(PowerStateType /*powerState*/)
|
||||||
|
DEFAULT_IMPL()
|
||||||
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
|
@ -312,6 +312,7 @@ public:
|
||||||
void updateEvtMask();
|
void updateEvtMask();
|
||||||
void updateNmeaMask(uint32_t mask);
|
void updateNmeaMask(uint32_t mask);
|
||||||
|
|
||||||
|
virtual void updateSystemPowerState(PowerStateType systemPowerState);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef LocApiBase* (getLocApi_t)(LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
typedef LocApiBase* (getLocApi_t)(LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||||
|
|
|
@ -99,7 +99,8 @@ GnssAdapter::GnssAdapter() :
|
||||||
mIsE911Session(NULL),
|
mIsE911Session(NULL),
|
||||||
mGnssMbSvIdUsedInPosition{},
|
mGnssMbSvIdUsedInPosition{},
|
||||||
mGnssMbSvIdUsedInPosAvail(false),
|
mGnssMbSvIdUsedInPosAvail(false),
|
||||||
mSupportNfwControl(true)
|
mSupportNfwControl(true),
|
||||||
|
mSystemPowerState(POWER_STATE_UNKNOWN)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: Constructor %p", __func__, this);
|
LOC_LOGD("%s]: Constructor %p", __func__, this);
|
||||||
mLocPositionMode.mode = LOC_POSITION_MODE_INVALID;
|
mLocPositionMode.mode = LOC_POSITION_MODE_INVALID;
|
||||||
|
@ -2022,6 +2023,35 @@ GnssAdapter::blockCPICommand(double latitude, double longitude,
|
||||||
sendMsg(new MsgBlockCPI(mBlockCPIInfo, blockCPIInfo));
|
sendMsg(new MsgBlockCPI(mBlockCPIInfo, blockCPIInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
GnssAdapter::updateSystemPowerState(PowerStateType systemPowerState) {
|
||||||
|
if (POWER_STATE_UNKNOWN != systemPowerState) {
|
||||||
|
mSystemPowerState = systemPowerState;
|
||||||
|
mLocApi->updateSystemPowerState(mSystemPowerState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
GnssAdapter::updateSystemPowerStateCommand(PowerStateType systemPowerState) {
|
||||||
|
LOC_LOGd("power event %d", systemPowerState);
|
||||||
|
|
||||||
|
struct MsgUpdatePowerState : public LocMsg {
|
||||||
|
GnssAdapter& mAdapter;
|
||||||
|
PowerStateType mSystemPowerState;
|
||||||
|
|
||||||
|
inline MsgUpdatePowerState(GnssAdapter& adapter,
|
||||||
|
PowerStateType systemPowerState) :
|
||||||
|
LocMsg(),
|
||||||
|
mAdapter(adapter),
|
||||||
|
mSystemPowerState(systemPowerState) {}
|
||||||
|
inline virtual void proc() const {
|
||||||
|
mAdapter.updateSystemPowerState(mSystemPowerState);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sendMsg(new MsgUpdatePowerState(*this, systemPowerState));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GnssAdapter::addClientCommand(LocationAPI* client, const LocationCallbacks& callbacks)
|
GnssAdapter::addClientCommand(LocationAPI* client, const LocationCallbacks& callbacks)
|
||||||
{
|
{
|
||||||
|
@ -2163,9 +2193,10 @@ GnssAdapter::handleEngineUpEvent()
|
||||||
mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
|
mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
|
||||||
// must be called only after capabilities are known
|
// must be called only after capabilities are known
|
||||||
mAdapter.setConfig();
|
mAdapter.setConfig();
|
||||||
mAdapter.restartSessions();
|
|
||||||
mAdapter.gnssSvIdConfigUpdate();
|
mAdapter.gnssSvIdConfigUpdate();
|
||||||
mAdapter.gnssSvTypeConfigUpdate();
|
mAdapter.gnssSvTypeConfigUpdate();
|
||||||
|
mAdapter.updateSystemPowerState(mAdapter.getSystemPowerState());
|
||||||
|
mAdapter.restartSessions();
|
||||||
for (auto msg: mAdapter.mPendingMsgs) {
|
for (auto msg: mAdapter.mPendingMsgs) {
|
||||||
mAdapter.sendMsg(msg);
|
mAdapter.sendMsg(msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,6 +189,7 @@ class GnssAdapter : public LocAdapterBase {
|
||||||
XtraSystemStatusObserver mXtraObserver;
|
XtraSystemStatusObserver mXtraObserver;
|
||||||
LocationSystemInfo mLocSystemInfo;
|
LocationSystemInfo mLocSystemInfo;
|
||||||
std::vector<GnssSvIdSource> mBlacklistedSvIds;
|
std::vector<GnssSvIdSource> mBlacklistedSvIds;
|
||||||
|
PowerStateType mSystemPowerState;
|
||||||
|
|
||||||
/* === Misc ===================================================================== */
|
/* === Misc ===================================================================== */
|
||||||
BlockCPIInfo mBlockCPIInfo;
|
BlockCPIInfo mBlockCPIInfo;
|
||||||
|
@ -416,6 +417,8 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateSystemPowerState(PowerStateType systemPowerState);
|
||||||
|
|
||||||
/*======== GNSSDEBUG ================================================================*/
|
/*======== GNSSDEBUG ================================================================*/
|
||||||
bool getDebugReport(GnssDebugReport& report);
|
bool getDebugReport(GnssDebugReport& report);
|
||||||
/* get AGC information from system status and fill it */
|
/* get AGC information from system status and fill it */
|
||||||
|
@ -462,11 +465,14 @@ public:
|
||||||
void reportPowerStateIfChanged();
|
void reportPowerStateIfChanged();
|
||||||
void savePowerStateCallback(powerStateCallback powerStateCb){ mPowerStateCb = powerStateCb; }
|
void savePowerStateCallback(powerStateCallback powerStateCb){ mPowerStateCb = powerStateCb; }
|
||||||
bool getPowerState() { return mPowerOn; }
|
bool getPowerState() { return mPowerOn; }
|
||||||
|
inline PowerStateType getSystemPowerState() { return mSystemPowerState; }
|
||||||
|
|
||||||
void setAllowFlpNetworkFixes(uint32_t allow) { mAllowFlpNetworkFixes = allow; }
|
void setAllowFlpNetworkFixes(uint32_t allow) { mAllowFlpNetworkFixes = allow; }
|
||||||
uint32_t getAllowFlpNetworkFixes() { return mAllowFlpNetworkFixes; }
|
uint32_t getAllowFlpNetworkFixes() { return mAllowFlpNetworkFixes; }
|
||||||
void setSuplHostServer(const char* server, int port, LocServerType type);
|
void setSuplHostServer(const char* server, int port, LocServerType type);
|
||||||
void notifyClientOfCachedLocationSystemInfo(LocationAPI* client,
|
void notifyClientOfCachedLocationSystemInfo(LocationAPI* client,
|
||||||
const LocationCallbacks& callbacks);
|
const LocationCallbacks& callbacks);
|
||||||
|
void updateSystemPowerStateCommand(PowerStateType systemPowerState);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //GNSS_ADAPTER_H
|
#endif //GNSS_ADAPTER_H
|
||||||
|
|
|
@ -79,6 +79,7 @@ static void odcpiInject(const Location& location);
|
||||||
static void blockCPI(double latitude, double longitude, float accuracy,
|
static void blockCPI(double latitude, double longitude, float accuracy,
|
||||||
int blockDurationMsec, double latLonDiffThreshold);
|
int blockDurationMsec, double latLonDiffThreshold);
|
||||||
static void updateBatteryStatus(bool charging);
|
static void updateBatteryStatus(bool charging);
|
||||||
|
static void updateSystemPowerState(PowerStateType systemPowerState);
|
||||||
|
|
||||||
static const GnssInterface gGnssInterface = {
|
static const GnssInterface gGnssInterface = {
|
||||||
sizeof(GnssInterface),
|
sizeof(GnssInterface),
|
||||||
|
@ -117,7 +118,8 @@ static const GnssInterface gGnssInterface = {
|
||||||
nfwInit,
|
nfwInit,
|
||||||
getPowerStateChanges,
|
getPowerStateChanges,
|
||||||
injectLocationExt,
|
injectLocationExt,
|
||||||
updateBatteryStatus
|
updateBatteryStatus,
|
||||||
|
updateSystemPowerState
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef DEBUG_X86
|
#ifndef DEBUG_X86
|
||||||
|
@ -390,3 +392,9 @@ static void updateBatteryStatus(bool charging) {
|
||||||
gGnssAdapter->getSystemStatus()->updatePowerConnectState(charging);
|
gGnssAdapter->getSystemStatus()->updatePowerConnectState(charging);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void updateSystemPowerState(PowerStateType systemPowerState) {
|
||||||
|
if (NULL != gGnssAdapter) {
|
||||||
|
gGnssAdapter->updateSystemPowerStateCommand(systemPowerState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -88,6 +88,7 @@ struct GnssInterface {
|
||||||
void (*getPowerStateChanges)(void* powerStateCb);
|
void (*getPowerStateChanges)(void* powerStateCb);
|
||||||
void (*injectLocationExt)(const GnssLocationInfoNotification &locationInfo);
|
void (*injectLocationExt)(const GnssLocationInfoNotification &locationInfo);
|
||||||
void (*updateBatteryStatus)(bool charging);
|
void (*updateBatteryStatus)(bool charging);
|
||||||
|
void (*updateSystemPowerState)(PowerStateType systemPowerState);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BatchingInterface {
|
struct BatchingInterface {
|
||||||
|
|
|
@ -2223,6 +2223,13 @@ typedef void (*LocAgpsOpenResultCb)(bool isSuccess, AGpsExtType agpsType, const
|
||||||
|
|
||||||
typedef void (*LocAgpsCloseResultCb)(bool isSuccess, AGpsExtType agpsType, void* userDataPtr);
|
typedef void (*LocAgpsCloseResultCb)(bool isSuccess, AGpsExtType agpsType, void* userDataPtr);
|
||||||
|
|
||||||
|
enum PowerStateType {
|
||||||
|
POWER_STATE_UNKNOWN = 0,
|
||||||
|
POWER_STATE_SUSPEND = 1,
|
||||||
|
POWER_STATE_RESUME = 2,
|
||||||
|
POWER_STATE_SHUTDOWN = 3
|
||||||
|
};
|
||||||
|
|
||||||
/* Shared resources of LocIpc */
|
/* Shared resources of LocIpc */
|
||||||
#define LOC_IPC_HAL "/dev/socket/location/socket_hal"
|
#define LOC_IPC_HAL "/dev/socket/location/socket_hal"
|
||||||
#define LOC_IPC_XTRA "/dev/socket/location/xtra/socket_xtra"
|
#define LOC_IPC_XTRA "/dev/socket/location/xtra/socket_xtra"
|
||||||
|
|
Loading…
Reference in a new issue