|
1 /* |
|
2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: provides timing services for AVController server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef C_UPNPAVTIMER_H_ |
|
24 #define C_UPNPAVTIMER_H_ |
|
25 |
|
26 // Include files |
|
27 #include <e32base.h> |
|
28 |
|
29 const TInt KTimerCycle3 = 3; |
|
30 const TInt KTimerCycle10 = 10; |
|
31 const TInt KTimerCycle30 = 30; |
|
32 const TInt KTimerCycle300 = 300; |
|
33 |
|
34 // Forward declarations |
|
35 class CUPnPBrowsingSession; |
|
36 class MUPnPAVTimerCallback; |
|
37 |
|
38 /** |
|
39 * Timer class. Used as a server (AVC and S60 Media Server) shutdown timer. |
|
40 * |
|
41 */ |
|
42 class CUPnPAVTimer: public CTimer |
|
43 { |
|
44 |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Timer type defination |
|
49 */ |
|
50 enum TAVTimerType |
|
51 { |
|
52 ETimerServerShutdown = 0, |
|
53 ETimerMediaServer |
|
54 }; |
|
55 |
|
56 public: |
|
57 |
|
58 /** |
|
59 * Static 1st phase constructor |
|
60 * @param aObserver Observer |
|
61 * @param aType timer type |
|
62 * @return A new timer instance |
|
63 */ |
|
64 static CUPnPAVTimer* NewL( MUPnPAVTimerCallback& aObserver, |
|
65 TAVTimerType aType ); |
|
66 |
|
67 /** |
|
68 * Destructor |
|
69 */ |
|
70 virtual ~CUPnPAVTimer(); |
|
71 |
|
72 |
|
73 private: |
|
74 |
|
75 /** |
|
76 * Private constructor |
|
77 * @param aObserver Observer |
|
78 * @param aType timer type |
|
79 */ |
|
80 CUPnPAVTimer( MUPnPAVTimerCallback& aObserver, TAVTimerType aType ); |
|
81 |
|
82 /** |
|
83 * 2nd phase construct |
|
84 */ |
|
85 void ConstructL(); |
|
86 |
|
87 protected: // From CTimer (CActive) |
|
88 |
|
89 /** |
|
90 * See e32base.h |
|
91 */ |
|
92 void RunL(); |
|
93 |
|
94 public: // New functions |
|
95 |
|
96 /** |
|
97 * Starts the timer |
|
98 * @param aType Type of timing interval |
|
99 */ |
|
100 void Start( TInt aIntervalInSecs ); |
|
101 |
|
102 private: |
|
103 |
|
104 MUPnPAVTimerCallback& iObserver; // Not Own |
|
105 |
|
106 TAVTimerType iTimerType; |
|
107 |
|
108 }; |
|
109 |
|
110 /** |
|
111 * Timer observer |
|
112 * |
|
113 */ |
|
114 class MUPnPAVTimerCallback |
|
115 { |
|
116 public: |
|
117 |
|
118 /** |
|
119 * Called when timer expires |
|
120 * |
|
121 * @param aType time-out type |
|
122 */ |
|
123 virtual void UPnPAVTimerCallback( CUPnPAVTimer::TAVTimerType aType ) = 0; |
|
124 |
|
125 }; |
|
126 |
|
127 #endif // C_UPNPAVTIMER_H_ |