|
1 /* |
|
2 * Copyright (c) 2009-2010 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 * Initial Contributors: |
|
9 * Nokia Corporation - initial contribution. |
|
10 * Contributors: |
|
11 * |
|
12 * Description: |
|
13 * MSRP Implementation |
|
14 * |
|
15 */ |
|
16 |
|
17 |
|
18 // Include Files |
|
19 #include "MsrpCommon.h" |
|
20 #include "CMSRPConnectionListener.h" |
|
21 #include "CMSRPSessionImplementation.h" |
|
22 #include "MMSRPServerInterface.h" |
|
23 |
|
24 |
|
25 // Member Functions |
|
26 |
|
27 CMSRPConnectionListener* CMSRPConnectionListener::NewL( |
|
28 CMSRPSessionImplementation& aSessionImpl, |
|
29 MMSRPServerInterface& aServerInterface ) |
|
30 { |
|
31 // Perform construction. |
|
32 CMSRPConnectionListener* self = |
|
33 new ( ELeave ) CMSRPConnectionListener( |
|
34 aSessionImpl, aServerInterface ); |
|
35 return self; |
|
36 } |
|
37 |
|
38 |
|
39 CMSRPConnectionListener::~CMSRPConnectionListener() |
|
40 { |
|
41 // Cancel any outstanding requests. |
|
42 Cancel(); |
|
43 } |
|
44 |
|
45 |
|
46 CMSRPConnectionListener::CMSRPConnectionListener( |
|
47 CMSRPSessionImplementation& aSessionImpl, |
|
48 MMSRPServerInterface& aServerInterface ) |
|
49 : CMSRPListenerBase( aSessionImpl, aServerInterface, EPriorityStandard ) |
|
50 { |
|
51 } |
|
52 |
|
53 |
|
54 void CMSRPConnectionListener::ConnectL( const TDesC8& aRemoteHost, |
|
55 const TUint aRemotePort, |
|
56 const TDesC8& aRemoteSessionID ) |
|
57 { |
|
58 if ( !IsActive() ) |
|
59 { |
|
60 // Connection request to server |
|
61 iServerInterface.Connect( aRemoteHost, aRemotePort, aRemoteSessionID, iStatus ); |
|
62 |
|
63 // Set this handler to active so that it can receive requests. |
|
64 SetActive(); |
|
65 } |
|
66 else |
|
67 { |
|
68 User::Leave( KErrInUse ); |
|
69 } |
|
70 } |
|
71 |
|
72 |
|
73 void CMSRPConnectionListener::RunL() |
|
74 { |
|
75 iSessionImpl.ConnectionEstablishedL( iStatus.Int() ); |
|
76 } |
|
77 |
|
78 |
|
79 void CMSRPConnectionListener::DoCancel() |
|
80 { |
|
81 // not possible to cancel the connect/disconnect sequence |
|
82 } |