21 #include <commdb.h> |
21 #include <commdb.h> |
22 #include <commdbconnpref.h> |
22 #include <commdbconnpref.h> |
23 #include <featdiscovery.h> |
23 #include <featdiscovery.h> |
24 #include <features.hrh> |
24 #include <features.hrh> |
25 #include <ProfileEngineSDKCRKeys.h> |
25 #include <ProfileEngineSDKCRKeys.h> |
26 #include <WebUtilsInternalCRKeys.h> |
|
27 #include <httpstringconstants.h> |
26 #include <httpstringconstants.h> |
28 #include <StringLoader.h> |
27 #include <StringLoader.h> |
29 #include <data_caging_path_literals.hrh> |
28 #include <data_caging_path_literals.hrh> |
30 #include <extendedconnpref.h> |
29 #include <extendedconnpref.h> |
31 |
30 |
35 #include "irnetworkobserver.h" |
34 #include "irnetworkobserver.h" |
36 #include "irsettings.h" |
35 #include "irsettings.h" |
37 |
36 |
38 #include "iractivenetworkobserver.h" |
37 #include "iractivenetworkobserver.h" |
39 |
38 |
40 //for ALR/SNAP |
|
41 #include <cmmanager.h> |
|
42 #include <cmdestination.h> |
|
43 |
|
44 |
39 |
45 const TInt KMaxIRUAProfLength = 250; // Max length of the UAProf string |
40 const TInt KMaxIRUAProfLength = 250; // Max length of the UAProf string |
46 const TInt KIRDefaultUAProfBufferSize = 0x80; |
41 const TInt KIRDefaultUAProfBufferSize = 0x80; |
47 const TUint KIRESockMessageSlots = 16; |
42 const TUint KIRESockMessageSlots = 16; |
48 const TUint32 KIRUniqueWlanId = 0x2000883F; // Just to make it unique |
|
49 const TInt KArraySize = 5; |
43 const TInt KArraySize = 5; |
50 const TInt KWlanStringMaxLength = 9; |
44 const TInt KWlanStringMaxLength = 9; |
51 const TInt KTwo = 2; |
45 const TInt KTwo = 2; |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // define in WebUtilsSDKCRKeys.h |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 const TUid KCRUidWebUtils = {0x101F8731};//Web APIs removal and Internet Radio build break |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // define in WebUtilsInternalCRKeys.h |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 // Compatability fragment of useragent string |
|
58 const TUint32 KWebUtilsUsrAg2 = 0x00000001; |
|
59 |
|
60 // PlatformVersion fragment of useragent string |
|
61 const TUint32 KWebUtilsUsrAg3 = 0x00000002; |
|
62 |
|
63 // MidPVersion fragment of useragent string |
|
64 const TUint32 KWebUtilsUsrAg4 = 0x00000003; |
|
65 |
|
66 // CLDConfiguration fragment of useragent string |
|
67 const TUint32 KWebUtilsUsrAg5 = 0x00000004; |
|
68 |
|
69 // Url to useragent profile |
|
70 const TUint32 KWebUtilsUaProf = 0x00000008; |
52 |
71 |
53 |
72 |
54 // To Format the UAProf string |
73 // To Format the UAProf string |
55 _LIT(KIRUAProfSpace," "); |
74 _LIT(KIRUAProfSpace," "); |
56 |
75 |
75 User::LeaveIfError(Dll::SetTls(networkController)); |
94 User::LeaveIfError(Dll::SetTls(networkController)); |
76 networkController->iSingletonInstances = 0; |
95 networkController->iSingletonInstances = 0; |
77 CleanupStack::Pop(networkController); |
96 CleanupStack::Pop(networkController); |
78 } |
97 } |
79 networkController->iSingletonInstances++; |
98 networkController->iSingletonInstances++; |
|
99 |
|
100 if (NULL != aObserver) |
|
101 { |
|
102 networkController->iObserver = aObserver; |
|
103 networkController->iIRNetworkObserver->SetObserver(aObserver); |
|
104 } |
|
105 |
80 IRLOG_DEBUG( "CIRNetworkController::OpenL - Exiting." ); |
106 IRLOG_DEBUG( "CIRNetworkController::OpenL - Exiting." ); |
81 return networkController; |
107 return networkController; |
82 } |
108 } |
83 |
109 |
84 // --------------------------------------------------------------------------- |
110 // --------------------------------------------------------------------------- |
232 { |
258 { |
233 retVal = KErrNotFound; |
259 retVal = KErrNotFound; |
234 } |
260 } |
235 IRLOG_DEBUG( "CIRNetworkController::GetIAPId - Exiting." ); |
261 IRLOG_DEBUG( "CIRNetworkController::GetIAPId - Exiting." ); |
236 return retVal; |
262 return retVal; |
237 } |
|
238 |
|
239 // --------------------------------------------------------------------------- |
|
240 // CIRNetworkController::GetAccessPointList |
|
241 // Reset the connection status to Disconnected statet |
|
242 // --------------------------------------------------------------------------- |
|
243 // |
|
244 EXPORT_C const CDesCArray* CIRNetworkController::GetAccessPointList() const |
|
245 { |
|
246 IRLOG_DEBUG( "CIRNetworkController::GetAccessPointList" ); |
|
247 return iIapList; |
|
248 } |
|
249 |
|
250 // --------------------------------------------------------------------------- |
|
251 // CIRNetworkController::GetBearerList |
|
252 // Reset the connection status to Disconnected statet |
|
253 // |
|
254 EXPORT_C const RArray<TUint32> CIRNetworkController::GetBearerList() const |
|
255 { |
|
256 IRLOG_DEBUG( "CIRNetworkController::GetBearerList" ); |
|
257 return iBearerList; |
|
258 } |
|
259 |
|
260 // --------------------------------------------------------------------------- |
|
261 // CIRNetworkController::GetNetworkList |
|
262 // Reset the connection status to Disconnected statet |
|
263 // --------------------------------------------------------------------------- |
|
264 // |
|
265 EXPORT_C const RArray<TUint32> CIRNetworkController::GetNetworkList() const |
|
266 { |
|
267 IRLOG_DEBUG( "CIRNetworkController::GetNetworkList" ); |
|
268 return iNetworkList; |
|
269 } |
|
270 |
|
271 // --------------------------------------------------------------------------- |
|
272 // CIRNetworkController::GetApList |
|
273 // Reset the connection status to Disconnected statet |
|
274 // --------------------------------------------------------------------------- |
|
275 // |
|
276 EXPORT_C const RArray<TUint32> CIRNetworkController::GetApList() const |
|
277 { |
|
278 IRLOG_DEBUG( "CIRNetworkController::GetApList" ); |
|
279 return iIapIdList; |
|
280 } |
263 } |
281 |
264 |
282 // --------------------------------------------------------------------------- |
265 // --------------------------------------------------------------------------- |
283 // CIRNetworkController::ChooseAccessPointL |
266 // CIRNetworkController::ChooseAccessPointL |
284 // Configures the Access Point which is used by all the components for network |
267 // Configures the Access Point which is used by all the components for network |
304 iDefaultConnection = aDefaultConnection; |
287 iDefaultConnection = aDefaultConnection; |
305 |
288 |
306 // Always validate the Access Points status |
289 // Always validate the Access Points status |
307 if ( ValidateAccessPointsL() ) |
290 if ( ValidateAccessPointsL() ) |
308 { |
291 { |
|
292 if(NULL != iMobility) |
|
293 { |
|
294 iMobility->Cancel(); |
|
295 delete iMobility; |
|
296 iMobility = NULL; |
|
297 } |
|
298 |
309 // Connect to the Symbian Socket Server |
299 // Connect to the Symbian Socket Server |
310 iIRNetworkConnection->Close(); |
300 iIRNetworkConnection->Close(); |
311 iIRSocketServer.Close(); |
301 iIRSocketServer.Close(); |
312 TInt ReturnErrorCode = iIRSocketServer.Connect( KIRESockMessageSlots ); |
302 TInt ReturnErrorCode = iIRSocketServer.Connect( KIRESockMessageSlots ); |
313 |
303 |
505 { |
495 { |
506 IRLOG_DEBUG( "CIRNetworkController::~CIRNetworkController- Entering" ); |
496 IRLOG_DEBUG( "CIRNetworkController::~CIRNetworkController- Entering" ); |
507 _LIT(KErrorMsg,"Method Close not called"); |
497 _LIT(KErrorMsg,"Method Close not called"); |
508 __ASSERT_ALWAYS(iSingletonInstances == 0, User::Panic(KErrorMsg, KErrCorrupt)); |
498 __ASSERT_ALWAYS(iSingletonInstances == 0, User::Panic(KErrorMsg, KErrCorrupt)); |
509 |
499 |
510 delete iMobility; |
500 if(NULL != iMobility) |
|
501 { |
|
502 iMobility->Cancel(); |
|
503 delete iMobility; |
|
504 iMobility = NULL; |
|
505 } |
|
506 |
511 if (IsActive()) |
507 if (IsActive()) |
512 { |
508 { |
513 Cancel(); |
509 Cancel(); |
514 } |
510 } |
515 if (iIRNetworkConnection) |
511 if (iIRNetworkConnection) |
596 { |
590 { |
597 IRLOG_DEBUG( "CIRNetworkController::QueryCommsForIAPL- Entering" ); |
591 IRLOG_DEBUG( "CIRNetworkController::QueryCommsForIAPL- Entering" ); |
598 |
592 |
599 // Reset all the comms info |
593 // Reset all the comms info |
600 iIapList->Reset(); |
594 iIapList->Reset(); |
601 iBearerList.Reset(); |
|
602 iNetworkList.Reset(); |
|
603 iIapIdList.Reset(); |
|
604 |
595 |
605 #ifndef __WINS__ |
596 #ifndef __WINS__ |
606 CIRFilteredApReader* filteredReader = CIRFilteredApReader:: |
597 CIRFilteredApReader* filteredReader = CIRFilteredApReader:: |
607 NewLC( CIRFilteredApReader::KIRFilterWAPOnly | |
598 NewLC( CIRFilteredApReader::KIRFilterWAPOnly | |
608 CIRFilteredApReader::KIRFilterWAPMandatory | |
599 CIRFilteredApReader::KIRFilterWAPMandatory | |
613 while ( iapRecord ) |
604 while ( iapRecord ) |
614 { |
605 { |
615 CleanupStack::PushL( iapRecord ); |
606 CleanupStack::PushL( iapRecord ); |
616 |
607 |
617 iIapList->AppendL( iapRecord->iRecordName.GetL() ); |
608 iIapList->AppendL( iapRecord->iRecordName.GetL() ); |
618 iBearerList.AppendL( static_cast<TUint32>(iapRecord->iBearer) ); |
|
619 iNetworkList.AppendL( static_cast<TUint32>(iapRecord->iNetwork) ); |
|
620 iIapIdList.AppendL( iapRecord->RecordId() ); |
|
621 |
609 |
622 CleanupStack::PopAndDestroy( iapRecord ); |
610 CleanupStack::PopAndDestroy( iapRecord ); |
623 iapRecord = filteredReader->NextRecordL(); |
611 iapRecord = filteredReader->NextRecordL(); |
624 } |
612 } |
625 CleanupStack::PopAndDestroy( filteredReader ); |
613 CleanupStack::PopAndDestroy( filteredReader ); |
636 for (TInt i = 0; i < iapSet->iRecords.Count(); i++) |
624 for (TInt i = 0; i < iapSet->iRecords.Count(); i++) |
637 { |
625 { |
638 CCDIAPRecord* iapRecord = |
626 CCDIAPRecord* iapRecord = |
639 static_cast<CCDIAPRecord*> (iapSet->iRecords[i]); |
627 static_cast<CCDIAPRecord*> (iapSet->iRecords[i]); |
640 iIapList->AppendL(iapRecord->iRecordName.GetL()); |
628 iIapList->AppendL(iapRecord->iRecordName.GetL()); |
641 iBearerList.AppendL(static_cast<TUint32> (iapRecord->iBearer)); |
|
642 iNetworkList.AppendL(static_cast<TUint32> (iapRecord->iNetwork)); |
|
643 iIapIdList.AppendL(iapRecord->RecordId()); |
|
644 } |
629 } |
645 CleanupStack::PopAndDestroy(2, dbSession); |
630 CleanupStack::PopAndDestroy(2, dbSession); |
646 |
631 |
647 #endif |
632 #endif |
648 |
633 |
653 if( iIsWlanSupported ) |
638 if( iIsWlanSupported ) |
654 { |
639 { |
655 TBuf<KWlanStringMaxLength> wlanString; |
640 TBuf<KWlanStringMaxLength> wlanString; |
656 wlanString.Copy(KIRWLanName); |
641 wlanString.Copy(KIRWLanName); |
657 iIapList->AppendL(wlanString); |
642 iIapList->AppendL(wlanString); |
658 TUint32 WlanIdentifier(KIRUniqueWlanId); |
|
659 iBearerList.AppendL(WlanIdentifier); |
|
660 iNetworkList.AppendL((TUint32)KErrNotFound); |
|
661 iIapIdList.AppendL((TUint32)KErrNotFound); |
|
662 } |
643 } |
663 #endif |
644 #endif |
664 |
645 |
665 iIapList->Compress(); |
646 iIapList->Compress(); |
666 |
647 |
845 // --------------------------------------------------------------------------- |
826 // --------------------------------------------------------------------------- |
846 // |
827 // |
847 void CIRNetworkController::DoCancel() |
828 void CIRNetworkController::DoCancel() |
848 { |
829 { |
849 IRLOG_DEBUG( "CIRNetworkController::DoCancel - Entering" ); |
830 IRLOG_DEBUG( "CIRNetworkController::DoCancel - Entering" ); |
|
831 |
|
832 if(NULL != iMobility) |
|
833 { |
|
834 iMobility->Cancel(); |
|
835 delete iMobility; |
|
836 iMobility = NULL; |
|
837 } |
|
838 |
850 iIRNetworkConnection->Stop(); |
839 iIRNetworkConnection->Stop(); |
851 iIRNetworkConnection->Close(); |
840 iIRNetworkConnection->Close(); |
852 iIRSocketServer.Close(); |
841 iIRSocketServer.Close(); |
853 IRLOG_DEBUG( "CIRNetworkController::DoCancel - Exiting." ); |
842 IRLOG_DEBUG( "CIRNetworkController::DoCancel - Exiting." ); |
854 } |
843 } |