|
1 /* |
|
2 * Copyright (c) 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 "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: DCMO Server |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __DCMO_SERVER_H__ |
|
19 #define __DCMO_SERVER_H__ |
|
20 |
|
21 // INCLUDES |
|
22 |
|
23 #include <e32base.h> |
|
24 #include "dcmoclientserver.h" |
|
25 #include "dcmoconst.h" |
|
26 #include "dcmonotifieraob.h" |
|
27 |
|
28 // CONSTANTS |
|
29 const TUid KCRUidDCMOServer={0x2001FE47}; |
|
30 const TInt KDCMOKeyMaxNumber = 16; |
|
31 // FORWARD DECLARATIONS |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * CDCMOServer |
|
36 * Description. |
|
37 */ |
|
38 |
|
39 |
|
40 class CDCMOServer : public CServer2 |
|
41 { |
|
42 friend class CDCMOSession; |
|
43 friend class CDCMONotifierAob; |
|
44 |
|
45 public: |
|
46 /** |
|
47 * Structure to hold the plug-in details |
|
48 */ |
|
49 struct dcmoInfoList |
|
50 { |
|
51 HBufC* iCategoryName; |
|
52 TInt iUid; |
|
53 TBool iStatus; |
|
54 }; |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 ~CDCMOServer(); |
|
59 |
|
60 /** |
|
61 * Static method which creates the server instance |
|
62 * @param None |
|
63 * @return CServer2* |
|
64 */ |
|
65 static CServer2* NewLC( ); |
|
66 |
|
67 /** |
|
68 * Locks the session, so that new session will not be started |
|
69 * before the previous request completion |
|
70 * @param None |
|
71 * @return None |
|
72 */ |
|
73 void LockSession(); |
|
74 |
|
75 /** |
|
76 * UnLocks the session, so that new session can start later. |
|
77 * @param None |
|
78 * @return None |
|
79 */ |
|
80 void UnLockSession(); |
|
81 |
|
82 /** |
|
83 * Stops the session and closes the server |
|
84 * @param None |
|
85 * @return None |
|
86 */ |
|
87 void DropSession(); |
|
88 |
|
89 private: |
|
90 /** |
|
91 * Default constructor |
|
92 */ |
|
93 CDCMOServer(); |
|
94 |
|
95 /** |
|
96 * second phase constructor |
|
97 */ |
|
98 void ConstructL(); |
|
99 |
|
100 /** |
|
101 * Calls when a New session is getting created |
|
102 * @param aVersion |
|
103 * @param aMessage |
|
104 * @return CSession2* |
|
105 */ |
|
106 CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; |
|
107 |
|
108 |
|
109 protected: |
|
110 // |
|
111 // Services |
|
112 // |
|
113 /** |
|
114 * Get the interger type value |
|
115 * @param aCategory |
|
116 * @param aId |
|
117 * @param aValue |
|
118 * @return TDCMOStatus |
|
119 */ |
|
120 TDCMOStatus GetIntAttributeL(TDes& aCategory, TDCMONode aId, TInt& aValue); |
|
121 |
|
122 /** |
|
123 * Get the string type value |
|
124 * @param aCategory |
|
125 * @param aId |
|
126 * @param aStrValue |
|
127 * @return TDCMOStatus |
|
128 */ |
|
129 TDCMOStatus GetStrAttributeL(TDes& aCategory, TDCMONode aId, TDes& aStrValue); |
|
130 |
|
131 /** |
|
132 * Set the interger type value |
|
133 * @param aCategory |
|
134 * @param aId |
|
135 * @param aValue |
|
136 * @return TDCMOStatus |
|
137 */ |
|
138 TDCMOStatus SetIntAttributeL(TDes& aCategory, TDCMONode aId, TInt aValue); |
|
139 |
|
140 /** |
|
141 * Set the string type value |
|
142 * @param aCategory |
|
143 * @param aId |
|
144 * @param aStrValue |
|
145 * @return TDCMOStatus |
|
146 */ |
|
147 TDCMOStatus SetStrAttributeL(TDes& aCategory, TDCMONode aId, const TDes& aStrValue); |
|
148 |
|
149 /** |
|
150 * Finalize the Service |
|
151 * @return TDCMOStatus |
|
152 */ |
|
153 void DoFinalizeL(); |
|
154 |
|
155 /** |
|
156 * Get the list of all plug-in adapters |
|
157 * @param aGroup |
|
158 * @param aAdapterList |
|
159 * @return |
|
160 */ |
|
161 void SearchAdaptersL(TDes& aGroup, TDes& aAdapterList); |
|
162 |
|
163 /** |
|
164 * Set the iStarter value |
|
165 * @param aValue, ETrue if it is Starter else EFalse |
|
166 * @return |
|
167 */ |
|
168 void SetStarter(TBool aValue); |
|
169 |
|
170 private: |
|
171 |
|
172 /** |
|
173 * Get the uid of plug-in adapter |
|
174 * @param aCategory |
|
175 * @return the uid |
|
176 */ |
|
177 TUid GetAdapterUidL(const TDesC& aCategory); |
|
178 |
|
179 /** |
|
180 * Finds whether the plug-in adapter is a generic category |
|
181 * @param aCategory |
|
182 * @return the integer |
|
183 */ |
|
184 TInt GetLocalCategoryL(const TDesC& aCategory); |
|
185 |
|
186 private: |
|
187 RArray<dcmoInfoList> idcmoArray; |
|
188 static TInt iSessionCount; |
|
189 TBool iStarter; |
|
190 CDCMONotifierAob* iNotifier; |
|
191 }; |
|
192 |
|
193 #endif //__DCMO_SERVER_H__ |