|
1 /* |
|
2 * Copyright (c) 2005-2006 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: fcreceiver.h |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __CFCRECEIVER_H__ |
|
22 #define __CFCRECEIVER_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include "fcnotifier.h" |
|
26 #include <e32base.h> |
|
27 #include <in_sock.h> |
|
28 |
|
29 const TInt KMaxMessageLength = 64000; |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class MFCNotifier; |
|
33 |
|
34 /** |
|
35 * Class provides functions for Receiving |
|
36 * |
|
37 * CFCReceiver Class provides functions for Receiving |
|
38 * |
|
39 * @lib FCTBCP.lib |
|
40 * @since S60 v3.0 |
|
41 */ |
|
42 class CFCReceiver : public CActive |
|
43 { |
|
44 public: |
|
45 /** |
|
46 * Static constructor. |
|
47 * @param aSocket Reference to Socket |
|
48 * @param aMFCNotifier, MFCNotifier |
|
49 * @return An initialized instance of this class. |
|
50 */ |
|
51 static CFCReceiver* NewL(RSocket& aSocket, MFCNotifier& aMFCNotifier); |
|
52 |
|
53 /** |
|
54 * Constructs an object and adds the pointer to the cleanup stack; |
|
55 * leaves on failure. |
|
56 * @param aSocket Reference to Socket |
|
57 * @param aMFCNotifier an interface for messaging receiving event |
|
58 * @return new instance |
|
59 */ |
|
60 static CFCReceiver* NewLC(RSocket& aSocket, MFCNotifier& aMFCNotifier); |
|
61 |
|
62 /** |
|
63 * Destructor |
|
64 */ |
|
65 ~CFCReceiver(); |
|
66 |
|
67 /** |
|
68 * Start to Listen |
|
69 */ |
|
70 void Listen(); |
|
71 |
|
72 |
|
73 public: //From MFCNotifier |
|
74 /** |
|
75 * Pass the receiving Data to the client |
|
76 * @param aData, Receving Data |
|
77 * @param aRemoteAddr, the data receving from this addr |
|
78 */ |
|
79 void ReceivedData(HBufC8* aData); |
|
80 |
|
81 protected: //From CActive |
|
82 void RunL(); |
|
83 void DoCancel(); |
|
84 TInt RunError(TInt aError); |
|
85 |
|
86 private: |
|
87 /** |
|
88 * Constructor |
|
89 * @param aSocket Reference to Socket |
|
90 * @param aNotifier, MFCNotifier |
|
91 * @return An initialized instance of this class. |
|
92 */ |
|
93 CFCReceiver(RSocket& aSocket, MFCNotifier& aMFCNotifier); |
|
94 void ConstructL(); |
|
95 |
|
96 private: //Data |
|
97 TInetAddr iAddr; |
|
98 MFCNotifier& iFCNotifier; |
|
99 HBufC8* iReceivedMsg; |
|
100 TPtr8 iReceivedMsgPtr; |
|
101 RSocket& iSocket; |
|
102 |
|
103 private: // For testing purposes |
|
104 friend class UT_CFCReceiver; |
|
105 }; |
|
106 |
|
107 #endif // end of __CFCRECEIVER_H__ |
|
108 |
|
109 // End of File |