|
1 // Copyright (c) 2005-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 @internalTechnology |
|
19 */ |
|
20 |
|
21 #ifndef AVCTPRECEIVER_H |
|
22 #define AVCTPRECEIVER_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <es_sock.h> |
|
26 |
|
27 #include <avctpservices.h> |
|
28 #include "avctppacketstatics.h" |
|
29 |
|
30 // forward declaration |
|
31 class CAvctpBody; |
|
32 class MControlChannelNotify; |
|
33 |
|
34 /** |
|
35 AVCTP active receiver |
|
36 @internalComponent |
|
37 */ |
|
38 NONSHARABLE_CLASS(CAvctpReceiver) : public CActive |
|
39 { |
|
40 public: |
|
41 static CAvctpReceiver* NewL(MAvctpEventNotify& aNotify, RSocket& aAvctpSocket, SymbianAvctp::TPid aPid); |
|
42 static CAvctpReceiver* NewLC(MAvctpEventNotify& aNotify, RSocket& aAvctpSocket, SymbianAvctp::TPid aPid); |
|
43 ~CAvctpReceiver(); |
|
44 |
|
45 private: |
|
46 MAvctpEventNotify& iNotify; |
|
47 RSocket& iAvctpSocket; |
|
48 |
|
49 enum TRecvState |
|
50 { |
|
51 EWaitingForPktHeader, |
|
52 EWaitingForMsgInfo, |
|
53 }; |
|
54 |
|
55 TRecvState iRecvState; |
|
56 |
|
57 HBufC8* iRecvBuf; |
|
58 TPtr8 iRecvPtr; |
|
59 TSockXfrLength iXfrLength; |
|
60 |
|
61 SymbianAvctp::TPid iPid; |
|
62 |
|
63 // Current packet info |
|
64 TSockAddr iAddr; |
|
65 SymbianAvctp::TTransactionLabel iTransactionLabel; |
|
66 SymbianAvctp::TMessageType iMessageType; |
|
67 TBool iIpidBitSet; |
|
68 private: |
|
69 CAvctpReceiver(MAvctpEventNotify& aNotify, RSocket& aAvctpSocket, SymbianAvctp::TPid aPid); |
|
70 void ConstructL(); |
|
71 |
|
72 inline void NotifyMessageReceived(const TBTDevAddr& aBTDevice, |
|
73 SymbianAvctp::TTransactionLabel aTransactionLabel, |
|
74 SymbianAvctp::TMessageType aType, |
|
75 TBool aIpidBitSet, |
|
76 const TDesC8& aMessageInformation); |
|
77 |
|
78 // Function that issues RecvFrom |
|
79 void ReceiveL(TRecvState aNextState, TInt aBufLen = SymbianAvctp::ENormalHeaderLength); |
|
80 |
|
81 // From CActive |
|
82 void DoCancel(); |
|
83 void RunL(); |
|
84 TInt RunError(TInt aError); |
|
85 |
|
86 // Other |
|
87 void ChangeState(TRecvState aNextState); |
|
88 void SetPacketInfo(TDes8& aHeader); |
|
89 }; |
|
90 |
|
91 #endif // AVCTPRECEIVER_H |