|
1 /* |
|
2 * Copyright (c) 2002 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: Declaration of CUnknownContentHandler. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CUNKNOWNCONTENTHANDLER_H__ |
|
21 #define __CUNKNOWNCONTENTHANDLER_H__ |
|
22 |
|
23 |
|
24 // INCLUDE FILES |
|
25 |
|
26 #include "CPushContentHandlerBase.h" |
|
27 #include "PushContentHandlerDef.hrh" |
|
28 #include <E32Base.h> |
|
29 #include <bldvariant.hrh> |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 const TUid KUidPushUnknownContentHandler = { EUidPushUnknownContentHandler }; |
|
34 _LIT( KUnknownContentHandlerData, "*" ); |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 |
|
38 class CSmsMessage; |
|
39 class CUnknownPushMsgEntry; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * CUnknownContentHandler provides the default plugin when the |
|
45 * specific plugin for a data type cannot be matched. |
|
46 * |
|
47 * If the feature flag __SERIES60_PUSH_SP is defined, then all this |
|
48 * kind of messages are discarded on reception. |
|
49 */ |
|
50 class CUnknownContentHandler : public CPushContentHandlerBase |
|
51 { |
|
52 public: // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. Leaves on failure. |
|
56 * @return The constructed object. |
|
57 */ |
|
58 static CUnknownContentHandler* NewL(); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 virtual ~CUnknownContentHandler(); |
|
64 |
|
65 private: // Constructors |
|
66 |
|
67 /** |
|
68 * Constructor. |
|
69 */ |
|
70 CUnknownContentHandler(); |
|
71 |
|
72 /** |
|
73 * Symbian OS constructor. |
|
74 */ |
|
75 void ConstructL(); |
|
76 |
|
77 private: // New functions |
|
78 |
|
79 /** |
|
80 * Do Garbage Collection synchronously. |
|
81 * @return None. |
|
82 */ |
|
83 void CollectGarbageL(); |
|
84 |
|
85 #ifdef __SERIES60_PUSH_SP |
|
86 |
|
87 /** |
|
88 * Create/Saving Push Msg Entry in the appropriate message store. |
|
89 * First query the type of push message to check if it is a known BIO |
|
90 * message type: |
|
91 * If it is then |
|
92 * save Push Message as appropriate BIO message |
|
93 * else |
|
94 * save as UnknownPushMsgEntry. |
|
95 * @return None. |
|
96 */ |
|
97 void ProcessingPushMsgEntryL(); |
|
98 |
|
99 /** |
|
100 * Check if the given Push Message, which is now owned by the handler, |
|
101 * is a BIO Messsage (setting the member variable iBioMsgUID if it is) |
|
102 * and returning a boolean to indicate success (ETrue) or EFalse otherwise. |
|
103 * @return TBool |
|
104 * ETrue - push message is a BIO message |
|
105 * EFalse - push message is not BIO message |
|
106 */ |
|
107 TBool BioMessageTypeL(); |
|
108 |
|
109 /** |
|
110 * Save CPushMessage as the relevant BIO message type. |
|
111 * Firstly create SMS message and use CPushMessage as |
|
112 * source to populate SMS. Then save SMS message. |
|
113 * @return None. |
|
114 */ |
|
115 void SaveBioMessageEntryL(); |
|
116 |
|
117 /** |
|
118 * Create CMsvEntry for sms messsage, stores the entry and |
|
119 * then delete entry once done. |
|
120 * @param aMessage CSmsMessage which embodies details of CPushMessage. |
|
121 */ |
|
122 void StoreMsgL( CSmsMessage* aSmsMsg ); |
|
123 |
|
124 /** |
|
125 * Set the service id for Bio messaging |
|
126 * @return TMsvId The service id for the message store. |
|
127 */ |
|
128 TMsvId SetBioServiceIdL(); |
|
129 |
|
130 /** |
|
131 * Save CPushMessage as a CUnknownPushMsgEntry |
|
132 * @return None. |
|
133 */ |
|
134 void SaveUnknownPushMsgEntryL(); |
|
135 |
|
136 /** |
|
137 * Sets the Unknown Push Message Entry Fields from the data in |
|
138 * the received CPushMessage: |
|
139 * @param aUnknownPushMsgEntry CUnknownPushMsgEntry to populate with |
|
140 * CPushMessage details. |
|
141 */ |
|
142 void SetUnknownPushMsgEntryFieldsL( CUnknownPushMsgEntry& |
|
143 aUnknownPushMsgEntry ); |
|
144 |
|
145 /** |
|
146 * Extract the file name from the URI. |
|
147 * @param aUri The URI. |
|
148 * @return The file name part or an empty string. |
|
149 */ |
|
150 HBufC* FileNameFromUriL( const TDesC& aUri ) const; |
|
151 |
|
152 #endif // __SERIES60_PUSH_SP |
|
153 |
|
154 private: // Methods from CPushHandlerBase |
|
155 |
|
156 /** |
|
157 * HandleMessage Async. Version. Takes ownership of Push Message and |
|
158 * sets self active to continue processing message. |
|
159 * @param aPushMsg CPushMessage to process. |
|
160 * @param aStatus Request status variable for use in asynchronous |
|
161 * operations. |
|
162 * @return None. |
|
163 */ |
|
164 void HandleMessageL( CPushMessage* aPushMsg, TRequestStatus& aStatus ); |
|
165 |
|
166 /** |
|
167 * HandleMessage Sync. Version. Takes ownership of Push Message and |
|
168 * sets self active to continue processing message. |
|
169 * Initial State: Set data members then go to the next state |
|
170 * @param aPushMsg CPushMessage to process. |
|
171 */ |
|
172 void HandleMessageL( CPushMessage* aPushMsg ); |
|
173 |
|
174 /** |
|
175 * Same functionality as DoCancel() |
|
176 */ |
|
177 void CancelHandleMessage(); |
|
178 |
|
179 /** |
|
180 * Reserved function. |
|
181 */ |
|
182 void CPushHandlerBase_Reserved1(); |
|
183 |
|
184 /** |
|
185 * Reserved function. |
|
186 */ |
|
187 void CPushHandlerBase_Reserved2(); |
|
188 |
|
189 private: // Methods from CActive |
|
190 |
|
191 /** |
|
192 * Cancels the handling of the message and revokes the active status |
|
193 * of the handler |
|
194 */ |
|
195 void DoCancel(); |
|
196 |
|
197 /** |
|
198 * Handler States: |
|
199 * EFilteringAndProcessing - Filter new msg according to Service |
|
200 * message settings and Convert CPushMessage to a |
|
201 * format to save and save the message (either as Bio |
|
202 * msg or UnknownPushMsgEntry) |
|
203 * EDone - Clean up, complete observer |
|
204 */ |
|
205 void RunL(); |
|
206 |
|
207 /** |
|
208 * This is invoked when RunL Leaves with an error. |
|
209 * Cleans up and returns. |
|
210 * @param aError Error passed into this function |
|
211 */ |
|
212 TInt RunError( TInt aError ); |
|
213 |
|
214 private: // Data |
|
215 |
|
216 enum TState |
|
217 { |
|
218 EGarbageCollecting, |
|
219 EFilteringAndProcessing, |
|
220 EDone |
|
221 }; |
|
222 |
|
223 TMsvId iSavedMsgId; ///< ID of the saved message. |
|
224 TUid iBioMsgUID; ///< BIO msg UID. |
|
225 }; |
|
226 |
|
227 #endif // __CUNKNOWNCONTENTHANDLER_H__ |
|
228 |