|
1 // Copyright (c) 2001-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Local includes |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @publishedPartner |
|
23 @released |
|
24 */ |
|
25 |
|
26 // System includes |
|
27 // |
|
28 #include <ecom/ecom.h> |
|
29 #include <push/cpushhandlerbase.h> |
|
30 |
|
31 |
|
32 /** |
|
33 Constructor. |
|
34 */ |
|
35 inline CPushHandlerBase::CPushHandlerBase() |
|
36 : CActive(EPriorityStandard) |
|
37 { |
|
38 } |
|
39 |
|
40 |
|
41 /** |
|
42 Destructor. |
|
43 */ |
|
44 inline CPushHandlerBase::~CPushHandlerBase() |
|
45 { |
|
46 REComSession::DestroyedImplementation(iDtor_ID_Key); |
|
47 } |
|
48 |
|
49 |
|
50 /** |
|
51 Finds and instantiates an ECom WAP Push Application plug-in that matches the |
|
52 specified Application ID. |
|
53 |
|
54 @return |
|
55 WAP Push Application plug-in that handles the specified Application ID. |
|
56 |
|
57 @param aMatchData |
|
58 Application ID. |
|
59 */ |
|
60 inline CPushHandlerBase* CPushHandlerBase::NewL(const TDesC& aMatchData) |
|
61 { |
|
62 return NewL(aMatchData, KUidPushHandlerBase); |
|
63 } |
|
64 |
|
65 |
|
66 /** |
|
67 Finds and instantiates an ECom plug-in that implements an interface specialised |
|
68 from CPushHandlerBase. |
|
69 |
|
70 This is a utility function for use by ECom interface classes that specialise |
|
71 CPushHandlerBase, such as CContentHandlerBase. |
|
72 |
|
73 @param aMatchData |
|
74 ECom match data. |
|
75 |
|
76 @param aInterfaceUid |
|
77 UID of the required derived ECom interface. |
|
78 |
|
79 @return |
|
80 WAP Push plug-in that handles the specified Application ID. |
|
81 */ |
|
82 inline CPushHandlerBase* CPushHandlerBase::NewL(const TDesC& aMatchData, const TUid& aInterfaceUid) |
|
83 { |
|
84 // Convert match data to 8-bits |
|
85 HBufC8* buf = HBufC8::NewLC(aMatchData.Length()); |
|
86 TPtr8 data = buf->Des(); |
|
87 data.Copy(aMatchData); |
|
88 data.LowerCase(); // change to lower case |
|
89 |
|
90 // Set resolving parameters |
|
91 TEComResolverParams resolverParams; |
|
92 resolverParams.SetDataType(data); |
|
93 resolverParams.SetWildcardMatch(ETrue); |
|
94 |
|
95 // Get the instantiation |
|
96 CPushHandlerBase* pushHandler = REINTERPRET_CAST(CPushHandlerBase*, |
|
97 REComSession::CreateImplementationL(aInterfaceUid, |
|
98 _FOFF(CPushHandlerBase, iDtor_ID_Key), |
|
99 resolverParams)); |
|
100 CleanupStack::PopAndDestroy(buf); |
|
101 return pushHandler; |
|
102 } |
|
103 |
|
104 |
|
105 /** |
|
106 Specifies an interface to handle logging. |
|
107 |
|
108 Log messages are intended to aid debugging. |
|
109 |
|
110 @param aLog |
|
111 Log interface. This is stored in iLog. |
|
112 */ |
|
113 inline void CPushHandlerBase::SetLogger(MWapPushLog& aLog) |
|
114 { |
|
115 iLog = &aLog; |
|
116 } |
|
117 |
|
118 |
|
119 /** |
|
120 Called by the framework to supply a CPluginKiller object. |
|
121 |
|
122 The plug-in calls CPluginKiller::KillPushPlugin() to delete itself when it |
|
123 has completed handling a message. |
|
124 |
|
125 @param aPluginKiller |
|
126 Plugin killer. This is stored in iPluginKiller. |
|
127 */ |
|
128 inline void CPushHandlerBase::SetKiller(CPluginKiller& aPluginKiller) |
|
129 { |
|
130 iPluginKiller = &aPluginKiller; |
|
131 } |
|
132 |
|
133 /** |
|
134 Set the connection manager. |
|
135 |
|
136 @param aManager Reference to connection manager object to be set.*/ |
|
137 inline void CPushHandlerBase::SetManager(MConnManObserver& aManager) |
|
138 { |
|
139 iManager = &aManager; |
|
140 } |
|
141 |
|
142 |
|
143 /** |
|
144 Stores the passed TRequestStatus and sets it to KRequestPending. |
|
145 |
|
146 @param aStatus |
|
147 Asynchronous status, stored in iConfirmStatus. |
|
148 */ |
|
149 inline void CPushHandlerBase::SetConfirmationStatus(TRequestStatus& aStatus) |
|
150 { |
|
151 aStatus=KRequestPending; |
|
152 iConfirmStatus = &aStatus; |
|
153 } |
|
154 |
|
155 /** |
|
156 Completes the stored asynchronous status with the specified error code. |
|
157 |
|
158 @param aErr |
|
159 Error code. |
|
160 */ |
|
161 inline void CPushHandlerBase::SignalConfirmationStatus(TInt aErr) |
|
162 { |
|
163 User::RequestComplete(iConfirmStatus, aErr); |
|
164 } |