|
1 /* |
|
2 * Copyright (c) 2003 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: Implementation of CCoUtlImplementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CCoUtlImplementation.h" |
|
22 #include "CCoUtlActive.h" |
|
23 #include <coemain.h> |
|
24 #include <data_caging_path_literals.hrh> |
|
25 |
|
26 // CONSTANTS |
|
27 // Path to ConnectUtil engine resource file. |
|
28 _LIT( KCoUtlResourceFile, "z:connectutilrsc.rsc" ); |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CCoUtlImplementation::CCoUtlImplementation |
|
34 // C++ default constructor can NOT contain any code, that |
|
35 // might leave. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 CCoUtlImplementation::CCoUtlImplementation() |
|
39 : iResourceLoader( *CCoeEnv::Static() ) |
|
40 { |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CCoUtlImplementation::ConstructL |
|
45 // Symbian 2nd phase constructor can leave. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 void CCoUtlImplementation::ConstructL() |
|
49 { |
|
50 TParse* fp = new (ELeave) TParse(); |
|
51 fp->Set( KCoUtlResourceFile, &KDC_RESOURCE_FILES_DIR, NULL ); |
|
52 TFileName fileName( fp->FullName() ); |
|
53 delete fp; |
|
54 User::LeaveIfError( iResourceLoader.Open( fileName ) ); |
|
55 |
|
56 iActive = new (ELeave) CCoUtlActive; |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CCoUtlImplementation::NewL |
|
61 // Two-phased constructor. |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 CCoUtlImplementation* CCoUtlImplementation::NewL() |
|
65 { |
|
66 if ( !CCoeEnv::Static() ) |
|
67 { |
|
68 // CONE must exist - use only from applications |
|
69 User::Leave( KErrNotSupported ); |
|
70 } |
|
71 |
|
72 CCoUtlImplementation* self = new( ELeave ) CCoUtlImplementation; |
|
73 |
|
74 CleanupStack::PushL( self ); |
|
75 self->ConstructL(); |
|
76 CleanupStack::Pop( self ); |
|
77 |
|
78 return self; |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CCoUtlImplementation::~CCoUtlImplementation |
|
83 // Destructor. |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 CCoUtlImplementation::~CCoUtlImplementation() |
|
87 { |
|
88 delete iActive; |
|
89 iResourceLoader.Close(); |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CCoUtlImplementation::CurrentState |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 CCoUtlInterface::TState CCoUtlImplementation::CurrentState() |
|
97 { |
|
98 CCoUtlInterface::TState result = CCoUtlInterface::EIdle; |
|
99 |
|
100 switch ( iActive->CurrentState() ) |
|
101 { |
|
102 case CCoUtlActive::EStarted: |
|
103 case CCoUtlActive::ECheckIfAttached: |
|
104 case CCoUtlActive::ECheckIfNetworkModeIII: |
|
105 case CCoUtlActive::EGetConnectionCount: |
|
106 case CCoUtlActive::EGoThroughConnections: |
|
107 case CCoUtlActive::EGoThroughConnectionsGetBearer: |
|
108 case CCoUtlActive::EGoThroughConnectionsGetStatus: |
|
109 case CCoUtlActive::ECheckConnectionCount: |
|
110 case CCoUtlActive::EGetNameThenConfirmTermination: |
|
111 case CCoUtlActive::EConfirmAllConnectionsTermination: |
|
112 result = CCoUtlInterface::EConfirm; |
|
113 break; |
|
114 |
|
115 case CCoUtlActive::ECheckDetachRequired: |
|
116 case CCoUtlActive::EStopConnectionsAndDetach: |
|
117 case CCoUtlActive::EStopConnectionsAndCheckDetachRequired: |
|
118 case CCoUtlActive::EDetach: |
|
119 result = CCoUtlInterface::ETerminate; |
|
120 break; |
|
121 |
|
122 case CCoUtlActive::EIdle: |
|
123 default: |
|
124 break; |
|
125 } |
|
126 |
|
127 return result; |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CCoUtlImplementation::Terminate |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 void CCoUtlImplementation::Terminate( TRequestStatus& aStatus ) |
|
135 { |
|
136 if ( !iActive->IsActive() ) |
|
137 { |
|
138 iActive->Start( aStatus ); |
|
139 } |
|
140 } |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // CCoUtlImplementation::Cancel |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 void CCoUtlImplementation::Cancel() |
|
147 { |
|
148 iActive->Cancel(); |
|
149 } |
|
150 |
|
151 // End of File |