|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Implementation of customization components |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __TESTDMCALLBACK_H |
|
21 #define __TESTDMCALLBACK_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <smldmadapter.h> |
|
25 #include <badesca.h> |
|
26 |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CStifLogger; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * ?one_line_short_description. |
|
35 * ?other_description_lines |
|
36 * |
|
37 * @lib ?library |
|
38 * @since Series ?XX ?SeriesXX_version |
|
39 */ |
|
40 class CTestDmCallback : public CBase, public MSmlDmCallback |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 */ |
|
47 static CTestDmCallback* NewL( CStifLogger *aLog ); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 virtual ~CTestDmCallback(); |
|
53 |
|
54 public: // New functions |
|
55 |
|
56 /** |
|
57 * ?member_description. |
|
58 * @since Series ?XX ?SeriesXX_version |
|
59 * @param ?arg1 ?description |
|
60 * @return ?description |
|
61 */ |
|
62 //?type ?member_function( ?type ?arg1 ); |
|
63 |
|
64 TPtrC8 GetLuidL( const TDesC8& aURI ); |
|
65 TInt FindMappingURI( const TDesC8& aURI ); |
|
66 TInt GetNewResultsRefL( ); |
|
67 TInt GetNewStatusRefL( ); |
|
68 CBufBase& GetResultsObjectL( TInt aResultsRef ); |
|
69 TPtrC8 GetResultsTypeL( TInt aResultsRef ); |
|
70 MSmlDmAdapter::TError GetStatusL( TInt aStatusRef ); |
|
71 void FreeResultsRefsL( ); |
|
72 void FreeStatusRefsL( ); |
|
73 |
|
74 public: // Functions from base classes |
|
75 |
|
76 public: |
|
77 /** |
|
78 The function is used to return the data in case of FetchLeafObjectL(), |
|
79 FetchLeafObjectSizeL() and ChildURIListL() functions. It should not be |
|
80 called where the DM command has failed, i.e. the error code returned in |
|
81 SetStatusL is something other than EOk. |
|
82 @param aResultsRef Reference to correct command |
|
83 @param aObject The data which should be returned |
|
84 @param aType MIME type of the object |
|
85 @publishedPartner |
|
86 @prototype |
|
87 */ |
|
88 void SetResultsL( TInt aResultsRef, CBufBase& aObject, |
|
89 const TDesC8& aType ); |
|
90 |
|
91 /** |
|
92 The function is used to return the data in case of FetchLeafObjectL() and |
|
93 ChildURIListL() functions, where the size of the data being returned is |
|
94 large enough for the Adapter to stream it. This function should not be |
|
95 called when command was failed, i.e. the error code returned in SetStatusL |
|
96 is something other than EOk. |
|
97 @param aResultsRef Reference to correct command |
|
98 @param aStream Large data which should be returned, DM engine |
|
99 closes stream when it has read all the data |
|
100 @param aType MIME type of the object |
|
101 @publishedPartner |
|
102 @prototype |
|
103 */ |
|
104 void SetResultsL( TInt /*aResultsRef*/, RReadStream*& /*aStream*/, |
|
105 const TDesC8& /*aType*/ ) |
|
106 { |
|
107 |
|
108 } |
|
109 |
|
110 /** |
|
111 The function returns information about the Add,Update,Delete and Fetch |
|
112 commands success to DM engine. The reference to correct command must be |
|
113 used when calling the SetStatusL function, the reference is got from the |
|
114 argument of the command functions. The SetStatusL function must be called |
|
115 separately for every single command. |
|
116 @param aStatusRef Reference to correct command |
|
117 @param aErrorCode Information about the command success |
|
118 @publishedPartner |
|
119 @prototype |
|
120 */ |
|
121 void SetStatusL( TInt aStatusRef, |
|
122 MSmlDmAdapter::TError aErrorCode ) ; |
|
123 |
|
124 /** |
|
125 The function passes map information to DM Module. This function is called |
|
126 for a new management object, both for node objects and for leaf objects. |
|
127 In addition if ChildURIListL() function has returned new objects a mapping |
|
128 information of the new objects must be passed. A mapping is treated as |
|
129 inheritable. If the mapping is not set with this function, the mapping |
|
130 LUID of the parent object is passed in following commands to the object. |
|
131 @param aURI URI of the object. |
|
132 @param aLUID LUID of the object. LUID must contain the all information, |
|
133 which is needed for retrieve the invidual object from the |
|
134 database. Typically it is ID for the database table. In |
|
135 more complicated structures it can be combination of IDs, |
|
136 which represent path to the object. |
|
137 @publishedPartner |
|
138 @prototype |
|
139 */ |
|
140 void SetMappingL( const TDesC8& aURI, const TDesC8& aLUID ); |
|
141 |
|
142 /** |
|
143 The function is used to make a fetch to other adapters. The most common |
|
144 use is to make a fetch to the AP adapter, because when managing the access |
|
145 points, the data comes as URI. For example, there are ToNAPId field in |
|
146 some adapters, and data to it can be something like AP/IAPidx, and then |
|
147 the link to AP adapter is needed. |
|
148 Using FetchLinkL causes the DM Framework to make a Get request to the |
|
149 appropriate DM adapter. The receiving adapter MUST complete the Get |
|
150 request synchronously. |
|
151 @param aURI URI of the object. |
|
152 @param aData Reference to data, i.e. data is returned here |
|
153 @param aStatus The status of fetch command is returned here |
|
154 @publishedPartner |
|
155 @prototype |
|
156 */ |
|
157 void FetchLinkL( const TDesC8& /*aURI*/, CBufBase& /*aData*/, |
|
158 MSmlDmAdapter::TError& /*aStatus*/ ) |
|
159 { |
|
160 |
|
161 } |
|
162 |
|
163 /** |
|
164 The function returns the LUID which is mapped to aURI. If LUID is not |
|
165 found, the function allocates a null length string, i.e. the function |
|
166 allocates memory in every case. |
|
167 @param aURI URI of the object. |
|
168 @publishedPartner |
|
169 @prototype |
|
170 */ |
|
171 HBufC8* GetLuidAllocL( const TDesC8& aURI ) ; |
|
172 |
|
173 protected: // New functions |
|
174 |
|
175 /** |
|
176 * ?member_description. |
|
177 * @since Series ?XX ?SeriesXX_version |
|
178 * @param ?arg1 ?description |
|
179 * @return ?description |
|
180 */ |
|
181 //?type ?member_function( ?type ?arg1 ); |
|
182 |
|
183 protected: // Functions from base classes |
|
184 |
|
185 /** |
|
186 * From ?base_class ?member_description |
|
187 */ |
|
188 //?type ?member_function(); |
|
189 |
|
190 private: |
|
191 |
|
192 /** |
|
193 * C++ default constructor. |
|
194 */ |
|
195 CTestDmCallback( CStifLogger *aLog ); |
|
196 |
|
197 /** |
|
198 * By default Symbian 2nd phase constructor is private. |
|
199 */ |
|
200 void ConstructL(); |
|
201 |
|
202 // Prohibit copy constructor if not deriving from CBase. |
|
203 // CTestDmCallback( const CTestDmCallback& ); |
|
204 // Prohibit assigment operator if not deriving from CBase. |
|
205 // CTestDmCallback& operator=( const CTestDmCallback& ); |
|
206 |
|
207 public: // Data |
|
208 // ?one_line_short_description_of_data |
|
209 //?data_declaration; |
|
210 |
|
211 protected: // Data |
|
212 // ?one_line_short_description_of_data |
|
213 //?data_declaration; |
|
214 |
|
215 private: // Data |
|
216 // ?one_line_short_description_of_data |
|
217 //?data_declaration; |
|
218 /** |
|
219 * Logger. |
|
220 */ |
|
221 CStifLogger* iLog; |
|
222 |
|
223 /* Containers for URI/LUID mapping */ |
|
224 |
|
225 CDesC8ArrayFlat iMappingURI; |
|
226 CDesC8ArrayFlat iMappingLuid; |
|
227 |
|
228 /* Containers for results */ |
|
229 RPointerArray<CBufBase> iResultObjects; |
|
230 CDesC8ArrayFlat iResultTypes; |
|
231 |
|
232 /* Container for status */ |
|
233 RArray<TInt> iStatusArray; |
|
234 //sf- RArray<MSmlDmAdapter::TError> iStatusArray; |
|
235 |
|
236 |
|
237 // Reserved pointer for future extension |
|
238 //TAny* iReserved; |
|
239 |
|
240 public: // Friend classes |
|
241 //?friend_class_declaration; |
|
242 protected: // Friend classes |
|
243 //?friend_class_declaration; |
|
244 private: // Friend classes |
|
245 //?friend_class_declaration; |
|
246 }; |
|
247 |
|
248 #endif // __TESTDMCALLBACK_H |
|
249 |
|
250 // End of File |