00001 /* 00002 00003 References: 00004 00005 http://library.forum.nokia.com/index.jsp?topic=/S60_5th_Edition_Cpp_Developers_Library/GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6/html/classRPositioner.html 00006 00007 */ 00008 00009 #include "epoc-gps-positioner.hpp" 00010 00011 _LIT_W(KRequestor, COMPONENT_NAME_W); 00012 00013 CTOR_IMPL_CPositioner_gps; 00014 00015 void CPositioner_gps::ConstructL(TInt aUpdateIntervalSecs, TInt aUpdateTimeoutSecs, TInt aMaxAgeSecs) 00016 { 00017 LEAVE_IF_ERROR_OR_SET_SESSION_OPEN(iPositioner, iPositioner.Open(iPositionServer, iModuleId)); 00018 User::LeaveIfError(iPositioner.SetRequestor(CRequestor::ERequestorService, 00019 CRequestor::EFormatApplication, 00020 KRequestor)); 00021 00022 iUpdateOptions.SetAcceptPartialUpdates(EFalse); 00023 00024 TInt64 usecs = aUpdateIntervalSecs * 1000000LL; 00025 iUpdateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(usecs)); 00026 00027 usecs = aUpdateTimeoutSecs * 1000000LL; 00028 iUpdateOptions.SetUpdateTimeOut(TTimeIntervalMicroSeconds(usecs)); 00029 00030 usecs = aMaxAgeSecs * 1000000LL; 00031 iUpdateOptions.SetMaxUpdateAge(TTimeIntervalMicroSeconds(usecs)); 00032 00033 /* 00034 If you set this to a non-zero value, expect error completions for 00035 positioning requests. Without setting this presumably there is no 00036 timeout. Set to zero for no timeout. 00037 */ 00038 User::LeaveIfError(iPositioner.SetUpdateOptions(iUpdateOptions)); 00039 00040 dblogg("positioner params interval=%d, timeout=%d, age=%d", 00041 aUpdateIntervalSecs, aUpdateTimeoutSecs, aMaxAgeSecs); 00042 } 00043 00044 CPositioner_gps::~CPositioner_gps() 00045 { 00046 Cancel(); // safe when AO inactive as DoCancel not called 00047 SESSION_CLOSE_IF_OPEN(iPositioner); 00048 } 00049 00050 void CPositioner_gps::MakeRequest() 00051 { 00052 iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus); 00053 SetActive(); 00054 } 00055 00056 gboolean CPositioner_gps::RunGL(GError** error) 00057 { 00058 return iObserver.PositionerEventL(error); 00059 } 00060 00061 const char* CPositioner_gps::Description() 00062 { 00063 return "gps_positioner"; 00064 } 00065 00066 void CPositioner_gps::DoCancel() 00067 { 00068 assert(IS_SESSION_OPEN(iPositioner)); 00069 // Ignoring return value. The only possible error should never 00070 // happen in this case. 00071 iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); 00072 } 00073 00074 /** 00075 00076 Copyright 2009 Helsinki Institute for Information Technology (HIIT) 00077 and the authors. All rights reserved. 00078 00079 Authors: Tero Hasu <tero.hasu@hut.fi> 00080 00081 Permission is hereby granted, free of charge, to any person 00082 obtaining a copy of this software and associated documentation files 00083 (the "Software"), to deal in the Software without restriction, 00084 including without limitation the rights to use, copy, modify, merge, 00085 publish, distribute, sublicense, and/or sell copies of the Software, 00086 and to permit persons to whom the Software is furnished to do so, 00087 subject to the following conditions: 00088 00089 The above copyright notice and this permission notice shall be 00090 included in all copies or substantial portions of the Software. 00091 00092 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00093 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00094 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00095 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00096 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00097 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00098 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00099 SOFTWARE. 00100 00101 **/
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:52 2011 by Doxygen 1.6.1