|
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 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #ifndef CHANNELCONTROLLERS_H |
|
24 #define CHANNELCONTROLLERS_H |
|
25 |
|
26 #include <es_sock.h> |
|
27 #include <avctpservices.h> |
|
28 |
|
29 #include "avctpcommon.h" |
|
30 #include "avctpremotedevices.h" |
|
31 #include "avctpserviceutils.h" |
|
32 |
|
33 using namespace SymbianAvctp; |
|
34 |
|
35 /** |
|
36 CBaseChController |
|
37 |
|
38 @internalComponent |
|
39 */ |
|
40 NONSHARABLE_CLASS(CBaseChController) : public CActive |
|
41 { |
|
42 public: |
|
43 ~CBaseChController(); |
|
44 virtual void AttachRequest(const TBTDevAddr& aBTDevice); |
|
45 virtual void DetachRequest(const TBTDevAddr& aBTDevice); |
|
46 virtual void RefuseAttach(const TBTDevAddr& aBTDevice); |
|
47 virtual void Listen(); |
|
48 virtual void Listen(const TBTDevAddr& aBTDevice); |
|
49 virtual void AgreeAttachment(const TBTDevAddr& aBTDevice); |
|
50 protected: |
|
51 CBaseChController(MControlChannelNotify& aNotify, RSocketServ& aSockServer, TControlIoctls aIoctl, SymbianAvctp::TPid aPid, TInt aChannel); |
|
52 void BaseConstructL(); |
|
53 |
|
54 // From CActive |
|
55 void DoCancel(); |
|
56 void RunL(); |
|
57 TInt RunError(TInt aError); |
|
58 |
|
59 virtual void Ioctl(); |
|
60 virtual void NotifyIoctlCompleted(TInt aError) = 0; |
|
61 virtual void NotifyIoctlError(TInt aError) = 0; |
|
62 protected: |
|
63 static const TInt KDefaultMtu = 335; |
|
64 MControlChannelNotify& iNotify; |
|
65 RSocketServ& iSockServer; |
|
66 RSocket iTransport; |
|
67 TControlIoctls iIoctl; |
|
68 TPckgBuf<TControlIoctlMessage> iIoctlBuf; |
|
69 SymbianAvctp::TPid iPid; |
|
70 TInt iChannel; |
|
71 }; |
|
72 |
|
73 /** |
|
74 CPrimaryChannelController |
|
75 |
|
76 @internalComponent |
|
77 */ |
|
78 NONSHARABLE_CLASS(CPrimaryChannelController) : public CBaseChController |
|
79 { |
|
80 public: |
|
81 static CPrimaryChannelController* NewL(MControlChannelNotify& aNotify, RSocketServ& aSockServer, SymbianAvctp::TPid aPid); |
|
82 static CPrimaryChannelController* NewLC(MControlChannelNotify& aNotify, RSocketServ& aSockServer, SymbianAvctp::TPid aPid); |
|
83 ~CPrimaryChannelController(); |
|
84 |
|
85 // override CBaseChController methods |
|
86 void AttachRequest(const TBTDevAddr& aBTDevice); |
|
87 void DetachRequest(const TBTDevAddr& aBTDevice); |
|
88 void RefuseAttach(const TBTDevAddr& aBTDevice); |
|
89 void Listen(); |
|
90 void AgreeAttachment(const TBTDevAddr& aBTDevice); |
|
91 private: |
|
92 CPrimaryChannelController(MControlChannelNotify& aNotify, RSocketServ& aSockServer, SymbianAvctp::TPid aPid); |
|
93 void ConstructL(); |
|
94 |
|
95 // implements CBaseChController pure methods |
|
96 void NotifyIoctlCompleted(TInt aError); |
|
97 void NotifyIoctlError(TInt aError); |
|
98 }; |
|
99 |
|
100 /** |
|
101 CSecondaryChannelController |
|
102 |
|
103 @internalComponent |
|
104 */ |
|
105 NONSHARABLE_CLASS(CSecondaryChannelController) : public CBaseChController |
|
106 { |
|
107 public: |
|
108 static CSecondaryChannelController* NewL(MControlChannelNotify& aNotify, RSocketServ& aSockServer, SymbianAvctp::TPid aPid); |
|
109 static CSecondaryChannelController* NewLC(MControlChannelNotify& aNotify, RSocketServ& aSockServer, SymbianAvctp::TPid aPid); |
|
110 ~CSecondaryChannelController(); |
|
111 void AttachRequest(const TBTDevAddr& aBTDevice); |
|
112 void DetachRequest(const TBTDevAddr& aBTDevice); |
|
113 void RefuseAttach(const TBTDevAddr& aBTDevice); |
|
114 void AttachPassively(const TBTDevAddr& aBTDevice); |
|
115 void Listen(); |
|
116 void AgreeAttachment(const TBTDevAddr& aBTDevice); |
|
117 private: |
|
118 CSecondaryChannelController(MControlChannelNotify& aNotify, RSocketServ& aSockServer, SymbianAvctp::TPid aPid); |
|
119 void ConstructL(); |
|
120 |
|
121 void NotifyIoctlCompleted(TInt aError); |
|
122 void NotifyIoctlError(TInt aError); |
|
123 }; |
|
124 |
|
125 #endif /*CHANNELCONTROLLERS_H*/ |