71
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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 the License "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 |
#ifndef TESTUTILCONNECTIONWAITER_H
|
|
20 |
#define TESTUTILCONNECTIONWAITER_H
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <CommDbConnPref.h>
|
|
24 |
|
|
25 |
#include <es_enum.h>
|
|
26 |
#include <es_sock.h>
|
|
27 |
#include <in_sock.h>
|
|
28 |
|
|
29 |
|
|
30 |
// FORWARD DECLARATIONS;
|
|
31 |
//class CCommDbOverrideSettings;
|
|
32 |
class MTestUtilConnectionObserver;
|
|
33 |
|
|
34 |
// CONSTANTS
|
|
35 |
|
|
36 |
// CLASS DECLARATION
|
|
37 |
|
|
38 |
/**
|
|
39 |
* CTestUtilConnectionWaiter
|
|
40 |
*/
|
|
41 |
class CTestUtilConnectionWaiter : public CActive
|
|
42 |
{
|
|
43 |
public:
|
|
44 |
|
|
45 |
/*
|
|
46 |
* NewL()
|
|
47 |
*/
|
|
48 |
IMPORT_C static CTestUtilConnectionWaiter* NewL(MTestUtilConnectionObserver* aObserver);
|
|
49 |
|
|
50 |
/*
|
|
51 |
* NewLC()
|
|
52 |
*/
|
|
53 |
IMPORT_C static CTestUtilConnectionWaiter* NewLC(MTestUtilConnectionObserver* aObserver);
|
|
54 |
|
|
55 |
/*
|
|
56 |
* ~CTestUtilConnection()
|
|
57 |
*/
|
|
58 |
IMPORT_C virtual ~CTestUtilConnectionWaiter();
|
|
59 |
|
|
60 |
/*
|
|
61 |
* WaitForConnection(TUint32 aIapId)
|
|
62 |
*
|
|
63 |
* Waits until connection is created. Asynchronous.
|
|
64 |
*
|
|
65 |
*/
|
|
66 |
IMPORT_C void WaitForConnection(TUint32 aIapId);
|
|
67 |
|
|
68 |
/*
|
|
69 |
* WaitUntilConnectionIsClosed(TUint32 aIapId)
|
|
70 |
*
|
|
71 |
* Waits until connection is closed. Asynchronous.
|
|
72 |
*
|
|
73 |
*/
|
|
74 |
IMPORT_C void WaitUntilConnectionIsClosed(TUint32 aIapId);
|
|
75 |
|
|
76 |
/*
|
|
77 |
* TBool IsConnectionActive()
|
|
78 |
*
|
|
79 |
* Checks if connection is active
|
|
80 |
*
|
|
81 |
*/
|
|
82 |
IMPORT_C TBool IsConnectionActive(TUint32 aIapId);
|
|
83 |
|
|
84 |
|
|
85 |
protected: // from CActive
|
|
86 |
|
|
87 |
/*
|
|
88 |
* RunL()
|
|
89 |
*
|
|
90 |
* Handle request completion events
|
|
91 |
*
|
|
92 |
*/
|
|
93 |
void RunL();
|
|
94 |
|
|
95 |
/*
|
|
96 |
* DoCancel()
|
|
97 |
*
|
|
98 |
* Cancel any outstanding requests
|
|
99 |
*
|
|
100 |
*/
|
|
101 |
void DoCancel();
|
|
102 |
|
|
103 |
// From MTestUtilConnectionObserver
|
|
104 |
|
|
105 |
private:
|
|
106 |
|
|
107 |
/*
|
|
108 |
* CTestUtilConnectionWaiter()
|
|
109 |
*/
|
|
110 |
CTestUtilConnectionWaiter(MTestUtilConnectionObserver* aObserver);
|
|
111 |
|
|
112 |
/*
|
|
113 |
* ConstructL()
|
|
114 |
*/
|
|
115 |
void ConstructL();
|
|
116 |
|
|
117 |
enum TConnectionWaiterState
|
|
118 |
{
|
|
119 |
ENoWaitState,
|
|
120 |
EWaitingConnection,
|
|
121 |
EWaitingConnectionClosed
|
|
122 |
};
|
|
123 |
|
|
124 |
private:
|
|
125 |
|
|
126 |
MTestUtilConnectionObserver* iObserver;
|
|
127 |
|
|
128 |
TUint32 iIapId;
|
|
129 |
|
|
130 |
RTimer iTimer;
|
|
131 |
|
|
132 |
RSocketServ iServ;
|
|
133 |
|
|
134 |
TInt iCheckCount;
|
|
135 |
|
|
136 |
TConnectionWaiterState iWaitState;
|
|
137 |
|
|
138 |
};
|
|
139 |
|
|
140 |
|
|
141 |
#endif
|