Merge "Checking messages supported or not"
This commit is contained in:
commit
0736472319
5 changed files with 52 additions and 4 deletions
|
@ -39,14 +39,15 @@ class LocAdapterProxyBase;
|
||||||
|
|
||||||
class LocAdapterBase {
|
class LocAdapterBase {
|
||||||
protected:
|
protected:
|
||||||
const LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
|
LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
|
||||||
ContextBase* mContext;
|
ContextBase* mContext;
|
||||||
LocApiBase* mLocApi;
|
LocApiBase* mLocApi;
|
||||||
LocAdapterProxyBase* mLocAdapterProxyBase;
|
LocAdapterProxyBase* mLocAdapterProxyBase;
|
||||||
const MsgTask* mMsgTask;
|
const MsgTask* mMsgTask;
|
||||||
|
|
||||||
inline LocAdapterBase(const MsgTask* msgTask) :
|
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:
|
public:
|
||||||
inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
|
inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
|
||||||
LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
|
LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
|
||||||
|
@ -68,6 +69,15 @@ public:
|
||||||
mMsgTask->sendMsg(msg);
|
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
|
// This will be overridden by the individual adapters
|
||||||
// if necessary.
|
// if necessary.
|
||||||
inline virtual void setUlpProxy(UlpProxyBase* ulp) {}
|
inline virtual void setUlpProxy(UlpProxyBase* ulp) {}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace loc_core {
|
||||||
|
|
||||||
class LocAdapterProxyBase {
|
class LocAdapterProxyBase {
|
||||||
private:
|
private:
|
||||||
const LocAdapterBase *mLocAdapterBase;
|
LocAdapterBase *mLocAdapterBase;
|
||||||
protected:
|
protected:
|
||||||
inline LocAdapterProxyBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
|
inline LocAdapterProxyBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
|
||||||
ContextBase* context):
|
ContextBase* context):
|
||||||
|
@ -49,6 +49,11 @@ protected:
|
||||||
ContextBase* getContext() const {
|
ContextBase* getContext() const {
|
||||||
return mLocAdapterBase->getContext();
|
return mLocAdapterBase->getContext();
|
||||||
}
|
}
|
||||||
|
inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event,
|
||||||
|
loc_registration_mask_status isEnabled) {
|
||||||
|
mLocAdapterBase->updateEvtMask(event,isEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline virtual void handleEngineUpEvent() {};
|
inline virtual void handleEngineUpEvent() {};
|
||||||
inline virtual void handleEngineDownEvent() {};
|
inline virtual void handleEngineDownEvent() {};
|
||||||
|
|
|
@ -128,7 +128,8 @@ struct LocOpenMsg : public LocMsg {
|
||||||
LocApiBase::LocApiBase(const MsgTask* msgTask,
|
LocApiBase::LocApiBase(const MsgTask* msgTask,
|
||||||
LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
|
LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
|
||||||
ContextBase* context) :
|
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));
|
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()
|
void LocApiBase::handleEngineUpEvent()
|
||||||
{
|
{
|
||||||
// This will take care of renegotiating the loc handle
|
// 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));
|
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotify(notify, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList)
|
||||||
|
{
|
||||||
|
mSupportedMsg = supportedMsgList;
|
||||||
|
}
|
||||||
|
|
||||||
void* LocApiBase :: getSibling()
|
void* LocApiBase :: getSibling()
|
||||||
DEFAULT_IMPL(NULL)
|
DEFAULT_IMPL(NULL)
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ class LocApiBase {
|
||||||
const MsgTask* mMsgTask;
|
const MsgTask* mMsgTask;
|
||||||
ContextBase *mContext;
|
ContextBase *mContext;
|
||||||
LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
|
LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
|
||||||
|
uint64_t mSupportedMsg;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
|
@ -128,6 +129,7 @@ public:
|
||||||
void reportDataCallOpened();
|
void reportDataCallOpened();
|
||||||
void reportDataCallClosed();
|
void reportDataCallClosed();
|
||||||
void requestNiNotify(GpsNiNotification ¬ify, const void* data);
|
void requestNiNotify(GpsNiNotification ¬ify, const void* data);
|
||||||
|
void saveSupportedMsgList(uint64_t supportedMsgList);
|
||||||
|
|
||||||
// downward calls
|
// downward calls
|
||||||
// All below functions are to be defined by adapter specific modules:
|
// All below functions are to be defined by adapter specific modules:
|
||||||
|
@ -212,6 +214,15 @@ public:
|
||||||
size_t length,
|
size_t length,
|
||||||
uint32_t slotBitMask);
|
uint32_t slotBitMask);
|
||||||
inline virtual void setInSession(bool inSession) {}
|
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
|
/*Values for lock
|
||||||
1 = Do not lock any position sessions
|
1 = Do not lock any position sessions
|
||||||
|
|
|
@ -71,6 +71,11 @@ extern "C" {
|
||||||
#define AGPS_CERTIFICATE_MAX_LENGTH 2000
|
#define AGPS_CERTIFICATE_MAX_LENGTH 2000
|
||||||
#define AGPS_CERTIFICATE_MAX_SLOTS 10
|
#define AGPS_CERTIFICATE_MAX_SLOTS 10
|
||||||
|
|
||||||
|
enum loc_registration_mask_status {
|
||||||
|
LOC_REGISTRATION_MASK_ENABLED,
|
||||||
|
LOC_REGISTRATION_MASK_DISABLED
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** set to sizeof(UlpLocation) */
|
/** set to sizeof(UlpLocation) */
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@ -368,6 +373,12 @@ enum loc_api_adapter_event_index {
|
||||||
|
|
||||||
typedef unsigned int LOC_API_ADAPTER_EVENT_MASK_T;
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue