Checking messages supported or not
When device boots up, get a list of message supported by modem, based on which some adapeters will be able to update register masks. CRs-fixed: 601349 Change-Id: I6af282f8e551f1f3c6bf8795e968fdbc7b0a9fa3
This commit is contained in:
parent
40931418ee
commit
90378134ea
5 changed files with 52 additions and 4 deletions
|
@ -39,14 +39,15 @@ class LocAdapterProxyBase;
|
|||
|
||||
class LocAdapterBase {
|
||||
protected:
|
||||
const LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
|
||||
LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
|
||||
ContextBase* mContext;
|
||||
LocApiBase* mLocApi;
|
||||
LocAdapterProxyBase* mLocAdapterProxyBase;
|
||||
const MsgTask* mMsgTask;
|
||||
|
||||
inline LocAdapterBase(const MsgTask* msgTask) :
|
||||
mEvtMask(0), mContext(NULL), mLocApi(NULL), mLocAdapterProxyBase(NULL), mMsgTask(msgTask) {}
|
||||
mEvtMask(0), mContext(NULL), mLocApi(NULL),
|
||||
mLocAdapterProxyBase(NULL), mMsgTask(msgTask) {}
|
||||
public:
|
||||
inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
|
||||
LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
|
||||
|
@ -68,6 +69,15 @@ public:
|
|||
mMsgTask->sendMsg(msg);
|
||||
}
|
||||
|
||||
inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event,
|
||||
loc_registration_mask_status isEnabled)
|
||||
{
|
||||
mEvtMask =
|
||||
isEnabled == LOC_REGISTRATION_MASK_ENABLED ? (mEvtMask|event):(mEvtMask&~event);
|
||||
|
||||
mLocApi->updateEvtMask();
|
||||
}
|
||||
|
||||
// This will be overridden by the individual adapters
|
||||
// if necessary.
|
||||
inline virtual void setUlpProxy(UlpProxyBase* ulp) {}
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace loc_core {
|
|||
|
||||
class LocAdapterProxyBase {
|
||||
private:
|
||||
const LocAdapterBase *mLocAdapterBase;
|
||||
LocAdapterBase *mLocAdapterBase;
|
||||
protected:
|
||||
inline LocAdapterProxyBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
|
||||
ContextBase* context):
|
||||
|
@ -49,6 +49,11 @@ protected:
|
|||
ContextBase* getContext() const {
|
||||
return mLocAdapterBase->getContext();
|
||||
}
|
||||
inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event,
|
||||
loc_registration_mask_status isEnabled) {
|
||||
mLocAdapterBase->updateEvtMask(event,isEnabled);
|
||||
}
|
||||
|
||||
public:
|
||||
inline virtual void handleEngineUpEvent() {};
|
||||
inline virtual void handleEngineDownEvent() {};
|
||||
|
|
|
@ -128,7 +128,8 @@ struct LocOpenMsg : public LocMsg {
|
|||
LocApiBase::LocApiBase(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
|
||||
ContextBase* context) :
|
||||
mExcludedMask(excludedMask), mMsgTask(msgTask), mMask(0), mContext(context)
|
||||
mExcludedMask(excludedMask), mMsgTask(msgTask),
|
||||
mMask(0), mSupportedMsg(0), mContext(context)
|
||||
{
|
||||
memset(mLocAdapters, 0, sizeof(mLocAdapters));
|
||||
}
|
||||
|
@ -203,6 +204,11 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter)
|
|||
}
|
||||
}
|
||||
|
||||
void LocApiBase::updateEvtMask()
|
||||
{
|
||||
mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
|
||||
}
|
||||
|
||||
void LocApiBase::handleEngineUpEvent()
|
||||
{
|
||||
// This will take care of renegotiating the loc handle
|
||||
|
@ -322,6 +328,11 @@ void LocApiBase::requestNiNotify(GpsNiNotification ¬ify, const void* data)
|
|||
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotify(notify, data));
|
||||
}
|
||||
|
||||
void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList)
|
||||
{
|
||||
mSupportedMsg = supportedMsgList;
|
||||
}
|
||||
|
||||
void* LocApiBase :: getSibling()
|
||||
DEFAULT_IMPL(NULL)
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ class LocApiBase {
|
|||
const MsgTask* mMsgTask;
|
||||
ContextBase *mContext;
|
||||
LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
|
||||
uint64_t mSupportedMsg;
|
||||
|
||||
protected:
|
||||
virtual enum loc_api_adapter_err
|
||||
|
@ -128,6 +129,7 @@ public:
|
|||
void reportDataCallOpened();
|
||||
void reportDataCallClosed();
|
||||
void requestNiNotify(GpsNiNotification ¬ify, const void* data);
|
||||
void saveSupportedMsgList(uint64_t supportedMsgList);
|
||||
|
||||
// downward calls
|
||||
// All below functions are to be defined by adapter specific modules:
|
||||
|
@ -212,6 +214,15 @@ public:
|
|||
size_t length,
|
||||
uint32_t slotBitMask);
|
||||
inline virtual void setInSession(bool inSession) {}
|
||||
inline bool isMessageSupported (LocCheckingMessagesID msgID) const {
|
||||
if (msgID > (sizeof(mSupportedMsg) << 3)) {
|
||||
return false;
|
||||
} else {
|
||||
uint32_t messageChecker = 1 << msgID;
|
||||
return (messageChecker & mSupportedMsg) == messageChecker;
|
||||
}
|
||||
}
|
||||
void updateEvtMask();
|
||||
|
||||
/*Values for lock
|
||||
1 = Do not lock any position sessions
|
||||
|
|
|
@ -71,6 +71,11 @@ extern "C" {
|
|||
#define AGPS_CERTIFICATE_MAX_LENGTH 2000
|
||||
#define AGPS_CERTIFICATE_MAX_SLOTS 10
|
||||
|
||||
enum loc_registration_mask_status {
|
||||
LOC_REGISTRATION_MASK_ENABLED,
|
||||
LOC_REGISTRATION_MASK_DISABLED
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
/** set to sizeof(UlpLocation) */
|
||||
size_t size;
|
||||
|
@ -368,6 +373,12 @@ enum loc_api_adapter_event_index {
|
|||
|
||||
typedef unsigned int LOC_API_ADAPTER_EVENT_MASK_T;
|
||||
|
||||
typedef enum loc_api_adapter_msg_to_check_supported {
|
||||
LOC_API_ADAPTER_MESSAGE_LOCATION_BATCHING, // Batching
|
||||
LOC_API_ADAPTER_MESSAGE_BATCHED_GENFENCE_BREACH, // Geofence Batched Breach
|
||||
|
||||
LOC_API_ADAPTER_MESSAGE_MAX
|
||||
} LocCheckingMessagesID;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue