1ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. 2ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * 3ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * Redistribution and use in source and binary forms, with or without 4ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * modification, are permitted provided that the following conditions are 5ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * met: 6ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * * Redistributions of source code must retain the above copyright 7ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * notice, this list of conditions and the following disclaimer. 8ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * * Redistributions in binary form must reproduce the above 9ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * copyright notice, this list of conditions and the following 10ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * disclaimer in the documentation and/or other materials provided 11ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * with the distribution. 12ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * * Neither the name of The Linux Foundation, nor the names of its 13ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * contributors may be used to endorse or promote products derived 14ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * from this software without specific prior written permission. 15ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * 16ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo * 28ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo */ 29ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo#ifndef LOC_API_ADAPTER_BASE_H 30ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo#define LOC_API_ADAPTER_BASE_H 31ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo 32ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo#include <gps_extended.h> 33ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo#include <UlpProxyBase.h> 34ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo#include <ContextBase.h> 35ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo 36ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russonamespace loc_core { 37ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo 38ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russoclass LocAdapterBase { 39ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russoprotected: 40ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo const LOC_API_ADAPTER_EVENT_MASK_T mEvtMask; 41ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo ContextBase* mContext; 42ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo LocApiBase* mLocApi; 43ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo const MsgTask* mMsgTask; 44ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo 45ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo inline LocAdapterBase(const MsgTask* msgTask) : 46ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo mEvtMask(0), mContext(NULL), mLocApi(NULL), mMsgTask(msgTask) {} 47ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo 48ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask, 49ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo ContextBase* context); 50ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); } 51ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo 52ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russopublic: 53ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo inline LOC_API_ADAPTER_EVENT_MASK_T 54ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo checkMask(LOC_API_ADAPTER_EVENT_MASK_T mask) const { 55ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo return mEvtMask & mask; 56ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo } 57ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo 58ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo inline LOC_API_ADAPTER_EVENT_MASK_T getEvtMask() const { 59ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo return mEvtMask; 60ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo } 61ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo 62ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo inline void sendMsg(const LocMsg* msg) const { 63ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo mMsgTask->sendMsg(msg); 64ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo } 65ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo 66ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo inline void sendMsg(const LocMsg* msg) { 67ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo mMsgTask->sendMsg(msg); 68ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo } 69ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo 70ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo // This will be overridden by the individual adapters 71ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo // if necessary. 72ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo inline virtual void setUlpProxy(UlpProxyBase* ulp) {} 73ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo inline virtual void handleEngineUpEvent() {} 74ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual void handleEngineDownEvent(); 75ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo inline virtual void setPositionModeInt(LocPosMode& posMode) {} 76ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual void startFixInt() {} 77ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual void stopFixInt() {} 78ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual void reportPosition(UlpLocation &location, 79ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo GpsLocationExtended &locationExtended, 80ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo void* locationExt, 81ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo enum loc_sess_status status, 82ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo LocPosTechMask loc_technology_mask); 83ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual void reportSv(GpsSvStatus &svStatus, 84ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo GpsLocationExtended &locationExtended, 85ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo void* svExt); 86ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual void reportStatus(GpsStatusValue status); 87ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual void reportNmea(const char* nmea, int length); 88ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual bool reportXtraServer(const char* url1, const char* url2, 89ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo const char* url3, const int maxlength); 90ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual bool requestXtraData(); 91ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual bool requestTime(); 92ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual bool requestLocation(); 93ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual bool requestATL(int connHandle, AGpsType agps_type); 94ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual bool releaseATL(int connHandle); 95ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual bool requestSuplES(int connHandle); 96ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual bool reportDataCallOpened(); 97ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual bool reportDataCallClosed(); 98ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo virtual bool requestNiNotify(GpsNiNotification ¬ify, 99ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo const void* data); 100ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo inline virtual bool isInSession() { return false; } 101ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo}; 102ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo 103ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo} // namespace loc_core 104ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo 105ec6e5d3a2597d37d5b1d98911cb06218cdf19bf1Dante Russo#endif //LOC_API_ADAPTER_BASE_H 106