|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef RECEIVER_H |
|
22 #define RECEIVER_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <remconinterfaceselector.h> |
|
26 #include <remcon/messagetype.h> |
|
27 #include "remconserver.h" |
|
28 |
|
29 class RRemCon; |
|
30 |
|
31 /** |
|
32 Active Object for receiving messages from an RRemConController or |
|
33 RRemConTarget. |
|
34 */ |
|
35 NONSHARABLE_CLASS(CReceiver) : public CActive |
|
36 { |
|
37 public: |
|
38 /** |
|
39 Factory method. |
|
40 @param aRemCon The session to receive on. |
|
41 @param aObserver Our observer. |
|
42 @param aMaxDataLength The size of the buffer to read operation-associated |
|
43 data into. |
|
44 @param aType The type of session aRemCon is. We pass this back up with new |
|
45 messages so the Interface Selector knows how to handle them. |
|
46 @return Ownership of a new CReceiver. |
|
47 */ |
|
48 static CReceiver* NewL(RRemCon& aRemCon, |
|
49 CRemConInterfaceSelector& aObserver, |
|
50 TUint aMaxDataLength, |
|
51 TRemConClientType aType); |
|
52 |
|
53 /** Destructor. */ |
|
54 ~CReceiver(); |
|
55 |
|
56 public: |
|
57 /** Called when the client wants to receive a message. On completion, |
|
58 notifies the observer and re-issues itself until the client destroys it. |
|
59 */ |
|
60 void Receive(); |
|
61 |
|
62 private: // from CActive |
|
63 void RunL(); |
|
64 void DoCancel(); |
|
65 |
|
66 private: |
|
67 /** Constructor. */ |
|
68 CReceiver(RRemCon& aRemCon, |
|
69 CRemConInterfaceSelector& aObserver, |
|
70 TRemConClientType aType); |
|
71 |
|
72 void ConstructL(TUint aMaxDataLength); |
|
73 |
|
74 private: // owned |
|
75 // These are the members we pass to the inner client API to get messages |
|
76 // out of RemCon. |
|
77 TRemConClientReceivePackage iReceivePackage; |
|
78 RBuf8 iData; |
|
79 |
|
80 const TRemConClientType iType; |
|
81 |
|
82 private: // unowned |
|
83 RRemCon& iRemCon; |
|
84 CRemConInterfaceSelector& iObserver; |
|
85 }; |
|
86 |
|
87 #endif // RECEIVER_H |