|
1 // Copyright (c) 2008-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 // testcontrolchannel.h |
|
15 // Contains declarations of CTestRControlChannel class |
|
16 // |
|
17 // |
|
18 |
|
19 #ifndef __TEST_RCONTROL_CHANNEL_H__ |
|
20 #define __TEST_RCONTROL_CHANNEL_H__ |
|
21 |
|
22 // System Includes |
|
23 #include <testexecutestepbase.h> |
|
24 #include <e32base.h> |
|
25 #include <e32cmn.h> |
|
26 #include <e32std.h> |
|
27 #include <upnpparamset.h> |
|
28 #include <upnp/rpnpservicediscovery.h> |
|
29 #include <upnp/rpnpservicepublisher.h> |
|
30 #include <upnpparamset.h> |
|
31 #include <upnp/mpnpobserver.h> |
|
32 #include <upnp/pnpparameterbundle.h> |
|
33 #include <uri8.h> |
|
34 #include <inetprottextutils.h> |
|
35 #include <f32file.h> |
|
36 #include <upnp/rcontrolchannel.h> |
|
37 |
|
38 |
|
39 // User Includes |
|
40 #include "constants.h" |
|
41 |
|
42 class CRControlChannelObserver; |
|
43 class CUPnPRControlChannelAO; |
|
44 |
|
45 /* |
|
46 CTestRControlChannel class which is derived from the CTestStep and provides the |
|
47 functionalities to perform Create (and open) an individual TestStep (testcase or part testcase), Run a TestStep |
|
48 with defined pre and post processing, Abort a TestStep, Close a TestStep session. |
|
49 Also performed to run as control point or service point, performs a sequence of upnp operations |
|
50 and get back the results to compare them against expected results. |
|
51 */ |
|
52 class CTestRControlChannel : public CTestStep |
|
53 { |
|
54 public: |
|
55 CTestRControlChannel(); |
|
56 ~CTestRControlChannel(); |
|
57 |
|
58 virtual TVerdict doTestStepPreambleL(); |
|
59 virtual TVerdict doTestStepPostambleL(); |
|
60 virtual TVerdict doTestStepL(); |
|
61 |
|
62 |
|
63 private: |
|
64 void InitializeL(); |
|
65 void SequenceOperationsL(); |
|
66 void PerformDesiredOperationsL(const TDesC& aSequence); |
|
67 |
|
68 void OpenPublisherL(); |
|
69 void PublishDeviceL (TDesC& aOperationType); |
|
70 void PublishServiceL (const TDesC& aOperationType); |
|
71 void ExtractServiceDescriptionL (const TDesC& aConfigSection, CUPnPServiceRegisterParamSet& aServiceRegisterParamSet); |
|
72 void TokenizeStringL(const TDesC& aString, RArray<TPtrC>& aList, TChar aSeparator = ','); |
|
73 void SendNotificationsL(); |
|
74 void InitiateControlL(); |
|
75 void CleanUpObserverArray(); |
|
76 void SavePreviousLogFileL(); |
|
77 |
|
78 private: |
|
79 TBuf<KMaxBufLength> iScriptName; |
|
80 RPnPServicePublisher iPublisher; |
|
81 RPointerArray<CRControlChannelObserver> iObserverArray; |
|
82 CPeriodic* iTimer; |
|
83 CActiveScheduler* iScheduler; |
|
84 |
|
85 RConnection iConnection; |
|
86 RSocketServ iSocketServ; |
|
87 }; |
|
88 |
|
89 /* |
|
90 CRControlChannelObserver class which is derived from CBase and MPnPObserver to provide the |
|
91 following functionalities. It supports the methods capture the results when an |
|
92 upnp event is hit after performing any upnp operation. |
|
93 */ |
|
94 class CRControlChannelObserver: public CBase, MPnPObserver |
|
95 { |
|
96 public: |
|
97 static CRControlChannelObserver* NewL(CTestRControlChannel* aManager); |
|
98 ~CRControlChannelObserver(); |
|
99 void OnPnPEventL (RPnPParameterBundleBase& aServiceEventInfo); |
|
100 void OnPnPError (TInt aError); |
|
101 CTestRControlChannel& Manager(); |
|
102 void CopyResultBundlesL(const RPnPParameterBundle& aPnpBundle); |
|
103 private: |
|
104 CRControlChannelObserver(); |
|
105 void ConstructL(CTestRControlChannel* aManager); |
|
106 |
|
107 private: |
|
108 CTestRControlChannel* iManager; |
|
109 }; |
|
110 |
|
111 |
|
112 class CUPnPRControlChannelAO:public CActive |
|
113 { |
|
114 public: |
|
115 |
|
116 CUPnPRControlChannelAO(RControlChannel& aControlChannel,CTestRControlChannel* aManager); |
|
117 ~ CUPnPRControlChannelAO(); |
|
118 void ExtractSoapResponse(RBuf8& aSoapResponse); |
|
119 void RecvdataL(); |
|
120 void SenddataL(); |
|
121 void RunL(); |
|
122 void DoCancel(); |
|
123 static TInt TimerCallbackL ( TAny* aPtr ); |
|
124 |
|
125 private: |
|
126 enum Tstate |
|
127 { |
|
128 ERecv, |
|
129 EStop |
|
130 }; |
|
131 |
|
132 Tstate iState; |
|
133 RControlChannel& iControlChannel; |
|
134 TControlMessage iInComingAction; |
|
135 RBuf8 iIncomingActionBuffer; |
|
136 RBuf8 iOutgoingActionBuffer; |
|
137 RBuf8 iCompleteBuffer; |
|
138 TInt iExepecteBufLen; |
|
139 CTestRControlChannel* iManager; |
|
140 CPeriodic* iTimer; |
|
141 }; |
|
142 |
|
143 #endif //__TEST_RCONTROL_CHANNEL_H__ |