1 /* |
|
2 * Copyright (c) 2007 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 the License "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: Session part of the client/server paradigm.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CCRSESSION_H |
|
21 #define __CCRSESSION_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 |
|
26 // CONSTANTS |
|
27 // None. |
|
28 |
|
29 // MACROS |
|
30 // None. |
|
31 |
|
32 // DATA TYPES |
|
33 enum TCRPanic |
|
34 { |
|
35 ECRPanicServiceHandle, |
|
36 ECRPanicBadDescriptor, |
|
37 ECRPanicInvalidRequestType, |
|
38 ECRPanicRequestAsyncTwice, |
|
39 ECRPanicBadSubSessionHandle, |
|
40 ECRPanicZeroLengthDes, |
|
41 ECRPanicDesLengthNegative, |
|
42 ECRPanicNullPtrArray, |
|
43 ECRPanicNullHandle, |
|
44 ECRPanicHandleNotOpen, |
|
45 ECRPanicIndexOutOfRange, |
|
46 ECRPanicHandleNotClosed, |
|
47 ECRPanicBadRequest, |
|
48 ECRPanicPanicBadName |
|
49 }; |
|
50 |
|
51 // FORWARD DECLARATIONS |
|
52 class CCREngine; |
|
53 class CCRServer; |
|
54 |
|
55 // CLASS DECLARATION |
|
56 |
|
57 /** |
|
58 * CCRSession is the server side session that client applications |
|
59 * talk with. This merely passes commands to CCREngine |
|
60 * |
|
61 * @lib CommonRecordingEngine.lib |
|
62 * @since Series 60 3.0 |
|
63 */ |
|
64 class CCRSession : public CSession2 |
|
65 { |
|
66 |
|
67 public: // Constructors and destructor |
|
68 |
|
69 /** |
|
70 * Two-phased constructor. |
|
71 * @Param aClient reference client thread |
|
72 * @Param aServer pointer to Server |
|
73 * @return CCRSession pointer to CCRSession class |
|
74 */ |
|
75 static CCRSession* NewL( CCRServer* aServer ); |
|
76 |
|
77 /** |
|
78 * Destructor. |
|
79 */ |
|
80 virtual ~CCRSession(); |
|
81 |
|
82 public: // New methods |
|
83 |
|
84 /** |
|
85 * Server. |
|
86 * @since Series 60 3.0 |
|
87 * @return a pointer to server. |
|
88 */ |
|
89 inline CCRServer* Server() const |
|
90 { |
|
91 return REINTERPRET_CAST( CCRServer*, |
|
92 CONST_CAST( CServer2*, CSession2::Server() ) ); |
|
93 } |
|
94 |
|
95 /** |
|
96 * Service. |
|
97 * @since Series 60 3.0 |
|
98 * @param aMessage contains data from the client. |
|
99 * @return None. |
|
100 */ |
|
101 void ServiceL( const RMessage2& aMessage ); |
|
102 |
|
103 private: // New methods |
|
104 |
|
105 /** |
|
106 * Dispatch message. |
|
107 * @since Series 60 3.0 |
|
108 * @param aMessage contains data from the client. |
|
109 * @return None. |
|
110 */ |
|
111 void DispatchMessageL( const RMessage2& aMessage ); |
|
112 |
|
113 /** |
|
114 * New Object. |
|
115 * @since Series 60 3.0 |
|
116 * @param aMessage contains data from the client. |
|
117 * @return None. |
|
118 */ |
|
119 void NewObjectL( const RMessage2& aMessage ); |
|
120 |
|
121 /** |
|
122 * Deletes object, can't fail - can panic client. |
|
123 * @since Series 60 3.0 |
|
124 * @param aHandle handle. |
|
125 * @return None. |
|
126 */ |
|
127 void DeleteObject( TUint aHandle ); |
|
128 |
|
129 /** |
|
130 * Counts resources |
|
131 * @return Number of resources |
|
132 */ |
|
133 TInt CountResources(); |
|
134 |
|
135 /** |
|
136 * Panics client. |
|
137 * @since Series 60 3.0 |
|
138 * @param aPanic panic code. |
|
139 * @return None. |
|
140 */ |
|
141 void PanicClient( TInt aPanic ) const; |
|
142 |
|
143 private: // Constructors and destructor |
|
144 |
|
145 /** |
|
146 * C++ default constructor. |
|
147 * @Param aClient reference client thread. |
|
148 */ |
|
149 CCRSession(); |
|
150 |
|
151 /** |
|
152 * Symbian 2nd phase constructor. |
|
153 * @Param aServer pointer to Server. |
|
154 */ |
|
155 void ConstructL( CCRServer* aServer ); |
|
156 |
|
157 private: // Data |
|
158 |
|
159 /** |
|
160 * Object index for this session. |
|
161 */ |
|
162 CObjectIx* iObjects; |
|
163 |
|
164 /** |
|
165 * Total number of resources allocated. |
|
166 */ |
|
167 TInt iResourceCount; |
|
168 |
|
169 }; |
|
170 |
|
171 #endif // __CCRSESSION_H |
|
172 |
|
173 // End of File |
|