00001 /* 00002 !concept {:name => "Timer-based retries on Symbian", 00003 :desc => "An API that encapsulates logic for repeating failed operations after increasing (and semi-randomized) time intervals."} 00004 */ 00005 00006 #ifndef __ut_retry_epoc_hpp__ 00007 #define __ut_retry_epoc_hpp__ 00008 00009 #include "utils_cl2.h" 00010 00011 #include <e32base.h> 00012 00013 // -------------------------------------------------- 00014 // CRetryAo 00015 // -------------------------------------------------- 00016 00017 class CRetryAo; 00018 00019 class MRetryAoObserver { 00020 public: 00021 virtual void RetryTimerExpired(CRetryAo* src, TInt errCode) = 0; 00022 }; 00023 00024 NONSHARABLE_CLASS(CRetryAo) : 00025 public CActive 00026 { 00027 public: 00028 static CRetryAo* NewL(MRetryAoObserver& aObserver, 00029 TInt aMaxNumRetries, 00030 TInt aBaseInterval /* secs */); 00031 00032 ~CRetryAo(); 00033 00034 private: 00035 CRetryAo(MRetryAoObserver& aObserver, 00036 TInt aMaxNumRetries, 00037 TInt aBaseInterval /* secs */); 00038 00039 void ConstructL(); 00040 00041 public: 00042 // Returns a false value if a retry timer was not set (due to 00043 // maximum number of retries having been reached). 00044 TBool Retry() __attribute__ ((warn_unused_result)); 00045 00046 void ResetFailures(); 00047 00048 private: // CActive 00049 00050 virtual void RunL(); 00051 00052 virtual void DoCancel(); 00053 00054 protected: // property 00055 00056 MRetryAoObserver& iObserver; 00057 TInt iMaxNumRetries; 00058 TInt iBaseInterval; 00059 00060 DEF_SESSION(RTimer, iTimer); 00061 00062 TInt iNumScanFailures; 00063 00064 protected: // for possible overriding 00065 00066 virtual TTimeIntervalMicroSeconds32 WaitInterval(); 00067 00068 }; 00069 00070 #endif /* __ut_retry_epoc_hpp__ */ 00071 00072 /** 00073 00074 ut_retry_epoc.hpp 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:57 2011 by Doxygen 1.6.1