|
1 /* |
|
2 * Copyright (c) 2004 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: Notifier API to listen presence changes. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "CPEngPresenceNotifier2.h" |
|
20 #include "CPEngPresenceNotifier2Imp.h" |
|
21 #include "TPEngMDesCArrayAdapter.h" |
|
22 #include "TPEngCntLstMDesCArrayAdapter.h" |
|
23 |
|
24 |
|
25 // MACORS |
|
26 #define RETURN_IF_NOT_VALID_CNT_LST_VIEW( aContactListView ) \ |
|
27 if( ( aContactListView != EPEngCntListLocalView ) && \ |
|
28 ( aContactListView != EPEngCntListNetworkView ) ) \ |
|
29 { \ |
|
30 return KErrArgument; \ |
|
31 } \ |
|
32 |
|
33 |
|
34 // ============================ MEMBER FUNCTIONS =============================== |
|
35 |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CPEngPresenceNotifier2::NewL() |
|
39 // Two-phased constructor. |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 EXPORT_C CPEngPresenceNotifier2* CPEngPresenceNotifier2::NewL( |
|
43 const CPEngNWSessionSlotID2& aNWSessionSlotID, |
|
44 TInt aPriority ) |
|
45 { |
|
46 CPEngPresenceNotifier2* self = CPEngPresenceNotifier2::NewLC( |
|
47 aNWSessionSlotID, |
|
48 aPriority ); |
|
49 CleanupStack::Pop( self ); |
|
50 return self; |
|
51 } |
|
52 |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CPEngPresenceNotifier2::NewLC() |
|
56 // Two-phased constructor. |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 EXPORT_C CPEngPresenceNotifier2* CPEngPresenceNotifier2::NewLC( |
|
60 const CPEngNWSessionSlotID2& aNWSessionSlotID, |
|
61 TInt aPriority ) |
|
62 { |
|
63 CPEngPresenceNotifier2* self = new ( ELeave ) CPEngPresenceNotifier2; |
|
64 CleanupStack::PushL( self ); |
|
65 self->iImp = CPEngPresenceNotifier2Imp::NewL( *self, |
|
66 aPriority, |
|
67 aNWSessionSlotID ); |
|
68 return self; |
|
69 } |
|
70 |
|
71 |
|
72 |
|
73 // Destructor |
|
74 CPEngPresenceNotifier2::~CPEngPresenceNotifier2() |
|
75 { |
|
76 delete iImp; |
|
77 } |
|
78 |
|
79 |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CPEngPresenceNotifier2::CPEngPresenceNotifier2 |
|
83 // C++ default constructor can NOT contain any code, that |
|
84 // might leave. |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 CPEngPresenceNotifier2::CPEngPresenceNotifier2() |
|
88 { |
|
89 } |
|
90 |
|
91 |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CPEngPresenceNotifier2::IsActive() |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 EXPORT_C TBool CPEngPresenceNotifier2::IsActive() const |
|
98 { |
|
99 return iImp->IsActive(); |
|
100 } |
|
101 |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // CPEngPresenceNotifier2::Start() |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 EXPORT_C TInt CPEngPresenceNotifier2::Start( |
|
108 const TDesC& aPresenceID, |
|
109 const TArray<TUint32>& aTypes ) |
|
110 { |
|
111 TPEngMDesCArrayAdapter adapter( aPresenceID ); |
|
112 return Start( adapter, aTypes ); |
|
113 } |
|
114 |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CPEngPresenceNotifier2::Start() |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 EXPORT_C TInt CPEngPresenceNotifier2::Start( |
|
121 const MDesCArray& aPresenceIDs, |
|
122 const TArray<TUint32>& aTypes ) |
|
123 { |
|
124 return iImp->Start( aPresenceIDs, aTypes ); |
|
125 } |
|
126 |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CPEngPresenceNotifier2::Start() |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 EXPORT_C TInt CPEngPresenceNotifier2::Start( |
|
133 const MPEngContactList2& aList, |
|
134 TPEngContactListView aContactListView, |
|
135 const TArray<TUint32>& aTypes ) |
|
136 { |
|
137 RETURN_IF_NOT_VALID_CNT_LST_VIEW( aContactListView ); |
|
138 |
|
139 TPEngCntLstMDesCArrayAdapter cntLstAdapter( aList, aContactListView ); |
|
140 return iImp->Start( cntLstAdapter, aTypes ); |
|
141 } |
|
142 |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CPEngPresenceNotifier2::Stop() |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 EXPORT_C void CPEngPresenceNotifier2::Stop() |
|
149 { |
|
150 iImp->Stop(); |
|
151 } |
|
152 |
|
153 |
|
154 // ----------------------------------------------------------------------------- |
|
155 // CPEngPresenceNotifier2::Update() |
|
156 // ----------------------------------------------------------------------------- |
|
157 // |
|
158 EXPORT_C TInt CPEngPresenceNotifier2::Update( const MDesCArray& aPresenceIDs ) |
|
159 { |
|
160 return iImp->Update( aPresenceIDs, NULL, EFalse ); |
|
161 } |
|
162 |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // CPEngPresenceNotifier2::Update() |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 EXPORT_C TInt CPEngPresenceNotifier2::Update( const MPEngContactList2& aList, |
|
169 TPEngContactListView aContactListView ) |
|
170 { |
|
171 RETURN_IF_NOT_VALID_CNT_LST_VIEW( aContactListView ); |
|
172 |
|
173 TPEngCntLstMDesCArrayAdapter cntLstAdapter( aList, aContactListView ); |
|
174 return iImp->Update( cntLstAdapter, NULL, EFalse ); |
|
175 } |
|
176 |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // CPEngPresenceNotifier2::Add() |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 EXPORT_C TInt CPEngPresenceNotifier2::Add( |
|
183 const TDesC& aPresenceID, |
|
184 const TArray<TUint32>& aTypes ) |
|
185 { |
|
186 TPEngMDesCArrayAdapter presenceIdAdapter( aPresenceID ); |
|
187 return iImp->Update( presenceIdAdapter, &aTypes, ETrue ); |
|
188 } |
|
189 |
|
190 |
|
191 // ----------------------------------------------------------------------------- |
|
192 // CPEngPresenceNotifier2::Remove() |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 EXPORT_C TInt CPEngPresenceNotifier2::Remove( |
|
196 const TDesC& aPresenceID ) |
|
197 |
|
198 { |
|
199 return iImp->Remove( aPresenceID ); |
|
200 } |
|
201 |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // CPEngPresenceNotifier2::Remove() |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 EXPORT_C TInt CPEngPresenceNotifier2::Remove( |
|
208 TUint32 aType ) |
|
209 { |
|
210 return iImp->Remove( aType ); |
|
211 } |
|
212 |
|
213 |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CPEngPresenceNotifier2::TrackedPresenceIDs() |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 EXPORT_C const CPEngTrackedPresenceIDs2& CPEngPresenceNotifier2:: |
|
220 TrackedPresenceIDs() const |
|
221 { |
|
222 return iImp->TrackedPresenceIDs(); |
|
223 } |
|
224 |
|
225 |
|
226 EXPORT_C CPEngTrackedPresenceIDs2& CPEngPresenceNotifier2:: |
|
227 TrackedPresenceIDs() |
|
228 { |
|
229 return iImp->TrackedPresenceIDs(); |
|
230 } |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 // ----------------------------------------------------------------------------- |
|
236 // CPEngPresenceNotifier2::AddObserver() |
|
237 // ----------------------------------------------------------------------------- |
|
238 // |
|
239 EXPORT_C TInt CPEngPresenceNotifier2::AddObserver( |
|
240 MPEngPresenceObserver2& aObserver ) |
|
241 { |
|
242 return iImp->AddObserver( aObserver ); |
|
243 } |
|
244 |
|
245 |
|
246 |
|
247 // ----------------------------------------------------------------------------- |
|
248 // CPEngPresenceNotifier2::RemoveObserver() |
|
249 // ----------------------------------------------------------------------------- |
|
250 // |
|
251 EXPORT_C TInt CPEngPresenceNotifier2::RemoveObserver( |
|
252 MPEngPresenceObserver2& aObserver ) |
|
253 { |
|
254 return iImp->RemoveObserver( aObserver ); |
|
255 } |
|
256 |
|
257 |
|
258 // End of File |
|
259 |
|
260 |