|
1 /* |
|
2 * Copyright (c) 2004-2005 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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32base.h> |
|
23 #include "IptvDebug.h" |
|
24 #include "CIptvUtil.h" |
|
25 #include "CIptvEpgManagerUpdater.h" |
|
26 #include "MIptvEpgManagerUpdateObserver.h" |
|
27 #include "CIptvEpgManagerImpl.h" |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 const TInt KIptvPluginPollDelay = 500000; // 0,5 seconds |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 // --------------------------------------------------------- |
|
36 // CIptvEpgManagerUpdater::ConstructL |
|
37 // Symbian 2nd phase constructor can leave. |
|
38 // --------------------------------------------------------- |
|
39 // |
|
40 void CIptvEpgManagerUpdater::ConstructL() |
|
41 { |
|
42 User::LeaveIfError(iTimer.CreateLocal()); |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------- |
|
46 // CIptvEpgManagerUpdater::NewL |
|
47 // Two-phased constructor. |
|
48 // --------------------------------------------------------- |
|
49 // |
|
50 EXPORT_C CIptvEpgManagerUpdater* CIptvEpgManagerUpdater::NewL(MIptvEpgManagerUpdateObserver& aObserver) |
|
51 { |
|
52 CIptvEpgManagerUpdater* self = new(ELeave) CIptvEpgManagerUpdater(aObserver); |
|
53 CleanupStack::PushL(self); |
|
54 |
|
55 self->ConstructL(); |
|
56 |
|
57 CleanupStack::Pop(self); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------- |
|
62 // CIptvEpgManagerUpdater::~CIptvEpgManagerUpdater |
|
63 // Destructor |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CIptvEpgManagerUpdater::~CIptvEpgManagerUpdater() |
|
67 { |
|
68 Cancel(); |
|
69 iTimer.Close(); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------- |
|
73 // CIptvEpgManagerUpdater::CIptvEpgManagerUpdater |
|
74 // C++ default constructor |
|
75 // --------------------------------------------------------- |
|
76 // |
|
77 CIptvEpgManagerUpdater::CIptvEpgManagerUpdater(MIptvEpgManagerUpdateObserver& aObserver) : CActive( EPriorityStandard ), |
|
78 iObserver( aObserver ) |
|
79 { |
|
80 CActiveScheduler::Add(this); |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------- |
|
84 // CIptvEpgManagerUpdater::DoCancel |
|
85 // |
|
86 // --------------------------------------------------------- |
|
87 // |
|
88 void CIptvEpgManagerUpdater::DoCancel() |
|
89 { |
|
90 iTimer.Cancel(); |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------- |
|
94 // CIptvEpgManagerUpdater::RunL |
|
95 // |
|
96 // --------------------------------------------------------- |
|
97 // |
|
98 void CIptvEpgManagerUpdater::RunL() |
|
99 { |
|
100 IPTVLOGSTRING_LOW_LEVEL("CIptvEpgManagerUpdater::RunL"); |
|
101 |
|
102 if (!IsActive()) |
|
103 { |
|
104 iTimer.After(iStatus, KIptvPluginPollDelay); |
|
105 SetActive(); |
|
106 } |
|
107 |
|
108 iObserver.CheckIsPluginRunning(); |
|
109 } |
|
110 |
|
111 // --------------------------------------------------------- |
|
112 // CIptvEpgManagerUpdater::Start |
|
113 // |
|
114 // --------------------------------------------------------- |
|
115 // |
|
116 void CIptvEpgManagerUpdater::Start() |
|
117 { |
|
118 IPTVLOGSTRING_LOW_LEVEL("CIptvEpgManagerUpdater::Start"); |
|
119 |
|
120 if (!IsActive()) |
|
121 { |
|
122 iTimer.After(iStatus, KIptvPluginPollDelay); |
|
123 SetActive(); |
|
124 } |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------- |
|
128 // CIptvEpgManagerUpdater::Stop |
|
129 // |
|
130 // --------------------------------------------------------- |
|
131 // |
|
132 void CIptvEpgManagerUpdater::Stop() |
|
133 { |
|
134 IPTVLOGSTRING_LOW_LEVEL("CIptvEpgManagerUpdater::Stop"); |
|
135 |
|
136 iTimer.Cancel(); |
|
137 Cancel(); |
|
138 } |