1 /* |
|
2 * Copyright (c) 2002-2008 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: Factory for event monitors |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "TSatEventMonitorFactory.h" |
|
21 #include "MSatEventMonitor.h" |
|
22 #include "CSatSimRemovalMonitor.h" |
|
23 #include "CSatUserActivityMonitor.h" |
|
24 #include "CSatIdleScreenMonitor.h" |
|
25 #include "CSatLanguageSelectionMonitor.h" |
|
26 #include "CSatBrowserTerminationMonitor.h" |
|
27 #include "CSatBIPDataAvailableMonitor.h" |
|
28 #include "CSatBIPChannelStatusMonitor.h" |
|
29 #include "SatLog.h" |
|
30 |
|
31 // ============================ LOCAL FUNCTIONS ================================ |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CleanupEventMonitors |
|
35 // Remove and destroy items from the specified array. |
|
36 // @param aArray An array whose items need to be removed and destroyed. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 LOCAL_C void CleanupEventMonitors( TAny* aArray ) |
|
40 { |
|
41 LOG( SIMPLE, "SATEVENTMONITORS: CleanupEventMonitors calling" ) |
|
42 |
|
43 CArrayPtrFlat<MSatEventMonitor>* array = |
|
44 static_cast< CArrayPtrFlat< MSatEventMonitor >* >(aArray); |
|
45 array->ResetAndDestroy(); |
|
46 |
|
47 LOG( SIMPLE, "SATEVENTMONITORS: CleanupEventMonitors exiting" ) |
|
48 } |
|
49 |
|
50 // ============================ MEMBER FUNCTIONS =============================== |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // TSatEventMonitorFactory::CreateEventMonitorsL |
|
54 // (other items were commented in a header). |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C CArrayPtrFlat<MSatEventMonitor>* TSatEventMonitorFactory:: |
|
58 CreateEventMonitorsL( MSatEventMonitorUtils& aUtils ) |
|
59 { |
|
60 LOG( SIMPLE, "SATEVENTMONITORS: TSatEventMonitorFactory::\ |
|
61 CreateEventMonitorsL calling" ) |
|
62 |
|
63 CArrayPtrFlat<MSatEventMonitor>* array = |
|
64 new( ELeave ) CArrayPtrFlat<MSatEventMonitor>( 1 ); |
|
65 CleanupStack::PushL( TCleanupItem(CleanupEventMonitors, array) ); |
|
66 |
|
67 MSatEventMonitor* eventMonitor = NULL; |
|
68 // Add event monitors |
|
69 eventMonitor = |
|
70 CSatSimRemovalMonitor::NewL( aUtils ); |
|
71 CleanupStack::PushL( eventMonitor ); |
|
72 array->AppendL( eventMonitor ); |
|
73 CleanupStack::Pop( eventMonitor ); |
|
74 |
|
75 eventMonitor = |
|
76 CSatUserActivityMonitor::NewL( aUtils ); |
|
77 CleanupStack::PushL( eventMonitor ); |
|
78 array->AppendL( eventMonitor ); |
|
79 CleanupStack::Pop( eventMonitor ); |
|
80 |
|
81 eventMonitor = |
|
82 CSatIdleScreenMonitor::NewL( aUtils ); |
|
83 CleanupStack::PushL( eventMonitor ); |
|
84 array->AppendL( eventMonitor ); |
|
85 CleanupStack::Pop( eventMonitor ); |
|
86 |
|
87 eventMonitor = |
|
88 CSatLanguageSelectionMonitor::NewL( aUtils ); |
|
89 CleanupStack::PushL( eventMonitor ); |
|
90 array->AppendL( eventMonitor ); |
|
91 CleanupStack::Pop( eventMonitor ); |
|
92 |
|
93 eventMonitor = |
|
94 CSatBrowserTerminationMonitor::NewL( aUtils ); |
|
95 CleanupStack::PushL( eventMonitor ); |
|
96 array->AppendL( eventMonitor ); |
|
97 CleanupStack::Pop( eventMonitor ); |
|
98 |
|
99 eventMonitor = |
|
100 CSatBIPDataAvailableMonitor::NewL( aUtils ); |
|
101 CleanupStack::PushL( eventMonitor ); |
|
102 array->AppendL( eventMonitor ); |
|
103 CleanupStack::Pop( eventMonitor ); |
|
104 |
|
105 eventMonitor = |
|
106 CSatBIPChannelStatusMonitor::NewL( aUtils ); |
|
107 CleanupStack::PushL( eventMonitor ); |
|
108 array->AppendL( eventMonitor ); |
|
109 CleanupStack::Pop( eventMonitor ); |
|
110 |
|
111 CleanupStack::Pop( array ); |
|
112 |
|
113 LOG( SIMPLE, "SATEVENTMONITORS: TSatEventMonitorFactory::\ |
|
114 CreateEventMonitorsL exiting" ) |
|
115 return array; |
|
116 } |
|
117 |
|
118 // End of File |
|