31 #include "CDataVolume.h" |
31 #include "CDataVolume.h" |
32 #include "connmondtmnoti.h" |
32 #include "connmondtmnoti.h" |
33 #include "connmontelnoti.h" |
33 #include "connmontelnoti.h" |
34 #include "ConnMonBearerNotifier.h" |
34 #include "ConnMonBearerNotifier.h" |
35 #include "log.h" |
35 #include "log.h" |
|
36 #include "cellulardatausagekeyupdater.h" |
36 |
37 |
37 // ============================ MEMBER FUNCTIONS =============================== |
38 // ============================ MEMBER FUNCTIONS =============================== |
38 |
39 |
39 // ----------------------------------------------------------------------------- |
40 // ----------------------------------------------------------------------------- |
40 // TConnInfo::TConnInfo |
41 // TConnInfo::TConnInfo |
1178 // |
1179 // |
1179 TInt CConnMonIAP::GetBearerInfo( const TUint aConnectionId, TBearerInfo& aBearerInfo ) |
1180 TInt CConnMonIAP::GetBearerInfo( const TUint aConnectionId, TBearerInfo& aBearerInfo ) |
1180 { |
1181 { |
1181 LOGENTRFN("CConnMonIAP::GetBearerInfo()") |
1182 LOGENTRFN("CConnMonIAP::GetBearerInfo()") |
1182 TInt err( KErrNone ); |
1183 TInt err( KErrNone ); |
|
1184 TBool getBearerCalled( EFalse ); |
1183 |
1185 |
1184 // Find connection matching the given Id |
1186 // Find connection matching the given Id |
1185 TInt index = Index( aConnectionId ); |
1187 TInt index = Index( aConnectionId ); |
1186 if ( index < 0 ) |
1188 if ( index < 0 ) |
1187 { |
1189 { |
1196 LOGIT("GetBearerInfo: EBearerInfoUnknown") |
1198 LOGIT("GetBearerInfo: EBearerInfoUnknown") |
1197 err = GetBearer( |
1199 err = GetBearer( |
1198 aConnectionId, |
1200 aConnectionId, |
1199 iConnInfos[index].iBearer, |
1201 iConnInfos[index].iBearer, |
1200 iConnInfos[index].iBearerInfo ); |
1202 iConnInfos[index].iBearerInfo ); |
|
1203 getBearerCalled = ETrue; |
1201 } |
1204 } |
1202 if ( KErrNone == err ) |
1205 if ( KErrNone == err ) |
1203 { |
1206 { |
1204 // Bearer is never unknown for the external connections but |
1207 // Bearer is never unknown for the external connections but |
1205 // sometimes it is not valid (e.g. CSD/HSCSD) until connection |
1208 // sometimes it is not valid (e.g. CSD/HSCSD) until connection |
1241 iConnInfos[index].iBearerInfo.iBearer == EBearerInfoWCDMA || |
1244 iConnInfos[index].iBearerInfo.iBearer == EBearerInfoWCDMA || |
1242 iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSDPA || |
1245 iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSDPA || |
1243 iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSUPA || |
1246 iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSUPA || |
1244 iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSxPA ) ) |
1247 iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSxPA ) ) |
1245 { |
1248 { |
1246 // CSD/HSCSD info could change after the first query also |
1249 // If GetBearer() was just called, no need to do it again. |
1247 // GPRS/EdgeGPRS/WCDMA info can change. |
1250 if ( !getBearerCalled ) |
1248 TInt bearer( EBearerUnknown ); |
1251 { |
1249 TBearerInfo bearerInfo; |
1252 // CSD/HSCSD info could change after the first query also |
1250 |
1253 // GPRS/EdgeGPRS/WCDMA info can change. |
1251 LOGIT("GetBearerInfo: GetBearer() 2nd query") |
1254 TInt bearer( EBearerUnknown ); |
1252 err = GetBearer( aConnectionId, bearer, bearerInfo ); |
1255 TBearerInfo bearerInfo; |
1253 if ( ( KErrNone == err ) && ( bearerInfo.iBearer != EBearerInfoUnknown ) ) |
1256 |
1254 { |
1257 LOGIT("GetBearerInfo: GetBearer() 2nd query") |
1255 iConnInfos[index].iBearer = bearer; |
1258 err = GetBearer( aConnectionId, bearer, bearerInfo ); |
1256 iConnInfos[index].iBearerInfo = bearerInfo; |
1259 if ( ( KErrNone == err ) && ( bearerInfo.iBearer != EBearerInfoUnknown ) ) |
|
1260 { |
|
1261 iConnInfos[index].iBearer = bearer; |
|
1262 iConnInfos[index].iBearerInfo = bearerInfo; |
|
1263 } |
1257 } |
1264 } |
1258 } |
1265 } |
1259 } |
1266 } |
1260 if ( KErrNone == err ) |
1267 if ( KErrNone == err ) |
1261 { |
1268 { |
2005 if ( iNetwRegistrationNotifier == 0 ) |
2012 if ( iNetwRegistrationNotifier == 0 ) |
2006 { |
2013 { |
2007 iNetwRegistrationNotifier = CNetwRegistrationNotifier::NewL( iServer, iMobilePhone ); |
2014 iNetwRegistrationNotifier = CNetwRegistrationNotifier::NewL( iServer, iMobilePhone ); |
2008 } |
2015 } |
2009 if ( !iNetwRegistrationNotifier->IsActive() ) |
2016 if ( !iNetwRegistrationNotifier->IsActive() ) |
2010 { |
2017 { |
2011 iNetwRegistrationNotifier->Receive(); // (re)start listening |
2018 iNetwRegistrationNotifier->Receive(); // (re)start listening |
|
2019 |
|
2020 // We might have missed the network registration notification before |
|
2021 // we started listening for notifications here. Update the |
|
2022 // network registration information. |
|
2023 TInt registration( ENetworkRegistrationExtNotAvailable ); |
|
2024 User::LeaveIfError( GetNetworkRegistration_v2( registration ) ); |
|
2025 iServer->CellularDataUsageKeyUpdater()->UpdateKeyL( registration ); |
2012 } |
2026 } |
2013 |
2027 |
2014 // Bearer change (GPRS/Edge GPRS) status events |
2028 // Bearer change (GPRS/Edge GPRS) status events |
2015 if ( FeatureManager::FeatureSupported( KFeatureIdEdgeKnowledge ) ) |
2029 if ( FeatureManager::FeatureSupported( KFeatureIdEdgeKnowledge ) ) |
2016 { |
2030 { |