|
1 /* |
|
2 * Copyright (c) 2005 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: Header declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 // Interface's (abstract base class's) static factory method implementation. |
|
26 // Asks ECOM plug-in framework to instantiate appropriate concrete plug-in |
|
27 // implementation. |
|
28 |
|
29 // What to do if there are NO providers to be found - should there always be a |
|
30 // "dummy" provider? |
|
31 |
|
32 inline CSenProvider* CSenProvider::NewL() |
|
33 { |
|
34 // Wish to instantiate the default provider - just a test provider... |
|
35 const TUid KTestProviderUid = {0x10273114}; |
|
36 |
|
37 // Find implementation behind KTestProviderUid. |
|
38 TAny* intf = REComSession::CreateImplementationL(KTestProviderUid, |
|
39 _FOFF (CSenProvider, |
|
40 iDtor_ID_Key), |
|
41 NULL); |
|
42 |
|
43 if(intf) |
|
44 { |
|
45 CSenProvider* provider = reinterpret_cast <CSenProvider*> (intf); |
|
46 CleanupStack::PushL(provider); |
|
47 provider->iCriticalSection.CreateLocal(); |
|
48 _LIT8(KTestProviderCue, "local://com.nokia.provider/TestProvider"); |
|
49 provider->iCue=KTestProviderCue().AllocL(); |
|
50 CleanupStack::Pop(); // provider |
|
51 } |
|
52 |
|
53 return reinterpret_cast <CSenProvider*> (intf); |
|
54 } |
|
55 |
|
56 // Interface's (abstract base class's) static factory method implementation. |
|
57 // Asks ECOM plug-in framework to instantiate appropriate concrete plug-in |
|
58 // implementation. |
|
59 inline CSenProvider* CSenProvider::NewL(const TDesC8& aCue) |
|
60 { |
|
61 #ifndef RD_SEN_COMPILE_SIS_PACKAGE_FILES |
|
62 const TUid KUidSenHostletPlugin = { 0x02000502 }; |
|
63 #else |
|
64 const TUid KUidSenHostletPlugin = { 0x10282C5D }; |
|
65 #endif |
|
66 |
|
67 TEComResolverParams resolverParams; |
|
68 resolverParams.SetDataType(aCue); |
|
69 resolverParams.SetWildcardMatch(EFalse); |
|
70 |
|
71 // Find implementation for our interface. |
|
72 |
|
73 TAny* intf = REComSession::CreateImplementationL(KUidSenHostletPlugin, |
|
74 _FOFF (CSenProvider, iDtor_ID_Key), |
|
75 NULL, |
|
76 resolverParams); |
|
77 |
|
78 if(intf) |
|
79 { |
|
80 CSenProvider* provider = reinterpret_cast <CSenProvider*> (intf); |
|
81 provider->iCriticalSection.CreateLocal(); |
|
82 CleanupStack::PushL(provider); |
|
83 provider->iCue = aCue.AllocL(); |
|
84 CleanupStack::Pop(); // provider |
|
85 } |
|
86 |
|
87 return reinterpret_cast<CSenProvider*> (intf); |
|
88 } |
|
89 |
|
90 |
|
91 // Interface's (abstract base class's) destructor |
|
92 inline CSenProvider::~CSenProvider() |
|
93 { |
|
94 // If in the NewL some memory is reserved for member data, it must be |
|
95 // released here. This interface does not have any instance variables so |
|
96 // no need to delete anything. |
|
97 |
|
98 // Inform the ECOM framework that this specific instance of the |
|
99 // interface has been destroyed. |
|
100 REComSession::DestroyedImplementation (iDtor_ID_Key); |
|
101 delete iCue; |
|
102 iCue = NULL; |
|
103 iCriticalSection.Close(); |
|
104 } |
|
105 |
|
106 inline TPtrC8 CSenProvider::Endpoint() const |
|
107 { |
|
108 if(iCue) |
|
109 return *iCue; |
|
110 else |
|
111 return KNullDesC8(); |
|
112 } |
|
113 |
|
114 // protected |
|
115 inline void CSenProvider::DescribeServiceL(CSenWSDescription& aSD) |
|
116 { |
|
117 aSD.SetEndPointL(Endpoint()); |
|
118 aSD.SetContractL(Contract()); |
|
119 aSD.SetFrameworkIdL(FrameworkId()); |
|
120 |
|
121 if(Exposed()) |
|
122 { |
|
123 CSenFacet* pExposed = CSenFacet::NewL(); |
|
124 CleanupStack::PushL(pExposed); |
|
125 pExposed->SetNameL(KExposeLocalServiceFacet); // from MSenServiceDescription.h |
|
126 aSD.SetFacetL(*pExposed); |
|
127 CleanupStack::PopAndDestroy(); // pExposed |
|
128 } |
|
129 |
|
130 if(Sharable()) |
|
131 { |
|
132 CSenFacet* pSharable = CSenFacet::NewL(); |
|
133 CleanupStack::PushL(pSharable); |
|
134 pSharable->SetNameL(KProviderSharableFacet); |
|
135 aSD.SetFacetL(*pSharable); |
|
136 CleanupStack::PopAndDestroy(); // pSharable |
|
137 |
|
138 } |
|
139 |
|
140 if(CompleteClientMessages()) |
|
141 { |
|
142 CSenFacet* pCompleteClientMsgs = CSenFacet::NewL(); |
|
143 CleanupStack::PushL(pCompleteClientMsgs); |
|
144 pCompleteClientMsgs->SetNameL(KProviderCompleteClientMsgsFacet); |
|
145 aSD.SetFacetL(*pCompleteClientMsgs); |
|
146 CleanupStack::PopAndDestroy(); // pCompleteClientMsgs |
|
147 } |
|
148 |
|
149 if(LoadOnStartup()) |
|
150 { |
|
151 CSenFacet* pLoadOnStartup = CSenFacet::NewL(); |
|
152 CleanupStack::PushL(pLoadOnStartup); |
|
153 pLoadOnStartup->SetNameL(KProviderLoadOnStartupFacet); |
|
154 aSD.SetFacetL(*pLoadOnStartup); |
|
155 CleanupStack::PopAndDestroy(); // pLoadOnStartup |
|
156 } |
|
157 |
|
158 if(Threadsafe()) |
|
159 { |
|
160 CSenFacet* pThreadsafe = CSenFacet::NewL(); |
|
161 CleanupStack::PushL(pThreadsafe); |
|
162 pThreadsafe->SetNameL(KProviderThreadsafeFacet); |
|
163 aSD.SetFacetL(*pThreadsafe); |
|
164 CleanupStack::PopAndDestroy(); // pLoadOnStartup |
|
165 } |
|
166 |
|
167 if(Reinitializable()) |
|
168 { |
|
169 CSenFacet* pReinitializable = CSenFacet::NewL(); |
|
170 CleanupStack::PushL(pReinitializable); |
|
171 pReinitializable->SetNameL(KProviderReinitializableFacet); |
|
172 aSD.SetFacetL(*pReinitializable); |
|
173 CleanupStack::PopAndDestroy(); // pReinitializable |
|
174 } |
|
175 |
|
176 if(StayOnBackground()) |
|
177 { |
|
178 CSenFacet* pStayOnBackgroudnd = CSenFacet::NewL(); |
|
179 CleanupStack::PushL(pStayOnBackgroudnd); |
|
180 pStayOnBackgroudnd->SetNameL(KProviderStayOnBackgroundFacet); |
|
181 aSD.SetFacetL(*pStayOnBackgroudnd); |
|
182 CleanupStack::PopAndDestroy(); // pStayOnBackgroudnd |
|
183 } |
|
184 } |
|
185 |
|
186 inline TBool CSenProvider::Exposed() const |
|
187 { |
|
188 return EFalse; |
|
189 } |
|
190 |
|
191 inline TBool CSenProvider::Sharable() const |
|
192 { |
|
193 return EFalse; |
|
194 } |
|
195 |
|
196 inline TBool CSenProvider::CompleteClientMessages() const |
|
197 { |
|
198 return EFalse; |
|
199 } |
|
200 |
|
201 |
|
202 inline TBool CSenProvider::LoadOnStartup() const |
|
203 { |
|
204 return EFalse; |
|
205 } |
|
206 |
|
207 inline TBool CSenProvider::Threadsafe() const |
|
208 { |
|
209 return ETrue; |
|
210 } |
|
211 |
|
212 inline TBool CSenProvider::Reinitializable() const |
|
213 { |
|
214 return EFalse; |
|
215 } |
|
216 |
|
217 inline TBool CSenProvider::StayOnBackground() const |
|
218 { |
|
219 return EFalse; |
|
220 } |
|
221 |
|
222 inline TInt CSenProvider::ReinitL() |
|
223 { |
|
224 return KErrNotSupported; |
|
225 } |
|
226 |
|
227 // END OF FILE |
|
228 |
|
229 |