|
1 /* |
|
2 * Copyright (c) 2005-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #if (!defined __T_DATA_RAVDP_H__ ) |
|
20 #define __T_DATA_RAVDP__H__ |
|
21 |
|
22 // EPOC Includes |
|
23 #include <test/datawrapper.h> |
|
24 #include <gavdp.h> |
|
25 #include <bluetoothav.h> |
|
26 |
|
27 // User includes |
|
28 #include "DataWrapperBase.h" |
|
29 |
|
30 |
|
31 /** |
|
32 * Test Active Notification class |
|
33 * |
|
34 */ |
|
35 class CT_DataRGavdp : public CDataWrapperBase, |
|
36 public MGavdpUser |
|
37 { |
|
38 public: |
|
39 /** |
|
40 * Two phase constructor |
|
41 */ |
|
42 static CT_DataRGavdp* NewL(); |
|
43 |
|
44 /** |
|
45 * Public destructor |
|
46 */ |
|
47 ~CT_DataRGavdp(); |
|
48 |
|
49 /** |
|
50 * Process a command read from the ini file |
|
51 * |
|
52 * @param aDataWrapper test step requiring command to be processed |
|
53 * @param aCommand the command to process |
|
54 * @param aSection the entry in the ini file requiring the command to be processed |
|
55 * |
|
56 * @return ETrue if the command is processed |
|
57 */ |
|
58 virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
59 |
|
60 /** |
|
61 * Return a pointer to the object that the data wraps |
|
62 * |
|
63 * @return pointer to the object that the data wraps |
|
64 */ |
|
65 virtual TAny* GetObject() { return iRGavdp; } |
|
66 |
|
67 /** |
|
68 * Set the object that the data wraps |
|
69 * |
|
70 * @param aObject object that the wrapper is testing |
|
71 * |
|
72 */ |
|
73 virtual void SetObjectL(TAny* aAny); |
|
74 |
|
75 /** |
|
76 * The object will no longer be owned by this |
|
77 * |
|
78 * @leave KErrNotSupported if the the function is not supported |
|
79 */ |
|
80 virtual void DisownObjectL(); |
|
81 |
|
82 inline virtual TCleanupOperation CleanupOperation(); |
|
83 |
|
84 // MGavdpUser implemention |
|
85 virtual void GAVDP_ConnectConfirm(const TBTDevAddr& aDeviceAddr); |
|
86 virtual void GAVDP_SEPDiscovered(const TAvdtpSEPInfo& aSEP); |
|
87 virtual void GAVDP_SEPDiscoveryComplete(); |
|
88 virtual void GAVDP_SEPCapability(TAvdtpServiceCapability* aCapability); |
|
89 virtual void GAVDP_SEPCapabilityComplete(); |
|
90 virtual void GAVDP_AbortStreamConfirm(); |
|
91 virtual void GAVDP_StartStreamsConfirm(); |
|
92 virtual void GAVDP_SuspendStreamsConfirm(); |
|
93 virtual void GAVDP_SecurityControlConfirm(const TDesC8& aResponseData); |
|
94 virtual void GAVDP_ConfigurationConfirm(); |
|
95 virtual void GAVDP_ConfigurationStartIndication(TSEID aLocalSEID, TSEID aRemoteSEID); |
|
96 virtual TInt GAVDP_ConfigurationIndication(TAvdtpServiceCapability* aCapability); |
|
97 virtual TInt GAVDP_ConfigurationEndIndication(); |
|
98 virtual TInt GAVDP_StartIndication(TSEID aSEID); |
|
99 virtual TInt GAVDP_SuspendIndication(TSEID aSEID); |
|
100 virtual TInt GAVDP_SecurityControlIndication(TSEID aSEID, TDes8& aSecurityDataInOut); |
|
101 virtual void GAVDP_AbortIndication(TSEID aSEID); |
|
102 virtual void GAVDP_ReleaseIndication(TSEID aSEID); |
|
103 virtual void GAVDP_BearerReady(RSocket aSocket, const TAvdtpSockAddr& aAddress); |
|
104 virtual void GAVDP_Error(TInt aError, const TDesC8& aErrorData); |
|
105 |
|
106 protected: |
|
107 /** |
|
108 * Protected constructor. First phase construction |
|
109 */ |
|
110 CT_DataRGavdp(); |
|
111 |
|
112 /** |
|
113 * Second phase construction |
|
114 */ |
|
115 void ConstructL(); |
|
116 |
|
117 void RunL(CActive* aActive, TInt aIndex); |
|
118 |
|
119 private: |
|
120 |
|
121 static void CleanupOperation(TAny* aAny); |
|
122 |
|
123 enum |
|
124 { |
|
125 EGAVDP_NoneEvent, |
|
126 EGAVDP_ConnectConfirm, |
|
127 EGAVDP_SEPDiscovered, |
|
128 EGAVDP_SEPDiscoveryComplete, |
|
129 EGAVDP_SEPCapability, |
|
130 EGAVDP_SEPCapabilityComplete, |
|
131 EGAVDP_AbortStreamConfirm, |
|
132 EGAVDP_StartStreamsConfirm, |
|
133 EGAVDP_SuspendStreamsConfirm, |
|
134 EGAVDP_SecurityControlConfirm, |
|
135 EGAVDP_ConfigurationConfirm, |
|
136 EGAVDP_ConfigurationStartIndication, |
|
137 EGAVDP_ConfigurationIndication, |
|
138 EGAVDP_ConfigurationEndIndication, |
|
139 EGAVDP_StartIndication, |
|
140 EGAVDP_SuspendIndication, |
|
141 EGAVDP_SecurityControlIndication, |
|
142 EGAVDP_AbortIndication, |
|
143 EGAVDP_ReleaseIndication, |
|
144 EGAVDP_BearerReady, |
|
145 EGAVDP_Error, |
|
146 }; |
|
147 TBool ReadExpectedEventsFromConfig(const TTEFSectionName& aSection); |
|
148 TBool ConvertEvents(TDesC &aEventStr, RArray<TUint>& aEvent); |
|
149 void SetEventOutstanding(); |
|
150 void CheckEvent(TUint aEvent); |
|
151 void CheckLocalSEID(TSEID aSEID); |
|
152 |
|
153 /** |
|
154 * Helper methods |
|
155 */ |
|
156 |
|
157 void DestroyData(); |
|
158 void DoCmdConstructor(); |
|
159 void DoCmdOpen(const TTEFSectionName& aSection); |
|
160 void DoCmdListen(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
161 void DoCmdClose(); |
|
162 void DoCmdCancel(); |
|
163 void DoCmdConnect(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
164 void DoCmdDiscoverRemoteSEPs(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
165 void DoCmdGetRemoteSEPCapabilities(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
166 void DoCmdRegisterSEP(const TTEFSectionName& aSection); |
|
167 void DoCmdBeginConfiguringRemoteSEP(const TTEFSectionName& aSection); |
|
168 void DoCmdBeginConfiguringLocalSEP(const TTEFSectionName& aSection); |
|
169 void DoCmdAddSEPCapability(const TTEFSectionName& aSection); |
|
170 void DoCmdCommitSEPConfiguration(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
171 void DoCmdStartStream(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
172 void DoCmdSuspendStream(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
173 void DoCmdAbortStream(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
174 void DoCmdSendSecurityControl(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
175 void DoCmdCreateBearerSockets(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
176 void DoCmdMaxSecurityControlLength(const TTEFSectionName& aSection); |
|
177 void DoCmdShutdown(); |
|
178 void DoCmdDestructor(); |
|
179 |
|
180 void Read(const TDesC& aSection, const TInt aAsyncErrorIndex); |
|
181 void Send(const TDesC& aSection, const TInt aAsyncErrorIndex); |
|
182 void CloseBearerSockets(); |
|
183 void IncreaseOutstanding(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
184 |
|
185 TBool ConvertSEIDs(TDesC &aSEIDsStr, RArray<TUint>& aSEIDs); |
|
186 TBool isExistSEID(TUint aSEID); |
|
187 |
|
188 private: |
|
189 RGavdp* iRGavdp; |
|
190 TBTDevAddr* iRemoteAddr; |
|
191 RArray<TUint> iExpectedEvent; |
|
192 TInt iExpectedEventCount; |
|
193 TInt iEventCount; |
|
194 RArray<TUint> iExistRemoteSEIDs; |
|
195 TInt iExpectedSEPsCount; |
|
196 TInt iDiscoverdSEPsCount; |
|
197 RPointerArray<TAvdtpSEPInfo> iRemoteSEPs; |
|
198 TAvdtpServiceCategory iSrvCategory; |
|
199 RPointerArray<TAvdtpServiceCapability> iRemoteCapabilities; |
|
200 TFixedArray<RSocket, 3> iSockets; |
|
201 HBufC8* iReadBuffer; |
|
202 TPtr8 iReadBufferDes; |
|
203 HBufC8* iReadExpectBuffer; |
|
204 HBufC8* iSendBuffer; |
|
205 HBufC8* iExpectedResponseSecurityData; |
|
206 TSEID iLocalSEID; |
|
207 TSEID iRemoteSEID; |
|
208 |
|
209 CActiveCallback* iActive; |
|
210 TInt iCmdIndex; |
|
211 |
|
212 TInt iConfigReturnCode; |
|
213 TInt iConfigEndReturnCode; |
|
214 |
|
215 }; |
|
216 |
|
217 #endif /* __T_DATA_RGAVDP_H__*/ |