|
1 /* |
|
2 * ============================================================================== |
|
3 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Initial Contributors: |
|
11 * Nokia Corporation - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 * ============================================================================== |
|
18 */ |
|
19 |
|
20 #ifndef ADDBUFFER_H_ |
|
21 #define ADDBUFFER_H_ |
|
22 |
|
23 TInt const KMaxFieldLength = 128; |
|
24 |
|
25 /** |
|
26 * CConnMoNodeElement is array element for ConnMo node objects. |
|
27 */ |
|
28 class CConnMoNodeElement : public CBase |
|
29 { |
|
30 public: |
|
31 CConnMoNodeElement(); |
|
32 ~CConnMoNodeElement(); |
|
33 |
|
34 /** Node address */ |
|
35 TBuf8<KMaxFieldLength> iUri; |
|
36 /** Unique identifier of the parent node */ |
|
37 TBuf8<KMaxFieldLength> iParentLUID; |
|
38 /** Leaf object's data */ |
|
39 TBuf8<KMaxFieldLength> iObject; |
|
40 /** Refenrence for giving commands return value to framework */ |
|
41 TInt iStatusRef; |
|
42 /** Information whether adapter has processed the node or not */ |
|
43 TBool iProcessed; |
|
44 /** Specifies if the node leaf or not */ |
|
45 TBool iLeaf; |
|
46 private: |
|
47 }; |
|
48 |
|
49 /** |
|
50 * CAddBuffer is array for ConnMo nodes to be added in . |
|
51 * |
|
52 * CConnMoAdapter uses this class to buffer node and leaf data |
|
53 * addition DM commands. |
|
54 */ |
|
55 class CAddBuffer : public CBase |
|
56 { |
|
57 public: |
|
58 |
|
59 /** |
|
60 * Creates new instance of CAddBuffer |
|
61 */ |
|
62 static CAddBuffer* NewL(); |
|
63 |
|
64 /** |
|
65 * Adds node to buffer |
|
66 * |
|
67 * @param aUri target node URI |
|
68 * @param aParentLUID refrence to parent node |
|
69 * @param aStatusRef Status reference |
|
70 */ |
|
71 void AddNodeToBufferL( const TDesC8& aUri, |
|
72 const TDesC8& aParentLUID, |
|
73 const TInt aStatusRef ); |
|
74 |
|
75 /** |
|
76 * Adds leaf node to buffer |
|
77 * |
|
78 * @param aUri target node URI |
|
79 * @param aParentLUID refrence to parent node |
|
80 * @param aObject Leaf object data |
|
81 * @param aStatusRef Status reference |
|
82 */ |
|
83 void AddNodeToBufferL( const TDesC8& aUri, |
|
84 const TDesC8& aLUID, |
|
85 const TDesC8& aObject, |
|
86 const TInt aStatusRef ); |
|
87 |
|
88 /** |
|
89 * Searches buffer for given dynamic node |
|
90 * |
|
91 * @param aUri target node URI |
|
92 */ |
|
93 CConnMoNodeElement* FindDynamicNode( const TDesC8& aUri ); |
|
94 |
|
95 /** |
|
96 * Gets all unprocessed nodes associated to given root node |
|
97 * |
|
98 * Function searches buffer for all unprocessed nodes that |
|
99 * belong to given group and are under same dynamic node |
|
100 * |
|
101 * @param aRoot target group |
|
102 * @param aGroup Array for result nodes |
|
103 */ |
|
104 TInt GetGroup( const TDesC8& aRoot, RPointerArray<CConnMoNodeElement>* aGroup ); |
|
105 |
|
106 /** |
|
107 * Searches buffer for givennode |
|
108 * |
|
109 * @param aUri target node URI |
|
110 */ |
|
111 CConnMoNodeElement* CacheFind( const TDesC8& aUri ); |
|
112 |
|
113 /** |
|
114 * Searches buffer for given dynamic node |
|
115 * |
|
116 * @param aUri target node URI |
|
117 */ |
|
118 CConnMoNodeElement* CacheFindDynamicNode( const TDesC8& aUri ); |
|
119 |
|
120 /** |
|
121 * Empties buffer and frees all allocated memory |
|
122 */ |
|
123 void Reset(); |
|
124 |
|
125 virtual ~CAddBuffer(); |
|
126 |
|
127 private: |
|
128 |
|
129 //----------------------------------------------------------------------------- |
|
130 // Private functions |
|
131 //----------------------------------------------------------------------------- |
|
132 void ConstructL(); |
|
133 CAddBuffer(); |
|
134 |
|
135 //----------------------------------------------------------------------------- |
|
136 // Private member variables |
|
137 //----------------------------------------------------------------------------- |
|
138 /** Contains all nodes to be added */ |
|
139 RPointerArray<CConnMoNodeElement> iBuffer; |
|
140 /** Contains group of nodes that user has previously asked */ |
|
141 RPointerArray<CConnMoNodeElement> iCache; |
|
142 |
|
143 }; |
|
144 |
|
145 #endif /* ADDBUFFER_H_ */ |