1 /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. 2 * 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions are 5 * met: 6 * * Redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer. 8 * * Redistributions in binary form must reproduce the above 9 * copyright notice, this list of conditions and the following 10 * disclaimer in the documentation and/or other materials provided 11 * with the distribution. 12 * * Neither the name of The Linux Foundation, nor the names of its 13 * contributors may be used to endorse or promote products derived 14 * from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 */ 29 #ifndef LOC_ENG_MSG_H 30 #define LOC_ENG_MSG_H 31 32 33 #include <hardware/gps.h> 34 #include <gps_extended.h> 35 #include <stdlib.h> 36 #include <string.h> 37 #include <log_util.h> 38 #include <loc_eng_log.h> 39 #include <loc_eng.h> 40 #include <MsgTask.h> 41 #include <LocEngAdapter.h> 42 43 #ifndef SSID_BUF_SIZE 44 #define SSID_BUF_SIZE (32+1) 45 #endif 46 #ifdef USE_GLIB 47 48 #include <glib.h> 49 50 #endif /* USE_GLIB */ 51 #include "platform_lib_includes.h" 52 53 #ifdef __cplusplus 54 extern "C" { 55 #endif /* __cplusplus */ 56 57 using namespace loc_core; 58 59 struct LocEngPositionMode : public LocMsg { 60 LocEngAdapter* mAdapter; 61 const LocPosMode mPosMode; 62 LocEngPositionMode(LocEngAdapter* adapter, LocPosMode &mode); 63 virtual void proc() const; 64 virtual void log() const; 65 void send() const; 66 }; 67 68 69 struct LocEngStartFix : public LocMsg { 70 LocEngAdapter* mAdapter; 71 LocEngStartFix(LocEngAdapter* adapter); 72 virtual void proc() const; 73 void locallog() const; 74 virtual void log() const; 75 void send() const; 76 }; 77 78 struct LocEngStopFix : public LocMsg { 79 LocEngAdapter* mAdapter; 80 LocEngStopFix(LocEngAdapter* adapter); 81 virtual void proc() const; 82 void locallog() const; 83 virtual void log() const; 84 void send() const; 85 }; 86 87 struct LocEngReportPosition : public LocMsg { 88 LocAdapterBase* mAdapter; 89 const UlpLocation mLocation; 90 const GpsLocationExtended mLocationExtended; 91 const void* mLocationExt; 92 const enum loc_sess_status mStatus; 93 const LocPosTechMask mTechMask; 94 LocEngReportPosition(LocAdapterBase* adapter, 95 UlpLocation &loc, 96 GpsLocationExtended &locExtended, 97 void* locExt, 98 enum loc_sess_status st, 99 LocPosTechMask technology); 100 virtual void proc() const; 101 void locallog() const; 102 virtual void log() const; 103 void send() const; 104 }; 105 106 struct LocEngReportSv : public LocMsg { 107 LocAdapterBase* mAdapter; 108 const GpsSvStatus mSvStatus; 109 const GpsLocationExtended mLocationExtended; 110 const void* mSvExt; 111 LocEngReportSv(LocAdapterBase* adapter, 112 GpsSvStatus &sv, 113 GpsLocationExtended &locExtended, 114 void* svExtended); 115 virtual void proc() const; 116 void locallog() const; 117 virtual void log() const; 118 void send() const; 119 }; 120 121 struct LocEngReportStatus : public LocMsg { 122 LocAdapterBase* mAdapter; 123 const GpsStatusValue mStatus; 124 LocEngReportStatus(LocAdapterBase* adapter, 125 GpsStatusValue engineStatus); 126 virtual void proc() const; 127 void locallog() const; 128 virtual void log() const; 129 }; 130 131 struct LocEngReportNmea : public LocMsg { 132 void* mLocEng; 133 char* const mNmea; 134 const int mLen; 135 LocEngReportNmea(void* locEng, 136 const char* data, int len); ~LocEngReportNmeaLocEngReportNmea137 inline virtual ~LocEngReportNmea() 138 { 139 delete[] mNmea; 140 } 141 virtual void proc() const; 142 void locallog() const; 143 virtual void log() const; 144 }; 145 146 struct LocEngReportXtraServer : public LocMsg { 147 void* mLocEng; 148 int mMaxLen; 149 char *mServers; 150 LocEngReportXtraServer(void* locEng, 151 const char *url1, const char *url2, 152 const char *url3, const int maxlength); ~LocEngReportXtraServerLocEngReportXtraServer153 inline virtual ~LocEngReportXtraServer() 154 { 155 delete[] mServers; 156 } 157 virtual void proc() const; 158 void locallog() const; 159 virtual void log() const; 160 }; 161 162 struct LocEngSuplEsOpened : public LocMsg { 163 void* mLocEng; 164 LocEngSuplEsOpened(void* locEng); 165 virtual void proc() const; 166 void locallog() const; 167 virtual void log() const; 168 }; 169 170 struct LocEngSuplEsClosed : public LocMsg { 171 void* mLocEng; 172 LocEngSuplEsClosed(void* locEng); 173 virtual void proc() const; 174 void locallog() const; 175 virtual void log() const; 176 }; 177 178 struct LocEngRequestSuplEs : public LocMsg { 179 void* mLocEng; 180 const int mID; 181 LocEngRequestSuplEs(void* locEng, int id); 182 virtual void proc() const; 183 void locallog() const; 184 virtual void log() const; 185 }; 186 187 struct LocEngRequestATL : public LocMsg { 188 void* mLocEng; 189 const int mID; 190 const AGpsExtType mType; 191 LocEngRequestATL(void* locEng, int id, 192 AGpsExtType agps_type); 193 virtual void proc() const; 194 void locallog() const; 195 virtual void log() const; 196 }; 197 198 struct LocEngReleaseATL : public LocMsg { 199 void* mLocEng; 200 const int mID; 201 LocEngReleaseATL(void* locEng, int id); 202 virtual void proc() const; 203 void locallog() const; 204 virtual void log() const; 205 }; 206 207 struct LocEngReqRelBIT : public LocMsg { 208 void* mLocEng; 209 const AGpsExtType mType; 210 const int mIPv4Addr; 211 char* const mIPv6Addr; 212 const bool mIsReq; 213 LocEngReqRelBIT(void* instance, AGpsExtType type, 214 int ipv4, char* ipv6, bool isReq); 215 virtual ~LocEngReqRelBIT(); 216 virtual void proc() const; 217 void locallog() const; 218 virtual void log() const; 219 void send() const; 220 }; 221 222 struct LocEngReqRelWifi : public LocMsg { 223 void* mLocEng; 224 const AGpsExtType mType; 225 const loc_if_req_sender_id_e_type mSenderId; 226 char* const mSSID; 227 char* const mPassword; 228 const bool mIsReq; 229 LocEngReqRelWifi(void* locEng, AGpsExtType type, 230 loc_if_req_sender_id_e_type sender_id, 231 char* s, char* p, bool isReq); 232 virtual ~LocEngReqRelWifi(); 233 virtual void proc() const; 234 void locallog() const; 235 virtual void log() const; 236 void send() const; 237 }; 238 239 struct LocEngRequestXtra : public LocMsg { 240 void* mLocEng; 241 LocEngRequestXtra(void* locEng); 242 virtual void proc() const; 243 void locallog() const; 244 virtual void log() const; 245 }; 246 247 struct LocEngRequestTime : public LocMsg { 248 void* mLocEng; 249 LocEngRequestTime(void* locEng); 250 virtual void proc() const; 251 void locallog() const; 252 virtual void log() const; 253 }; 254 255 struct LocEngRequestNi : public LocMsg { 256 void* mLocEng; 257 const GpsNiNotification mNotify; 258 const void *mPayload; 259 LocEngRequestNi(void* locEng, 260 GpsNiNotification ¬if, 261 const void* data); 262 virtual void proc() const; 263 void locallog() const; 264 virtual void log() const; 265 }; 266 267 struct LocEngDown : public LocMsg { 268 void* mLocEng; 269 LocEngDown(void* locEng); 270 virtual void proc() const; 271 void locallog() const; 272 virtual void log() const; 273 }; 274 275 struct LocEngUp : public LocMsg { 276 void* mLocEng; 277 LocEngUp(void* locEng); 278 virtual void proc() const; 279 void locallog() const; 280 virtual void log() const; 281 }; 282 283 struct LocEngGetZpp : public LocMsg { 284 LocEngAdapter* mAdapter; 285 LocEngGetZpp(LocEngAdapter* adapter); 286 virtual void proc() const; 287 void locallog() const; 288 virtual void log() const; 289 void send() const; 290 }; 291 292 struct LocEngReportGpsMeasurement : public LocMsg { 293 void* mLocEng; 294 const GpsData mGpsData; 295 LocEngReportGpsMeasurement(void* locEng, 296 GpsData &gpsData); 297 virtual void proc() const; 298 void locallog() const; 299 virtual void log() const; 300 }; 301 302 #ifdef __cplusplus 303 } 304 #endif /* __cplusplus */ 305 306 #endif /* LOC_ENG_MSG_H */ 307