internetradio2.0/networkcontrollersrc/irnetworkcontroller.cpp
changeset 11 f683e24efca3
parent 5 0930554dc389
--- a/internetradio2.0/networkcontrollersrc/irnetworkcontroller.cpp	Fri Jun 11 13:30:40 2010 +0300
+++ b/internetradio2.0/networkcontrollersrc/irnetworkcontroller.cpp	Wed Jun 23 18:04:00 2010 +0300
@@ -36,15 +36,10 @@
 
 #include "iractivenetworkobserver.h"
 
-//for ALR/SNAP
-#include <cmmanager.h>
-#include <cmdestination.h>
-
 
 const TInt KMaxIRUAProfLength = 250; // Max length of the UAProf string
 const TInt KIRDefaultUAProfBufferSize = 0x80;
 const TUint KIRESockMessageSlots = 16;
-const TUint32 KIRUniqueWlanId = 0x2000883F; // Just to make it unique
 const TInt KArraySize = 5;
 const TInt KWlanStringMaxLength = 9;
 const TInt KTwo = 2;
@@ -101,6 +96,13 @@
         CleanupStack::Pop(networkController);
 	}
     networkController->iSingletonInstances++;
+    
+    if (NULL != aObserver)
+    {
+        networkController->iObserver = aObserver;
+        networkController->iIRNetworkObserver->SetObserver(aObserver);
+    }
+    
     IRLOG_DEBUG( "CIRNetworkController::OpenL - Exiting." );
     return networkController;
 }
@@ -261,49 +263,6 @@
 }
 
 // ---------------------------------------------------------------------------
-// CIRNetworkController::GetAccessPointList
-// Reset the connection status to Disconnected statet
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const CDesCArray* CIRNetworkController::GetAccessPointList() const
-{
-    IRLOG_DEBUG( "CIRNetworkController::GetAccessPointList" );
-    return iIapList;
-}
-
-// ---------------------------------------------------------------------------
-// CIRNetworkController::GetBearerList
-// Reset the connection status to Disconnected statet
-//
-EXPORT_C const RArray<TUint32> CIRNetworkController::GetBearerList() const
-{
-    IRLOG_DEBUG( "CIRNetworkController::GetBearerList" );
-    return iBearerList;
-}
-
-// ---------------------------------------------------------------------------
-// CIRNetworkController::GetNetworkList
-// Reset the connection status to Disconnected statet
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const RArray<TUint32> CIRNetworkController::GetNetworkList() const
-{
-    IRLOG_DEBUG( "CIRNetworkController::GetNetworkList" );
-    return iNetworkList;
-}
-
-// ---------------------------------------------------------------------------
-// CIRNetworkController::GetApList
-// Reset the connection status to Disconnected statet
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const RArray<TUint32> CIRNetworkController::GetApList() const
-{
-    IRLOG_DEBUG( "CIRNetworkController::GetApList" );
-    return iIapIdList;
-}
-
-// ---------------------------------------------------------------------------
 //  CIRNetworkController::ChooseAccessPointL
 //  Configures the Access Point which is used by all the components for network
 //  connectivity
@@ -330,6 +289,13 @@
     // Always validate the Access Points status
     if ( ValidateAccessPointsL() )
     { 
+        if(NULL != iMobility)
+        {
+         iMobility->Cancel();
+         delete iMobility;
+         iMobility = NULL;
+        }
+
         // Connect to the Symbian Socket Server
         iIRNetworkConnection->Close();
         iIRSocketServer.Close();
@@ -531,7 +497,13 @@
     _LIT(KErrorMsg,"Method Close not called");
     __ASSERT_ALWAYS(iSingletonInstances == 0, User::Panic(KErrorMsg, KErrCorrupt));
 
-    delete iMobility;
+    if(NULL != iMobility)
+    {
+     iMobility->Cancel();
+     delete iMobility;
+     iMobility = NULL;
+    }
+
     if (IsActive())
     {
         Cancel();
@@ -552,9 +524,7 @@
     }
     delete iIRNetworkObserver;
     iIRSocketServer.Close();
-    iBearerList.Close();
-    iNetworkList.Close();
-    iIapIdList.Close();
+
     if (iIapList)
     {
         iIapList->Reset();
@@ -622,9 +592,6 @@
 
     // Reset all the comms info
     iIapList->Reset();
-    iBearerList.Reset();
-    iNetworkList.Reset();
-    iIapIdList.Reset();
     
 #ifndef __WINS__
     CIRFilteredApReader* filteredReader = CIRFilteredApReader::
@@ -639,9 +606,6 @@
         CleanupStack::PushL( iapRecord );
 
         iIapList->AppendL( iapRecord->iRecordName.GetL() );
-        iBearerList.AppendL( static_cast<TUint32>(iapRecord->iBearer) );
-        iNetworkList.AppendL( static_cast<TUint32>(iapRecord->iNetwork) );
-        iIapIdList.AppendL( iapRecord->RecordId() );
 
         CleanupStack::PopAndDestroy( iapRecord );
         iapRecord = filteredReader->NextRecordL();
@@ -662,9 +626,6 @@
         CCDIAPRecord* iapRecord =
                 static_cast<CCDIAPRecord*> (iapSet->iRecords[i]);
         iIapList->AppendL(iapRecord->iRecordName.GetL());
-        iBearerList.AppendL(static_cast<TUint32> (iapRecord->iBearer));
-        iNetworkList.AppendL(static_cast<TUint32> (iapRecord->iNetwork));
-        iIapIdList.AppendL(iapRecord->RecordId());
     }
     CleanupStack::PopAndDestroy(2, dbSession);
 
@@ -679,10 +640,6 @@
         TBuf<KWlanStringMaxLength> wlanString;
         wlanString.Copy(KIRWLanName);
         iIapList->AppendL(wlanString);
-        TUint32 WlanIdentifier(KIRUniqueWlanId);
-        iBearerList.AppendL(WlanIdentifier);
-        iNetworkList.AppendL((TUint32)KErrNotFound);
-        iIapIdList.AppendL((TUint32)KErrNotFound);
     }
 #endif
 
@@ -871,6 +828,14 @@
 void CIRNetworkController::DoCancel()
 {
     IRLOG_DEBUG( "CIRNetworkController::DoCancel - Entering" );
+
+    if(NULL != iMobility)
+    {
+     iMobility->Cancel();
+     delete iMobility;
+     iMobility = NULL;
+    }
+
     iIRNetworkConnection->Stop();
     iIRNetworkConnection->Close();
     iIRSocketServer.Close();