|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Subconnection class for session of ASYComms |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CACCSRVSUBASYCOMMS_H |
|
20 #define CACCSRVSUBASYCOMMS_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "AccSrvProcessCommandTimer.h" |
|
24 #include "AccSrvProcessCommandObserver.h" |
|
25 #include "AsyProxyAPI.h" |
|
26 #include "AccSrvSubBase.h" |
|
27 #include <e32base.h> |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // MACROS |
|
32 |
|
33 // DATA TYPES |
|
34 enum TProcessResponseType |
|
35 { |
|
36 EProcessResponseTBool, |
|
37 EProcessResponseTInt, |
|
38 EProcessResponseTDes, |
|
39 EProcessResponseObject |
|
40 }; |
|
41 |
|
42 // FUNCTION PROTOTYPES |
|
43 |
|
44 // FORWARD DECLARATIONS |
|
45 class CAccSrvMainSession; |
|
46 |
|
47 // CLASS DECLARATION |
|
48 /** |
|
49 * Subconnection class for session of ASYComms |
|
50 * |
|
51 * @lib AccServer.exe |
|
52 * @since S60 3.1 |
|
53 */ |
|
54 NONSHARABLE_CLASS( CAccSrvSubAsyComms ) : public CAccSrvSubBase, |
|
55 public MAccSrvProcessCommandObserver |
|
56 { |
|
57 public: // Constructors and destructor |
|
58 |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 * @since S60 3.1 |
|
62 * @param aProxy Pointer to an ASYProxy |
|
63 * @param aConnectionController Pointer to a connection controller object |
|
64 * @param aServerModel Pointer to a server model object |
|
65 * @param aASYThreadID id of the ASY thread |
|
66 * @param aMainServiceUid Uid of the main service ASY |
|
67 * @return Pointer to a new subsession |
|
68 */ |
|
69 static CAccSrvSubAsyComms* NewL( |
|
70 CASYProxyAPI* aProxy, |
|
71 CAccSrvConnectionController* aConnectionController, |
|
72 CAccSrvServerModel* aServerModel, |
|
73 TUint aASYThreadID, |
|
74 TUid aMainServiceUid ); |
|
75 |
|
76 /** |
|
77 * Destructor. |
|
78 */ |
|
79 virtual ~CAccSrvSubAsyComms(); |
|
80 |
|
81 public: // New functions |
|
82 |
|
83 public: // Functions from base classes |
|
84 |
|
85 /** |
|
86 * From CAccSrvSubBase |
|
87 * Handles received messages from client. |
|
88 * @since S60 3.1 |
|
89 * @param aMessage Client request. |
|
90 * @return void |
|
91 */ |
|
92 void DispatchMessageL( const RMessage2& aMessage ); |
|
93 |
|
94 /** |
|
95 * From CAccSrvSubBase Called to handle message completion handling. |
|
96 * @since S60 3.1 |
|
97 * @param aMsgID Message id |
|
98 * @param aErrorCode Error Code of the operation. |
|
99 * @param aUniqueID Unique ID of the Generic ID in question. |
|
100 * @return ETrue if the message was consumpted by a observer. |
|
101 */ |
|
102 TBool CompleteMessageL( TMsgID aMsgID, |
|
103 TInt aErrorCode, |
|
104 TInt aUniqueID ); |
|
105 |
|
106 /** |
|
107 * From CAccSrvSubBase Called to handle message completion handling. |
|
108 * @since S60 3.1 |
|
109 * @param aCmdn Process command id |
|
110 * @param aTrId Transaction id |
|
111 * @param aASYCommandParamRecord Data for NotifyProcessCommand() completion. |
|
112 * @param aPtrBuf Pointer to CBufFlat buffer where CAccPolObjectCon object |
|
113 * is externalized to. |
|
114 * @return ETrue if the message was consumpted by a observer. |
|
115 */ |
|
116 virtual TBool CompleteProcessCommandL( |
|
117 TProcessCmdId aCmdn, |
|
118 TInt aTrId, |
|
119 TASYCommandParamRecord& aASYCommandParamRecord, |
|
120 TPtr8* aPtrBuf=NULL ); |
|
121 |
|
122 protected: // New functions |
|
123 |
|
124 /** |
|
125 * C++ default constructor. |
|
126 */ |
|
127 CAccSrvSubAsyComms( |
|
128 CASYProxyAPI* aSession, |
|
129 CAccSrvConnectionController* aConnectionController, |
|
130 CAccSrvServerModel* aServerModel, |
|
131 TUint aASYThreadID, |
|
132 TUid aMainServiceUid ); |
|
133 |
|
134 /** |
|
135 * By default Symbian 2nd phase constructor is private. |
|
136 */ |
|
137 void ConstructL(); |
|
138 |
|
139 protected: // Functions from base classes |
|
140 |
|
141 private: |
|
142 |
|
143 /** |
|
144 * Handles NotifyProcessCommand() client request. |
|
145 * If leave occurs, the client request is completed with that error code. |
|
146 * |
|
147 * @since S60 3.1 |
|
148 * @param aMessage Client request. |
|
149 * @return void |
|
150 */ |
|
151 void NotifyProcessCommand( const RMessage2& aMessage ); |
|
152 |
|
153 /** |
|
154 * Handles CancelNotifyProcessCommand() client request. |
|
155 * If leave occurs, the client request is completed with that error code. |
|
156 * |
|
157 * @since S60 3.1 |
|
158 * @param aMessage Client request. |
|
159 * @return void |
|
160 */ |
|
161 void CancelNotifyProcessCommand( const RMessage2& aMessage ); |
|
162 |
|
163 /** |
|
164 * Handles ProcessResponse() TBool, TInt and TDesC8 client request. |
|
165 * If leave occurs, the client request is completed with that error code. |
|
166 * |
|
167 * @since S60 3.1 |
|
168 * @param aMessage Client request. |
|
169 * @param aResponseType Type of the response, TBool, TInt or TDesC8 |
|
170 * @param aTimeOut Indicates has request timed out |
|
171 * @return void |
|
172 */ |
|
173 void ProcessResponseL( const RMessage2& aMessage, |
|
174 TProcessResponseType aResponseType, |
|
175 TBool aTimeOut = EFalse ); |
|
176 |
|
177 TBool HandleCommandL( TProcessCmdId aCmdn, |
|
178 TInt aTrId, |
|
179 TASYCommandParamRecord& aASYCommandParamRecord, |
|
180 TPtr8* aPtrBuf ); |
|
181 |
|
182 TInt HandleObjectBufferWriteL( TPtr8* aPtrBuf ); |
|
183 |
|
184 virtual void CompleteProcessCommandInitL(); |
|
185 virtual void ProcessCommandTimeOutCompleteL(); |
|
186 |
|
187 public: // Data |
|
188 |
|
189 protected: // Data |
|
190 |
|
191 private: // Data |
|
192 |
|
193 // Stores RAccessoryAsyComms::NotifyProcessCommand() request |
|
194 RMessage2 iMessage; |
|
195 |
|
196 //Transaction id for outstanding SetValueL() or GetValueL |
|
197 TInt iOutstandingTrId; |
|
198 |
|
199 //Timeout transaction id. |
|
200 TInt iTimeOutTrId; |
|
201 |
|
202 //Process command ID for outstanding SetValueL() or GetValueL |
|
203 TProcessCmdId iOutstandingProcessCmdId; |
|
204 |
|
205 // Pointer to timer, that handles time out during |
|
206 // Init ProcessCommand |
|
207 CAccSrvProcessCommandTimer* iInitCommandTimer; // Owned |
|
208 |
|
209 // Pointer to timer, that handles time out during |
|
210 // ProcessCommands |
|
211 CAccSrvProcessCommandTimer* iProcessCommandTimer; // Owned |
|
212 |
|
213 //This sub-session is created by ASY from iASYThreadID thread |
|
214 TUint iASYThreadID; |
|
215 TUid iMainServiceUid; |
|
216 |
|
217 // CAccPolObjectBase object is externalized to this buffer. |
|
218 // This is done when ASY Proxy buffer size is not enough. |
|
219 CBufFlat* iObjectBuf; // Owned |
|
220 |
|
221 public: // Friend classes |
|
222 |
|
223 protected: // Friend classes |
|
224 |
|
225 private: // Friend classes |
|
226 |
|
227 }; |
|
228 |
|
229 #endif // CACCSRVSUBASYCOMMS_H |
|
230 |
|
231 // End of File |