|
1 /* |
|
2 * Copyright (c) 2005 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: See class definition below. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CTCSIPCLIENTDISCOVERYCONTAINER_H__ |
|
19 #define __CTCSIPCLIENTDISCOVERYCONTAINER_H__ |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <badesca.h> |
|
24 |
|
25 #include <sipclientdiscoveryobserver.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CTcSIPContext; |
|
29 class CSIPClientDiscovery; |
|
30 |
|
31 |
|
32 // ENUMERATIONS |
|
33 enum TTcClientDiscoveryEventType |
|
34 { |
|
35 ETcClientDiscoveryEventUnset, |
|
36 ETcClientDiscoveryChannelResolved, |
|
37 ETcClientDiscoveryClientNotFound, |
|
38 ETcClientDiscoveryError |
|
39 }; |
|
40 |
|
41 |
|
42 // CLASS DEFINITIONS |
|
43 |
|
44 /** |
|
45 * Simple container for received ClientDiscovery events |
|
46 */ |
|
47 class TTcClientDiscoveryEvent |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 |
|
51 /// Default constructor |
|
52 TTcClientDiscoveryEvent() : iType( ETcClientDiscoveryEventUnset ), |
|
53 iChannel( TUid::Uid( 0 ) ), |
|
54 iRequestId( 0 ), |
|
55 iError( KErrNone ) { } |
|
56 |
|
57 /// Destructor |
|
58 ~TTcClientDiscoveryEvent() { } |
|
59 |
|
60 public: // Data |
|
61 |
|
62 /// Event type |
|
63 TTcClientDiscoveryEventType iType; |
|
64 |
|
65 /// Uid of channel event was concerning |
|
66 TUid iChannel; |
|
67 |
|
68 /// Id of request event was concerning |
|
69 TUint32 iRequestId; |
|
70 |
|
71 /// System-wide or ClientDiscovery specific error code |
|
72 TInt iError; |
|
73 |
|
74 }; |
|
75 |
|
76 /** |
|
77 * CTcSIPClientDiscoveryContainer uses SIP ClientDiscovery API |
|
78 */ |
|
79 class CTcSIPClientDiscoveryContainer |
|
80 : public CBase, |
|
81 public MSIPClientDiscoveryObserver |
|
82 { |
|
83 public: // Constructors and destructor |
|
84 |
|
85 /** |
|
86 * Static constructor. |
|
87 * |
|
88 * @param aContext Reference to test context object. |
|
89 * @param aUid Uid of ClientDiscovery API user |
|
90 * @return An initialized instance of this class. |
|
91 */ |
|
92 static CTcSIPClientDiscoveryContainer* NewL( CTcSIPContext& aContext, TUid aUid ); |
|
93 |
|
94 /// Destructor |
|
95 ~CTcSIPClientDiscoveryContainer(); |
|
96 |
|
97 private: |
|
98 |
|
99 /** |
|
100 * Constructor. |
|
101 * |
|
102 * @param aContext Reference to test context object. |
|
103 */ |
|
104 CTcSIPClientDiscoveryContainer( CTcSIPContext& aContext, TUid aUid ); |
|
105 |
|
106 /** |
|
107 * Second phase constructor |
|
108 * |
|
109 */ |
|
110 void ConstructL(); |
|
111 |
|
112 /// Default constructor. Not implemented. |
|
113 CTcSIPClientDiscoveryContainer(); |
|
114 |
|
115 |
|
116 public: // From MSIPClientDiscoveryObserver |
|
117 |
|
118 void ChannelResolvedL( TUid aChannel, TUint32 aRequestId ); |
|
119 |
|
120 void ClientNotFoundL( TUint32 aRequestId, |
|
121 TUint aStatusCode, |
|
122 RStringF aReasonPhrase, |
|
123 RPointerArray<CSIPHeaderBase> aHeaders, |
|
124 HBufC8* aContent ); |
|
125 |
|
126 void ErrorOccurred( TInt aError, TUint32 aRequestId ); |
|
127 |
|
128 public: // New methods |
|
129 |
|
130 TTcClientDiscoveryEvent ReceivedClientDiscoveryEventL( TInt aTimeout ); |
|
131 |
|
132 |
|
133 /// @return Reference to the contained CSIPClientDiscovery object. |
|
134 inline CSIPClientDiscovery& ClientDiscovery() { return *iSipClientDiscovery; } |
|
135 |
|
136 |
|
137 private: |
|
138 |
|
139 /** |
|
140 * Add the received event to the received events queue. |
|
141 * The item is copied to the internal array. |
|
142 * |
|
143 * @param aClientDiscoveryEvent Referece to received event |
|
144 */ |
|
145 void QueueReceivedEventL( TTcClientDiscoveryEvent& aClientDiscoveryEvent ); |
|
146 |
|
147 /** |
|
148 * CDeltaTimer callback. Called when the timer entry expires. |
|
149 * |
|
150 * @param aSelf Pointer to self |
|
151 * @return KErrNone |
|
152 */ |
|
153 static TInt ReceiveTimeout( TAny* aSelf ); |
|
154 |
|
155 |
|
156 private: // data |
|
157 |
|
158 /// Active scheduler wrapper for async waiting. Owned. |
|
159 CActiveSchedulerWait iActiveWait; |
|
160 |
|
161 /// Timeout timer. Owned. |
|
162 CDeltaTimer* iTimer; |
|
163 |
|
164 /// Timeout entry. Owned. |
|
165 TDeltaTimerEntry iReceiveTimeout; |
|
166 |
|
167 /// Reference to the test context. Not owned. |
|
168 CTcSIPContext& iContext; |
|
169 |
|
170 /// Array of received challenges. Owned. |
|
171 CArrayFixSeg< TTcClientDiscoveryEvent > iReceivedEventsQueue; |
|
172 |
|
173 /// SIP ClientDiscovery. Owned. |
|
174 CSIPClientDiscovery* iSipClientDiscovery; |
|
175 |
|
176 /// Uid of ClientDiscovery user |
|
177 TUid iUid; |
|
178 }; |
|
179 |
|
180 #endif // __CTCSIPCLIENTDISCOVERYCONTAINER_H__ |