35 const TInt KIPCGetBuffer = KIPCOperation+1; |
35 const TInt KIPCGetBuffer = KIPCOperation+1; |
36 const TInt KIPCOperationWithSharableFile = KIPCOperation+2; // Sharable file support |
36 const TInt KIPCOperationWithSharableFile = KIPCOperation+2; // Sharable file support |
37 |
37 |
38 |
38 |
39 /*! |
39 /*! |
40 \class CApaServerSymbianSession |
40 \class CApaServerSymbianSession |
41 Symbian Session class |
41 \brief Symbian Session class |
42 */ |
42 */ |
43 |
43 |
44 /*! |
44 /*! |
45 Constructor |
45 Constructor. |
46 @param aObserver observer to the server |
46 \param aObserver Observer to the server. |
47 */ |
47 */ |
48 CApaServerSymbianSession::CApaServerSymbianSession(MServiceIPCObserver* aObserver) : |
48 CApaServerSymbianSession::CApaServerSymbianSession(MServiceIPCObserver* aObserver) : |
49 ServiceIPCSession(aObserver) |
49 ServiceIPCSession(aObserver) |
50 { |
50 { |
51 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::CApaServerSymbianSession"); |
51 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::CApaServerSymbianSession"); |
52 } |
52 } |
53 |
53 |
54 /*! |
54 /*! |
55 2nd phased constructor |
55 2nd phased constructor. |
56 */ |
56 */ |
57 void CApaServerSymbianSession::ConstructL() |
57 void CApaServerSymbianSession::ConstructL() |
58 { |
58 { |
59 } |
59 } |
60 |
60 |
61 /*! |
61 /*! |
62 Two-Phased Constructor |
62 Two-Phased Constructor. |
63 @param aObserver observer to the server |
63 \param aObserver Observer to the server. |
64 */ |
64 */ |
65 CApaServerSymbianSession* CApaServerSymbianSession::NewL(MServiceIPCObserver* aObserver) |
65 CApaServerSymbianSession* CApaServerSymbianSession::NewL(MServiceIPCObserver* aObserver) |
66 { |
66 { |
67 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::NewL"); |
67 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::NewL"); |
68 CApaServerSymbianSession* self = |
68 CApaServerSymbianSession* self = |
69 new( ELeave ) CApaServerSymbianSession(aObserver); |
69 new( ELeave ) CApaServerSymbianSession(aObserver); |
85 } |
85 } |
86 iCurRequest = NULL; |
86 iCurRequest = NULL; |
87 } |
87 } |
88 |
88 |
89 /*! |
89 /*! |
90 Write some data in response to a request |
90 Write some data in response to a request. |
91 @param aData some data to write as response |
91 \param aData Some data to write as response. |
92 @return bool if write was successful |
92 \return bool If write was successful. |
93 */ |
93 */ |
94 bool CApaServerSymbianSession::write( const QByteArray& aData ) |
94 bool CApaServerSymbianSession::write( const QByteArray& aData ) |
95 { |
95 { |
96 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::write"); |
96 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::write"); |
97 XQSERVICE_DEBUG_PRINT("aData: %s,length=%d", aData.constData(), aData.length()); |
97 XQSERVICE_DEBUG_PRINT("aData: %s,length=%d", aData.constData(), aData.length()); |
98 // Implicitly shared |
98 // Implicitly shared |
99 iData = aData; |
99 iData = aData; |
100 return false; |
100 return false; |
101 } |
101 } |
102 |
102 |
103 /*! |
103 /*! |
104 Complete a Request |
104 Complete a request. |
105 @return bool if request completed |
105 \return true if request completed |
106 */ |
106 */ |
107 bool CApaServerSymbianSession::completeRequest() |
107 bool CApaServerSymbianSession::completeRequest() |
108 { |
108 { |
109 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::completeRequest"); |
109 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::completeRequest"); |
110 TPtrC8 data(reinterpret_cast<const TUint8*> (iData.constData()), iData.length()); |
110 TPtrC8 data(reinterpret_cast<const TUint8*> (iData.constData()), iData.length()); |
111 XQSERVICE_DEBUG_PRINT("data: %s, length=%d", iData.constData(), data.Length() ); |
111 XQSERVICE_DEBUG_PRINT("data: %s, length=%d", iData.constData(), data.Length() ); |
117 iCurRequest = NULL; |
117 iCurRequest = NULL; |
118 return true; |
118 return true; |
119 } |
119 } |
120 |
120 |
121 /*! |
121 /*! |
122 Close a session and gracefully shutdown |
122 Close a session and gracefully shutdown. |
123 */ |
123 */ |
124 void CApaServerSymbianSession::close() |
124 void CApaServerSymbianSession::close() |
125 { |
125 { |
126 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::close"); |
126 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::close"); |
127 // Symbian doens't really do anything |
127 // Symbian doens't really do anything |
128 } |
128 } |
129 |
129 |
130 /*! |
130 /*! |
131 From CSession2 |
131 From CSession2. Service request. |
132 Service request |
132 \param aMessage Message object. |
133 @param aMessage message object |
133 */ |
134 */ |
|
135 void CApaServerSymbianSession::ServiceL(const RMessage2& aMessage) |
134 void CApaServerSymbianSession::ServiceL(const RMessage2& aMessage) |
136 { |
135 { |
137 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::ServiceL"); |
136 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::ServiceL"); |
138 // Default ServiceErrorL() will complete the message if this method leaves |
137 // Default ServiceErrorL() will complete the message if this method leaves |
139 TInt operation(aMessage.Function()); |
138 TInt operation(aMessage.Function()); |
174 } |
173 } |
175 } |
174 } |
176 } |
175 } |
177 |
176 |
178 /*! |
177 /*! |
179 From CSession2 |
178 From CSession2. |
180 Handle any disconnection from the client |
179 Handle any disconnection from the client. |
181 @param aMessage message Object |
180 \param aMessage Message Object. |
182 */ |
181 */ |
183 void CApaServerSymbianSession::Disconnect(const RMessage2 &aMessage) |
182 void CApaServerSymbianSession::Disconnect(const RMessage2 &aMessage) |
184 { |
183 { |
185 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::Disconnect"); |
184 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::Disconnect"); |
186 if (iCurRequest) { |
185 if (iCurRequest) { |
187 // Inform also observer, that current pending request is about to go |
186 // Inform also observer, that current pending request is about to go |
189 } |
188 } |
190 CApaAppServiceBase::Disconnect(aMessage); |
189 CApaAppServiceBase::Disconnect(aMessage); |
191 } |
190 } |
192 |
191 |
193 /*! |
192 /*! |
194 Handle an IPC request |
193 Handle an IPC request. |
195 @param aMessage message Object |
194 \param aMessage Message Object. |
196 */ |
195 */ |
197 void CApaServerSymbianSession::handleRequestL( const RMessage2& aMessage ) |
196 void CApaServerSymbianSession::handleRequestL( const RMessage2& aMessage ) |
198 { |
197 { |
199 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::handleRequestL"); |
198 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::handleRequestL"); |
200 // Store the message |
199 // Store the message |
201 iMessage = aMessage; |
200 iMessage = aMessage; |
262 |
261 |
263 CleanupStack::PopAndDestroy(2, request); |
262 CleanupStack::PopAndDestroy(2, request); |
264 } |
263 } |
265 |
264 |
266 /*! |
265 /*! |
267 Handle getting the result buffer |
266 Handle getting the result buffer. |
|
267 \param aMessage Message Object. |
268 */ |
268 */ |
269 void CApaServerSymbianSession::handleGetBufferL( const RMessage2& aMessage ) |
269 void CApaServerSymbianSession::handleGetBufferL( const RMessage2& aMessage ) |
270 { |
270 { |
271 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::handleGetBufferL"); |
271 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::handleGetBufferL"); |
272 XQSERVICE_DEBUG_PRINT("iData: %s", iData.constData()); |
272 XQSERVICE_DEBUG_PRINT("iData: %s", iData.constData()); |
274 TInt err = aMessage.Write(0, data); |
274 TInt err = aMessage.Write(0, data); |
275 aMessage.Complete(err); |
275 aMessage.Complete(err); |
276 } |
276 } |
277 |
277 |
278 /*! |
278 /*! |
279 Read a 16 bit descriptor from the message |
279 Read a 16 bit descriptor from the message. |
280 @param aMessage message to read from, |
280 \param aMessage Message to read from. |
281 @param aMsgSlot slot to read from |
281 \param aMsgSlot Slot to read from. |
282 */ |
282 */ |
283 HBufC* CApaServerSymbianSession::ReadDesLC(const RMessage2& aMessage, |
283 HBufC* CApaServerSymbianSession::ReadDesLC(const RMessage2& aMessage, |
284 TInt aMsgSlot) |
284 TInt aMsgSlot) |
285 { |
285 { |
286 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::ReadDesLC"); |
286 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::ReadDesLC"); |
287 TInt length = aMessage.GetDesLengthL(aMsgSlot); |
287 TInt length = aMessage.GetDesLengthL(aMsgSlot); |
290 aMessage.ReadL(aMsgSlot, ptr); |
290 aMessage.ReadL(aMsgSlot, ptr); |
291 return des; |
291 return des; |
292 } |
292 } |
293 |
293 |
294 /*! |
294 /*! |
295 Read a 8 bit descriptor from the message |
295 Read a 8 bit descriptor from the message. |
296 @param aMessage message to read from, |
296 \param aMessage Message to read from. |
297 @param aMsgSlot slot to read from |
297 \param aMsgSlot Slot to read from. |
298 */ |
298 */ |
299 HBufC8* CApaServerSymbianSession::ReadDes8LC(const RMessage2& aMessage, |
299 HBufC8* CApaServerSymbianSession::ReadDes8LC(const RMessage2& aMessage, |
300 TInt aMsgSlot) |
300 TInt aMsgSlot) |
301 { |
301 { |
302 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::ReadDes8LC"); |
302 XQSERVICE_DEBUG_PRINT("CApaServerSymbianSession::ReadDes8LC"); |