Merge "removed ulp dependency."
This commit is contained in:
commit
259c58fd27
23 changed files with 454 additions and 866 deletions
|
@ -37,6 +37,8 @@ LOCAL_COPY_HEADERS:= \
|
|||
LocAdapterBase.h \
|
||||
ContextBase.h \
|
||||
LocDualContext.h \
|
||||
IzatProxyBase.h \
|
||||
UlpProxyBase.h \
|
||||
gps_extended_c.h \
|
||||
gps_extended.h \
|
||||
loc_core_log.h
|
||||
|
|
|
@ -34,29 +34,63 @@
|
|||
#include <unistd.h>
|
||||
#include <ContextBase.h>
|
||||
#include <msg_q.h>
|
||||
#include <loc_target.h>
|
||||
#include <log_util.h>
|
||||
#include <loc_log.h>
|
||||
|
||||
namespace loc_core {
|
||||
|
||||
const char* ContextBase::mIzatLibName = "libizat_core.so";
|
||||
// we initialized this handle to 1 because it can't possibly
|
||||
// 1 if it ever gets assigned a value. NULL on the otherhand
|
||||
// is possilbe.
|
||||
void* ContextBase::mIzatLibHandle = (void*)1;
|
||||
|
||||
void* ContextBase::getIzatLibHandle()
|
||||
IzatProxyBase* ContextBase::getIzatProxy(const char* libName)
|
||||
{
|
||||
if ((void*)1 == mIzatLibHandle) {
|
||||
mIzatLibHandle = dlopen(mIzatLibName, RTLD_NOW);
|
||||
IzatProxyBase* proxy = NULL;
|
||||
void* lib = dlopen(libName, RTLD_NOW);
|
||||
|
||||
if ((void*)NULL != lib) {
|
||||
getIzatProxy_t* getter = (getIzatProxy_t*)dlsym(lib, "getIzatProxy");
|
||||
if (NULL != getter) {
|
||||
proxy = (*getter)();
|
||||
}
|
||||
return mIzatLibHandle;
|
||||
}
|
||||
if (NULL == proxy) {
|
||||
proxy = new IzatProxyBase();
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
|
||||
LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
|
||||
{
|
||||
LocApiBase* locApi = NULL;
|
||||
|
||||
// first if can not be MPQ
|
||||
if (TARGET_MPQ != get_target()) {
|
||||
if (NULL == (locApi = mIzatProxy->getLocApi(mMsgTask, exMask))) {
|
||||
// only RPC is the option now
|
||||
void* handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW);
|
||||
if (NULL != handle) {
|
||||
getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi");
|
||||
if (NULL != getter) {
|
||||
locApi = (*getter)(mMsgTask, exMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// locApi could still be NULL at this time
|
||||
// we would then create a dummy one
|
||||
if (NULL == locApi) {
|
||||
locApi = new LocApiBase(mMsgTask, exMask);
|
||||
}
|
||||
|
||||
return locApi;
|
||||
}
|
||||
|
||||
ContextBase::ContextBase(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask) :
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||
const char* libName) :
|
||||
mIzatProxy(getIzatProxy(libName)),
|
||||
mMsgTask(msgTask),
|
||||
mLocApi(LocApiBase::create(mMsgTask, exMask, getIzatLibHandle()))
|
||||
mLocApi(createLocApi(exMask))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -33,26 +33,33 @@
|
|||
#include <ctype.h>
|
||||
#include <MsgTask.h>
|
||||
#include <LocApiBase.h>
|
||||
#include <IzatProxyBase.h>
|
||||
|
||||
namespace loc_core {
|
||||
|
||||
class LocAdapterBase;
|
||||
|
||||
class ContextBase {
|
||||
static const char* mIzatLibName;
|
||||
static void* mIzatLibHandle;
|
||||
static IzatProxyBase* getIzatProxy(const char* libName);
|
||||
LocApiBase* createLocApi(LOC_API_ADAPTER_EVENT_MASK_T excludedMask);
|
||||
protected:
|
||||
const IzatProxyBase* mIzatProxy;
|
||||
const MsgTask* mMsgTask;
|
||||
LocApiBase* mLocApi;
|
||||
|
||||
public:
|
||||
ContextBase(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask);
|
||||
inline virtual ~ContextBase() { delete mLocApi; }
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||
const char* libName);
|
||||
inline virtual ~ContextBase() { delete mLocApi; delete mIzatProxy; }
|
||||
|
||||
static void* getIzatLibHandle();
|
||||
inline const MsgTask* getMsgTask() { return mMsgTask; }
|
||||
inline LocApiBase* getLocApi() { return mLocApi; }
|
||||
inline bool hasAgpsExt() { return mIzatProxy->hasAgpsExt(); }
|
||||
inline void requestUlp(LocAdapterBase* adapter,
|
||||
unsigned long capabilities) {
|
||||
mIzatProxy->requestUlp(adapter, capabilities);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace loc_core
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -26,36 +26,35 @@
|
|||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef IZAT_PROXY_BASE_H
|
||||
#define IZAT_PROXY_BASE_H
|
||||
|
||||
#ifndef ULP_H
|
||||
#define ULP_H
|
||||
#include <gps_extended.h>
|
||||
#include <MsgTask.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
namespace loc_core {
|
||||
|
||||
#include <hardware/gps.h>
|
||||
struct loc_eng_data_s;
|
||||
class LocApiBase;
|
||||
class LocAdapterBase;
|
||||
|
||||
/** Represents the standard ulp module interface. */
|
||||
typedef struct {
|
||||
/** set to sizeof(ulpInterface) */
|
||||
size_t size;
|
||||
class IzatProxyBase {
|
||||
friend class ContextBase;
|
||||
inline virtual LocApiBase*
|
||||
getLocApi(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask) const {
|
||||
return NULL;
|
||||
}
|
||||
protected:
|
||||
inline IzatProxyBase() {}
|
||||
public:
|
||||
inline virtual ~IzatProxyBase() {}
|
||||
inline virtual void requestUlp(LocAdapterBase* adapter,
|
||||
unsigned long capabilities) const {}
|
||||
inline virtual bool hasAgpsExt() const { return false; }
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts the libulp module. 0: success
|
||||
*/
|
||||
int (*init)(struct loc_eng_data_s &loc_eng_data);
|
||||
/** Get a pointer to extension information. */
|
||||
const void* (*get_extension)(const char* name);
|
||||
typedef IzatProxyBase* (getIzatProxy_t)();
|
||||
|
||||
}ulpInterface;
|
||||
|
||||
typedef const ulpInterface* (get_ulp_interface) (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* ULP_H */
|
||||
} // namespace loc_core
|
||||
|
||||
#endif // IZAT_PROXY_BASE_H
|
|
@ -30,6 +30,7 @@
|
|||
#define LOC_API_ADAPTER_BASE_H
|
||||
|
||||
#include <gps_extended.h>
|
||||
#include <UlpProxyBase.h>
|
||||
#include <ContextBase.h>
|
||||
|
||||
namespace loc_core {
|
||||
|
@ -41,6 +42,9 @@ protected:
|
|||
LocApiBase* mLocApi;
|
||||
const MsgTask* mMsgTask;
|
||||
|
||||
inline LocAdapterBase(const MsgTask* msgTask) :
|
||||
mEvtMask(0), mContext(NULL), mLocApi(NULL), mMsgTask(msgTask) {}
|
||||
|
||||
LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
|
||||
ContextBase* context);
|
||||
inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
|
||||
|
@ -65,8 +69,12 @@ public:
|
|||
|
||||
// This will be overridden by the individual adapters
|
||||
// if necessary.
|
||||
inline virtual void setUlpProxy(UlpProxyBase* ulp) {}
|
||||
inline virtual void handleEngineUpEvent() {}
|
||||
virtual void handleEngineDownEvent() ;
|
||||
virtual void handleEngineDownEvent();
|
||||
inline virtual void setPositionModeInt(LocPosMode& posMode) {}
|
||||
virtual void startFixInt() {}
|
||||
virtual void stopFixInt() {}
|
||||
virtual void reportPosition(UlpLocation &location,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* locationExt,
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <dlfcn.h>
|
||||
#include <LocApiBase.h>
|
||||
#include <LocAdapterBase.h>
|
||||
#include <loc_target.h>
|
||||
#include <log_util.h>
|
||||
|
||||
namespace loc_core {
|
||||
|
@ -104,41 +103,6 @@ struct LocSsrMsg : public LocMsg {
|
|||
}
|
||||
};
|
||||
|
||||
LocApiBase* LocApiBase::create(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||
void* libHandle)
|
||||
{
|
||||
LocApiBase* locApi = NULL;
|
||||
|
||||
// first if can not be MPQ
|
||||
if (TARGET_MPQ != get_target()) {
|
||||
getLocApi_t* getter = NULL;
|
||||
// needto check if locaction.so exists
|
||||
void* handle = ContextBase::getIzatLibHandle();
|
||||
|
||||
if (NULL == handle ||
|
||||
NULL == (getter = (getLocApi_t*)dlsym(handle, "getLocApi")) ||
|
||||
NULL == (locApi = (*getter)(msgTask, exMask))) {
|
||||
// only RPC is the option now
|
||||
handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW);
|
||||
if (NULL != handle) {
|
||||
getter = (getLocApi_t*)dlsym(handle, "getLocApi");
|
||||
if (NULL != getter) {
|
||||
locApi = (*getter)(msgTask, exMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// locApi could still be NULL at this time
|
||||
// we would then create a dummy one
|
||||
if (NULL == locApi) {
|
||||
locApi = new LocApiBase(msgTask, exMask);
|
||||
}
|
||||
|
||||
return locApi;
|
||||
}
|
||||
|
||||
LocApiBase::LocApiBase(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T excludedMask) :
|
||||
mExcludedMask(excludedMask), mMsgTask(msgTask), mMask(0)
|
||||
|
|
|
@ -34,17 +34,6 @@
|
|||
#include <gps_extended.h>
|
||||
#include <MsgTask.h>
|
||||
|
||||
#define smaller_of(a, b) (((a) > (b)) ? (b) : (a))
|
||||
#define MAX_APN_LEN 100
|
||||
|
||||
// This will be overridden by the individual adapters
|
||||
// if necessary.
|
||||
#define DEFAULT_IMPL(rtv) \
|
||||
{ \
|
||||
LOC_LOGW("%s: default implementation invoked", __func__); \
|
||||
return rtv; \
|
||||
}
|
||||
|
||||
namespace loc_core {
|
||||
|
||||
int hexcode(char *hexstring, int string_size,
|
||||
|
@ -52,65 +41,6 @@ int hexcode(char *hexstring, int string_size,
|
|||
int decodeAddress(char *addr_string, int string_size,
|
||||
const char *data, int data_size);
|
||||
|
||||
enum loc_api_adapter_err {
|
||||
LOC_API_ADAPTER_ERR_SUCCESS = 0,
|
||||
LOC_API_ADAPTER_ERR_GENERAL_FAILURE = 1,
|
||||
LOC_API_ADAPTER_ERR_UNSUPPORTED = 2,
|
||||
LOC_API_ADAPTER_ERR_INVALID_HANDLE = 4,
|
||||
LOC_API_ADAPTER_ERR_INVALID_PARAMETER = 5,
|
||||
LOC_API_ADAPTER_ERR_ENGINE_BUSY = 6,
|
||||
LOC_API_ADAPTER_ERR_PHONE_OFFLINE = 7,
|
||||
LOC_API_ADAPTER_ERR_TIMEOUT = 8,
|
||||
LOC_API_ADAPTER_ERR_SERVICE_NOT_PRESENT = 9,
|
||||
|
||||
LOC_API_ADAPTER_ERR_ENGINE_DOWN = 100,
|
||||
LOC_API_ADAPTER_ERR_FAILURE,
|
||||
LOC_API_ADAPTER_ERR_UNKNOWN
|
||||
};
|
||||
|
||||
enum loc_api_adapter_event_index {
|
||||
LOC_API_ADAPTER_REPORT_POSITION = 0, // Position report comes in loc_parsed_position_s_type
|
||||
LOC_API_ADAPTER_REPORT_SATELLITE, // Satellite in view report
|
||||
LOC_API_ADAPTER_REPORT_NMEA_1HZ, // NMEA report at 1HZ rate
|
||||
LOC_API_ADAPTER_REPORT_NMEA_POSITION, // NMEA report at position report rate
|
||||
LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY, // NI notification/verification request
|
||||
LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA, // Assistance data, eg: time, predicted orbits request
|
||||
LOC_API_ADAPTER_REQUEST_LOCATION_SERVER, // Request for location server
|
||||
LOC_API_ADAPTER_REPORT_IOCTL, // Callback report for loc_ioctl
|
||||
LOC_API_ADAPTER_REPORT_STATUS, // Misc status report: eg, engine state
|
||||
LOC_API_ADAPTER_REQUEST_WIFI, //
|
||||
LOC_API_ADAPTER_SENSOR_STATUS, //
|
||||
LOC_API_ADAPTER_REQUEST_TIME_SYNC, //
|
||||
LOC_API_ADAPTER_REPORT_SPI, //
|
||||
LOC_API_ADAPTER_REPORT_NI_GEOFENCE, //
|
||||
LOC_API_ADAPTER_GEOFENCE_GEN_ALERT, //
|
||||
LOC_API_ADAPTER_REPORT_GENFENCE_BREACH, //
|
||||
LOC_API_ADAPTER_PEDOMETER_CTRL, //
|
||||
LOC_API_ADAPTER_MOTION_CTRL, //
|
||||
|
||||
LOC_API_ADAPTER_EVENT_MAX
|
||||
};
|
||||
|
||||
#define LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT (1<<LOC_API_ADAPTER_REPORT_POSITION)
|
||||
#define LOC_API_ADAPTER_BIT_SATELLITE_REPORT (1<<LOC_API_ADAPTER_REPORT_SATELLITE)
|
||||
#define LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT (1<<LOC_API_ADAPTER_REPORT_NMEA_1HZ)
|
||||
#define LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT (1<<LOC_API_ADAPTER_REPORT_NMEA_POSITION)
|
||||
#define LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST (1<<LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY)
|
||||
#define LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST (1<<LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA)
|
||||
#define LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST (1<<LOC_API_ADAPTER_REQUEST_LOCATION_SERVER)
|
||||
#define LOC_API_ADAPTER_BIT_IOCTL_REPORT (1<<LOC_API_ADAPTER_REPORT_IOCTL)
|
||||
#define LOC_API_ADAPTER_BIT_STATUS_REPORT (1<<LOC_API_ADAPTER_REPORT_STATUS)
|
||||
#define LOC_API_ADAPTER_BIT_REQUEST_WIFI (1<<LOC_API_ADAPTER_REQUEST_WIFI)
|
||||
#define LOC_API_ADAPTER_BIT_SENSOR_STATUS (1<<LOC_API_ADAPTER_SENSOR_STATUS)
|
||||
#define LOC_API_ADAPTER_BIT_REQUEST_TIME_SYNC (1<<LOC_API_ADAPTER_REQUEST_TIME_SYNC)
|
||||
#define LOC_API_ADAPTER_BIT_REPORT_SPI (1<<LOC_API_ADAPTER_REPORT_SPI)
|
||||
#define LOC_API_ADAPTER_BIT_REPORT_NI_GEOFENCE (1<<LOC_API_ADAPTER_REPORT_NI_GEOFENCE)
|
||||
#define LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT (1<<LOC_API_ADAPTER_GEOFENCE_GEN_ALERT)
|
||||
#define LOC_API_ADAPTER_BIT_REPORT_GENFENCE_BREACH (1<<LOC_API_ADAPTER_REPORT_GENFENCE_BREACH)
|
||||
#define LOC_API_ADAPTER_BIT_PEDOMETER_CTRL (1<<LOC_API_ADAPTER_PEDOMETER_CTRL)
|
||||
#define LOC_API_ADAPTER_BIT_MOTION_CTRL (1<<LOC_API_ADAPTER_MOTION_CTRL)
|
||||
|
||||
typedef unsigned int LOC_API_ADAPTER_EVENT_MASK_T;
|
||||
#define MAX_ADAPTERS 10
|
||||
|
||||
#define TO_ALL_ADAPTERS(adapters, call) \
|
||||
|
@ -133,10 +63,6 @@ class LocApiBase {
|
|||
|
||||
LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
|
||||
|
||||
static LocApiBase* create(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||
void* libHandle);
|
||||
|
||||
protected:
|
||||
virtual enum loc_api_adapter_err
|
||||
open(LOC_API_ADAPTER_EVENT_MASK_T mask);
|
||||
|
|
|
@ -56,10 +56,9 @@ const MsgTask* LocDualContext::mMsgTask = NULL;
|
|||
ContextBase* LocDualContext::mFgContext = NULL;
|
||||
ContextBase* LocDualContext::mBgContext = NULL;
|
||||
|
||||
char LocDualContext::mHasAgpsExt = 0xff;
|
||||
|
||||
// the name must be shorter than 15 chars
|
||||
const char* LocDualContext::mLocationHalName = "Loc_hal_worker";
|
||||
const char* LocDualContext::mIzatLibName = "libizat_core.so";
|
||||
|
||||
const MsgTask* LocDualContext::getMsgTask(MsgTask::tCreate tCreator,
|
||||
const char* name)
|
||||
|
@ -124,26 +123,9 @@ ContextBase* LocDualContext::getLocBgContext(MsgTask::tAssociate tAssociate,
|
|||
return mBgContext;
|
||||
}
|
||||
|
||||
|
||||
bool LocDualContext::hasAgpsExt()
|
||||
{
|
||||
if (0xff == mHasAgpsExt) {
|
||||
mHasAgpsExt = 0;
|
||||
void* handle = ContextBase::getIzatLibHandle();
|
||||
if (NULL != handle) {
|
||||
bool(*getter)() = (bool(*)())dlsym(handle, "hasAgpsExt");
|
||||
if (NULL != getter) {
|
||||
mHasAgpsExt = (*getter)();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mHasAgpsExt == 1;
|
||||
}
|
||||
|
||||
LocDualContext::LocDualContext(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask) :
|
||||
ContextBase(msgTask, exMask)
|
||||
ContextBase(msgTask, exMask, mIzatLibName)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ class LocDualContext : public ContextBase {
|
|||
static const MsgTask* mMsgTask;
|
||||
static ContextBase* mFgContext;
|
||||
static ContextBase* mBgContext;
|
||||
static char mHasAgpsExt;
|
||||
|
||||
static const MsgTask* getMsgTask(MsgTask::tCreate tCreator,
|
||||
const char* name);
|
||||
|
@ -53,6 +52,7 @@ protected:
|
|||
inline virtual ~LocDualContext() {}
|
||||
|
||||
public:
|
||||
static const char* mIzatLibName;
|
||||
static const LOC_API_ADAPTER_EVENT_MASK_T mFgExclMask;
|
||||
static const LOC_API_ADAPTER_EVENT_MASK_T mBgExclMask;
|
||||
static const char* mLocationHalName;
|
||||
|
@ -65,8 +65,6 @@ public:
|
|||
const char* name);
|
||||
static ContextBase* getLocBgContext(MsgTask::tAssociate tAssociate,
|
||||
const char* name);
|
||||
|
||||
static bool hasAgpsExt();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
63
core/UlpProxyBase.h
Normal file
63
core/UlpProxyBase.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef ULP_PROXY_BASE_H
|
||||
#define ULP_PROXY_BASE_H
|
||||
|
||||
#include <gps_extended.h>
|
||||
|
||||
namespace loc_core {
|
||||
|
||||
class LocAdapterBase;
|
||||
|
||||
class UlpProxyBase {
|
||||
public:
|
||||
inline UlpProxyBase() {}
|
||||
inline virtual ~UlpProxyBase() {}
|
||||
inline virtual bool sendStartFix() { return false;}
|
||||
inline virtual bool sendStopFix() { return false;}
|
||||
inline virtual bool sendFixMode(LocPosMode ¶ms) { return false;}
|
||||
inline virtual bool reportPosition(UlpLocation &location,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* locationExt,
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask) {
|
||||
return false;
|
||||
}
|
||||
inline virtual bool reportSv(GpsSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt) {
|
||||
return false;
|
||||
}
|
||||
inline virtual void setAdapter(LocAdapterBase* adapter) {}
|
||||
inline virtual void setCapabilities(unsigned long capabilities) {}
|
||||
};
|
||||
|
||||
} // namespace loc_core
|
||||
|
||||
#endif // ULP_PROXY_BASE_H
|
|
@ -247,6 +247,77 @@ typedef enum {
|
|||
} loc_if_req_sender_id_e_type;
|
||||
|
||||
|
||||
#define smaller_of(a, b) (((a) > (b)) ? (b) : (a))
|
||||
#define MAX_APN_LEN 100
|
||||
|
||||
// This will be overridden by the individual adapters
|
||||
// if necessary.
|
||||
#define DEFAULT_IMPL(rtv) \
|
||||
{ \
|
||||
LOC_LOGW("%s: default implementation invoked", __func__); \
|
||||
return rtv; \
|
||||
}
|
||||
|
||||
enum loc_api_adapter_err {
|
||||
LOC_API_ADAPTER_ERR_SUCCESS = 0,
|
||||
LOC_API_ADAPTER_ERR_GENERAL_FAILURE = 1,
|
||||
LOC_API_ADAPTER_ERR_UNSUPPORTED = 2,
|
||||
LOC_API_ADAPTER_ERR_INVALID_HANDLE = 4,
|
||||
LOC_API_ADAPTER_ERR_INVALID_PARAMETER = 5,
|
||||
LOC_API_ADAPTER_ERR_ENGINE_BUSY = 6,
|
||||
LOC_API_ADAPTER_ERR_PHONE_OFFLINE = 7,
|
||||
LOC_API_ADAPTER_ERR_TIMEOUT = 8,
|
||||
LOC_API_ADAPTER_ERR_SERVICE_NOT_PRESENT = 9,
|
||||
|
||||
LOC_API_ADAPTER_ERR_ENGINE_DOWN = 100,
|
||||
LOC_API_ADAPTER_ERR_FAILURE,
|
||||
LOC_API_ADAPTER_ERR_UNKNOWN
|
||||
};
|
||||
|
||||
enum loc_api_adapter_event_index {
|
||||
LOC_API_ADAPTER_REPORT_POSITION = 0, // Position report comes in loc_parsed_position_s_type
|
||||
LOC_API_ADAPTER_REPORT_SATELLITE, // Satellite in view report
|
||||
LOC_API_ADAPTER_REPORT_NMEA_1HZ, // NMEA report at 1HZ rate
|
||||
LOC_API_ADAPTER_REPORT_NMEA_POSITION, // NMEA report at position report rate
|
||||
LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY, // NI notification/verification request
|
||||
LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA, // Assistance data, eg: time, predicted orbits request
|
||||
LOC_API_ADAPTER_REQUEST_LOCATION_SERVER, // Request for location server
|
||||
LOC_API_ADAPTER_REPORT_IOCTL, // Callback report for loc_ioctl
|
||||
LOC_API_ADAPTER_REPORT_STATUS, // Misc status report: eg, engine state
|
||||
LOC_API_ADAPTER_REQUEST_WIFI, //
|
||||
LOC_API_ADAPTER_SENSOR_STATUS, //
|
||||
LOC_API_ADAPTER_REQUEST_TIME_SYNC, //
|
||||
LOC_API_ADAPTER_REPORT_SPI, //
|
||||
LOC_API_ADAPTER_REPORT_NI_GEOFENCE, //
|
||||
LOC_API_ADAPTER_GEOFENCE_GEN_ALERT, //
|
||||
LOC_API_ADAPTER_REPORT_GENFENCE_BREACH, //
|
||||
LOC_API_ADAPTER_PEDOMETER_CTRL, //
|
||||
LOC_API_ADAPTER_MOTION_CTRL, //
|
||||
|
||||
LOC_API_ADAPTER_EVENT_MAX
|
||||
};
|
||||
|
||||
#define LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT (1<<LOC_API_ADAPTER_REPORT_POSITION)
|
||||
#define LOC_API_ADAPTER_BIT_SATELLITE_REPORT (1<<LOC_API_ADAPTER_REPORT_SATELLITE)
|
||||
#define LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT (1<<LOC_API_ADAPTER_REPORT_NMEA_1HZ)
|
||||
#define LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT (1<<LOC_API_ADAPTER_REPORT_NMEA_POSITION)
|
||||
#define LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST (1<<LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY)
|
||||
#define LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST (1<<LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA)
|
||||
#define LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST (1<<LOC_API_ADAPTER_REQUEST_LOCATION_SERVER)
|
||||
#define LOC_API_ADAPTER_BIT_IOCTL_REPORT (1<<LOC_API_ADAPTER_REPORT_IOCTL)
|
||||
#define LOC_API_ADAPTER_BIT_STATUS_REPORT (1<<LOC_API_ADAPTER_REPORT_STATUS)
|
||||
#define LOC_API_ADAPTER_BIT_REQUEST_WIFI (1<<LOC_API_ADAPTER_REQUEST_WIFI)
|
||||
#define LOC_API_ADAPTER_BIT_SENSOR_STATUS (1<<LOC_API_ADAPTER_SENSOR_STATUS)
|
||||
#define LOC_API_ADAPTER_BIT_REQUEST_TIME_SYNC (1<<LOC_API_ADAPTER_REQUEST_TIME_SYNC)
|
||||
#define LOC_API_ADAPTER_BIT_REPORT_SPI (1<<LOC_API_ADAPTER_REPORT_SPI)
|
||||
#define LOC_API_ADAPTER_BIT_REPORT_NI_GEOFENCE (1<<LOC_API_ADAPTER_REPORT_NI_GEOFENCE)
|
||||
#define LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT (1<<LOC_API_ADAPTER_GEOFENCE_GEN_ALERT)
|
||||
#define LOC_API_ADAPTER_BIT_REPORT_GENFENCE_BREACH (1<<LOC_API_ADAPTER_REPORT_GENFENCE_BREACH)
|
||||
#define LOC_API_ADAPTER_BIT_PEDOMETER_CTRL (1<<LOC_API_ADAPTER_PEDOMETER_CTRL)
|
||||
#define LOC_API_ADAPTER_BIT_MOTION_CTRL (1<<LOC_API_ADAPTER_MOTION_CTRL)
|
||||
|
||||
typedef unsigned int LOC_API_ADAPTER_EVENT_MASK_T;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -41,8 +41,7 @@ LOCAL_CFLAGS += \
|
|||
LOCAL_C_INCLUDES:= \
|
||||
$(TARGET_OUT_HEADERS)/gps.utils \
|
||||
$(TARGET_OUT_HEADERS)/libloc_core \
|
||||
hardware/qcom/gps/loc_api/libloc_api_50001 \
|
||||
hardware/qcom/gps/loc_api/ulp/inc
|
||||
hardware/qcom/gps/loc_api/libloc_api_50001
|
||||
|
||||
LOCAL_COPY_HEADERS_TO:= libloc_eng/
|
||||
LOCAL_COPY_HEADERS:= \
|
||||
|
@ -53,7 +52,6 @@ LOCAL_COPY_HEADERS:= \
|
|||
loc_eng_ni.h \
|
||||
loc_eng_agps.h \
|
||||
loc_eng_msg.h \
|
||||
loc_eng_msg_id.h \
|
||||
loc_eng_log.h
|
||||
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
|
@ -94,8 +92,7 @@ endif
|
|||
## Includes
|
||||
LOCAL_C_INCLUDES:= \
|
||||
$(TARGET_OUT_HEADERS)/gps.utils \
|
||||
$(TARGET_OUT_HEADERS)/libloc_core \
|
||||
hardware/qcom/gps/loc_api/ulp/inc
|
||||
$(TARGET_OUT_HEADERS)/libloc_core
|
||||
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
|
||||
|
|
|
@ -35,15 +35,47 @@
|
|||
|
||||
using namespace loc_core;
|
||||
|
||||
LocInternalAdapter::LocInternalAdapter(LocEngAdapter* adapter) :
|
||||
LocAdapterBase(adapter->getMsgTask()),
|
||||
mLocEngAdapter(adapter)
|
||||
{
|
||||
}
|
||||
void LocInternalAdapter::setPositionModeInt(LocPosMode& posMode) {
|
||||
sendMsg(new LocEngPositionMode(mLocEngAdapter, posMode));
|
||||
}
|
||||
void LocInternalAdapter::startFixInt() {
|
||||
sendMsg(new LocEngStartFix(mLocEngAdapter));
|
||||
}
|
||||
void LocInternalAdapter::stopFixInt() {
|
||||
sendMsg(new LocEngStopFix(mLocEngAdapter));
|
||||
}
|
||||
void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) {
|
||||
struct LocSetUlpProxy : public LocMsg {
|
||||
LocAdapterBase* mAdapter;
|
||||
UlpProxyBase* mUlp;
|
||||
inline LocSetUlpProxy(LocAdapterBase* adapter, UlpProxyBase* ulp) :
|
||||
LocMsg(), mAdapter(adapter), mUlp(ulp) {
|
||||
}
|
||||
virtual void proc() const {
|
||||
LOC_LOGV("%s] ulp %p adapter %p", __func__,
|
||||
mUlp, mAdapter);
|
||||
mAdapter->setUlpProxy(mUlp);
|
||||
}
|
||||
};
|
||||
|
||||
sendMsg(new LocSetUlpProxy(mLocEngAdapter, ulp));
|
||||
}
|
||||
|
||||
LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
|
||||
void* owner, loc_msg_sender msgSender,
|
||||
void* owner,
|
||||
MsgTask::tCreate tCreator) :
|
||||
LocAdapterBase(mask,
|
||||
LocDualContext::getLocFgContext(
|
||||
tCreator,
|
||||
LocDualContext::mLocationHalName)),
|
||||
mOwner(owner), mSendUlpMsg(msgSender), mNavigating(false),
|
||||
mAgpsEnabled(loc_core::LocDualContext::hasAgpsExt())
|
||||
mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)),
|
||||
mUlp(new UlpProxyBase()), mNavigating(false),
|
||||
mAgpsEnabled(false)
|
||||
{
|
||||
memset(&mFixCriteria, 0, sizeof(mFixCriteria));
|
||||
LOC_LOGD("LocEngAdapter created");
|
||||
|
@ -52,34 +84,61 @@ LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
|
|||
inline
|
||||
LocEngAdapter::~LocEngAdapter()
|
||||
{
|
||||
delete mInternalAdapter;
|
||||
LOC_LOGV("LocEngAdapter deleted");
|
||||
}
|
||||
|
||||
void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp)
|
||||
{
|
||||
delete mUlp;
|
||||
LOC_LOGV("%s] %p", __func__, ulp);
|
||||
if (NULL == ulp) {
|
||||
ulp = new UlpProxyBase();
|
||||
}
|
||||
mUlp = ulp;
|
||||
}
|
||||
|
||||
void LocInternalAdapter::reportPosition(UlpLocation &location,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* locationExt,
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask)
|
||||
{
|
||||
sendMsg(new LocEngReportPosition(mLocEngAdapter,
|
||||
location,
|
||||
locationExtended,
|
||||
locationExt,
|
||||
status,
|
||||
loc_technology_mask));
|
||||
}
|
||||
|
||||
|
||||
void LocEngAdapter::reportPosition(UlpLocation &location,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* locationExt,
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask )
|
||||
LocPosTechMask loc_technology_mask)
|
||||
{
|
||||
if (mSendUlpMsg) {
|
||||
loc_eng_msg_report_position *msg(
|
||||
new loc_eng_msg_report_position(mOwner,
|
||||
location,
|
||||
if (! mUlp->reportPosition(location,
|
||||
locationExtended,
|
||||
locationExt,
|
||||
status,
|
||||
loc_technology_mask));
|
||||
mSendUlpMsg(mOwner, msg);
|
||||
} else {
|
||||
sendMsg(new LocEngReportPosition(mOwner,
|
||||
location,
|
||||
loc_technology_mask )) {
|
||||
mInternalAdapter->reportPosition(location,
|
||||
locationExtended,
|
||||
locationExt,
|
||||
status,
|
||||
loc_technology_mask));
|
||||
loc_technology_mask);
|
||||
}
|
||||
}
|
||||
|
||||
void LocInternalAdapter::reportSv(GpsSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt){
|
||||
sendMsg(new LocEngReportSv(mLocEngAdapter, svStatus,
|
||||
locationExtended, svExt));
|
||||
}
|
||||
|
||||
void LocEngAdapter::reportSv(GpsSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt)
|
||||
|
@ -88,14 +147,8 @@ void LocEngAdapter::reportSv(GpsSvStatus &svStatus,
|
|||
// We want to send SV info to ULP to help it in determining GNSS
|
||||
// signal strength ULP will forward the SV reports to HAL without
|
||||
// any modifications
|
||||
if (mSendUlpMsg) {
|
||||
loc_eng_msg_report_sv *msg(
|
||||
new loc_eng_msg_report_sv(mOwner, svStatus,
|
||||
locationExtended, svExt));
|
||||
mSendUlpMsg(mOwner, msg);
|
||||
} else {
|
||||
sendMsg(new LocEngReportSv(mOwner, svStatus,
|
||||
locationExtended, svExt));
|
||||
if (! mUlp->reportSv(svStatus, locationExtended, svExt)) {
|
||||
mInternalAdapter->reportSv(svStatus, locationExtended, svExt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,28 +36,61 @@
|
|||
#include <log_util.h>
|
||||
#include <LocAdapterBase.h>
|
||||
#include <LocDualContext.h>
|
||||
#include <UlpProxyBase.h>
|
||||
#include <platform_lib_includes.h>
|
||||
|
||||
#define MAX_URL_LEN 256
|
||||
|
||||
using namespace loc_core;
|
||||
|
||||
class LocEngAdapter;
|
||||
|
||||
class LocInternalAdapter : public LocAdapterBase {
|
||||
LocEngAdapter* mLocEngAdapter;
|
||||
public:
|
||||
LocInternalAdapter(LocEngAdapter* adapter);
|
||||
|
||||
virtual void reportPosition(UlpLocation &location,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* locationExt,
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask);
|
||||
virtual void reportSv(GpsSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt);
|
||||
virtual void setPositionModeInt(LocPosMode& posMode);
|
||||
virtual void startFixInt();
|
||||
virtual void stopFixInt();
|
||||
virtual void setUlpProxy(UlpProxyBase* ulp);
|
||||
};
|
||||
|
||||
typedef void (*loc_msg_sender)(void* loc_eng_data_p, void* msgp);
|
||||
|
||||
class LocEngAdapter : public LocAdapterBase {
|
||||
void* mOwner;
|
||||
loc_msg_sender mSendUlpMsg;
|
||||
LocInternalAdapter* mInternalAdapter;
|
||||
UlpProxyBase* mUlp;
|
||||
LocPosMode mFixCriteria;
|
||||
bool mNavigating;
|
||||
|
||||
public:
|
||||
const bool mAgpsEnabled;
|
||||
bool mAgpsEnabled;
|
||||
|
||||
LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
|
||||
void* owner, loc_msg_sender msgSender,
|
||||
void* owner,
|
||||
MsgTask::tCreate tCreator);
|
||||
virtual ~LocEngAdapter();
|
||||
|
||||
virtual void setUlpProxy(UlpProxyBase* ulp);
|
||||
inline void requestUlp(unsigned long capabilities) {
|
||||
mContext->requestUlp(mInternalAdapter, capabilities);
|
||||
}
|
||||
inline LocInternalAdapter* getInternalAdapter() { return mInternalAdapter; }
|
||||
inline UlpProxyBase* getUlpProxy() { return mUlp; }
|
||||
inline void* getOwner() { return mOwner; }
|
||||
inline bool hasAgpsExt() { return mContext->hasAgpsExt(); }
|
||||
inline const MsgTask* getMsgTask() { return mMsgTask; }
|
||||
|
||||
inline enum loc_api_adapter_err
|
||||
startFix()
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
AM_CFLAGS = \
|
||||
-I../../utils \
|
||||
-I../../platform_lib_abstractions \
|
||||
-I../ulp/inc \
|
||||
-fno-short-enums \
|
||||
-DFEATURE_GNSS_BIT_API
|
||||
|
||||
|
@ -69,9 +68,7 @@ library_include_HEADERS = \
|
|||
loc_eng_ni.h \
|
||||
loc_eng_agps.h \
|
||||
loc_eng_msg.h \
|
||||
loc_eng_msg_id.h \
|
||||
loc_eng_log.h \
|
||||
../ulp/inc/ulp.h
|
||||
loc_eng_log.h
|
||||
|
||||
library_includedir = $(pkgincludedir)/libloc_api_50001
|
||||
|
||||
|
|
|
@ -37,41 +37,27 @@
|
|||
#include <loc_log.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <msg_q.h>
|
||||
#include <dlfcn.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <LocDualContext.h>
|
||||
#include <loc_eng_msg.h>
|
||||
#include <cutils/properties.h>
|
||||
|
||||
namespace android {
|
||||
namespace AndroidRuntime {
|
||||
void* createJavaThread(const char* name, void (*start)(void *), void* arg);
|
||||
}
|
||||
}
|
||||
using namespace loc_core;
|
||||
|
||||
//Globals defns
|
||||
static const ulpInterface * loc_eng_ulp_inf = NULL;
|
||||
static const ulpInterface * loc_eng_get_ulp_inf(void);
|
||||
static gps_location_callback gps_loc_cb = NULL;
|
||||
static gps_sv_status_callback gps_sv_cb = NULL;
|
||||
|
||||
static void local_loc_cb(UlpLocation* location, void* locExt);
|
||||
static void local_status_cb(GpsStatus* status);
|
||||
static void local_sv_cb(GpsSvStatus* sv_status, void* svExt);
|
||||
static void local_nmea_cb(GpsUtcTime timestamp, const char* nmea, int length);
|
||||
static void local_set_capabilities_cb(uint32_t capabilities);
|
||||
static void local_acquire_wakelock_cb(void);
|
||||
static void local_release_wakelock_cb(void);
|
||||
static void local_request_utc_time_cb(void);
|
||||
|
||||
static const GpsGeofencingInterface* get_geofence_interface(void);
|
||||
|
||||
// Function declarations for sLocEngInterface
|
||||
static int loc_init(GpsCallbacks* callbacks);
|
||||
static int loc_hal_init(void);
|
||||
static int loc_start();
|
||||
static int loc_stop();
|
||||
static void loc_cleanup();
|
||||
|
@ -154,7 +140,6 @@ static const AGpsRilInterface sLocEngAGpsRilInterface =
|
|||
};
|
||||
|
||||
static loc_eng_data_s_type loc_afw_data;
|
||||
static LocCallbacks afw_cb_data;
|
||||
static int gss_fd = 0;
|
||||
|
||||
/*===========================================================================
|
||||
|
@ -195,16 +180,6 @@ const GpsInterface* gps_get_hardware_interface ()
|
|||
|
||||
loc_eng_read_config();
|
||||
|
||||
//We load up libulp module at this point itself
|
||||
loc_eng_ulp_inf = loc_eng_get_ulp_inf();
|
||||
|
||||
if (0 != loc_hal_init()) {
|
||||
LOC_LOGE("HAL could not be initialized");
|
||||
ret_val = NULL;
|
||||
} else {
|
||||
ret_val = &sLocEngInterface;
|
||||
}
|
||||
|
||||
EXIT_LOG(%p, ret_val);
|
||||
return ret_val;
|
||||
}
|
||||
|
@ -213,12 +188,8 @@ const GpsInterface* gps_get_hardware_interface ()
|
|||
extern "C" const GpsInterface* get_gps_interface()
|
||||
{
|
||||
unsigned int target = TARGET_DEFAULT;
|
||||
if (NULL == loc_afw_data.adapter) {
|
||||
loc_eng_read_config();
|
||||
|
||||
//We load up libulp module at this point itself
|
||||
loc_eng_ulp_inf = loc_eng_get_ulp_inf();
|
||||
|
||||
target = get_target();
|
||||
LOC_LOGD("Target name check returned %s", loc_get_target_name(target));
|
||||
//APQ8064
|
||||
|
@ -229,7 +200,8 @@ extern "C" const GpsInterface* get_gps_interface()
|
|||
LOC_LOGE("GSS open failed: %s\n", strerror(errno));
|
||||
}
|
||||
else {
|
||||
LOC_LOGD("GSS open success! CAPABILITIES %0lx\n", gps_conf.CAPABILITIES);
|
||||
LOC_LOGD("GSS open success! CAPABILITIES %0lx\n",
|
||||
gps_conf.CAPABILITIES);
|
||||
}
|
||||
}
|
||||
//MPQ8064
|
||||
|
@ -237,27 +209,11 @@ extern "C" const GpsInterface* get_gps_interface()
|
|||
LOC_LOGE("No GPS HW on this target (MPQ8064). Not returning interface");
|
||||
return NULL;
|
||||
}
|
||||
if (0 != loc_hal_init()) {
|
||||
LOC_LOGE("HAL could not be initialized");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return &sLocEngInterface;
|
||||
}
|
||||
|
||||
static void loc_free_msg(void* msg)
|
||||
{
|
||||
delete (loc_eng_msg*)msg;
|
||||
}
|
||||
|
||||
void loc_ulp_msg_sender(void* loc_eng_data_p, void* msg)
|
||||
{
|
||||
loc_eng_data_s_type* loc_eng = (loc_eng_data_s_type*)loc_eng_data_p;
|
||||
msg_q_snd(loc_eng->ulp_q, msg, loc_free_msg);
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_hal_init
|
||||
FUNCTION loc_init
|
||||
|
||||
DESCRIPTION
|
||||
Initialize the location engine, this include setting up global datas
|
||||
|
@ -273,19 +229,18 @@ SIDE EFFECTS
|
|||
N/Ax
|
||||
|
||||
===========================================================================*/
|
||||
static int loc_hal_init(void)
|
||||
static int loc_init(GpsCallbacks* callbacks)
|
||||
{
|
||||
int retVal = -1;
|
||||
ENTRY_LOG();
|
||||
LOC_API_ADAPTER_EVENT_MASK_T event;
|
||||
|
||||
if (loc_core::LocDualContext::hasAgpsExt()) {
|
||||
event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
|
||||
LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
|
||||
LOC_API_ADAPTER_BIT_IOCTL_REPORT |
|
||||
LOC_API_ADAPTER_BIT_STATUS_REPORT |
|
||||
LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT;
|
||||
} else {
|
||||
if (NULL == callbacks) {
|
||||
LOC_LOGE("loc_init failed. cb = NULL\n");
|
||||
EXIT_LOG(%d, retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
|
||||
LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
|
||||
LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
|
||||
|
@ -294,29 +249,26 @@ static int loc_hal_init(void)
|
|||
LOC_API_ADAPTER_BIT_STATUS_REPORT |
|
||||
LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
|
||||
LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
|
||||
}
|
||||
|
||||
LocCallbacks clientCallbacks = {local_loc_cb, /* location_cb */
|
||||
local_status_cb, /* status_cb */
|
||||
callbacks->status_cb, /* status_cb */
|
||||
local_sv_cb, /* sv_status_cb */
|
||||
local_nmea_cb, /* nmea_cb */
|
||||
local_set_capabilities_cb, /* set_capabilities_cb */
|
||||
local_acquire_wakelock_cb, /* acquire_wakelock_cb */
|
||||
local_release_wakelock_cb, /* release_wakelock_cb */
|
||||
(pthread_t (*)(const char*, void (*)(void*), void*))
|
||||
android::AndroidRuntime::createJavaThread, /* create_thread_cb */
|
||||
callbacks->nmea_cb, /* nmea_cb */
|
||||
callbacks->set_capabilities_cb, /* set_capabilities_cb */
|
||||
callbacks->acquire_wakelock_cb, /* acquire_wakelock_cb */
|
||||
callbacks->release_wakelock_cb, /* release_wakelock_cb */
|
||||
callbacks->create_thread_cb, /* create_thread_cb */
|
||||
NULL, /* location_ext_parser */
|
||||
NULL, /* sv_ext_parser */
|
||||
local_request_utc_time_cb /* request_utc_time_cb */};
|
||||
callbacks->request_utc_time_cb /* request_utc_time_cb */};
|
||||
|
||||
if (loc_eng_ulp_inf == NULL)
|
||||
retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event,
|
||||
NULL);
|
||||
else
|
||||
retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event,
|
||||
loc_ulp_msg_sender);
|
||||
gps_loc_cb = callbacks->location_cb;
|
||||
gps_sv_cb = callbacks->sv_status_cb;
|
||||
|
||||
retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event);
|
||||
loc_afw_data.adapter->requestUlp(gps_conf.CAPABILITIES);
|
||||
loc_afw_data.adapter->mAgpsEnabled = !loc_afw_data.adapter->hasAgpsExt();
|
||||
|
||||
int ret_val1 = loc_eng_ulp_init(loc_afw_data, loc_eng_ulp_inf);
|
||||
LOC_LOGD("loc_eng_ulp_init returned %d\n",ret_val1);
|
||||
|
||||
EXIT_LOG(%d, retVal);
|
||||
return retVal;
|
||||
|
@ -473,9 +425,8 @@ static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertain
|
|||
ENTRY_LOG();
|
||||
int ret_val = 0;
|
||||
|
||||
if (loc_core::LocDualContext::hasAgpsExt()) {
|
||||
ret_val = loc_eng_inject_time(loc_afw_data, time, timeReference, uncertainty);
|
||||
}
|
||||
ret_val = loc_eng_inject_time(loc_afw_data, time,
|
||||
timeReference, uncertainty);
|
||||
|
||||
EXIT_LOG(%d, ret_val);
|
||||
return ret_val;
|
||||
|
@ -582,7 +533,7 @@ const GpsGeofencingInterface* get_geofence_interface(void)
|
|||
dlerror(); /* Clear any existing error */
|
||||
get_gps_geofence_interface = (get_gps_geofence_interface_function)dlsym(handle, "gps_geofence_get_interface");
|
||||
if ((error = dlerror()) != NULL) {
|
||||
LOC_LOGE ("%s, dlsym for ulpInterface failed, error = %s\n", __func__, error);
|
||||
LOC_LOGE ("%s, dlsym for get_gps_geofence_interface failed, error = %s\n", __func__, error);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
@ -616,22 +567,16 @@ const void* loc_get_extension(const char* name)
|
|||
LOC_LOGD("%s:%d] For Interface = %s\n",__func__, __LINE__, name);
|
||||
if (strcmp(name, GPS_XTRA_INTERFACE) == 0)
|
||||
{
|
||||
if (loc_core::LocDualContext::hasAgpsExt()) {
|
||||
ret_val = &sLocEngXTRAInterface;
|
||||
}
|
||||
}
|
||||
else if (strcmp(name, AGPS_INTERFACE) == 0)
|
||||
{
|
||||
if (loc_core::LocDualContext::hasAgpsExt()) {
|
||||
ret_val = &sLocEngAGpsInterface;
|
||||
}
|
||||
}
|
||||
else if (strcmp(name, GPS_NI_INTERFACE) == 0)
|
||||
{
|
||||
if (loc_core::LocDualContext::hasAgpsExt()) {
|
||||
ret_val = &sLocEngNiInterface;
|
||||
}
|
||||
}
|
||||
else if (strcmp(name, AGPS_RIL_INTERFACE) == 0)
|
||||
{
|
||||
char baseband[PROPERTY_VALUE_MAX];
|
||||
|
@ -789,6 +734,8 @@ static int loc_agps_set_server(AGpsType type, const char* hostname, int port)
|
|||
case AGPS_TYPE_C2K:
|
||||
serverType = LOC_AGPS_CDMA_PDE_SERVER;
|
||||
break;
|
||||
default:
|
||||
serverType = LOC_AGPS_SUPL_SERVER;
|
||||
}
|
||||
int ret_val = loc_eng_set_server_proxy(loc_afw_data, serverType, hostname, port);
|
||||
|
||||
|
@ -797,7 +744,8 @@ static int loc_agps_set_server(AGpsType type, const char* hostname, int port)
|
|||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_xtra_init
|
||||
FUNCTIONf571
|
||||
loc_xtra_init
|
||||
|
||||
DESCRIPTION
|
||||
Initialize XTRA module.
|
||||
|
@ -932,8 +880,6 @@ static void local_loc_cb(UlpLocation* location, void* locExt)
|
|||
|
||||
if (NULL != gps_loc_cb) {
|
||||
gps_loc_cb(&location->gpsLocation);
|
||||
} else {
|
||||
LOC_LOGE("Error. GPS not enabled");
|
||||
}
|
||||
}
|
||||
EXIT_LOG(%s, VOID_RET);
|
||||
|
@ -945,174 +891,6 @@ static void local_sv_cb(GpsSvStatus* sv_status, void* svExt)
|
|||
if (NULL != gps_sv_cb) {
|
||||
CALLBACK_LOG_CALLFLOW("sv_status_cb -", %d, sv_status->num_svs);
|
||||
gps_sv_cb(sv_status);
|
||||
} else {
|
||||
LOC_LOGE("Error. GPS not enabled");
|
||||
}
|
||||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_eng_get_ulp_inf
|
||||
|
||||
DESCRIPTION
|
||||
This function checks if ULP is enabled, and loads the libulp2.so and
|
||||
returns its interface
|
||||
|
||||
DEPENDENCIES
|
||||
None
|
||||
|
||||
RETURN VALUE
|
||||
interface pointer to libulp: no error
|
||||
NULL: errors
|
||||
|
||||
SIDE EFFECTS
|
||||
N/A
|
||||
|
||||
===========================================================================*/
|
||||
const ulpInterface * loc_eng_get_ulp_inf(void)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
void *handle;
|
||||
const char *error;
|
||||
get_ulp_interface* get_ulp_inf;
|
||||
const ulpInterface* loc_eng_ulpInf = NULL;
|
||||
|
||||
dlerror(); /* Clear any existing error */
|
||||
|
||||
handle = dlopen ("libulp2.so", RTLD_NOW);
|
||||
|
||||
if (!handle)
|
||||
{
|
||||
if ((error = dlerror()) != NULL) {
|
||||
LOC_LOGE ("%s, dlopen for libulp.so failed, error = %s\n", __func__, error);
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
dlerror(); /* Clear any existing error */
|
||||
get_ulp_inf = (get_ulp_interface*) dlsym(handle, "ulp_get_interface");
|
||||
if ((error = dlerror()) != NULL) {
|
||||
LOC_LOGE ("%s, dlsym for ulpInterface failed, error = %s\n", __func__, error);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// Initialize the ULP interface
|
||||
loc_eng_ulpInf = get_ulp_inf();
|
||||
|
||||
exit:
|
||||
EXIT_LOG(%d, loc_eng_ulpInf == NULL);
|
||||
return loc_eng_ulpInf;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_init
|
||||
|
||||
DESCRIPTION
|
||||
Registers the AFW call backs with the local tables
|
||||
|
||||
DEPENDENCIES
|
||||
None
|
||||
|
||||
RETURN VALUE
|
||||
0: success
|
||||
|
||||
SIDE EFFECTS
|
||||
N/Ax
|
||||
|
||||
===========================================================================*/
|
||||
static int loc_init(GpsCallbacks* callbacks)
|
||||
{
|
||||
int retVal = -1;
|
||||
ENTRY_LOG();
|
||||
if(callbacks == NULL) {
|
||||
LOC_LOGE(" loc_init. cb = NULL\n");
|
||||
EXIT_LOG(%d, retVal);
|
||||
return retVal;
|
||||
}
|
||||
memset(&afw_cb_data, 0, sizeof (afw_cb_data));
|
||||
gps_loc_cb = callbacks->location_cb;
|
||||
afw_cb_data.status_cb = callbacks->status_cb;
|
||||
gps_sv_cb = callbacks->sv_status_cb;
|
||||
afw_cb_data.set_capabilities_cb = callbacks->set_capabilities_cb;
|
||||
afw_cb_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
|
||||
afw_cb_data.release_wakelock_cb = callbacks->release_wakelock_cb;
|
||||
afw_cb_data.request_utc_time_cb = callbacks->request_utc_time_cb;
|
||||
afw_cb_data.nmea_cb = callbacks->nmea_cb;
|
||||
if (NULL != callbacks->set_capabilities_cb) {
|
||||
callbacks->set_capabilities_cb(gps_conf.CAPABILITIES);
|
||||
}
|
||||
retVal = 0;
|
||||
EXIT_LOG(%d, retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
static void local_nmea_cb(GpsUtcTime timestamp, const char* nmea, int length)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
if (0 != length) {
|
||||
if (NULL != afw_cb_data.nmea_cb) {
|
||||
afw_cb_data.nmea_cb(timestamp, nmea, length);
|
||||
} else
|
||||
{
|
||||
LOC_LOGE("Error. GPS not enabled");
|
||||
}
|
||||
}
|
||||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
||||
static void local_set_capabilities_cb(uint32_t capabilities)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
if (NULL != afw_cb_data.set_capabilities_cb) {
|
||||
afw_cb_data.set_capabilities_cb(capabilities);
|
||||
} else {
|
||||
LOC_LOGE("Error. GPS not enabled");
|
||||
}
|
||||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
||||
static void local_acquire_wakelock_cb(void)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
if (NULL != afw_cb_data.acquire_wakelock_cb) {
|
||||
afw_cb_data.acquire_wakelock_cb();
|
||||
} else {
|
||||
LOC_LOGE("Error. GPS not enabled");
|
||||
}
|
||||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
||||
static void local_release_wakelock_cb(void)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
if (NULL != afw_cb_data.release_wakelock_cb) {
|
||||
afw_cb_data.release_wakelock_cb();
|
||||
} else {
|
||||
LOC_LOGE("Error. GPS not enabled");
|
||||
}
|
||||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
||||
static void local_request_utc_time_cb(void)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
if (NULL != afw_cb_data.request_utc_time_cb) {
|
||||
afw_cb_data.request_utc_time_cb();
|
||||
} else {
|
||||
LOC_LOGE("Error. GPS not enabled");
|
||||
}
|
||||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
||||
static void local_status_cb(GpsStatus* status)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
if (NULL != status) {
|
||||
CALLBACK_LOG_CALLFLOW("status_callback - status", %d, status->status);
|
||||
if (NULL != afw_cb_data.status_cb) {
|
||||
afw_cb_data.status_cb(status);
|
||||
} else {
|
||||
LOC_LOGE("Error. GPS not enabled");
|
||||
}
|
||||
}
|
||||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
|
|
@ -57,8 +57,6 @@ typedef struct {
|
|||
gps_request_utc_time request_utc_time_cb;
|
||||
} LocCallbacks;
|
||||
|
||||
void loc_ulp_msg_sender(void* loc_eng_data_p, void* msg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
@ -65,7 +65,6 @@
|
|||
#include <loc_eng_dmn_conn.h>
|
||||
#include <loc_eng_dmn_conn_handler.h>
|
||||
#include <loc_eng_msg.h>
|
||||
#include <loc_eng_msg_id.h>
|
||||
#include <loc_eng_nmea.h>
|
||||
#include <msg_q.h>
|
||||
#include <loc.h>
|
||||
|
@ -190,11 +189,6 @@ static void deleteAidingData(loc_eng_data_s_type &logEng);
|
|||
static AgpsStateMachine*
|
||||
getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType);
|
||||
|
||||
static void loc_eng_free_msg(void* msg)
|
||||
{
|
||||
delete (loc_eng_msg*)msg;
|
||||
}
|
||||
|
||||
static void update_aiding_data_for_deletion(loc_eng_data_s_type& loc_eng_data) {
|
||||
if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON &&
|
||||
loc_eng_data.aiding_data_for_deletion != 0)
|
||||
|
@ -246,14 +240,15 @@ inline void LocEngRequestNi::log() const {
|
|||
// in loc_eng_ni.cpp
|
||||
|
||||
// case LOC_ENG_MSG_START_FIX:
|
||||
LocEngStartFix::LocEngStartFix(loc_eng_data_s_type* locEng) :
|
||||
LocMsg(), mLocEng(locEng)
|
||||
LocEngStartFix::LocEngStartFix(LocEngAdapter* adapter) :
|
||||
LocMsg(), mAdapter(adapter)
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
inline void LocEngStartFix::proc() const
|
||||
{
|
||||
loc_eng_start_handler(*mLocEng);
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
|
||||
loc_eng_start_handler(*locEng);
|
||||
}
|
||||
inline void LocEngStartFix::locallog() const
|
||||
{
|
||||
|
@ -264,19 +259,19 @@ inline void LocEngStartFix::log() const
|
|||
locallog();
|
||||
}
|
||||
void LocEngStartFix::send() const {
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
|
||||
locEng->adapter->sendMsg(this);
|
||||
mAdapter->sendMsg(this);
|
||||
}
|
||||
|
||||
// case LOC_ENG_MSG_STOP_FIX:
|
||||
LocEngStopFix::LocEngStopFix(loc_eng_data_s_type* locEng) :
|
||||
LocMsg(), mLocEng(locEng)
|
||||
LocEngStopFix::LocEngStopFix(LocEngAdapter* adapter) :
|
||||
LocMsg(), mAdapter(adapter)
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
inline void LocEngStopFix::proc() const
|
||||
{
|
||||
loc_eng_stop_handler(*mLocEng);
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
|
||||
loc_eng_stop_handler(*locEng);
|
||||
}
|
||||
inline void LocEngStopFix::locallog() const
|
||||
{
|
||||
|
@ -287,8 +282,7 @@ inline void LocEngStopFix::log() const
|
|||
locallog();
|
||||
}
|
||||
void LocEngStopFix::send() const {
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
|
||||
locEng->adapter->sendMsg(this);
|
||||
mAdapter->sendMsg(this);
|
||||
}
|
||||
|
||||
// case LOC_ENG_MSG_SET_POSITION_MODE:
|
||||
|
@ -669,21 +663,24 @@ struct LocEngExtPowerConfig : public LocMsg {
|
|||
};
|
||||
|
||||
// case LOC_ENG_MSG_REPORT_POSITION:
|
||||
LocEngReportPosition::LocEngReportPosition(void* locEng,
|
||||
LocEngReportPosition::LocEngReportPosition(LocAdapterBase* adapter,
|
||||
UlpLocation &loc,
|
||||
GpsLocationExtended &locExtended,
|
||||
void* locExt,
|
||||
enum loc_sess_status st,
|
||||
LocPosTechMask technology) :
|
||||
LocMsg(), mLocEng(locEng), mLocation(loc),
|
||||
LocMsg(), mAdapter(adapter), mLocation(loc),
|
||||
mLocationExtended(locExtended),
|
||||
mLocationExt(((loc_eng_data_s_type*)mLocEng)->location_ext_parser(locExt)),
|
||||
mLocationExt(((loc_eng_data_s_type*)
|
||||
((LocEngAdapter*)
|
||||
(mAdapter))->getOwner())->location_ext_parser(locExt)),
|
||||
mStatus(st), mTechMask(technology)
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
void LocEngReportPosition::proc() const {
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
|
||||
LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
|
||||
|
||||
if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION) {
|
||||
bool reported = false;
|
||||
|
@ -768,24 +765,26 @@ void LocEngReportPosition::log() const {
|
|||
locallog();
|
||||
}
|
||||
void LocEngReportPosition::send() const {
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
|
||||
locEng->adapter->sendMsg(this);
|
||||
mAdapter->sendMsg(this);
|
||||
}
|
||||
|
||||
|
||||
// case LOC_ENG_MSG_REPORT_SV:
|
||||
LocEngReportSv::LocEngReportSv(void* locEng,
|
||||
LocEngReportSv::LocEngReportSv(LocAdapterBase* adapter,
|
||||
GpsSvStatus &sv,
|
||||
GpsLocationExtended &locExtended,
|
||||
void* svExt) :
|
||||
LocMsg(), mLocEng(locEng), mSvStatus(sv),
|
||||
LocMsg(), mAdapter(adapter), mSvStatus(sv),
|
||||
mLocationExtended(locExtended),
|
||||
mSvExt(((loc_eng_data_s_type*)mLocEng)->sv_ext_parser(svExt))
|
||||
mSvExt(((loc_eng_data_s_type*)
|
||||
((LocEngAdapter*)
|
||||
(mAdapter))->getOwner())->sv_ext_parser(svExt))
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
void LocEngReportSv::proc() const {
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
|
||||
LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
|
||||
|
||||
if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
|
||||
{
|
||||
|
@ -819,8 +818,7 @@ inline void LocEngReportSv::log() const {
|
|||
locallog();
|
||||
}
|
||||
void LocEngReportSv::send() const {
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
|
||||
locEng->adapter->sendMsg(this);
|
||||
mAdapter->sendMsg(this);
|
||||
}
|
||||
|
||||
// case LOC_ENG_MSG_REPORT_STATUS:
|
||||
|
@ -1405,8 +1403,7 @@ SIDE EFFECTS
|
|||
|
||||
===========================================================================*/
|
||||
int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T event,
|
||||
void (*loc_external_msg_sender) (void*, void*))
|
||||
LOC_API_ADAPTER_EVENT_MASK_T event)
|
||||
|
||||
{
|
||||
int ret_val = 0;
|
||||
|
@ -1424,6 +1421,10 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
|
|||
|
||||
memset(&loc_eng_data, 0, sizeof (loc_eng_data));
|
||||
|
||||
if (NULL != callbacks->set_capabilities_cb) {
|
||||
callbacks->set_capabilities_cb(gps_conf.CAPABILITIES);
|
||||
}
|
||||
|
||||
// Save callbacks
|
||||
loc_eng_data.location_cb = callbacks->location_cb;
|
||||
loc_eng_data.sv_status_cb = callbacks->sv_status_cb;
|
||||
|
@ -1455,7 +1456,6 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
|
|||
|
||||
loc_eng_data.adapter =
|
||||
new LocEngAdapter(event, &loc_eng_data,
|
||||
loc_external_msg_sender,
|
||||
(MsgTask::tCreate)callbacks->create_thread_cb);
|
||||
|
||||
LOC_LOGD("loc_eng_init created client, id = %p\n",
|
||||
|
@ -1563,13 +1563,6 @@ void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data)
|
|||
|
||||
#if 0 // can't afford to actually clean up, for many reason.
|
||||
|
||||
// De-initialize ulp
|
||||
if (locEngUlpInf != NULL)
|
||||
{
|
||||
locEngUlpInf = NULL;
|
||||
msg_q_destroy( &loc_eng_data.ulp_q);
|
||||
}
|
||||
|
||||
LOC_LOGD("loc_eng_init: client opened. close it now.");
|
||||
delete loc_eng_data.adapter;
|
||||
loc_eng_data.adapter = NULL;
|
||||
|
@ -1604,15 +1597,9 @@ int loc_eng_start(loc_eng_data_s_type &loc_eng_data)
|
|||
ENTRY_LOG_CALLFLOW();
|
||||
INIT_CHECK(loc_eng_data.adapter, return -1);
|
||||
|
||||
if(loc_eng_data.ulp_q)
|
||||
if(! loc_eng_data.adapter->getUlpProxy()->sendStartFix())
|
||||
{
|
||||
//Pass the start messgage to ULP if present & activated
|
||||
loc_eng_msg *msg(new loc_eng_msg(&loc_eng_data, LOC_ENG_MSG_START_FIX));
|
||||
msg_q_snd(loc_eng_data.ulp_q, msg, loc_eng_free_msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
loc_eng_data.adapter->sendMsg(new LocEngStartFix(&loc_eng_data));
|
||||
loc_eng_data.adapter->sendMsg(new LocEngStartFix(loc_eng_data.adapter));
|
||||
}
|
||||
|
||||
EXIT_LOG(%d, 0);
|
||||
|
@ -1660,15 +1647,9 @@ int loc_eng_stop(loc_eng_data_s_type &loc_eng_data)
|
|||
ENTRY_LOG_CALLFLOW();
|
||||
INIT_CHECK(loc_eng_data.adapter, return -1);
|
||||
|
||||
if(loc_eng_data.ulp_q)
|
||||
if(! loc_eng_data.adapter->getUlpProxy()->sendStopFix())
|
||||
{
|
||||
//Pass the start messgage to ULP if present & activated
|
||||
loc_eng_msg *msg(new loc_eng_msg(&loc_eng_data, LOC_ENG_MSG_STOP_FIX));
|
||||
msg_q_snd(loc_eng_data.ulp_q, msg, loc_eng_free_msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
loc_eng_data.adapter->sendMsg(new LocEngStopFix(&loc_eng_data));
|
||||
loc_eng_data.adapter->sendMsg(new LocEngStopFix(loc_eng_data.adapter));
|
||||
}
|
||||
|
||||
EXIT_LOG(%d, 0);
|
||||
|
@ -1739,17 +1720,8 @@ int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
|
|||
{
|
||||
ENTRY_LOG_CALLFLOW();
|
||||
INIT_CHECK(loc_eng_data.adapter, return -1);
|
||||
loc_eng_msg_position_mode *msg(
|
||||
new loc_eng_msg_position_mode(&loc_eng_data, params));
|
||||
|
||||
if(loc_eng_data.ulp_q)
|
||||
{
|
||||
loc_eng_msg_position_mode *msg(
|
||||
new loc_eng_msg_position_mode(&loc_eng_data, params));
|
||||
//Pass the start messgage to ULP if present & activated
|
||||
msg_q_snd(loc_eng_data.ulp_q, msg, loc_eng_free_msg);
|
||||
}
|
||||
else
|
||||
if(! loc_eng_data.adapter->getUlpProxy()->sendFixMode(params))
|
||||
{
|
||||
LocEngAdapter* adapter = loc_eng_data.adapter;
|
||||
adapter->sendMsg(new LocEngPositionMode(adapter, params));
|
||||
|
@ -1781,8 +1753,10 @@ int loc_eng_inject_time(loc_eng_data_s_type &loc_eng_data, GpsUtcTime time,
|
|||
ENTRY_LOG_CALLFLOW();
|
||||
INIT_CHECK(loc_eng_data.adapter, return -1);
|
||||
LocEngAdapter* adapter = loc_eng_data.adapter;
|
||||
if (adapter->mAgpsEnabled) {
|
||||
adapter->sendMsg(new LocEngSetTime(adapter, time, timeReference,
|
||||
uncertainty));
|
||||
}
|
||||
EXIT_LOG(%d, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2467,41 +2441,6 @@ static int set_sched_policy(int tid, SchedPolicy policy)
|
|||
}
|
||||
#endif /* USE_GLIB */
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_eng_ulp_init
|
||||
|
||||
DESCRIPTION
|
||||
This function dynamically loads the libulp.so and calls
|
||||
its init function to start up the ulp module
|
||||
|
||||
DEPENDENCIES
|
||||
None
|
||||
|
||||
RETURN VALUE
|
||||
0: no error
|
||||
-1: errors
|
||||
|
||||
SIDE EFFECTS
|
||||
N/A
|
||||
|
||||
===========================================================================*/
|
||||
int loc_eng_ulp_init(loc_eng_data_s_type &loc_eng_data, const ulpInterface * loc_eng_ulpInf)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
int ret_val=-1;
|
||||
if((loc_eng_ulpInf != NULL) && (((ulpInterface *)loc_eng_ulpInf)->init != NULL))
|
||||
{
|
||||
// Initialize the ULP interface
|
||||
((ulpInterface *)loc_eng_ulpInf)->init(loc_eng_data);
|
||||
loc_eng_data.ulp_q = (void*)msg_q_init2();
|
||||
ret_val = 0;
|
||||
}
|
||||
else
|
||||
LOC_LOGE("ulp not initialized. NULL parameter");
|
||||
EXIT_LOG(%d, ret_val);
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_eng_read_config
|
||||
|
||||
|
|
|
@ -130,14 +130,11 @@ typedef struct loc_eng_data_s
|
|||
int mpc_host_set;
|
||||
char mpc_host_buf[101];
|
||||
int mpc_port_buf;
|
||||
void *ulp_q;
|
||||
|
||||
loc_ext_parser location_ext_parser;
|
||||
loc_ext_parser sv_ext_parser;
|
||||
} loc_eng_data_s_type;
|
||||
|
||||
#include "ulp.h"
|
||||
|
||||
/* GPS.conf support */
|
||||
typedef struct loc_gps_cfg_s
|
||||
{
|
||||
|
@ -182,9 +179,7 @@ extern loc_sap_cfg_s_type sap_conf;
|
|||
|
||||
int loc_eng_init(loc_eng_data_s_type &loc_eng_data,
|
||||
LocCallbacks* callbacks,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T event,
|
||||
void (*loc_external_msg_sender) (void*, void*));
|
||||
int loc_eng_ulp_init(loc_eng_data_s_type &loc_eng_data, const ulpInterface * loc_eng_ulpInf);
|
||||
LOC_API_ADAPTER_EVENT_MASK_T event);
|
||||
int loc_eng_start(loc_eng_data_s_type &loc_eng_data);
|
||||
int loc_eng_stop(loc_eng_data_s_type &loc_eng_data);
|
||||
void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data);
|
||||
|
|
|
@ -32,61 +32,4 @@
|
|||
|
||||
#include "loc_log.h"
|
||||
#include "loc_eng_log.h"
|
||||
#include "loc_eng_msg_id.h"
|
||||
|
||||
static loc_name_val_s_type loc_eng_msgs[] =
|
||||
{
|
||||
NAME_VAL( LOC_ENG_MSG_QUIT ),
|
||||
NAME_VAL( LOC_ENG_MSG_ENGINE_DOWN ),
|
||||
NAME_VAL( LOC_ENG_MSG_ENGINE_UP ),
|
||||
NAME_VAL( LOC_ENG_MSG_START_FIX ),
|
||||
NAME_VAL( LOC_ENG_MSG_STOP_FIX ),
|
||||
NAME_VAL( LOC_ENG_MSG_SET_POSITION_MODE ),
|
||||
NAME_VAL( LOC_ENG_MSG_SET_TIME ),
|
||||
NAME_VAL( LOC_ENG_MSG_INJECT_XTRA_DATA ),
|
||||
NAME_VAL( LOC_ENG_MSG_INJECT_LOCATION ),
|
||||
NAME_VAL( LOC_ENG_MSG_DELETE_AIDING_DATA ),
|
||||
NAME_VAL( LOC_ENG_MSG_SET_APN ),
|
||||
NAME_VAL( LOC_ENG_MSG_SET_SERVER_URL ),
|
||||
NAME_VAL( LOC_ENG_MSG_SET_SERVER_IPV4 ),
|
||||
NAME_VAL( LOC_ENG_MSG_ENABLE_DATA ),
|
||||
NAME_VAL( LOC_ENG_MSG_SUPL_VERSION ),
|
||||
NAME_VAL( LOC_ENG_MSG_SET_SENSOR_CONTROL_CONFIG ),
|
||||
NAME_VAL( LOC_ENG_MSG_SET_SENSOR_PROPERTIES ),
|
||||
NAME_VAL( LOC_ENG_MSG_SET_SENSOR_PERF_CONTROL_CONFIG ),
|
||||
NAME_VAL( LOC_ENG_MSG_MUTE_SESSION ),
|
||||
NAME_VAL( LOC_ENG_MSG_ATL_OPEN_SUCCESS ),
|
||||
NAME_VAL( LOC_ENG_MSG_ATL_CLOSED ),
|
||||
NAME_VAL( LOC_ENG_MSG_ATL_OPEN_FAILED ),
|
||||
NAME_VAL( LOC_ENG_MSG_REPORT_POSITION ),
|
||||
NAME_VAL( LOC_ENG_MSG_REPORT_SV ),
|
||||
NAME_VAL( LOC_ENG_MSG_REPORT_STATUS ),
|
||||
NAME_VAL( LOC_ENG_MSG_REPORT_NMEA ),
|
||||
NAME_VAL( LOC_ENG_MSG_REQUEST_ATL ),
|
||||
NAME_VAL( LOC_ENG_MSG_RELEASE_ATL ),
|
||||
NAME_VAL( LOC_ENG_MSG_REQUEST_BIT ),
|
||||
NAME_VAL( LOC_ENG_MSG_RELEASE_BIT ),
|
||||
NAME_VAL( LOC_ENG_MSG_REQUEST_WIFI ),
|
||||
NAME_VAL( LOC_ENG_MSG_RELEASE_WIFI ),
|
||||
NAME_VAL( LOC_ENG_MSG_REQUEST_NI ),
|
||||
NAME_VAL( LOC_ENG_MSG_INFORM_NI_RESPONSE ),
|
||||
NAME_VAL( LOC_ENG_MSG_REQUEST_XTRA_DATA ),
|
||||
NAME_VAL( LOC_ENG_MSG_REQUEST_TIME ),
|
||||
NAME_VAL( LOC_ENG_MSG_EXT_POWER_CONFIG ),
|
||||
NAME_VAL( LOC_ENG_MSG_REQUEST_POSITION ),
|
||||
NAME_VAL( LOC_ENG_MSG_LPP_CONFIG ),
|
||||
NAME_VAL( LOC_ENG_MSG_A_GLONASS_PROTOCOL ),
|
||||
NAME_VAL( LOC_ENG_MSG_LOC_INIT ),
|
||||
NAME_VAL( LOC_ENG_MSG_REQUEST_SUPL_ES ),
|
||||
NAME_VAL( LOC_ENG_MSG_CLOSE_DATA_CALL)
|
||||
};
|
||||
static int loc_eng_msgs_num = sizeof(loc_eng_msgs) / sizeof(loc_name_val_s_type);
|
||||
|
||||
/* Find Android GPS status name */
|
||||
const char* loc_get_msg_name(int id)
|
||||
{
|
||||
return loc_get_name_from_val(loc_eng_msgs, loc_eng_msgs_num, (long) id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -37,8 +37,6 @@ extern "C"
|
|||
|
||||
#include <ctype.h>
|
||||
|
||||
const char* loc_get_msg_name(int id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include <log_util.h>
|
||||
#include <loc_eng_log.h>
|
||||
#include <loc_eng.h>
|
||||
#include <loc_eng_msg_id.h>
|
||||
#include <MsgTask.h>
|
||||
#include <LocEngAdapter.h>
|
||||
|
||||
|
@ -57,92 +56,10 @@ extern "C" {
|
|||
|
||||
using namespace loc_core;
|
||||
|
||||
struct loc_eng_msg {
|
||||
const void* owner;
|
||||
const int msgid;
|
||||
inline loc_eng_msg(void* instance, int id) :
|
||||
owner(instance), msgid(id)
|
||||
{
|
||||
LOC_LOGV("creating msg %s", loc_get_msg_name(msgid));
|
||||
LOC_LOGV("creating msg ox%x", msgid);
|
||||
}
|
||||
virtual ~loc_eng_msg()
|
||||
{
|
||||
LOC_LOGV("deleting msg %s (0x%x)", loc_get_msg_name(msgid), msgid);
|
||||
}
|
||||
};
|
||||
|
||||
struct loc_eng_msg_position_mode : public loc_eng_msg {
|
||||
const LocPosMode pMode;
|
||||
inline loc_eng_msg_position_mode(void* instance,
|
||||
LocPosMode &mode) :
|
||||
loc_eng_msg(instance, LOC_ENG_MSG_SET_POSITION_MODE),
|
||||
pMode(mode)
|
||||
{
|
||||
pMode.logv();
|
||||
}
|
||||
};
|
||||
|
||||
struct loc_eng_msg_report_position : public loc_eng_msg {
|
||||
const UlpLocation location;
|
||||
const GpsLocationExtended locationExtended;
|
||||
const void* locationExt;
|
||||
const enum loc_sess_status status;
|
||||
const LocPosTechMask technology_mask;
|
||||
inline loc_eng_msg_report_position(void* instance, UlpLocation &loc, GpsLocationExtended &locExtended, void* locExt,
|
||||
enum loc_sess_status st) :
|
||||
loc_eng_msg(instance, LOC_ENG_MSG_REPORT_POSITION),
|
||||
location(loc), locationExtended(locExtended), locationExt(locExt), status(st), technology_mask(LOC_POS_TECH_MASK_DEFAULT)
|
||||
{
|
||||
LOC_LOGV("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n timestamp: %lld\n rawDataSize: %d\n rawData: %p\n Session status: %d\n Technology mask: %u",
|
||||
location.gpsLocation.flags, location.position_source,
|
||||
location.gpsLocation.latitude, location.gpsLocation.longitude,
|
||||
location.gpsLocation.altitude, location.gpsLocation.speed,
|
||||
location.gpsLocation.bearing, location.gpsLocation.accuracy,
|
||||
location.gpsLocation.timestamp, location.rawDataSize,
|
||||
location.rawData,status,technology_mask);
|
||||
}
|
||||
inline loc_eng_msg_report_position(void* instance, UlpLocation &loc, GpsLocationExtended &locExtended, void* locExt,
|
||||
enum loc_sess_status st, LocPosTechMask technology) :
|
||||
loc_eng_msg(instance, LOC_ENG_MSG_REPORT_POSITION),
|
||||
location(loc), locationExtended(locExtended), locationExt(locExt), status(st), technology_mask(technology)
|
||||
{
|
||||
LOC_LOGV("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n timestamp: %lld\n rawDataSize: %d\n rawData: %p\n Session status: %d\n Technology mask: %u",
|
||||
location.gpsLocation.flags, location.position_source,
|
||||
location.gpsLocation.latitude, location.gpsLocation.longitude,
|
||||
location.gpsLocation.altitude, location.gpsLocation.speed,
|
||||
location.gpsLocation.bearing, location.gpsLocation.accuracy,
|
||||
location.gpsLocation.timestamp, location.rawDataSize,
|
||||
location.rawData,status,technology_mask);
|
||||
}
|
||||
};
|
||||
|
||||
struct loc_eng_msg_report_sv : public loc_eng_msg {
|
||||
const GpsSvStatus svStatus;
|
||||
const GpsLocationExtended locationExtended;
|
||||
const void* svExt;
|
||||
inline loc_eng_msg_report_sv(void* instance, GpsSvStatus &sv, GpsLocationExtended &locExtended, void* ext) :
|
||||
loc_eng_msg(instance, LOC_ENG_MSG_REPORT_SV), svStatus(sv), locationExtended(locExtended), svExt(ext)
|
||||
{
|
||||
LOC_LOGV("num sv: %d\n ephemeris mask: %dxn almanac mask: %x\n used in fix mask: %x\n sv: prn snr elevation azimuth",
|
||||
svStatus.num_svs, svStatus.ephemeris_mask, svStatus.almanac_mask, svStatus.used_in_fix_mask);
|
||||
for (int i = 0; i < svStatus.num_svs && i < GPS_MAX_SVS; i++) {
|
||||
LOC_LOGV(" %d: %d %f %f %f\n ",
|
||||
i,
|
||||
svStatus.sv_list[i].prn,
|
||||
svStatus.sv_list[i].snr,
|
||||
svStatus.sv_list[i].elevation,
|
||||
svStatus.sv_list[i].azimuth);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct LocEngPositionMode : public LocMsg {
|
||||
LocEngAdapter* mAdapter;
|
||||
const LocPosMode mPosMode;
|
||||
LocEngPositionMode(LocEngAdapter* adapter,
|
||||
LocPosMode &mode);
|
||||
LocEngPositionMode(LocEngAdapter* adapter, LocPosMode &mode);
|
||||
virtual void proc() const;
|
||||
virtual void log() const;
|
||||
void send() const;
|
||||
|
@ -150,8 +67,8 @@ struct LocEngPositionMode : public LocMsg {
|
|||
|
||||
|
||||
struct LocEngStartFix : public LocMsg {
|
||||
loc_eng_data_s_type* mLocEng;
|
||||
LocEngStartFix(loc_eng_data_s_type* locEng);
|
||||
LocEngAdapter* mAdapter;
|
||||
LocEngStartFix(LocEngAdapter* adapter);
|
||||
virtual void proc() const;
|
||||
void locallog() const;
|
||||
virtual void log() const;
|
||||
|
@ -159,8 +76,8 @@ struct LocEngStartFix : public LocMsg {
|
|||
};
|
||||
|
||||
struct LocEngStopFix : public LocMsg {
|
||||
loc_eng_data_s_type* mLocEng;
|
||||
LocEngStopFix(loc_eng_data_s_type* locEng);
|
||||
LocEngAdapter* mAdapter;
|
||||
LocEngStopFix(LocEngAdapter* adapter);
|
||||
virtual void proc() const;
|
||||
void locallog() const;
|
||||
virtual void log() const;
|
||||
|
@ -168,13 +85,13 @@ struct LocEngStopFix : public LocMsg {
|
|||
};
|
||||
|
||||
struct LocEngReportPosition : public LocMsg {
|
||||
void* mLocEng;
|
||||
LocAdapterBase* mAdapter;
|
||||
const UlpLocation mLocation;
|
||||
const GpsLocationExtended mLocationExtended;
|
||||
const void* mLocationExt;
|
||||
const enum loc_sess_status mStatus;
|
||||
const LocPosTechMask mTechMask;
|
||||
LocEngReportPosition(void* locEng,
|
||||
LocEngReportPosition(LocAdapterBase* adapter,
|
||||
UlpLocation &loc,
|
||||
GpsLocationExtended &locExtended,
|
||||
void* locExt,
|
||||
|
@ -187,11 +104,11 @@ struct LocEngReportPosition : public LocMsg {
|
|||
};
|
||||
|
||||
struct LocEngReportSv : public LocMsg {
|
||||
void* mLocEng;
|
||||
LocAdapterBase* mAdapter;
|
||||
const GpsSvStatus mSvStatus;
|
||||
const GpsLocationExtended mLocationExtended;
|
||||
const void* mSvExt;
|
||||
LocEngReportSv(void* locEng,
|
||||
LocEngReportSv(LocAdapterBase* adapter,
|
||||
GpsSvStatus &sv,
|
||||
GpsLocationExtended &locExtended,
|
||||
void* svExtended);
|
||||
|
|
|
@ -1,114 +0,0 @@
|
|||
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef LOC_ENG_MSG_ID_H
|
||||
#define LOC_ENG_MSG_ID_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
struct msgbuf {
|
||||
unsigned int msgsz;
|
||||
void* msgid;
|
||||
};
|
||||
|
||||
enum loc_eng_msg_ids_t {
|
||||
/* 0x 0 - 0xEF is reserved for daemon internal */
|
||||
/* 0xF0 - 0x1FF is reserved for daemon & framework communication */
|
||||
LOC_ENG_MSG_QUIT = 0x200,
|
||||
/*******************OEMs PLEASE NOTE***************************/
|
||||
/* The next five messages are shared with libulp. They are should
|
||||
not be altered if libulp cannot be recompiled */
|
||||
LOC_ENG_MSG_START_FIX,
|
||||
LOC_ENG_MSG_STOP_FIX,
|
||||
LOC_ENG_MSG_SET_POSITION_MODE,
|
||||
LOC_ENG_MSG_REPORT_POSITION,
|
||||
LOC_ENG_MSG_REPORT_SV,
|
||||
|
||||
LOC_ENG_MSG_ENGINE_DOWN,
|
||||
LOC_ENG_MSG_ENGINE_UP,
|
||||
|
||||
LOC_ENG_MSG_SET_TIME,
|
||||
LOC_ENG_MSG_INJECT_XTRA_DATA,
|
||||
LOC_ENG_MSG_REQUEST_XTRA_SERVER,
|
||||
LOC_ENG_MSG_INJECT_LOCATION,
|
||||
LOC_ENG_MSG_DELETE_AIDING_DATA,
|
||||
LOC_ENG_MSG_SET_APN,
|
||||
LOC_ENG_MSG_SET_SERVER_URL,
|
||||
LOC_ENG_MSG_SET_SERVER_IPV4,
|
||||
LOC_ENG_MSG_ENABLE_DATA,
|
||||
|
||||
LOC_ENG_MSG_SUPL_VERSION,
|
||||
LOC_ENG_MSG_SET_SENSOR_CONTROL_CONFIG,
|
||||
LOC_ENG_MSG_SET_SENSOR_PROPERTIES,
|
||||
LOC_ENG_MSG_SET_SENSOR_PERF_CONTROL_CONFIG,
|
||||
LOC_ENG_MSG_MUTE_SESSION,
|
||||
|
||||
LOC_ENG_MSG_ATL_OPEN_SUCCESS,
|
||||
LOC_ENG_MSG_ATL_CLOSED,
|
||||
LOC_ENG_MSG_ATL_OPEN_FAILED,
|
||||
|
||||
LOC_ENG_MSG_REPORT_STATUS,
|
||||
LOC_ENG_MSG_REPORT_NMEA,
|
||||
LOC_ENG_MSG_REPORT_XTRA_SERVER,
|
||||
LOC_ENG_MSG_REQUEST_BIT,
|
||||
LOC_ENG_MSG_RELEASE_BIT,
|
||||
LOC_ENG_MSG_REQUEST_ATL,
|
||||
LOC_ENG_MSG_RELEASE_ATL,
|
||||
LOC_ENG_MSG_REQUEST_WIFI,
|
||||
LOC_ENG_MSG_RELEASE_WIFI,
|
||||
LOC_ENG_MSG_REQUEST_NI,
|
||||
LOC_ENG_MSG_INFORM_NI_RESPONSE,
|
||||
LOC_ENG_MSG_REQUEST_XTRA_DATA,
|
||||
LOC_ENG_MSG_REQUEST_TIME,
|
||||
LOC_ENG_MSG_REQUEST_POSITION,
|
||||
LOC_ENG_MSG_EXT_POWER_CONFIG,
|
||||
|
||||
/* Message is sent by HAL to LOC API to configure LTE Positioning
|
||||
Profile in modem */
|
||||
LOC_ENG_MSG_LPP_CONFIG,
|
||||
|
||||
/* Message is sent by HAL to LOC API to select A-GLONASS protocol */
|
||||
LOC_ENG_MSG_A_GLONASS_PROTOCOL,
|
||||
|
||||
//Message is sent by LOC to do LOC INIT
|
||||
LOC_ENG_MSG_LOC_INIT,
|
||||
|
||||
/*Message is sent by modem to request emergency call setup*/
|
||||
LOC_ENG_MSG_REQUEST_SUPL_ES,
|
||||
|
||||
/*Ask the DS client to close the data call by releasing the handle*/
|
||||
LOC_ENG_MSG_CLOSE_DATA_CALL,
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* LOC_ENG_MSG_ID_H */
|
Loading…
Reference in a new issue