|
1 /* |
|
2 * Copyright (c) 2002-2005 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: CNetworkResetHandler is a async activeobject which handles reseting network call. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CNetworkResetHandler.h" |
|
22 #include "PhoneSettingsLogger.h" |
|
23 |
|
24 // MEMBER FUNCTIONS |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // |
|
28 // 1st phase constructor for network reseting observer. |
|
29 // |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 CNetworkResetHandler* CNetworkResetHandler::NewL( RMobilePhone& aPhone ) |
|
33 { |
|
34 __PHSLOGSTRING("[PHS]CNetworkResetHandler::NewL"); |
|
35 |
|
36 CNetworkResetHandler* self = new ( ELeave ) CNetworkResetHandler( aPhone ); |
|
37 CleanupStack::PushL( self ); |
|
38 self->ConstructL(); |
|
39 CleanupStack::Pop( self ); |
|
40 return self; |
|
41 } |
|
42 |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 // C++ constructor. |
|
47 // |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CNetworkResetHandler::CNetworkResetHandler( RMobilePhone& aPhone ) |
|
51 : CActive( EPriorityStandard ), iPhone ( aPhone ) |
|
52 { |
|
53 __PHSLOGSTRING("[PHS]CNetworkResetHandler::CNetworkResetHandler"); |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 // Destructor. |
|
59 // |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 CNetworkResetHandler::~CNetworkResetHandler() |
|
63 { |
|
64 __PHSLOGSTRING("[PHS]CNetworkResetHandler::~CNetworkResetHandler"); |
|
65 |
|
66 Cancel(); |
|
67 iCustomApi.Close(); |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 // ConstructL. |
|
73 // |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 void CNetworkResetHandler::ConstructL() |
|
77 { |
|
78 __PHSLOGSTRING("[PHS]CNetworkResetHandler::ConstructL"); |
|
79 CActiveScheduler::Add( this ); |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 // Close connect to ctsy |
|
85 // |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 void CNetworkResetHandler::RunL() |
|
89 { |
|
90 __PHSLOGSTRING("[PHS]CNetworkResetHandler::RunL"); |
|
91 iCustomApi.Close(); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 // Requests ETEL to Reset back to the previously used network. |
|
97 // |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 TInt CNetworkResetHandler::ResetNetworkSearch() |
|
101 { |
|
102 __PHSLOGSTRING("[PHS]--> CNetworkResetHandler::ResetNetworkSearch"); |
|
103 |
|
104 TInt error = KErrNone; |
|
105 |
|
106 if( IsActive() ) |
|
107 { |
|
108 error = KErrInUse; |
|
109 } |
|
110 else |
|
111 { |
|
112 error = iCustomApi.Open( iPhone ); |
|
113 } |
|
114 if( KErrNone == error ) |
|
115 { |
|
116 // if there wasn´t already connect open to ETEL or active object wasn´t already in use, |
|
117 // we can thus send request for reset network server |
|
118 iCustomApi.ResetNetServer( iStatus ); |
|
119 SetActive(); |
|
120 } |
|
121 __PHSLOGSTRING("[PHS]<-- CNetworkResetHandler::ResetNetworkSearch"); |
|
122 return error; |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 // DoCancel. |
|
128 // |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 void CNetworkResetHandler::DoCancel() |
|
132 { |
|
133 __PHSLOGSTRING("[PHS]CNetworkResetHandler::DoCancel"); |
|
134 iCustomApi.Close(); |
|
135 } |
|
136 |
|
137 // End of file |