sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <apmstd.h>
|
sl@0
|
20 |
|
sl@0
|
21 |
#include <caf/data.h>
|
sl@0
|
22 |
#include <caf/agentinterface.h>
|
sl@0
|
23 |
#include "agentinfo.h"
|
sl@0
|
24 |
#include <caf/agentfactory.h>
|
sl@0
|
25 |
#include <caf/attributeset.h>
|
sl@0
|
26 |
#include <caf/virtualpath.h>
|
sl@0
|
27 |
#include "resolver.h"
|
sl@0
|
28 |
#include "agentinfo.h"
|
sl@0
|
29 |
#include <e32def.h>
|
sl@0
|
30 |
|
sl@0
|
31 |
using namespace ContentAccess;
|
sl@0
|
32 |
|
sl@0
|
33 |
EXPORT_C CData* CData::NewL(const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode)
|
sl@0
|
34 |
{
|
sl@0
|
35 |
CData *self = CData::NewLC(aVirtualPath, aIntent, aShareMode);
|
sl@0
|
36 |
CleanupStack::Pop(self);
|
sl@0
|
37 |
return self;
|
sl@0
|
38 |
}
|
sl@0
|
39 |
|
sl@0
|
40 |
EXPORT_C CData* CData::NewLC(const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode)
|
sl@0
|
41 |
{
|
sl@0
|
42 |
CData *self = new (ELeave) CData;
|
sl@0
|
43 |
CleanupStack::PushL(self);
|
sl@0
|
44 |
self->ConstructL(aVirtualPath, aIntent, aShareMode);
|
sl@0
|
45 |
return self;
|
sl@0
|
46 |
}
|
sl@0
|
47 |
|
sl@0
|
48 |
EXPORT_C CData* CData::NewL(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent)
|
sl@0
|
49 |
{
|
sl@0
|
50 |
CData *self = CData::NewLC(aFile, aUniqueId, aIntent);
|
sl@0
|
51 |
CleanupStack::Pop(self);
|
sl@0
|
52 |
return self;
|
sl@0
|
53 |
}
|
sl@0
|
54 |
|
sl@0
|
55 |
EXPORT_C CData* CData::NewLC(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent)
|
sl@0
|
56 |
{
|
sl@0
|
57 |
CData *self = new (ELeave) CData;
|
sl@0
|
58 |
CleanupStack::PushL(self);
|
sl@0
|
59 |
self->ConstructL(aFile, aUniqueId, aIntent);
|
sl@0
|
60 |
return self;
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
|
sl@0
|
64 |
EXPORT_C CData* CData::NewL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)
|
sl@0
|
65 |
{
|
sl@0
|
66 |
CData *self = CData::NewLC(aVirtualPath, aShareMode);
|
sl@0
|
67 |
CleanupStack::Pop(self);
|
sl@0
|
68 |
return self;
|
sl@0
|
69 |
}
|
sl@0
|
70 |
|
sl@0
|
71 |
EXPORT_C CData* CData::NewLC(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)
|
sl@0
|
72 |
{
|
sl@0
|
73 |
CData *self = new (ELeave) CData;
|
sl@0
|
74 |
CleanupStack::PushL(self);
|
sl@0
|
75 |
self->ConstructL(aVirtualPath, aShareMode);
|
sl@0
|
76 |
return self;
|
sl@0
|
77 |
}
|
sl@0
|
78 |
|
sl@0
|
79 |
EXPORT_C CData* CData::NewL(RFile& aFile, const TDesC& aUniqueId)
|
sl@0
|
80 |
{
|
sl@0
|
81 |
CData *self = CData::NewLC(aFile, aUniqueId);
|
sl@0
|
82 |
CleanupStack::Pop(self);
|
sl@0
|
83 |
return self;
|
sl@0
|
84 |
}
|
sl@0
|
85 |
|
sl@0
|
86 |
EXPORT_C CData* CData::NewLC(RFile& aFile, const TDesC& aUniqueId)
|
sl@0
|
87 |
{
|
sl@0
|
88 |
CData *self = new (ELeave) CData;
|
sl@0
|
89 |
CleanupStack::PushL(self);
|
sl@0
|
90 |
self->ConstructL(aFile, aUniqueId);
|
sl@0
|
91 |
return self;
|
sl@0
|
92 |
}
|
sl@0
|
93 |
|
sl@0
|
94 |
|
sl@0
|
95 |
CData* CData::NewLC(TUid aUid,
|
sl@0
|
96 |
const TVirtualPathPtr& aVirtualPath,
|
sl@0
|
97 |
TIntent aIntent,
|
sl@0
|
98 |
TContentShareMode aShareMode)
|
sl@0
|
99 |
{
|
sl@0
|
100 |
CData* self = new(ELeave) CData();
|
sl@0
|
101 |
CleanupStack::PushL(self);
|
sl@0
|
102 |
self->ConstructL(aUid, aVirtualPath, aIntent, aShareMode);
|
sl@0
|
103 |
return self;
|
sl@0
|
104 |
}
|
sl@0
|
105 |
|
sl@0
|
106 |
CData* CData::NewLC(TUid aUid, RFile& aFile, const TDesC& aUniqueId, TIntent aIntent)
|
sl@0
|
107 |
{
|
sl@0
|
108 |
CData* self = new (ELeave) CData();
|
sl@0
|
109 |
CleanupStack::PushL(self);
|
sl@0
|
110 |
self->ConstructL(aUid, aFile, aUniqueId, aIntent);
|
sl@0
|
111 |
return self;
|
sl@0
|
112 |
}
|
sl@0
|
113 |
|
sl@0
|
114 |
#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
|
sl@0
|
115 |
|
sl@0
|
116 |
EXPORT_C CData* CData::NewL(const TDesC8& aHeaderData)
|
sl@0
|
117 |
{
|
sl@0
|
118 |
CData* self = CData::NewLC(aHeaderData);
|
sl@0
|
119 |
CleanupStack::Pop(self);
|
sl@0
|
120 |
return self;
|
sl@0
|
121 |
}
|
sl@0
|
122 |
|
sl@0
|
123 |
EXPORT_C CData* CData::NewL(const TDesC8& aHeaderData, TIntent aIntent)
|
sl@0
|
124 |
{
|
sl@0
|
125 |
CData* self = CData::NewLC(aHeaderData, aIntent);
|
sl@0
|
126 |
CleanupStack::Pop(self);
|
sl@0
|
127 |
return self;
|
sl@0
|
128 |
}
|
sl@0
|
129 |
|
sl@0
|
130 |
EXPORT_C CData* CData::NewLC(const TDesC8& aHeaderData)
|
sl@0
|
131 |
{
|
sl@0
|
132 |
CData* self = new (ELeave) CData();
|
sl@0
|
133 |
CleanupStack::PushL(self);
|
sl@0
|
134 |
self->ConstructL(aHeaderData);
|
sl@0
|
135 |
return self;
|
sl@0
|
136 |
}
|
sl@0
|
137 |
|
sl@0
|
138 |
EXPORT_C CData* CData::NewLC(const TDesC8& aHeaderData, TIntent aIntent)
|
sl@0
|
139 |
{
|
sl@0
|
140 |
CData* self = new (ELeave) CData();
|
sl@0
|
141 |
CleanupStack::PushL(self);
|
sl@0
|
142 |
self->ConstructL(aHeaderData, aIntent);
|
sl@0
|
143 |
return self;
|
sl@0
|
144 |
}
|
sl@0
|
145 |
|
sl@0
|
146 |
CData* CData::NewLC(TUid aAgentUid, const TDesC8& aHeaderData, TIntent aIntent)
|
sl@0
|
147 |
{
|
sl@0
|
148 |
CData* self = new (ELeave) CData();
|
sl@0
|
149 |
CleanupStack::PushL(self);
|
sl@0
|
150 |
self->ConstructL(aAgentUid, aHeaderData, aIntent);
|
sl@0
|
151 |
return self;
|
sl@0
|
152 |
}
|
sl@0
|
153 |
|
sl@0
|
154 |
#endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
|
sl@0
|
155 |
|
sl@0
|
156 |
CData::CData()
|
sl@0
|
157 |
{
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
CData::~CData()
|
sl@0
|
161 |
{
|
sl@0
|
162 |
// Destroy the agent implementation
|
sl@0
|
163 |
delete iAgentData;
|
sl@0
|
164 |
|
sl@0
|
165 |
// close ECOM session, may result in the unloading of the DLL
|
sl@0
|
166 |
delete iAgentFactory;
|
sl@0
|
167 |
REComSession::FinalClose();
|
sl@0
|
168 |
}
|
sl@0
|
169 |
|
sl@0
|
170 |
|
sl@0
|
171 |
void CData::ConstructL(const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode)
|
sl@0
|
172 |
{
|
sl@0
|
173 |
// Create the agent resolver which will contains a reference to
|
sl@0
|
174 |
// the agent responsible for this piece of content
|
sl@0
|
175 |
CAgentResolver* resolver = CAgentResolver::NewLC(EFalse);
|
sl@0
|
176 |
|
sl@0
|
177 |
// Create a temporary buffer used to store the translated version of the URI
|
sl@0
|
178 |
HBufC* actualUri = HBufC::NewLC(aVirtualPath.URI().Length() + KMaxSIDLength);
|
sl@0
|
179 |
TPtr uri = actualUri->Des();
|
sl@0
|
180 |
|
sl@0
|
181 |
// Find the agent who handles the file and translate the URI if it is pointing to a private directory
|
sl@0
|
182 |
CAgentInfo& agentInfo = resolver->ResolveFileL(aVirtualPath.URI(), uri, aShareMode);
|
sl@0
|
183 |
|
sl@0
|
184 |
// Figure out the Uid of the agent
|
sl@0
|
185 |
TUid agentUid = agentInfo.Agent().ImplementationUid();
|
sl@0
|
186 |
|
sl@0
|
187 |
// call internal CData::NewL()
|
sl@0
|
188 |
CData::ConstructL(agentUid, TVirtualPathPtr(*actualUri, aVirtualPath.UniqueId()), aIntent, aShareMode);
|
sl@0
|
189 |
|
sl@0
|
190 |
CleanupStack::PopAndDestroy(2, resolver); // actualUri, resolver
|
sl@0
|
191 |
}
|
sl@0
|
192 |
|
sl@0
|
193 |
void CData::ConstructL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)
|
sl@0
|
194 |
{
|
sl@0
|
195 |
// Create the agent resolver which will contains a reference to
|
sl@0
|
196 |
// the agent responsible for this piece of content
|
sl@0
|
197 |
CAgentResolver* resolver = CAgentResolver::NewLC(EFalse);
|
sl@0
|
198 |
|
sl@0
|
199 |
// Create a temporary buffer used to store the translated version of the URI
|
sl@0
|
200 |
HBufC* actualUri = HBufC::NewLC(aVirtualPath.URI().Length() + KMaxSIDLength);
|
sl@0
|
201 |
TPtr uri = actualUri->Des();
|
sl@0
|
202 |
|
sl@0
|
203 |
// Find the agent who handles the file and translate the URI if it is pointing to a private directory
|
sl@0
|
204 |
CAgentInfo& agentInfo = resolver->ResolveFileL(aVirtualPath.URI(), uri, aShareMode);
|
sl@0
|
205 |
|
sl@0
|
206 |
// Figure out the Uid of the agent
|
sl@0
|
207 |
TUid agentUid = agentInfo.Agent().ImplementationUid();
|
sl@0
|
208 |
|
sl@0
|
209 |
// call internal CData::NewL()
|
sl@0
|
210 |
CData::ConstructL(agentUid, TVirtualPathPtr(*actualUri, aVirtualPath.UniqueId()), aShareMode);
|
sl@0
|
211 |
|
sl@0
|
212 |
CleanupStack::PopAndDestroy(2, resolver); // actualUri, resolver
|
sl@0
|
213 |
}
|
sl@0
|
214 |
|
sl@0
|
215 |
void CData::ConstructL(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent)
|
sl@0
|
216 |
{
|
sl@0
|
217 |
// Find the agent who handles the file
|
sl@0
|
218 |
CAgentResolver* resolver = CAgentResolver::NewLC(EFalse);
|
sl@0
|
219 |
CAgentInfo& agentInfo = resolver->ResolveFileL(aFile);
|
sl@0
|
220 |
|
sl@0
|
221 |
// Figure out the Uid of the agent
|
sl@0
|
222 |
TUid agentUid = agentInfo.Agent().ImplementationUid();
|
sl@0
|
223 |
|
sl@0
|
224 |
// call other constructL now that we have the Uid
|
sl@0
|
225 |
CData::ConstructL(agentUid, aFile, aUniqueId, aIntent);
|
sl@0
|
226 |
|
sl@0
|
227 |
// Cleanup resolver after creating CData to unnecessary
|
sl@0
|
228 |
// unloading and loading of agent plug-ins
|
sl@0
|
229 |
CleanupStack::PopAndDestroy(resolver);
|
sl@0
|
230 |
}
|
sl@0
|
231 |
|
sl@0
|
232 |
void CData::ConstructL(RFile& aFile, const TDesC& aUniqueId)
|
sl@0
|
233 |
{
|
sl@0
|
234 |
// Find the agent who handles the file
|
sl@0
|
235 |
CAgentResolver* resolver = CAgentResolver::NewLC(EFalse);
|
sl@0
|
236 |
CAgentInfo& agentInfo = resolver->ResolveFileL(aFile);
|
sl@0
|
237 |
|
sl@0
|
238 |
// Figure out the Uid of the agent
|
sl@0
|
239 |
TUid agentUid = agentInfo.Agent().ImplementationUid();
|
sl@0
|
240 |
|
sl@0
|
241 |
// call other constructL now that we have the Uid
|
sl@0
|
242 |
CData::ConstructL(agentUid, aFile, aUniqueId);
|
sl@0
|
243 |
|
sl@0
|
244 |
// Cleanup resolver after creating CData to unnecessary
|
sl@0
|
245 |
// unloading and loading of agent plug-ins
|
sl@0
|
246 |
CleanupStack::PopAndDestroy(resolver);
|
sl@0
|
247 |
}
|
sl@0
|
248 |
|
sl@0
|
249 |
void CData::ConstructL(TUid aUid,
|
sl@0
|
250 |
const TVirtualPathPtr& aVirtualPath,
|
sl@0
|
251 |
TIntent aIntent,
|
sl@0
|
252 |
TContentShareMode aShareMode)
|
sl@0
|
253 |
{
|
sl@0
|
254 |
CData::ConstructL(aUid, aVirtualPath, aShareMode);
|
sl@0
|
255 |
|
sl@0
|
256 |
// Ensure that client's intent is possible
|
sl@0
|
257 |
User::LeaveIfError(iAgentData->EvaluateIntent(aIntent));
|
sl@0
|
258 |
}
|
sl@0
|
259 |
|
sl@0
|
260 |
void CData::ConstructL(TUid aUid,
|
sl@0
|
261 |
const TVirtualPathPtr& aVirtualPath,
|
sl@0
|
262 |
TContentShareMode aShareMode)
|
sl@0
|
263 |
{
|
sl@0
|
264 |
iAgentUid = aUid;
|
sl@0
|
265 |
|
sl@0
|
266 |
// create our own agent factory (de-facto session handle for ECOM)
|
sl@0
|
267 |
iAgentFactory = CAgentFactory::NewL(iAgentUid);
|
sl@0
|
268 |
|
sl@0
|
269 |
// Create an instance of the Agent's CAgentData
|
sl@0
|
270 |
iAgentData = iAgentFactory->CreateDataConsumerL(aVirtualPath, aShareMode);
|
sl@0
|
271 |
|
sl@0
|
272 |
}
|
sl@0
|
273 |
|
sl@0
|
274 |
void CData::ConstructL(TUid aUid, RFile& aFile, const TDesC& aUniqueId, TIntent aIntent)
|
sl@0
|
275 |
{
|
sl@0
|
276 |
CData::ConstructL(aUid, aFile, aUniqueId);
|
sl@0
|
277 |
|
sl@0
|
278 |
// Ensure that client's intent is possible
|
sl@0
|
279 |
User::LeaveIfError(iAgentData->EvaluateIntent(aIntent));
|
sl@0
|
280 |
}
|
sl@0
|
281 |
|
sl@0
|
282 |
void CData::ConstructL(TUid aUid, RFile& aFile, const TDesC& aUniqueId)
|
sl@0
|
283 |
{
|
sl@0
|
284 |
iAgentUid = aUid;
|
sl@0
|
285 |
|
sl@0
|
286 |
// create our own agent factory (de-facto session handle for ECOM)
|
sl@0
|
287 |
iAgentFactory = CAgentFactory::NewL(iAgentUid);
|
sl@0
|
288 |
|
sl@0
|
289 |
// Create an instance of the agent's CAgentData
|
sl@0
|
290 |
// The agent must make a duplicate of the file handle
|
sl@0
|
291 |
iAgentData = iAgentFactory->CreateDataConsumerL(aFile, aUniqueId);
|
sl@0
|
292 |
}
|
sl@0
|
293 |
|
sl@0
|
294 |
#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
|
sl@0
|
295 |
|
sl@0
|
296 |
void CData::ConstructL(const TDesC8& aHeaderData)
|
sl@0
|
297 |
{
|
sl@0
|
298 |
// Find the agent who handles the file
|
sl@0
|
299 |
CAgentResolver* resolver = CAgentResolver::NewLC(EFalse);
|
sl@0
|
300 |
CAgentInfo& agentInfo = resolver->ResolveFileL(aHeaderData);
|
sl@0
|
301 |
|
sl@0
|
302 |
// Figure out the Uid of the agent
|
sl@0
|
303 |
TUid agentUid = agentInfo.Agent().ImplementationUid();
|
sl@0
|
304 |
CData::ConstructL(agentUid, aHeaderData);
|
sl@0
|
305 |
|
sl@0
|
306 |
// Cleanup resolver after creating CData to unnecessary
|
sl@0
|
307 |
// unloading and loading of agent plug-ins
|
sl@0
|
308 |
CleanupStack::PopAndDestroy(resolver);
|
sl@0
|
309 |
}
|
sl@0
|
310 |
|
sl@0
|
311 |
void CData::ConstructL(const TDesC8& aHeaderData, TIntent aIntent)
|
sl@0
|
312 |
{
|
sl@0
|
313 |
CData::ConstructL(aHeaderData);
|
sl@0
|
314 |
|
sl@0
|
315 |
// Ensure that client's intent is possible
|
sl@0
|
316 |
User::LeaveIfError(iAgentData->EvaluateIntent(aIntent));
|
sl@0
|
317 |
}
|
sl@0
|
318 |
|
sl@0
|
319 |
void CData::ConstructL(TUid aAgentUid, const TDesC8& aHeaderData)
|
sl@0
|
320 |
{
|
sl@0
|
321 |
iAgentUid = aAgentUid;
|
sl@0
|
322 |
|
sl@0
|
323 |
iAgentFactory = CAgentFactory::NewL(iAgentUid);
|
sl@0
|
324 |
// create an instance of agent's CAgentStreamData.
|
sl@0
|
325 |
iAgentData = iAgentFactory->CreateDataConsumerL(aHeaderData);
|
sl@0
|
326 |
}
|
sl@0
|
327 |
|
sl@0
|
328 |
void CData::ConstructL(TUid aUid, const TDesC8& aHeaderData, TIntent aIntent)
|
sl@0
|
329 |
{
|
sl@0
|
330 |
CData::ConstructL(aUid, aHeaderData);
|
sl@0
|
331 |
|
sl@0
|
332 |
// Ensure that client's intent is possible
|
sl@0
|
333 |
User::LeaveIfError(iAgentData->EvaluateIntent(aIntent));
|
sl@0
|
334 |
}
|
sl@0
|
335 |
|
sl@0
|
336 |
#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
|
sl@0
|
337 |
|
sl@0
|
338 |
EXPORT_C void CData::DataSizeL(TInt& aSize)
|
sl@0
|
339 |
{
|
sl@0
|
340 |
// ask the agent for the data size of the current content object
|
sl@0
|
341 |
iAgentData->DataSizeL(aSize);
|
sl@0
|
342 |
}
|
sl@0
|
343 |
|
sl@0
|
344 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
sl@0
|
345 |
EXPORT_C void CData::DataSize64L(TInt64& aSize)
|
sl@0
|
346 |
{
|
sl@0
|
347 |
// ask the agent for the data size of the current content object
|
sl@0
|
348 |
TRAPD(err, iAgentData->DataSize64L(aSize));
|
sl@0
|
349 |
if(err == KErrCANotSupported)
|
sl@0
|
350 |
{
|
sl@0
|
351 |
//fallback to 32bit API
|
sl@0
|
352 |
TInt size32;
|
sl@0
|
353 |
iAgentData->DataSizeL(size32);
|
sl@0
|
354 |
aSize = size32;
|
sl@0
|
355 |
}
|
sl@0
|
356 |
else
|
sl@0
|
357 |
User::LeaveIfError(err);
|
sl@0
|
358 |
}
|
sl@0
|
359 |
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
sl@0
|
360 |
|
sl@0
|
361 |
EXPORT_C TInt CData::EvaluateIntent(TIntent aIntent)
|
sl@0
|
362 |
{
|
sl@0
|
363 |
// ask the agent to re-evaluate the intent on the current content object
|
sl@0
|
364 |
return iAgentData->EvaluateIntent(aIntent);
|
sl@0
|
365 |
}
|
sl@0
|
366 |
|
sl@0
|
367 |
EXPORT_C TInt CData::ExecuteIntent(TIntent aIntent)
|
sl@0
|
368 |
{
|
sl@0
|
369 |
// ask the agent to re-evaluate the intent on the current content object
|
sl@0
|
370 |
return iAgentData->ExecuteIntent(aIntent);
|
sl@0
|
371 |
}
|
sl@0
|
372 |
|
sl@0
|
373 |
EXPORT_C TInt CData::Read(TDes8& aDes) const
|
sl@0
|
374 |
{
|
sl@0
|
375 |
// ask the agent to read plaintext from the content object
|
sl@0
|
376 |
return iAgentData->Read(aDes);
|
sl@0
|
377 |
}
|
sl@0
|
378 |
|
sl@0
|
379 |
EXPORT_C TInt CData::Read(TDes8& aDes, TInt aLength) const
|
sl@0
|
380 |
{
|
sl@0
|
381 |
// ask the agent to read plaintext from the content object
|
sl@0
|
382 |
return iAgentData->Read(aDes, aLength);
|
sl@0
|
383 |
}
|
sl@0
|
384 |
|
sl@0
|
385 |
EXPORT_C void CData::Read(TDes8& aDes,
|
sl@0
|
386 |
TRequestStatus& aStatus) const
|
sl@0
|
387 |
{
|
sl@0
|
388 |
// ask the agent to read plaintext from the content object
|
sl@0
|
389 |
iAgentData->Read(aDes, aStatus);
|
sl@0
|
390 |
}
|
sl@0
|
391 |
|
sl@0
|
392 |
EXPORT_C void CData::Read(TDes8& aDes,
|
sl@0
|
393 |
TInt aLength,
|
sl@0
|
394 |
TRequestStatus& aStatus) const
|
sl@0
|
395 |
{
|
sl@0
|
396 |
// ask the agent to read plaintext from the content object
|
sl@0
|
397 |
iAgentData->Read(aDes, aLength, aStatus);
|
sl@0
|
398 |
}
|
sl@0
|
399 |
|
sl@0
|
400 |
EXPORT_C void CData::ReadCancel(TRequestStatus &aStatus) const
|
sl@0
|
401 |
{
|
sl@0
|
402 |
iAgentData->ReadCancel(aStatus);
|
sl@0
|
403 |
}
|
sl@0
|
404 |
|
sl@0
|
405 |
#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
|
sl@0
|
406 |
|
sl@0
|
407 |
EXPORT_C TInt CData::Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputPacket) const
|
sl@0
|
408 |
{
|
sl@0
|
409 |
return iAgentData->Read(aEncryptedInputDataPacket, aDecryptedOutputPacket);
|
sl@0
|
410 |
}
|
sl@0
|
411 |
|
sl@0
|
412 |
EXPORT_C void CData::Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputPacket, TRequestStatus& aStatus) const
|
sl@0
|
413 |
{
|
sl@0
|
414 |
iAgentData->Read(aEncryptedInputDataPacket, aDecryptedOutputPacket, aStatus);
|
sl@0
|
415 |
}
|
sl@0
|
416 |
|
sl@0
|
417 |
#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
|
sl@0
|
418 |
|
sl@0
|
419 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
sl@0
|
420 |
EXPORT_C TInt CData::Read_Unused(TInt aPos, TDes8& aDes,
|
sl@0
|
421 |
TInt aLength, TRequestStatus& aStatus) const
|
sl@0
|
422 |
#else
|
sl@0
|
423 |
EXPORT_C TInt CData::Read(TInt aPos, TDes8& aDes,
|
sl@0
|
424 |
TInt aLength, TRequestStatus& aStatus) const
|
sl@0
|
425 |
#endif
|
sl@0
|
426 |
{
|
sl@0
|
427 |
// ask the agent to read plaintext from the content object
|
sl@0
|
428 |
if(aPos<0)
|
sl@0
|
429 |
return KErrArgument;
|
sl@0
|
430 |
return iAgentData->Read(aPos, aDes, aLength, aStatus);
|
sl@0
|
431 |
}
|
sl@0
|
432 |
|
sl@0
|
433 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
sl@0
|
434 |
EXPORT_C TInt CData::Read(TInt64 aPos, TDes8& aDes,
|
sl@0
|
435 |
TInt aLength, TRequestStatus& aStatus) const
|
sl@0
|
436 |
{
|
sl@0
|
437 |
// If agent does not support 64bit Read, a fallback to 32bit Read is provided automatically
|
sl@0
|
438 |
// The above API method signature allows error codes to be returned
|
sl@0
|
439 |
// via two different routes (return code & aStatus). Should the async request
|
sl@0
|
440 |
// dispatch fail then an error code is returned immediately via the
|
sl@0
|
441 |
// aStatus parameter rather than via the return code of the function.
|
sl@0
|
442 |
|
sl@0
|
443 |
// NOTE: it is not generally not recommended for functions to be able to return
|
sl@0
|
444 |
// error codes in two different ways as this places a bigger error-checking
|
sl@0
|
445 |
// burden on clients.
|
sl@0
|
446 |
if(aPos<0)
|
sl@0
|
447 |
return KErrArgument;
|
sl@0
|
448 |
|
sl@0
|
449 |
TInt rval = iAgentData->Read64(aPos, aDes, aLength, aStatus);
|
sl@0
|
450 |
return (rval == KErrCANotSupported? iAgentData->Read((TInt)aPos, aDes, aLength, aStatus) : rval );
|
sl@0
|
451 |
}
|
sl@0
|
452 |
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
sl@0
|
453 |
|
sl@0
|
454 |
EXPORT_C TInt CData::Seek(TSeek aMode,TInt& aPos) const
|
sl@0
|
455 |
{
|
sl@0
|
456 |
// ask the agent to seek witin the plaintext
|
sl@0
|
457 |
return iAgentData->Seek(aMode, aPos);
|
sl@0
|
458 |
}
|
sl@0
|
459 |
|
sl@0
|
460 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
sl@0
|
461 |
EXPORT_C TInt CData::Seek64(TSeek aMode,TInt64& aPos) const
|
sl@0
|
462 |
{
|
sl@0
|
463 |
// ask the agent to seek witin the plaintext
|
sl@0
|
464 |
TInt rval64 = iAgentData->Seek64(aMode, aPos);
|
sl@0
|
465 |
if(rval64 == KErrCANotSupported)
|
sl@0
|
466 |
{
|
sl@0
|
467 |
//fallback to 32bit API
|
sl@0
|
468 |
TInt pos32 = I64INT(aPos);
|
sl@0
|
469 |
TInt rval32 = iAgentData->Seek(aMode, pos32);
|
sl@0
|
470 |
aPos = pos32;
|
sl@0
|
471 |
return rval32;
|
sl@0
|
472 |
}
|
sl@0
|
473 |
return rval64;
|
sl@0
|
474 |
}
|
sl@0
|
475 |
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
sl@0
|
476 |
|
sl@0
|
477 |
EXPORT_C TInt CData::SetProperty(TAgentProperty aProperty, TInt aValue)
|
sl@0
|
478 |
{
|
sl@0
|
479 |
// Set a property within the agent
|
sl@0
|
480 |
return iAgentData->SetProperty(aProperty, aValue);
|
sl@0
|
481 |
}
|
sl@0
|
482 |
|
sl@0
|
483 |
EXPORT_C TInt CData::GetAttribute(TInt aAttribute, TInt& aValue) const
|
sl@0
|
484 |
{
|
sl@0
|
485 |
// Get an attribute related to this content object
|
sl@0
|
486 |
return iAgentData->GetAttribute(aAttribute, aValue);
|
sl@0
|
487 |
}
|
sl@0
|
488 |
|
sl@0
|
489 |
EXPORT_C TInt CData::GetAttributeSet(RAttributeSet& aAttributeSet) const
|
sl@0
|
490 |
{
|
sl@0
|
491 |
// Get a set of attributes related to this content object
|
sl@0
|
492 |
return iAgentData->GetAttributeSet(aAttributeSet);
|
sl@0
|
493 |
}
|
sl@0
|
494 |
|
sl@0
|
495 |
EXPORT_C TInt CData::GetStringAttribute(TInt aAttribute, TDes& aValue) const
|
sl@0
|
496 |
{
|
sl@0
|
497 |
// Get a string attribute related to this content object
|
sl@0
|
498 |
return iAgentData->GetStringAttribute(aAttribute, aValue);
|
sl@0
|
499 |
}
|
sl@0
|
500 |
|
sl@0
|
501 |
EXPORT_C TInt CData::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet) const
|
sl@0
|
502 |
{
|
sl@0
|
503 |
// Get a set of string attributes related to this content object
|
sl@0
|
504 |
return iAgentData->GetStringAttributeSet(aStringAttributeSet);
|
sl@0
|
505 |
}
|
sl@0
|
506 |
|
sl@0
|
507 |
#ifndef REMOVE_CAF1
|
sl@0
|
508 |
EXPORT_C void CData::SetQosL(TQosAttribute aQosAttr, TInt aValue)
|
sl@0
|
509 |
{
|
sl@0
|
510 |
if(aQosAttr == EQosBufferSize)
|
sl@0
|
511 |
{
|
sl@0
|
512 |
User::LeaveIfError(iAgentData->SetProperty(EAgentPropertyBufferSize, aValue));
|
sl@0
|
513 |
}
|
sl@0
|
514 |
}
|
sl@0
|
515 |
|
sl@0
|
516 |
EXPORT_C TBool CData::GetMimeTypeL(TDes8& aMimeType) const
|
sl@0
|
517 |
{
|
sl@0
|
518 |
TBuf16 <KMaxDataTypeLength> mimeType;
|
sl@0
|
519 |
TInt err = KErrNone;
|
sl@0
|
520 |
if(iAgentUid != KF32AgentImplUid)
|
sl@0
|
521 |
{
|
sl@0
|
522 |
err = iAgentData->GetStringAttribute(EMimeType, mimeType);
|
sl@0
|
523 |
if(err == KErrNone && mimeType.Length() != 0)
|
sl@0
|
524 |
{
|
sl@0
|
525 |
aMimeType.Copy(mimeType);
|
sl@0
|
526 |
return ETrue;
|
sl@0
|
527 |
}
|
sl@0
|
528 |
}
|
sl@0
|
529 |
return EFalse;
|
sl@0
|
530 |
}
|
sl@0
|
531 |
#endif // REMOVE_CAF1
|