|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Capability Exchange |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CMUSAVACAPABILITYEXCHANGE_H |
|
19 #define CMUSAVACAPABILITYEXCHANGE_H |
|
20 |
|
21 #include <e32base.h> // CBase |
|
22 #include "musunittesting.h" |
|
23 |
|
24 class MMusAvaCapabilityQueryObserver; |
|
25 class CMusAvaCapabilityQueryBase; |
|
26 class CSIPClientTransaction; |
|
27 class CSIPServerTransaction; |
|
28 class CMusAvaTerminal; |
|
29 class CMusAvaCapability; |
|
30 |
|
31 /** |
|
32 * Capability Exchange |
|
33 * |
|
34 * @lib musavailabilityplugin.dll |
|
35 */ |
|
36 class CMusAvaCapabilityExchange : public CBase |
|
37 { |
|
38 |
|
39 public: // constructors and destructor |
|
40 |
|
41 static CMusAvaCapabilityExchange* NewL( const TDesC8& aTerminalId, |
|
42 MMusAvaCapabilityQueryObserver& aQueryObserver ); |
|
43 |
|
44 virtual ~CMusAvaCapabilityExchange(); |
|
45 |
|
46 |
|
47 private: // constructors |
|
48 |
|
49 CMusAvaCapabilityExchange( |
|
50 MMusAvaCapabilityQueryObserver& aQueryObserver ); |
|
51 |
|
52 void ConstructL( const TDesC8& aTerminalId ); |
|
53 |
|
54 |
|
55 public: // new functions |
|
56 |
|
57 |
|
58 /** |
|
59 * Returns query observer |
|
60 * |
|
61 * @return query observer |
|
62 */ |
|
63 MMusAvaCapabilityQueryObserver& QueryObserver() const; |
|
64 |
|
65 /** |
|
66 * Returns terminal ID |
|
67 * |
|
68 * @return terminal ID |
|
69 */ |
|
70 const TDesC8& TerminalId() const; |
|
71 |
|
72 /** |
|
73 * Called when answer to query has been received |
|
74 * |
|
75 * @param aResponse SIP client transaction representing |
|
76 * the response to query |
|
77 */ |
|
78 void AnswerToQueryReceived( const CSIPClientTransaction& aResponse ); |
|
79 |
|
80 /** |
|
81 * Called when capability query has been received |
|
82 * |
|
83 * @param aQuery SIP server transaction representing |
|
84 * a capability query, ownership is transferred |
|
85 */ |
|
86 void QueryReceived( CSIPServerTransaction* aQuery ); |
|
87 |
|
88 /** |
|
89 * Called when capability query has been canceled |
|
90 * |
|
91 * @param aError system wide or SIP error code |
|
92 * @param aTransaction SIP client transaction |
|
93 */ |
|
94 void CancelQuery( TInt aError, const CSIPClientTransaction& aTransaction ); |
|
95 |
|
96 |
|
97 public: // new functions |
|
98 |
|
99 |
|
100 /** |
|
101 * Adds capability |
|
102 * |
|
103 * @param aCapability a capability, ownership is transferred |
|
104 */ |
|
105 void AddCapabilityL( CMusAvaCapability* aCapability ); |
|
106 |
|
107 /** |
|
108 * Returns all discovered terminals |
|
109 * |
|
110 * @return all discovered terminals |
|
111 */ |
|
112 const RPointerArray<CMusAvaTerminal>& Terminals(); |
|
113 |
|
114 /** |
|
115 * Returns all capabilities |
|
116 * |
|
117 * @return all capabilities |
|
118 */ |
|
119 const RPointerArray<CMusAvaCapability>& Capabilities(); |
|
120 |
|
121 |
|
122 public: // for internal use only |
|
123 |
|
124 /** |
|
125 * Returns terminal based on remote URI |
|
126 * |
|
127 * @return terminal based on remote URI |
|
128 */ |
|
129 CMusAvaTerminal& TerminalL( const TDesC8& aRemoteUri ); |
|
130 |
|
131 |
|
132 private: // new functions |
|
133 |
|
134 CMusAvaTerminal& TerminalL( const CSIPServerTransaction& aQuery ); |
|
135 void DoQueryReceivedL( CSIPServerTransaction& aQuery ); |
|
136 void RejectQueryL( CSIPServerTransaction& aQuery, |
|
137 TInt aError ); |
|
138 TInt FindByFeature( CMusAvaCapability& aCapablity ); |
|
139 |
|
140 |
|
141 private: // data |
|
142 |
|
143 MMusAvaCapabilityQueryObserver& iQueryObserver; |
|
144 HBufC8* iTerminalId; |
|
145 RPointerArray<CMusAvaTerminal> iTerminals; |
|
146 RPointerArray<CMusAvaCapability> iCapabilities; |
|
147 |
|
148 MUS_UNITTEST ( UT_CMusAvaCapabilityExchange ) |
|
149 MUS_UNITTEST ( UT_CMusAvaCapabilitySipAgent ) |
|
150 }; |
|
151 |
|
152 |
|
153 #endif // CMUSAVACAPABILITYEXCHANGE_H |