|
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 "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: active object, that monitors stopping of connection |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INTERNAL INCLUDES |
|
20 #include "vpnconnection.h" |
|
21 |
|
22 // CLASS HEADER |
|
23 #include "connectionstopper.h" |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // Two-phased constructor. |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CConnectionStopper* CConnectionStopper::NewL( CVpnConnection& aVpnConnection, |
|
32 MConnectionStopperCallback& aCallback ) |
|
33 { |
|
34 CConnectionStopper* self = new ( ELeave ) CConnectionStopper( aVpnConnection, |
|
35 aCallback ); |
|
36 return self; |
|
37 } |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // Destructor. |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 CConnectionStopper::~CConnectionStopper() |
|
44 { |
|
45 Cancel(); |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // Constructor. |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 CConnectionStopper::CConnectionStopper( CVpnConnection& aVpnConnection, |
|
53 MConnectionStopperCallback& aCallback ) |
|
54 : CActive( EPriorityStandard ), |
|
55 iVpnConnection( aVpnConnection ), |
|
56 iCallback( aCallback ) |
|
57 { |
|
58 CActiveScheduler::Add( this ); |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // Stops VPN connection asynchronously. |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 void CConnectionStopper::StopVpnConnection( TBool aSilentClose ) |
|
66 { |
|
67 iVpnConnection.StopVpnConnection( aSilentClose, iStatus ); |
|
68 SetActive(); |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // From class CActive |
|
73 // Handles completion of asynchronous connection stopping. |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 void CConnectionStopper::RunL() |
|
77 { |
|
78 iCallback.VpnConnectionStopped( iStatus.Int() ); |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // From class CActive |
|
83 // Handles cancellation of asynchronous connection stopping. |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 void CConnectionStopper::DoCancel() |
|
87 { |
|
88 iVpnConnection.CancelStopVpnConnection(); |
|
89 } |
|
90 |