|
1 /* |
|
2 * Copyright (c) 2004-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 "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 #ifndef CIMAGEPRINTSERVER_H |
|
20 #define CIMAGEPRINTSERVER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <fbs.h> |
|
24 |
|
25 class CImagePrintBody; |
|
26 |
|
27 // ---------------------------------------------------------------------------------------- |
|
28 // Server's policy here |
|
29 // ---------------------------------------------------------------------------------------- |
|
30 |
|
31 // Total number of ranges |
|
32 const TUint KImagePrintRangeCount = 2; |
|
33 |
|
34 // Definition of the ranges of IPC numbers |
|
35 const TInt KImagePrintRanges[KImagePrintRangeCount] = |
|
36 { |
|
37 0, // implemented 0-38 |
|
38 39 // non implemented function end of range check ; ENotSupported |
|
39 }; |
|
40 |
|
41 // Policy to implement for each of the above ranges |
|
42 const TUint8 KImagePrintElementsIndex[KImagePrintRangeCount] = |
|
43 { |
|
44 CPolicyServer::EAlwaysPass, // applies to 0th range |
|
45 CPolicyServer::ENotSupported // applies to 1st range (out of range IPC) |
|
46 }; |
|
47 |
|
48 // Package all the above together into a policy |
|
49 const CPolicyServer::TPolicy KImagePrintPolicy = |
|
50 { |
|
51 CPolicyServer::EAlwaysPass, // specifies all connect attempts should pass |
|
52 KImagePrintRangeCount, // number of ranges |
|
53 KImagePrintRanges, // ranges array |
|
54 KImagePrintElementsIndex, // elements<->ranges index |
|
55 NULL, // array of elements |
|
56 }; |
|
57 class CImagePrintServer : public CPolicyServer |
|
58 { |
|
59 public: |
|
60 |
|
61 /** |
|
62 * 2-phase constructor |
|
63 * |
|
64 * @return new object. The object is left on the cleanup stack |
|
65 */ |
|
66 static CImagePrintServer* NewLC(); |
|
67 |
|
68 /** |
|
69 * Destructor |
|
70 */ |
|
71 ~CImagePrintServer(); |
|
72 |
|
73 /** |
|
74 * Increase session counter |
|
75 */ |
|
76 void AddSession(); |
|
77 |
|
78 /** |
|
79 * Decrease session counter. If the counter is decreased to 0, the |
|
80 * server is shut down |
|
81 */ |
|
82 void RemoveSession(); |
|
83 |
|
84 /** |
|
85 * Session count getter |
|
86 * |
|
87 * @return session count |
|
88 */ |
|
89 TInt SessionCount() const; |
|
90 |
|
91 /** |
|
92 * Reserve printing engine to the session |
|
93 * |
|
94 * @param aSession session that claims the printing engine |
|
95 * @return error code |
|
96 */ |
|
97 TInt ReserveEngine( const CSession2* aSession ); |
|
98 |
|
99 /** |
|
100 * Release printing engine by the session |
|
101 * |
|
102 * @param aSession session that wants to release the printing engine |
|
103 * @return error code |
|
104 */ |
|
105 TInt ReleaseEngine( const CSession2* aSession ); |
|
106 |
|
107 /** |
|
108 * Printing engine getter |
|
109 * |
|
110 * @return printing engine |
|
111 */ |
|
112 CImagePrintBody& Engine() const; |
|
113 |
|
114 private: |
|
115 |
|
116 TInt RunError( TInt aError ); |
|
117 CImagePrintServer(); |
|
118 void ConstructL(); |
|
119 CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const; |
|
120 |
|
121 private: |
|
122 |
|
123 TInt iConnsCount; |
|
124 |
|
125 const CSession2* iEngineHolder; |
|
126 |
|
127 CImagePrintBody* iEngine; |
|
128 |
|
129 RFbsSession iFbs; |
|
130 }; |
|
131 |
|
132 |
|
133 #endif // CIMAGEPRINTSERVER_H |
|
134 |
|
135 // End of File |