34 #include "irnetworkobserver.h" |
34 #include "irnetworkobserver.h" |
35 #include "irsettings.h" |
35 #include "irsettings.h" |
36 |
36 |
37 #include "iractivenetworkobserver.h" |
37 #include "iractivenetworkobserver.h" |
38 |
38 |
39 //for ALR/SNAP |
|
40 #include <cmmanager.h> |
|
41 #include <cmdestination.h> |
|
42 |
|
43 |
39 |
44 const TInt KMaxIRUAProfLength = 250; // Max length of the UAProf string |
40 const TInt KMaxIRUAProfLength = 250; // Max length of the UAProf string |
45 const TInt KIRDefaultUAProfBufferSize = 0x80; |
41 const TInt KIRDefaultUAProfBufferSize = 0x80; |
46 const TUint KIRESockMessageSlots = 16; |
42 const TUint KIRESockMessageSlots = 16; |
47 const TUint32 KIRUniqueWlanId = 0x2000883F; // Just to make it unique |
|
48 const TInt KArraySize = 5; |
43 const TInt KArraySize = 5; |
49 const TInt KWlanStringMaxLength = 9; |
44 const TInt KWlanStringMaxLength = 9; |
50 const TInt KTwo = 2; |
45 const TInt KTwo = 2; |
51 |
46 |
52 // --------------------------------------------------------------------------- |
47 // --------------------------------------------------------------------------- |
99 User::LeaveIfError(Dll::SetTls(networkController)); |
94 User::LeaveIfError(Dll::SetTls(networkController)); |
100 networkController->iSingletonInstances = 0; |
95 networkController->iSingletonInstances = 0; |
101 CleanupStack::Pop(networkController); |
96 CleanupStack::Pop(networkController); |
102 } |
97 } |
103 networkController->iSingletonInstances++; |
98 networkController->iSingletonInstances++; |
|
99 |
|
100 if (NULL != aObserver) |
|
101 { |
|
102 networkController->iObserver = aObserver; |
|
103 networkController->iIRNetworkObserver->SetObserver(aObserver); |
|
104 } |
|
105 |
104 IRLOG_DEBUG( "CIRNetworkController::OpenL - Exiting." ); |
106 IRLOG_DEBUG( "CIRNetworkController::OpenL - Exiting." ); |
105 return networkController; |
107 return networkController; |
106 } |
108 } |
107 |
109 |
108 // --------------------------------------------------------------------------- |
110 // --------------------------------------------------------------------------- |
256 { |
258 { |
257 retVal = KErrNotFound; |
259 retVal = KErrNotFound; |
258 } |
260 } |
259 IRLOG_DEBUG( "CIRNetworkController::GetIAPId - Exiting." ); |
261 IRLOG_DEBUG( "CIRNetworkController::GetIAPId - Exiting." ); |
260 return retVal; |
262 return retVal; |
261 } |
|
262 |
|
263 // --------------------------------------------------------------------------- |
|
264 // CIRNetworkController::GetAccessPointList |
|
265 // Reset the connection status to Disconnected statet |
|
266 // --------------------------------------------------------------------------- |
|
267 // |
|
268 EXPORT_C const CDesCArray* CIRNetworkController::GetAccessPointList() const |
|
269 { |
|
270 IRLOG_DEBUG( "CIRNetworkController::GetAccessPointList" ); |
|
271 return iIapList; |
|
272 } |
|
273 |
|
274 // --------------------------------------------------------------------------- |
|
275 // CIRNetworkController::GetBearerList |
|
276 // Reset the connection status to Disconnected statet |
|
277 // |
|
278 EXPORT_C const RArray<TUint32> CIRNetworkController::GetBearerList() const |
|
279 { |
|
280 IRLOG_DEBUG( "CIRNetworkController::GetBearerList" ); |
|
281 return iBearerList; |
|
282 } |
|
283 |
|
284 // --------------------------------------------------------------------------- |
|
285 // CIRNetworkController::GetNetworkList |
|
286 // Reset the connection status to Disconnected statet |
|
287 // --------------------------------------------------------------------------- |
|
288 // |
|
289 EXPORT_C const RArray<TUint32> CIRNetworkController::GetNetworkList() const |
|
290 { |
|
291 IRLOG_DEBUG( "CIRNetworkController::GetNetworkList" ); |
|
292 return iNetworkList; |
|
293 } |
|
294 |
|
295 // --------------------------------------------------------------------------- |
|
296 // CIRNetworkController::GetApList |
|
297 // Reset the connection status to Disconnected statet |
|
298 // --------------------------------------------------------------------------- |
|
299 // |
|
300 EXPORT_C const RArray<TUint32> CIRNetworkController::GetApList() const |
|
301 { |
|
302 IRLOG_DEBUG( "CIRNetworkController::GetApList" ); |
|
303 return iIapIdList; |
|
304 } |
263 } |
305 |
264 |
306 // --------------------------------------------------------------------------- |
265 // --------------------------------------------------------------------------- |
307 // CIRNetworkController::ChooseAccessPointL |
266 // CIRNetworkController::ChooseAccessPointL |
308 // 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 |
328 iDefaultConnection = aDefaultConnection; |
287 iDefaultConnection = aDefaultConnection; |
329 |
288 |
330 // Always validate the Access Points status |
289 // Always validate the Access Points status |
331 if ( ValidateAccessPointsL() ) |
290 if ( ValidateAccessPointsL() ) |
332 { |
291 { |
|
292 if(NULL != iMobility) |
|
293 { |
|
294 iMobility->Cancel(); |
|
295 delete iMobility; |
|
296 iMobility = NULL; |
|
297 } |
|
298 |
333 // Connect to the Symbian Socket Server |
299 // Connect to the Symbian Socket Server |
334 iIRNetworkConnection->Close(); |
300 iIRNetworkConnection->Close(); |
335 iIRSocketServer.Close(); |
301 iIRSocketServer.Close(); |
336 TInt ReturnErrorCode = iIRSocketServer.Connect( KIRESockMessageSlots ); |
302 TInt ReturnErrorCode = iIRSocketServer.Connect( KIRESockMessageSlots ); |
337 |
303 |
529 { |
495 { |
530 IRLOG_DEBUG( "CIRNetworkController::~CIRNetworkController- Entering" ); |
496 IRLOG_DEBUG( "CIRNetworkController::~CIRNetworkController- Entering" ); |
531 _LIT(KErrorMsg,"Method Close not called"); |
497 _LIT(KErrorMsg,"Method Close not called"); |
532 __ASSERT_ALWAYS(iSingletonInstances == 0, User::Panic(KErrorMsg, KErrCorrupt)); |
498 __ASSERT_ALWAYS(iSingletonInstances == 0, User::Panic(KErrorMsg, KErrCorrupt)); |
533 |
499 |
534 delete iMobility; |
500 if(NULL != iMobility) |
|
501 { |
|
502 iMobility->Cancel(); |
|
503 delete iMobility; |
|
504 iMobility = NULL; |
|
505 } |
|
506 |
535 if (IsActive()) |
507 if (IsActive()) |
536 { |
508 { |
537 Cancel(); |
509 Cancel(); |
538 } |
510 } |
539 if (iIRNetworkConnection) |
511 if (iIRNetworkConnection) |
620 { |
590 { |
621 IRLOG_DEBUG( "CIRNetworkController::QueryCommsForIAPL- Entering" ); |
591 IRLOG_DEBUG( "CIRNetworkController::QueryCommsForIAPL- Entering" ); |
622 |
592 |
623 // Reset all the comms info |
593 // Reset all the comms info |
624 iIapList->Reset(); |
594 iIapList->Reset(); |
625 iBearerList.Reset(); |
|
626 iNetworkList.Reset(); |
|
627 iIapIdList.Reset(); |
|
628 |
595 |
629 #ifndef __WINS__ |
596 #ifndef __WINS__ |
630 CIRFilteredApReader* filteredReader = CIRFilteredApReader:: |
597 CIRFilteredApReader* filteredReader = CIRFilteredApReader:: |
631 NewLC( CIRFilteredApReader::KIRFilterWAPOnly | |
598 NewLC( CIRFilteredApReader::KIRFilterWAPOnly | |
632 CIRFilteredApReader::KIRFilterWAPMandatory | |
599 CIRFilteredApReader::KIRFilterWAPMandatory | |
637 while ( iapRecord ) |
604 while ( iapRecord ) |
638 { |
605 { |
639 CleanupStack::PushL( iapRecord ); |
606 CleanupStack::PushL( iapRecord ); |
640 |
607 |
641 iIapList->AppendL( iapRecord->iRecordName.GetL() ); |
608 iIapList->AppendL( iapRecord->iRecordName.GetL() ); |
642 iBearerList.AppendL( static_cast<TUint32>(iapRecord->iBearer) ); |
|
643 iNetworkList.AppendL( static_cast<TUint32>(iapRecord->iNetwork) ); |
|
644 iIapIdList.AppendL( iapRecord->RecordId() ); |
|
645 |
609 |
646 CleanupStack::PopAndDestroy( iapRecord ); |
610 CleanupStack::PopAndDestroy( iapRecord ); |
647 iapRecord = filteredReader->NextRecordL(); |
611 iapRecord = filteredReader->NextRecordL(); |
648 } |
612 } |
649 CleanupStack::PopAndDestroy( filteredReader ); |
613 CleanupStack::PopAndDestroy( filteredReader ); |
660 for (TInt i = 0; i < iapSet->iRecords.Count(); i++) |
624 for (TInt i = 0; i < iapSet->iRecords.Count(); i++) |
661 { |
625 { |
662 CCDIAPRecord* iapRecord = |
626 CCDIAPRecord* iapRecord = |
663 static_cast<CCDIAPRecord*> (iapSet->iRecords[i]); |
627 static_cast<CCDIAPRecord*> (iapSet->iRecords[i]); |
664 iIapList->AppendL(iapRecord->iRecordName.GetL()); |
628 iIapList->AppendL(iapRecord->iRecordName.GetL()); |
665 iBearerList.AppendL(static_cast<TUint32> (iapRecord->iBearer)); |
|
666 iNetworkList.AppendL(static_cast<TUint32> (iapRecord->iNetwork)); |
|
667 iIapIdList.AppendL(iapRecord->RecordId()); |
|
668 } |
629 } |
669 CleanupStack::PopAndDestroy(2, dbSession); |
630 CleanupStack::PopAndDestroy(2, dbSession); |
670 |
631 |
671 #endif |
632 #endif |
672 |
633 |
677 if( iIsWlanSupported ) |
638 if( iIsWlanSupported ) |
678 { |
639 { |
679 TBuf<KWlanStringMaxLength> wlanString; |
640 TBuf<KWlanStringMaxLength> wlanString; |
680 wlanString.Copy(KIRWLanName); |
641 wlanString.Copy(KIRWLanName); |
681 iIapList->AppendL(wlanString); |
642 iIapList->AppendL(wlanString); |
682 TUint32 WlanIdentifier(KIRUniqueWlanId); |
|
683 iBearerList.AppendL(WlanIdentifier); |
|
684 iNetworkList.AppendL((TUint32)KErrNotFound); |
|
685 iIapIdList.AppendL((TUint32)KErrNotFound); |
|
686 } |
643 } |
687 #endif |
644 #endif |
688 |
645 |
689 iIapList->Compress(); |
646 iIapList->Compress(); |
690 |
647 |
869 // --------------------------------------------------------------------------- |
826 // --------------------------------------------------------------------------- |
870 // |
827 // |
871 void CIRNetworkController::DoCancel() |
828 void CIRNetworkController::DoCancel() |
872 { |
829 { |
873 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 |
874 iIRNetworkConnection->Stop(); |
839 iIRNetworkConnection->Stop(); |
875 iIRNetworkConnection->Close(); |
840 iIRNetworkConnection->Close(); |
876 iIRSocketServer.Close(); |
841 iIRSocketServer.Close(); |
877 IRLOG_DEBUG( "CIRNetworkController::DoCancel - Exiting." ); |
842 IRLOG_DEBUG( "CIRNetworkController::DoCancel - Exiting." ); |
878 } |
843 } |