|
1 /* |
|
2 * Copyright (c) 2007 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: cch client api implementation class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_CCHCLIENTOBSERVER_H |
|
21 #define C_CCHCLIENTOBSERVER_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <ccherror.h> |
|
25 #include <cchtypes.h> |
|
26 |
|
27 #include "cch.h" |
|
28 |
|
29 |
|
30 /** |
|
31 * Class for basic cch functionality, getting services |
|
32 * |
|
33 * @code |
|
34 * ?good_class_usage_example(s) |
|
35 * @endcode |
|
36 * |
|
37 * @lib cch |
|
38 */ |
|
39 class CCchClientObserver : public CActive |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 * |
|
47 * @param aCchService Cch service factory |
|
48 */ |
|
49 static CCchClientObserver* NewL( CCchServiceImpl& aCchService ) ; |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. |
|
53 * |
|
54 * @param aCchService Cch service factory |
|
55 */ |
|
56 static CCchClientObserver* NewLC( CCchServiceImpl& aCchService ); |
|
57 |
|
58 /** |
|
59 * Destructor. |
|
60 */ |
|
61 ~CCchClientObserver(); |
|
62 |
|
63 /** |
|
64 * @deprecated Do not use this anymore, change to AddObserver! |
|
65 * |
|
66 * Adds observer for listening service events |
|
67 * |
|
68 * @param aObserver Event observing class |
|
69 */ |
|
70 void SetObserver( MCchServiceStatusObserver& aObserver ); |
|
71 |
|
72 /** |
|
73 * @deprecated Do not use this anymore, change to |
|
74 * RemoveObserver method with paramater |
|
75 * |
|
76 * Removes the observer of service events |
|
77 */ |
|
78 void RemoveObserver( ); |
|
79 |
|
80 /** |
|
81 * Adds observer for listening service events |
|
82 * |
|
83 * @param aObserver Event observing class |
|
84 * @return KErrAlreadyExist Observer already added |
|
85 * KErrNone Observer was added |
|
86 */ |
|
87 TInt AddObserver( MCchServiceStatusObserver& aObserver ); |
|
88 |
|
89 /** |
|
90 * Removes the observer of service events |
|
91 * |
|
92 * @param aObserver Event observing class |
|
93 * @return KErrNotFound Observer was not found |
|
94 * KErrNone Observer was removed |
|
95 */ |
|
96 TInt RemoveObserver( MCchServiceStatusObserver& aObserver ); |
|
97 |
|
98 private: |
|
99 |
|
100 /** |
|
101 * The constructor |
|
102 * |
|
103 * @param aCchService Cch service factory |
|
104 */ |
|
105 CCchClientObserver( CCchServiceImpl& aCchService ); |
|
106 |
|
107 /** |
|
108 * By default Symbian 2nd phase constructor is private. |
|
109 */ |
|
110 void ConstructL(); |
|
111 |
|
112 private: //from CActive |
|
113 |
|
114 /** |
|
115 * @see CActive. |
|
116 */ |
|
117 void RunL(); |
|
118 |
|
119 /** |
|
120 * @see CActive. |
|
121 */ |
|
122 void DoCancel(); |
|
123 |
|
124 /** |
|
125 * @see CActive. |
|
126 */ |
|
127 TInt RunError( TInt aError ); |
|
128 |
|
129 private: // data |
|
130 |
|
131 /** |
|
132 * cch service factory, not own |
|
133 */ |
|
134 CCchServiceImpl& iCchService; |
|
135 |
|
136 /** |
|
137 * Service observer, not own |
|
138 */ |
|
139 MCchServiceStatusObserver* iBackwardSupportObserver; |
|
140 |
|
141 /** |
|
142 * Stores service status information |
|
143 */ |
|
144 TPckgBuf<TServiceStatus> iServiceStatus; |
|
145 |
|
146 // Observers |
|
147 RPointerArray<MCchServiceStatusObserver> iObservers; |
|
148 |
|
149 #ifdef CCHUNITTEST |
|
150 friend class UT_CCchService; |
|
151 #endif |
|
152 }; |
|
153 |
|
154 #endif // C_CCHCLIENTOBSERVER_H |