1 /* |
|
2 * Copyright (c) 2009-2010 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: |
|
15 * Session side object representing a connection method. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CMMCONNMETHODINSTANCE_H_ |
|
21 #define CMMCONNMETHODINSTANCE_H_ |
|
22 |
|
23 #include <e32base.h> |
|
24 |
|
25 #include "cmmserverdefs.h" |
|
26 |
|
27 class CCmmSession; |
|
28 class CCmmCache; |
|
29 class CCmPluginBaseEng; |
|
30 class CCmClientPluginInstance; |
|
31 class CCmmConnMethodStruct; |
|
32 class TCmmIdStruct; |
|
33 |
|
34 |
|
35 /** |
|
36 * Session side object representing a connection method. Keeps track of any |
|
37 * changes the client makes before they are updated to database. |
|
38 */ |
|
39 NONSHARABLE_CLASS( CCmmConnMethodInstance ) : public CObject |
|
40 { |
|
41 public: |
|
42 /** |
|
43 * NewL. |
|
44 */ |
|
45 static CCmmConnMethodInstance* NewL( CCmmSession* aCmmSession, CCmmCache* aCache ); |
|
46 |
|
47 /** |
|
48 * NewLC. |
|
49 */ |
|
50 static CCmmConnMethodInstance* NewLC( CCmmSession* aCmmSession, CCmmCache* aCache ); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 ~CCmmConnMethodInstance(); |
|
56 |
|
57 private: |
|
58 /** |
|
59 * Constructor. |
|
60 * |
|
61 * @param aCache database cache. |
|
62 */ |
|
63 CCmmConnMethodInstance( CCmmSession* aCmmSession, CCmmCache* aCache ); |
|
64 |
|
65 /** |
|
66 * Second phase constructor. |
|
67 */ |
|
68 void ConstructL(); |
|
69 |
|
70 public: |
|
71 /** |
|
72 * Get connection method ID. |
|
73 */ |
|
74 TUint32 GetId() const; |
|
75 |
|
76 /** |
|
77 * Set connection method ID. |
|
78 */ |
|
79 void SetId( const TUint32 aConnMethodId ); |
|
80 |
|
81 /** |
|
82 * Return bearer type. |
|
83 */ |
|
84 TUint32 GetBearerType() const; |
|
85 |
|
86 /** |
|
87 * Get handle ID. |
|
88 */ |
|
89 TInt GetHandle() const; |
|
90 |
|
91 /** |
|
92 * Set handle ID. |
|
93 */ |
|
94 void SetHandle( const TInt aHandle ); |
|
95 |
|
96 /** |
|
97 * Get pointer to the plugin data container. |
|
98 */ |
|
99 CCmClientPluginInstance* GetPluginDataInstance() const; |
|
100 |
|
101 /** |
|
102 * Return ETrue, if this connection method represents an embedded destination. |
|
103 */ |
|
104 TBool IsEmbeddedDestination() const; |
|
105 |
|
106 /** |
|
107 * Save the contents of this connection method into database. The attribute |
|
108 * aTemporaryHandle must be true if this connection instance was |
|
109 * temporarily created for the duration of this update operation only. |
|
110 */ |
|
111 void UpdateL( TBool aTemporaryHandle = EFalse ); |
|
112 |
|
113 /** |
|
114 * Copy the relevant connection method information from cache side object. |
|
115 */ |
|
116 void CopyDataL( CCmmConnMethodStruct* aConnMethodStruct ); |
|
117 |
|
118 /** |
|
119 * Returns integer value identified by aAttribute. Some special cases |
|
120 * are handled in this module and the rest in plugin. |
|
121 * @param aAttribute Parameter which specifies the requested attribute. |
|
122 * @return Returns the value of the requested attribute if succees. Otherwise |
|
123 * leaves with KErrArgument |
|
124 */ |
|
125 TUint32 GetIntAttributeL( const TUint32 aAttribute ); |
|
126 |
|
127 /** |
|
128 * Returns integer value identified by aAttribute. Some special cases |
|
129 * are handled in this module and the rest in plugin. |
|
130 * @param aAttribute Parameter which specifies the requested attribute. |
|
131 * @return Returns the value of the requested attribute if succees. Otherwise |
|
132 * leaves with KErrArgument |
|
133 */ |
|
134 TBool GetBoolAttributeL( const TUint32 aAttribute ); |
|
135 |
|
136 /** |
|
137 * Returns 16 bit string value identified by aAttribute. |
|
138 * @param aAttribute Parameter which specifies the requested attribute. |
|
139 * @return Returns the value of the requested attribute if succees. Otherwise |
|
140 * leaves with KErrArgument |
|
141 */ |
|
142 HBufC* GetStringAttributeL( const TUint32 aAttribute ); |
|
143 |
|
144 /** |
|
145 * Returns 8 bit string value identified by aAttribute. |
|
146 * @param aAttribute Parameter which specifies the requested attribute. |
|
147 * @return Returns the value of the requested attribute if succees. Otherwise |
|
148 * leaves with KErrArgument |
|
149 */ |
|
150 HBufC8* GetString8AttributeL( const TUint32 aAttribute ); |
|
151 |
|
152 /** |
|
153 * Sets the integer value identified by aAttribute. |
|
154 * @param aAttribute Identifies the attribute to be set. |
|
155 * @param aValue The value to be set. |
|
156 * @return None |
|
157 */ |
|
158 void SetIntAttributeL( |
|
159 const TUint32 aAttribute, |
|
160 const TUint32 aValue ); |
|
161 |
|
162 /** |
|
163 * Sets the integer value identified by aAttribute. |
|
164 * @param aAttribute Identifies the attribute to be set. |
|
165 * @param aValue The value to be set. |
|
166 * @return None |
|
167 */ |
|
168 void SetBoolAttributeL( |
|
169 const TUint32 aAttribute, |
|
170 const TBool aValue ); |
|
171 |
|
172 /** |
|
173 * Sets the 16 bit string value identified by aAttribute. |
|
174 * @param aAttribute Identifies the attribute to be set. |
|
175 * @param aValue The value to be set. |
|
176 * @return None |
|
177 */ |
|
178 void SetStringAttributeL( |
|
179 const TUint32 aAttribute, |
|
180 const TDesC16& aValue ); |
|
181 |
|
182 /** |
|
183 * Sets the 8 bit string value identified by aAttribute. |
|
184 * @param aAttribute Identifies the attribute to be set. |
|
185 * @param aValue The value to be set. |
|
186 * @return None |
|
187 */ |
|
188 void SetString8AttributeL( |
|
189 const TUint32 aAttribute, |
|
190 const TDesC8& aValue ); |
|
191 |
|
192 /** |
|
193 * Gets the current status value. |
|
194 */ |
|
195 TCmmConnMethodStatus GetStatus() const; |
|
196 |
|
197 /** |
|
198 * Sets a new status value. |
|
199 */ |
|
200 void SetStatus( const TCmmConnMethodStatus aStatus ); |
|
201 |
|
202 /* |
|
203 * Called after this connection method has been updated and database |
|
204 * transaction has completed successfully. Sets the internal state of this |
|
205 * connection method instance to reflect the new valid state. |
|
206 */ |
|
207 void UpdateSuccessful(); |
|
208 |
|
209 /** |
|
210 * Called after this connection method has been deleted and database |
|
211 * transaction has completed successfully. Sets the internal state of this |
|
212 * connection method structure to reflect the new deleted state. |
|
213 */ |
|
214 void DeleteSuccessful( const TUint32 aNewSecondaryId ); |
|
215 |
|
216 /** |
|
217 * After update/delete to database, refresh temporary ID to real ID if |
|
218 * necessary and refresh status information for any related handles for |
|
219 * all client sessions. |
|
220 */ |
|
221 void RefreshHandlesForAllSessions( const TCmmIdStruct& aIdStruct ); |
|
222 |
|
223 /** |
|
224 * Removes a connection method from any open destination handle in the same |
|
225 * session. |
|
226 */ |
|
227 void RemoveConnMethodFromSessionDestinationHandles( const TUint32 aConnMethodId ); |
|
228 |
|
229 private: |
|
230 // Session that owns this instance. |
|
231 CCmmSession* iCmmSession; // Not owned. |
|
232 |
|
233 // Database cache. |
|
234 CCmmCache* iCache; // Not owned. |
|
235 |
|
236 // Pointer to original bearer plugin owned by cache. |
|
237 CCmPluginBaseEng* iPlugin; // Not owned. |
|
238 |
|
239 // Object to contain the data of this connection method instance. |
|
240 CCmClientPluginInstance* iPluginDataInstance; // Owned. |
|
241 |
|
242 // Connection method ID. |
|
243 TUint32 iConnMethodId; |
|
244 |
|
245 // Connection method bearer type. |
|
246 TUint32 iBearerType; |
|
247 |
|
248 // Connection method handle status. |
|
249 TCmmConnMethodStatus iStatus; |
|
250 |
|
251 // Current status of the loaded commsdat records of this connection method. |
|
252 TCmmRecordStatus iRecordStatus; |
|
253 |
|
254 // Subsession handle ID. |
|
255 TInt iHandle; |
|
256 }; |
|
257 |
|
258 #endif // CMMCONNMETHODINSTANCE_H_ |
|
259 |
|
260 // End of file |
|