|
1 /* |
|
2 * Copyright (c) 2004-2009 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: Observes terminals roaming status. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MPMROAMINGWATCHER_H |
|
20 #define MPMROAMINGWATCHER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <etel.h> |
|
25 #include <etelmm.h> |
|
26 |
|
27 // Possible roaming status values |
|
28 enum TMPMRoamingStatus |
|
29 { |
|
30 EMPMHomenetwork = 0, |
|
31 EMPMNationalRoaming, |
|
32 EMPMInternationalRoaming, |
|
33 EMPMRoamingStatusUnknown |
|
34 }; |
|
35 |
|
36 // CONSTANTS |
|
37 // None. |
|
38 |
|
39 // MACROS |
|
40 // None. |
|
41 |
|
42 // DATA TYPES |
|
43 // None. |
|
44 |
|
45 // FUNCTION PROTOTYPES |
|
46 // None. |
|
47 |
|
48 // FORWARD DECLARATIONS |
|
49 // None. |
|
50 |
|
51 // CLASS DECLARATION |
|
52 /** |
|
53 * Mobility Policy Manager network roaming status watcher. |
|
54 * @lib MPMServer.exe |
|
55 * @since 5.2 |
|
56 */ |
|
57 class CMPMRoamingWatcher : public CActive |
|
58 { |
|
59 public: // Constructors and destructor |
|
60 |
|
61 /** |
|
62 * Two-phased constructor. |
|
63 * @param aMobilePhone Reference to RMobilePhone object |
|
64 */ |
|
65 static CMPMRoamingWatcher* NewL( RMobilePhone& aMobilePhone ); |
|
66 |
|
67 /** |
|
68 * Destructor. |
|
69 */ |
|
70 ~CMPMRoamingWatcher(); |
|
71 |
|
72 public: // New functions |
|
73 |
|
74 /** |
|
75 * Returns the current roaming status. |
|
76 * @return The current roaming status |
|
77 */ |
|
78 TMPMRoamingStatus RoamingStatus() const; |
|
79 |
|
80 TBool AskCellularDataUsageAbroad() const; |
|
81 |
|
82 void SetAskCellularDataUsageAbroad(TBool aAskUsage); |
|
83 |
|
84 |
|
85 protected: // Constructors and destructor |
|
86 |
|
87 /** |
|
88 * Second-phase constructor. |
|
89 */ |
|
90 void ConstructL(); |
|
91 |
|
92 protected: // from CActive |
|
93 |
|
94 /** |
|
95 * Handles completions of async requests. |
|
96 */ |
|
97 void RunL(); |
|
98 |
|
99 /** |
|
100 * Handles a leave occurring in RunL. |
|
101 * @param aError Leave code of RunL method. |
|
102 * @return KErrNone |
|
103 */ |
|
104 TInt RunError( TInt aError ); |
|
105 |
|
106 /** |
|
107 * Cancels async requests. |
|
108 */ |
|
109 void DoCancel(); |
|
110 |
|
111 private: // Data |
|
112 |
|
113 /** |
|
114 * C++ default constructor. Not implemented. |
|
115 */ |
|
116 CMPMRoamingWatcher(); |
|
117 |
|
118 /** |
|
119 * Constructor. |
|
120 */ |
|
121 CMPMRoamingWatcher( RMobilePhone& aMobilePhone ); |
|
122 |
|
123 /** |
|
124 * Maps registration value received from ETEL. |
|
125 * @param aStatus Registration value to be mapped |
|
126 * @return Roaming status |
|
127 */ |
|
128 TMPMRoamingStatus MapRegistrationStatus( RMobilePhone::TMobilePhoneRegistrationStatus aStatus ); |
|
129 |
|
130 //data |
|
131 |
|
132 /** |
|
133 * Reference to ETEL object |
|
134 */ |
|
135 RMobilePhone& iMobilePhone; |
|
136 |
|
137 /** |
|
138 * This variable is used to store registration status from async request to ETEL |
|
139 */ |
|
140 RMobilePhone::TMobilePhoneRegistrationStatus iRegistrationStatus; |
|
141 |
|
142 /** |
|
143 * Current roaming status |
|
144 */ |
|
145 TMPMRoamingStatus iRoamingStatus; |
|
146 |
|
147 /** |
|
148 * Current country |
|
149 */ |
|
150 RMobilePhone::TMobilePhoneNetworkCountryCode iCurrentCountryCode; |
|
151 |
|
152 /** |
|
153 * This variable indicates wheather cellular data usage abroad must be confirmed from the user |
|
154 * This variable is set to TRUE when roaming to visitor network happens and it is set to FALSE when |
|
155 * Confirm Dialog is presented first time in current foreign country. It is also set to FALSE every |
|
156 * time when mobile comes back to home network or moves to other foreign country |
|
157 */ |
|
158 TBool iAskCellularDataUsageAbroad; |
|
159 }; |
|
160 |
|
161 #endif // MPMROAMINGWATCHER_H |
|
162 |
|
163 // End of File |