|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __CMSCONTACTNOTIFIER__ |
|
21 #define __CMSCONTACTNOTIFIER__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <s32std.h> |
|
25 |
|
26 #include "cmscontact.h" |
|
27 #include "cmscontactfielditem.h" |
|
28 #include "cmsnotificationhandlerapi.h" |
|
29 |
|
30 class CCmsContactField; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 NONSHARABLE_CLASS( CCmsContactNotifier ) : public CActive |
|
34 { |
|
35 public: |
|
36 |
|
37 /** |
|
38 * Symbian default constructor |
|
39 * @param RCmsContact The main contact object |
|
40 * @param MCmsNotificationHandlerAPI The observer |
|
41 * @param CCmsContactFieldItem::TCmsContactNotification The type of the |
|
42 subscribed notification |
|
43 * @return CCmsContactNotifier* Self |
|
44 */ |
|
45 static CCmsContactNotifier* NewL( RCmsContact& aContact, |
|
46 MCmsNotificationHandlerAPI& aObserver, |
|
47 CCmsContactFieldItem::TCmsContactNotification aType ); |
|
48 |
|
49 /** |
|
50 * Destructor |
|
51 */ |
|
52 ~CCmsContactNotifier(); |
|
53 |
|
54 /** |
|
55 * Activate this object |
|
56 * @return void |
|
57 */ |
|
58 void StartOrderL( TBool aAskMore = EFalse ); |
|
59 |
|
60 |
|
61 private: |
|
62 |
|
63 /** |
|
64 * C++ constructor is private |
|
65 * |
|
66 * @return CCmsContactFieldInfo |
|
67 */ |
|
68 CCmsContactNotifier( RCmsContact& aContact, |
|
69 MCmsNotificationHandlerAPI& aObserver, |
|
70 CCmsContactFieldItem::TCmsContactNotification aType ); |
|
71 |
|
72 |
|
73 /** |
|
74 * Symbian second-phase constructor |
|
75 * |
|
76 * @return void |
|
77 */ |
|
78 void ConstructL(); |
|
79 |
|
80 public: // new functions |
|
81 |
|
82 /** |
|
83 * Return the notification type |
|
84 * |
|
85 * @return CCmsContactFieldItem::TCmsContactNotification |
|
86 */ |
|
87 CCmsContactFieldItem::TCmsContactNotification Type(); |
|
88 |
|
89 private: //From CActive |
|
90 |
|
91 /** |
|
92 * An asynchrounous request has been completed |
|
93 * |
|
94 * * @return void |
|
95 */ |
|
96 void RunL(); |
|
97 |
|
98 /** |
|
99 * An asynchrounous request has been cancelled |
|
100 * |
|
101 * @return void |
|
102 */ |
|
103 void DoCancel(); |
|
104 |
|
105 /** |
|
106 * An asynchrounous request has failed |
|
107 * |
|
108 * @return TInt Error |
|
109 */ |
|
110 TInt RunError( TInt aError ); |
|
111 |
|
112 private: |
|
113 |
|
114 /** |
|
115 * Start phonebook notifications |
|
116 * |
|
117 * @return TInt Error |
|
118 */ |
|
119 void StartPhoneboookNotifyL( TBool aAskMore ); |
|
120 |
|
121 /** |
|
122 * Start presence notifications |
|
123 * |
|
124 * @return TInt Error |
|
125 */ |
|
126 void StartPresenceNotifyL( TBool aAskMore ); |
|
127 |
|
128 /** |
|
129 * Start presence notifications |
|
130 * |
|
131 * @return TInt Error |
|
132 */ |
|
133 void CheckRestartL( TBool aDestroyed, TCmsPhonebookEvent aEvent ); |
|
134 |
|
135 private : // data |
|
136 |
|
137 RCmsContact& iContact; |
|
138 |
|
139 TPtr iStreamDesc; |
|
140 |
|
141 HBufC* iStreamBuffer; |
|
142 |
|
143 MCmsNotificationHandlerAPI& iObserver; |
|
144 |
|
145 TBool iPresenceStarted; |
|
146 |
|
147 TBool iPhonebookStarted; |
|
148 |
|
149 /** |
|
150 * Pointer to stack variable to detect the deletion of the heap |
|
151 * instance. This case takes place if a client |
|
152 * calls destructor in callback method. |
|
153 * Own. |
|
154 */ |
|
155 TBool* iDestroyedPtr; |
|
156 |
|
157 CCmsContactFieldItem::TCmsContactNotification iType; |
|
158 |
|
159 CCmsContactField *iContactField; |
|
160 }; |
|
161 |
|
162 #endif //__CMSCONTACTBASENOTIFIER__ |
|
163 |
|
164 |
|
165 // End of File |