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