|
1 /* |
|
2 * Copyright (c) 2003-2009 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 the License "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: |
|
15 * testagentconsumer.h |
|
16 * Test agent implementation of the CAgentConsumer class |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef __TESTAGENTDATA_H__ |
|
24 #define __TESTAGENTDATA_H__ |
|
25 |
|
26 #include <caf/caf.h> |
|
27 #include "agentinterface.h" |
|
28 #include "TestAgentFileInterface.h" |
|
29 |
|
30 class CTestAgentData : public ContentAccess::CAgentData |
|
31 { |
|
32 public: |
|
33 static CTestAgentData* NewL(const ContentAccess::TVirtualPathPtr& aVirtualPath, ContentAccess::TContentShareMode aShareMode); |
|
34 static CTestAgentData* NewLC(const ContentAccess::TVirtualPathPtr& aVirtualPath, ContentAccess::TContentShareMode aShareMode); |
|
35 |
|
36 static CTestAgentData* NewL(RFile& aFile, const TDesC& aUniqueId); |
|
37 static CTestAgentData* NewLC(RFile& aFile, const TDesC& aUniqueId); |
|
38 |
|
39 virtual ~CTestAgentData(); |
|
40 |
|
41 public: // From CAgentConsumer |
|
42 virtual TInt Read(TDes8& aDes); |
|
43 virtual TInt Read(TDes8& aDes,TInt aLength); |
|
44 virtual void Read(TDes8& aDes, TRequestStatus& aStatus); |
|
45 virtual void Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus); |
|
46 virtual void ReadCancel(TRequestStatus& aStatus); |
|
47 virtual void DataSizeL(TInt& aSize); |
|
48 virtual TInt Seek(TSeek aMode,TInt& aPos); |
|
49 virtual TInt SetProperty(ContentAccess::TAgentProperty aProperty, TInt aValue); |
|
50 virtual TInt EvaluateIntent(ContentAccess::TIntent aIntent); |
|
51 virtual TInt ExecuteIntent(ContentAccess::TIntent aIntent); |
|
52 virtual TInt GetAttribute(TInt aAttribute, TInt& aValue); |
|
53 virtual TInt GetAttributeSet(ContentAccess::RAttributeSet& aAttributeSet); |
|
54 virtual TInt GetStringAttribute(TInt aAttribute, TDes& aValue); |
|
55 virtual TInt GetStringAttributeSet(ContentAccess::RStringAttributeSet& aStringAttributeSet); |
|
56 virtual TInt Read(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus); |
|
57 |
|
58 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
59 virtual void DataSize64L(TInt64 &aSize); |
|
60 virtual TInt Seek64(TSeek aMode, TInt64& aPos); |
|
61 virtual TInt Read64(TInt64 aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus); |
|
62 #endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
63 |
|
64 private: |
|
65 CTestAgentData(); |
|
66 void ConstructL(const ContentAccess::TVirtualPathPtr& aVirtualPath, ContentAccess::TContentShareMode aShareMode); |
|
67 void ConstructL(RFile& aFile, const TDesC& aUniqueId); |
|
68 |
|
69 private: |
|
70 /* Calculate Data Size and Data offset */ |
|
71 void CalculateDataSizeAndOffsetL(); |
|
72 |
|
73 /* Format of a TUintvar is defined by the Open Mobile alliance in |
|
74 * Wireless Session Protocol OMA-WAP-WSP-v1_0-20020920-C |
|
75 * @param aBuffer [in] buffer containing a TUintvar |
|
76 * @param Offset [in] location of the first byte of the TUintvar within the buffer |
|
77 * @param aNumBytes [out] number of bytes read from the buffer to decode the the TUintvar |
|
78 * @return the value of the TUnitvar |
|
79 */ |
|
80 TInt ReadTUintvarL(TDes8& aBuffer, TInt Offset, TInt& aNumBytes) const; |
|
81 |
|
82 // encapsulates and parses a DCF file |
|
83 CTestAgentFileInterface *iTestFileObject; |
|
84 |
|
85 // File session used when checking attributes |
|
86 RFs iFs; |
|
87 // File handle |
|
88 RFile iFile; |
|
89 |
|
90 ContentAccess::CVirtualPath *iVirtualPath; |
|
91 }; |
|
92 |
|
93 #endif // __TESTAGENTCONSUMER_H__ |