|
1 /* |
|
2 * Copyright (c) 2002 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef AKN_ICON_SRV_SESSION_H |
|
22 #define AKN_ICON_SRV_SESSION_H |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include <e32base.h> |
|
27 #include "AknIconPanic.h" |
|
28 #include "AknIconSrvDef.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CAknIconServer; |
|
32 class CAknIconSrvIconItem; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * This class represents a session in the server. |
|
38 * Functions are provided to respond appropriately to client messages. |
|
39 */ |
|
40 |
|
41 NONSHARABLE_CLASS(CAknIconSrvSession) : public CSession2 |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * C++ default constructor. |
|
47 */ |
|
48 CAknIconSrvSession(); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 virtual ~CAknIconSrvSession(); |
|
54 |
|
55 public: // New functions |
|
56 |
|
57 public: // From CSharableSession |
|
58 |
|
59 void ServiceL( const RMessage2& aMessage ); |
|
60 |
|
61 RFile& AdoptedFileHandle(); |
|
62 |
|
63 /** |
|
64 * @fn SetClientPanicCode |
|
65 * sets the panic code, which will be used in panicing the client |
|
66 * @param aPanicCode This panic code to set |
|
67 * @see TAknIconPanic |
|
68 */ |
|
69 void SetClientPanicCode(TAknIconPanic aPanicCode); |
|
70 |
|
71 private: // New Functions |
|
72 |
|
73 /** |
|
74 * Handles a client request; tests the opcode and gives |
|
75 * service according to that. |
|
76 * |
|
77 * @param aMessage service request message from client |
|
78 * |
|
79 * Leaves if: |
|
80 * - a service routine leaves |
|
81 */ |
|
82 TInt DispatchMessageL( const RMessage2& aMessage ); |
|
83 |
|
84 /** |
|
85 * Below are handlers for different services. |
|
86 * They get the parameters from client message and |
|
87 * call the desired service routine. |
|
88 * |
|
89 * They also do the necessary inter-thread data transfers. |
|
90 * |
|
91 * Leave if: |
|
92 * - a service routine leaves |
|
93 * |
|
94 * Leaves are trapped by ServiceL() which returns the |
|
95 * errorcode to the client. |
|
96 */ |
|
97 |
|
98 /** |
|
99 * Server down-cast. |
|
100 */ |
|
101 inline CAknIconServer* Server(); |
|
102 |
|
103 /** |
|
104 * Panics the client thread |
|
105 * @param aPanic panic reason |
|
106 */ |
|
107 void PanicClient( const RMessage2& aMessage, TAknIconPanic aPanic ) const; |
|
108 |
|
109 void ModifyUserCount( |
|
110 const CAknIconSrvIconItem* aItem, |
|
111 TInt aCount ); |
|
112 |
|
113 void ModifyUserCount( |
|
114 const CAknIconDataItem* aItem, |
|
115 TInt aCount ); |
|
116 |
|
117 private: // Data |
|
118 |
|
119 // Information of which icons this session is referring to. |
|
120 // Needed for cleanup purposes in e.g. client thread panic case. |
|
121 RArray<TAknIconSrvSessionIconItem> iIconItems; |
|
122 |
|
123 // Information of which icon data this session has preserved. |
|
124 // Needed for cleanup purposes in e.g. client thread panic case. |
|
125 RArray<TAknIconSrvSessionPreservedItem> iPreservedItems; |
|
126 |
|
127 // File handle adopted from the client side. |
|
128 // It is adopted in the beginning of the service request |
|
129 // and always closed after the service request. |
|
130 RFile iAdoptedFile; |
|
131 |
|
132 //! Code to use while panicking the client |
|
133 TAknIconPanic iClientPanicCode; |
|
134 |
|
135 #ifdef _DEBUG |
|
136 TInt iDbgHeapFailNextCount; // for heap testing |
|
137 #endif // _DEBUG |
|
138 }; |
|
139 |
|
140 #include "AknIconSrvSession.inl" |
|
141 |
|
142 #endif // AKN_ICON_SRV_SESSION_H |
|
143 |
|
144 // End of File |