|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This file contains the declaration of the CPushAppHandlerEx which is an example |
|
15 // WAP Push plugin |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file PushAppHandlerEx.h |
|
21 */ |
|
22 |
|
23 #ifndef __PUSHAPPHANDEREX_H__ |
|
24 #define __PUSHAPPHANDEREX_H__ |
|
25 |
|
26 |
|
27 /** All Push Messages have an Application-ID header. |
|
28 * Registered values are on the Wapforum web site: http://www.wapforum.com/wina/ |
|
29 * It can be found on that site under 'WAG' 'Push Application ID' |
|
30 * |
|
31 * This example uses a non-registered value as an example. Change this for your |
|
32 * real push plugin. |
|
33 * |
|
34 * This plugin is registered for this via the ECOM resource mechanism |
|
35 * Look in the XXXXX.rss file |
|
36 * The values in both the text and numeric form is in the default_data section. |
|
37 * |
|
38 * This file conatains the Example WAP Push Application Handler Plugin |
|
39 * |
|
40 */ |
|
41 |
|
42 |
|
43 #include <e32base.h> |
|
44 #include <push/cpushhandlerbase.h> |
|
45 |
|
46 |
|
47 /** |
|
48 * The CPushAppHandlerEx is a WAP Push Plugin. It registers for a nonsense push |
|
49 * push message. It is invoked to do its work in when HandleMessage() API is |
|
50 * called by the Push Watcher framework. |
|
51 * As a WAP Push Plugin, it must destroy itself when it is complete. The Watcher |
|
52 * does not hold a pointer to it, it is invoked and responsible for destoying |
|
53 * itself. |
|
54 * |
|
55 * When invoked, the Push Message will contain a CPushMessage. It can do anything |
|
56 * with the message such as parsing, storing, passing it to another application, etc. |
|
57 * |
|
58 * In this example, it will parse the message, then destroy it. |
|
59 * |
|
60 */ |
|
61 class CPushAppHandlerEx : public CPushHandlerBase |
|
62 { |
|
63 public: // Methods |
|
64 |
|
65 /** |
|
66 * Intended Usage : Static factory constructor called by the Wap Push framework |
|
67 * @return Pointer to a fully instantiated CPushAppHandlerEx class |
|
68 */ |
|
69 static CPushAppHandlerEx* NewL(); |
|
70 |
|
71 /** |
|
72 * Intended Usage : Default Destructor |
|
73 */ |
|
74 virtual ~CPushAppHandlerEx(); |
|
75 |
|
76 public: // Methods from CPushHandlerBase |
|
77 |
|
78 /** |
|
79 * Intended Usage :Called by the Wap Push Framework to handle the message. |
|
80 * Asynchronous version |
|
81 * @param aPushMsg The push message delivered from the framework containing |
|
82 * the Push Message. Ownership is taken over. |
|
83 * @param aStatus when this function is complete, this status is returned |
|
84 * with acompletion code. |
|
85 */ |
|
86 void HandleMessageL(CPushMessage* aPushMsg, TRequestStatus& aStatus); |
|
87 |
|
88 /** |
|
89 * Intended Usage : Called by the Wap Push Framework to handle the message. |
|
90 * Synchronous version |
|
91 * @param aPushMsg The push message delivered from the framework containing |
|
92 * the Push Message. Ownership is taken over. |
|
93 */ |
|
94 void HandleMessageL(CPushMessage* aPushMsg); |
|
95 |
|
96 /** |
|
97 * Intended Usage :Called by the Wap Push Framework to cancel outstanding |
|
98 * events. |
|
99 */ |
|
100 void CancelHandleMessage(); |
|
101 |
|
102 /** |
|
103 * Intended Usage :Reserved for ECOM for future expansion |
|
104 */ |
|
105 virtual void CPushHandlerBase_Reserved1(); |
|
106 |
|
107 /** |
|
108 * Intended Usage :Reserved for ECOM for future expansion |
|
109 */ |
|
110 virtual void CPushHandlerBase_Reserved2(); |
|
111 |
|
112 private: // Methods from CActive |
|
113 |
|
114 /** |
|
115 * Intended Usage :Inherited from CActive - called to cancel outanding events |
|
116 */ |
|
117 void DoCancel(); |
|
118 |
|
119 /** |
|
120 * Intended Usage :Inherited from CActive - called when object is active |
|
121 */ |
|
122 void RunL(); |
|
123 |
|
124 |
|
125 private: // Methods |
|
126 |
|
127 /** |
|
128 * Intended Usage :Default constructor |
|
129 */ |
|
130 CPushAppHandlerEx(); |
|
131 |
|
132 /** |
|
133 * Intended Usage :2nd phase constuctor for instantiating member variables |
|
134 */ |
|
135 void ConstructL(); |
|
136 |
|
137 |
|
138 /** |
|
139 * Intended Usage :Completes the iRequestStatus with KErrNone |
|
140 */ |
|
141 void IdleComplete(); |
|
142 |
|
143 /** |
|
144 * @param aError - indicate to function an error |
|
145 * Intended Usage :Kill Self |
|
146 */ |
|
147 void Done(TInt aError); |
|
148 |
|
149 /** |
|
150 * Intended Usage :Demonstrate parsing a push message |
|
151 */ |
|
152 void ParsePushMsgL(); |
|
153 |
|
154 /** |
|
155 * Intended Usage :Demonstrate doing something with a push message |
|
156 */ |
|
157 void ProcessPushMsgL(); |
|
158 |
|
159 private: // Attributes |
|
160 /** |
|
161 * State machine to demonstate plugin |
|
162 */ |
|
163 typedef enum TState { EParsing, EProcessing, EDone }; |
|
164 TState iState; |
|
165 |
|
166 /** |
|
167 * Push Message passed in |
|
168 */ |
|
169 CPushMessage* iMessage; |
|
170 |
|
171 /** |
|
172 * Flag to indicate if this was called asynchonously |
|
173 */ |
|
174 TBool iAsyncHandling; |
|
175 |
|
176 }; |
|
177 |
|
178 #endif // __PUSHAPPHANDEREX_H__ |