connectionmonitoring/connmon/connectionmonitor/src/cellulardatausagekeyupdater.cpp
equal
deleted
inserted
replaced
27 #include <cmpluginbaseeng.h> |
27 #include <cmpluginbaseeng.h> |
28 |
28 |
29 #include "cellulardatausagekeyupdater.h" |
29 #include "cellulardatausagekeyupdater.h" |
30 #include "ConnMonServ.h" |
30 #include "ConnMonServ.h" |
31 #include "ConnMonAvailabilityManager.h" |
31 #include "ConnMonAvailabilityManager.h" |
32 #include "ConnMonIap.h" |
32 #include "ConnMonIAP.h" |
33 #include "ConnMonDef.h" |
33 #include "ConnMonDef.h" |
34 #include "log.h" |
34 #include "log.h" |
35 |
35 |
36 // Repository for CommsDat |
36 // Repository for CommsDat |
37 const TUid KCDCommsRepositoryId = { 0xCCCCCC00 }; |
37 const TUid KCDCommsRepositoryId = { 0xCCCCCC00 }; |
84 LOGIT1("CCellularDataUsageKeyUpdater::UpdateKeyL: aRegistration <%d>", |
84 LOGIT1("CCellularDataUsageKeyUpdater::UpdateKeyL: aRegistration <%d>", |
85 aRegistration) |
85 aRegistration) |
86 |
86 |
87 TCmGenConnSettings occSettings = ReadGenConnSettingsL(); |
87 TCmGenConnSettings occSettings = ReadGenConnSettingsL(); |
88 |
88 |
89 TInt value( occSettings.iCellularDataUsageHome ); |
89 TInt value( ECmCellularDataUsageDisabled ); |
90 |
90 |
91 if ( aRegistration == ENetworkRegistrationExtRoamingInternational ) |
91 if ( aRegistration == ENetworkRegistrationExtRoamingInternational ) |
92 { |
92 { |
93 value = occSettings.iCellularDataUsageVisitor; |
93 value = occSettings.iCellularDataUsageVisitor; |
|
94 } |
|
95 else if ( aRegistration == ENetworkRegistrationExtHomeNetwork || |
|
96 aRegistration == ENetworkRegistrationExtRoamingNational ) |
|
97 { |
|
98 value = occSettings.iCellularDataUsageHome; |
94 } |
99 } |
95 |
100 |
96 CRepository* cmRepository = NULL; |
101 CRepository* cmRepository = NULL; |
97 |
102 |
98 TRAPD( err, cmRepository = CRepository::NewL( KCRUidCmManager ) ) |
103 TRAPD( err, cmRepository = CRepository::NewL( KCRUidCmManager ) ) |
104 |
109 |
105 if ( err == KErrNone && ( value != previous ) ) |
110 if ( err == KErrNone && ( value != previous ) ) |
106 { |
111 { |
107 cmRepository->Set( KCurrentCellularDataUsage, value ); |
112 cmRepository->Set( KCurrentCellularDataUsage, value ); |
108 LOGIT1("KCurrentCellularDataUsage set to %d", value) |
113 LOGIT1("KCurrentCellularDataUsage set to %d", value) |
109 |
114 } |
110 LOGIT("CCellularDataUsageKeyUpdater triggered HandleAvailabilityChange()") |
115 else |
111 iServer->AvailabilityManager()->HandleAvailabilityChange(); |
116 { |
112 } |
117 LOGIT1("KCurrentCellularDataUsage already up-to-date %d", previous) |
|
118 } |
|
119 |
113 delete cmRepository; |
120 delete cmRepository; |
114 } |
121 } |
115 else |
122 else |
116 { |
123 { |
117 LOGIT1("CCRepository::NewL( KCRUidCmManager ) FAILED <%d>", err) |
124 LOGIT1("CCRepository::NewL( KCRUidCmManager ) FAILED <%d>", err) |
217 else |
224 else |
218 { |
225 { |
219 iErrorCounter = 0; |
226 iErrorCounter = 0; |
220 |
227 |
221 TRAPD( leaveCode, UpdateKeyL() ) |
228 TRAPD( leaveCode, UpdateKeyL() ) |
|
229 |
|
230 LOGIT("CCellularDataUsageKeyUpdater triggered HandleAvailabilityChange()") |
|
231 iServer->AvailabilityManager()->HandleAvailabilityChange(); |
222 |
232 |
223 if ( leaveCode ) |
233 if ( leaveCode ) |
224 { |
234 { |
225 LOGIT1("CCellularDataUsageKeyUpdater::RunL: LEAVE <%d>", leaveCode) |
235 LOGIT1("CCellularDataUsageKeyUpdater::RunL: LEAVE <%d>", leaveCode) |
226 } |
236 } |