|
1 /* |
|
2 * Copyright (c) 2007-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: This is the bteng ecom plugin class implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "DisconnectHelper.h" |
|
20 #include "debug.h" |
|
21 |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // NewL |
|
25 // --------------------------------------------------------------------------- |
|
26 CDisconnectHelper* CDisconnectHelper::NewL( MDisconnectionCallback* aObserver ) |
|
27 { |
|
28 TRACE_FUNC |
|
29 CDisconnectHelper* self = new (ELeave) CDisconnectHelper( aObserver ); |
|
30 CleanupStack::PushL( self ); |
|
31 self->ConstructL(); |
|
32 CleanupStack::Pop( self ); |
|
33 return self; |
|
34 } |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // Destructor |
|
38 // --------------------------------------------------------------------------- |
|
39 CDisconnectHelper::~CDisconnectHelper() |
|
40 { |
|
41 TRACE_FUNC_ENTRY |
|
42 Cancel(); |
|
43 TRACE_FUNC_EXIT |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // Constructor |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CDisconnectHelper::CDisconnectHelper( MDisconnectionCallback* aObserver ): |
|
51 CActive( CActive::EPriorityStandard ), |
|
52 iObserver( aObserver ) |
|
53 { |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // ConstructL |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 void CDisconnectHelper::ConstructL() |
|
61 { |
|
62 TRACE_FUNC |
|
63 if ( !iObserver ) |
|
64 { |
|
65 User::Leave(KErrArgument); |
|
66 } |
|
67 CActiveScheduler::Add( this ); |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------- |
|
71 // CPBAPplugin::Activate |
|
72 // --------------------------------------------------------- |
|
73 // |
|
74 TInt CDisconnectHelper::Activate() |
|
75 { |
|
76 if ( IsActive() ) |
|
77 { |
|
78 return KErrInUse; |
|
79 } |
|
80 iStatus = KRequestPending; |
|
81 SetActive(); |
|
82 TRequestStatus* status = &iStatus; |
|
83 User::RequestComplete( status, KErrNone ); |
|
84 return KErrNone; |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------- |
|
88 // From class CActive |
|
89 // CPBAPplugin::RunL |
|
90 // --------------------------------------------------------- |
|
91 // |
|
92 void CDisconnectHelper::RunL( ) |
|
93 { |
|
94 if ( iObserver ) |
|
95 { |
|
96 iObserver->CompleteDisconnection(); |
|
97 } |
|
98 } |
|
99 |
|
100 // --------------------------------------------------------- |
|
101 // From class CActive |
|
102 // CPBAPplugin::DoCancel |
|
103 // --------------------------------------------------------- |
|
104 // |
|
105 void CDisconnectHelper::DoCancel() |
|
106 { |
|
107 } |