|
1 /* |
|
2 * Copyright (c) 2008 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: CMS Server |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __CMSSERVER_H__ |
|
21 #define __CMSSERVER_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <f32file.h> |
|
25 #include "cmscommondefines.h" |
|
26 #include "MCmsPhonebookOperationsObserver.h" |
|
27 |
|
28 //FORWARD DECLARATIONS |
|
29 class CCmsPhonebookProxy; |
|
30 class MPresenceTrafficLights; |
|
31 class MVPbkContactLink; |
|
32 class CCmsServerSession; |
|
33 class CCmsServerContact; |
|
34 class CCmsPhonebookProxy; |
|
35 |
|
36 /** |
|
37 * CCmsScheduler is used instead of default active scheduler to |
|
38 * make customized handling of leaves in RunL methods of active |
|
39 * objects. |
|
40 */ |
|
41 class CCmsScheduler : public CActiveScheduler |
|
42 { |
|
43 public: // from base class |
|
44 |
|
45 /** |
|
46 * Error handling that ignores leaves of |
|
47 * active object RunL methods |
|
48 */ |
|
49 void Error( TInt aError ) const; |
|
50 }; |
|
51 |
|
52 /** |
|
53 * CCmsServer class is responsible for starting the server thread and creating |
|
54 * sessions for its clients. |
|
55 */ |
|
56 NONSHARABLE_CLASS( CCmsServer ) : public CServer2, |
|
57 public MCmsPhonebookOperationsObserver |
|
58 { |
|
59 public: // Constructors and destructor |
|
60 |
|
61 /** |
|
62 * Start the server thread |
|
63 * |
|
64 * @return Error code |
|
65 */ |
|
66 static TInt StartThreadL(); |
|
67 |
|
68 /** |
|
69 * Create a new session |
|
70 * |
|
71 * @param TVersion The version of the client interface |
|
72 * @param RMessage2& Kernel message |
|
73 * @return The new session |
|
74 */ |
|
75 CSession2* NewSessionL( const TVersion& aVersion, |
|
76 const RMessage2& /*aMessage*/ ) const; |
|
77 |
|
78 /** |
|
79 * Destructor |
|
80 */ |
|
81 ~CCmsServer(); |
|
82 |
|
83 private: // Constructors |
|
84 |
|
85 /** |
|
86 * Create the main server object |
|
87 * |
|
88 * @return Main server object |
|
89 */ |
|
90 static CCmsServer* NewLC(); |
|
91 |
|
92 /** |
|
93 * Private default constructor |
|
94 * |
|
95 * @param aPriority Active object priority |
|
96 */ |
|
97 CCmsServer( TInt aPriority ); |
|
98 |
|
99 /** |
|
100 * The Symbian OS second-phase constructor |
|
101 */ |
|
102 void ConstructL(); |
|
103 |
|
104 public: |
|
105 |
|
106 /** |
|
107 * Return a reference to phonebook proxy |
|
108 * |
|
109 * @return Reference to phonebook proxy |
|
110 */ |
|
111 CCmsPhonebookProxy& PhonebookProxyHandle(); |
|
112 |
|
113 /** |
|
114 * Return a reference to file session handle |
|
115 * |
|
116 * @return File session handle |
|
117 */ |
|
118 RFs& FileSession(); |
|
119 |
|
120 public: //static |
|
121 |
|
122 /** |
|
123 * Panic the server |
|
124 * |
|
125 * @param aPanic Panic code |
|
126 */ |
|
127 static void PanicServer( TCmsServerPanic aPanic ); |
|
128 |
|
129 public: // From MCmsPhonebookOperationsObserver |
|
130 |
|
131 void StoreOpenComplete(); |
|
132 void CmsSingleContactOperationComplete( TInt aError ); |
|
133 |
|
134 private: // Data |
|
135 |
|
136 /// Global handler to file server session, available for all |
|
137 /// CMS sessions. Owned. |
|
138 RFs iFS; |
|
139 |
|
140 /// Phonebook proxy which is responsible for common phonebook |
|
141 /// operations. Available for all CMS sessions. Owned. |
|
142 CCmsPhonebookProxy* iPhonebookProxy; |
|
143 }; |
|
144 |
|
145 #endif |
|
146 |
|
147 // End of File |