|
1 /** @file |
|
2 * Copyright (c) 2005-2006 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: Defines RUpnpDispatcherSession class |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <e32math.h> |
|
20 #include "upnpmhcommon.h" |
|
21 #include "upnpdispatchersession.h" |
|
22 |
|
23 #ifdef _DEBUG |
|
24 #define KLogFile _L("UPnPStack.txt") |
|
25 #endif |
|
26 #include "upnpcustomlog.h" |
|
27 |
|
28 // Number of message slots to reserve for this client server session. |
|
29 |
|
30 #if defined(__HN_31__) || defined(__HN_32__) |
|
31 const TUid KServerUid3 = |
|
32 {0x2000F881}; |
|
33 #else |
|
34 const TUid KServerUid3 = |
|
35 {0x10005BCD}; |
|
36 #endif |
|
37 |
|
38 #ifdef __WINS__ |
|
39 static const TUint KServerMinHeapSize = 0x100000; // 4K |
|
40 static const TUint KServerMaxHeapSize = 0x1000000; // 16M |
|
41 #endif |
|
42 |
|
43 const TInt KServerMessageSlots = 10; //Number of message slots available per session. |
|
44 const TInt KServerRetryCount = 2; |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // RUpnpDispatcherSession::RUpnpDispatcherSession |
|
48 // C++ default constructor can NOT contain any code, that |
|
49 // might leave. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 RUpnpDispatcherSession::RUpnpDispatcherSession() : |
|
53 RUpnpSessionBase(), iParameter0( NULL, 0, 0 ) |
|
54 { |
|
55 // No implementation required |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // RUpnpDispatcherSession::Connect |
|
60 // Establish connection to server. |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 TInt RUpnpDispatcherSession::Connect() |
|
64 { |
|
65 return RUpnpSessionBase::Connect( KMessageHandlerName, TVersion( |
|
66 KMessageHandlerMajorVersionNumber, KMessageHandlerMinorVersionNumber, |
|
67 KMessageHandlerBuildVersionNumber ), KServerMessageSlots, |
|
68 KServerRetryCount, KMessageHandlerFilename, KServerUid3 ); |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // RUpnpDispatcherSession::RequestAddLocalDevice |
|
73 // Client requests server to add local device. |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 void RUpnpDispatcherSession::RequestAddLocalDevice( TRequestStatus& aStatus, |
|
77 TUpnpAddLocalDevice& aDevice, TPtr8& aBuffer ) |
|
78 { |
|
79 LOG_FUNC_NAME; |
|
80 iParameter0.Set( reinterpret_cast<TUint8*>( &aDevice ), sizeof(aDevice ), |
|
81 sizeof(aDevice ) ); |
|
82 SendReceive( EAddLocalDevice, TIpcArgs( &iParameter0, &aBuffer ), aStatus ); |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // RUpnpDispatcherSession::RequestRemoveLocalDevice |
|
87 // Client requests server to remove local device. |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 void RUpnpDispatcherSession::RequestRemoveLocalDevice( |
|
91 TRequestStatus& aStatus, const TDesC8& aUuid ) |
|
92 { |
|
93 LOG_FUNC_NAME; |
|
94 iParameter0.Set( (TUint8*)aUuid.Ptr( ), aUuid.Size( ), aUuid.Size( ) ); |
|
95 SendReceive( ERemoveLocalDevice, TIpcArgs( &iParameter0 ), aStatus ); |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // RUpnpDispatcherSession::RequestRemoveSilentLocalDevice |
|
100 // Client requests server to remove local device. |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 void RUpnpDispatcherSession::RequestRemoveSilentLocalDevice( |
|
104 TRequestStatus& aStatus, const TDesC8& aUuid ) |
|
105 { |
|
106 LOG_FUNC_NAME; |
|
107 iParameter0.Set( (TUint8*)aUuid.Ptr( ), aUuid.Size( ), aUuid.Size( ) ); |
|
108 TIpcArgs ipcArgs; |
|
109 ipcArgs.Set( 0, &iParameter0 ); |
|
110 SendReceive( ERemoveSilentLocalDevice, ipcArgs, aStatus ); |
|
111 LOGS("RUpnpDispatcherSession::RequestRemoveSilentLocalDevice passed"); |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // RUpnpDispatcherSession::RequestAddControlPoint |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 void RUpnpDispatcherSession::RequestAddControlPoint( TRequestStatus& aStatus ) |
|
119 { |
|
120 SendReceive( EAddControlPointClient, aStatus ); |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // RUpnpDispatcherSession::RequestRemoveControlPoint |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 void RUpnpDispatcherSession::RequestRemoveControlPoint( |
|
128 TRequestStatus& aStatus ) |
|
129 { |
|
130 SendReceive( ERemoveControlPointClient, aStatus ); |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // RUpnpDispatcherSession::RequestStopFiltering |
|
135 // |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 void RUpnpDispatcherSession::RequestStopFiltering( const TDesC8& aUuids ) |
|
139 { |
|
140 // Retruned error is ignored |
|
141 SendReceive( EStopFilteringDevice, TIpcArgs( &aUuids ) ); |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // RUpnpDispatcherSession::RequestGetDeviceListSize |
|
146 // Client requests server to get device list size. |
|
147 // ----------------------------------------------------------------------------- |
|
148 // |
|
149 void RUpnpDispatcherSession::RequestGetDeviceListSize( |
|
150 TRequestStatus& aStatus, TUpnpGetDeviceListSize& aSize ) |
|
151 { |
|
152 iParameter0.Set( reinterpret_cast<TUint8*>(&aSize), sizeof(aSize ), |
|
153 sizeof(aSize ) ); |
|
154 aStatus = KRequestPending; |
|
155 SendReceive( EGetDeviceListSize, TIpcArgs( &iParameter0 ), aStatus ); |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // RUpnpDispatcherSession::RequestGetDeviceList |
|
160 // Client requests server to get device list. |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 void RUpnpDispatcherSession::RequestGetDeviceList( TRequestStatus& aStatus, |
|
164 TPtr8& devPtr, TPtr8& servPtr ) const |
|
165 { |
|
166 LOG_FUNC_NAME; |
|
167 SendReceive( EGetDeviceList, TIpcArgs( &devPtr, &servPtr ), aStatus ); |
|
168 } |
|
169 |
|
170 // ----------------------------------------------------------------------------- |
|
171 // RUpnpDispatcherSession::RequestSsdpSearch |
|
172 // Client requests server to start SSDP search. |
|
173 // ----------------------------------------------------------------------------- |
|
174 // |
|
175 void RUpnpDispatcherSession::RequestSsdpSearch( TRequestStatus& aStatus, |
|
176 TDesC8& aSearch, TDesC8& aMX ) |
|
177 { |
|
178 LOG_FUNC_NAME; |
|
179 SendReceive( ESsdpSearch, TIpcArgs( &aSearch, &aMX ), aStatus ); |
|
180 } |
|
181 |
|
182 // ----------------------------------------------------------------------------- |
|
183 // RUpnpDispatcherSession::RequestActiveIap |
|
184 // Client requests server active IAP. |
|
185 // ----------------------------------------------------------------------------- |
|
186 // |
|
187 void RUpnpDispatcherSession::RequestActiveIap( TRequestStatus& aStatus, |
|
188 TInt& aIap ) |
|
189 { |
|
190 LOG_FUNC_NAME; |
|
191 iParameter0.Set( reinterpret_cast<TUint8*>( &aIap ), sizeof(TInt), |
|
192 sizeof(TInt) ); |
|
193 SendReceive( EActiveIap, TIpcArgs( &iParameter0 ), aStatus ); |
|
194 } |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // RUpnpDispatcherSession::RequestStartSsdp |
|
198 // Client requests server to start SSDP. |
|
199 // ----------------------------------------------------------------------------- |
|
200 // |
|
201 void RUpnpDispatcherSession::RequestStartSsdpL() const |
|
202 { |
|
203 LOG_FUNC_NAME; |
|
204 User::LeaveIfError( SendReceive( EStartSsdp, TIpcArgs() ) ); |
|
205 } |
|
206 |
|
207 // ----------------------------------------------------------------------------- |
|
208 // RUpnpDispatcherSession::RequestCheckError |
|
209 // |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
|
212 void RUpnpDispatcherSession::RequestCheckError( TInt& aError ) |
|
213 { |
|
214 TPckgBuf<TInt> pckgTInt; |
|
215 TIpcArgs ipcArgs; |
|
216 pckgTInt = aError; |
|
217 ipcArgs.Set( 0, &pckgTInt ); |
|
218 |
|
219 SendReceive( ECheckError, ipcArgs ); |
|
220 |
|
221 aError = pckgTInt( ); |
|
222 } |
|
223 |
|
224 // ----------------------------------------------------------------------------- |
|
225 // RUpnpDispatcherSession::RequestStop |
|
226 // Client requests server to cancel. |
|
227 // ----------------------------------------------------------------------------- |
|
228 // |
|
229 void RUpnpDispatcherSession::RequestStop() |
|
230 { |
|
231 LOG_FUNC_NAME; |
|
232 TInt err = SendReceive( ECancelRequest, TIpcArgs( ) ); |
|
233 if ( err != KErrNone ) |
|
234 { |
|
235 LOGS("RUpnpDispatcherSession::RequestStop - Request for RMessage Cancel Failed"); |
|
236 } |
|
237 } |
|
238 |
|
239 // End of File |