phonebookengines/VirtualPhonebook/VPbkSimStoreImpl/src/CAdnStore.cpp
branchRCL_3
changeset 20 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  An ADN store
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "CAdnStore.h"
       
    22 
       
    23 #include "CPhone.h"
       
    24 #include <CVPbkSimStateInformation.h>
       
    25 #include <VPbkDebug.h>
       
    26 
       
    27 namespace VPbkSimStoreImpl {
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CAdnStore::CAdnStore
       
    33 // C++ default constructor can NOT contain any code, that
       
    34 // might leave.
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CAdnStore::CAdnStore( TStoreParams& aParams )
       
    38 :   CCustomStore( aParams )
       
    39     {
       
    40     }
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // CAdnStore::ConstructL
       
    44 // Symbian 2nd phase constructor can leave.
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 void CAdnStore::ConstructL()
       
    48     {
       
    49     CCustomStore::ConstructL();
       
    50     Phone().AddObserverL( *this );
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CAdnStore::NewL
       
    55 // Two-phased constructor.
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CAdnStore* CAdnStore::NewL( TStoreParams& aParams )
       
    59     {
       
    60     CAdnStore* self = new( ELeave ) CAdnStore( aParams );
       
    61     CleanupStack::PushL( self );
       
    62     self->ConstructL();
       
    63     CleanupStack::Pop( self );
       
    64     return self;
       
    65     }
       
    66     
       
    67 // Destructor
       
    68 CAdnStore::~CAdnStore()
       
    69     {
       
    70     VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING(
       
    71         "VPbkSimStoreImpl: CAdnStore::~CAdnStore"));
       
    72     CancelRequests();
       
    73     Phone().RemoveObserver(*this);
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CAdnStore::ETelName
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 const TDesC& CAdnStore::ETelName() const
       
    81     {
       
    82     return KETelIccAdnPhoneBook;
       
    83     }
       
    84 
       
    85 // ----------------------------------------------------------------------------
       
    86 // CAdnStore::CompleteSATRefresh
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 void CAdnStore::CompleteSATRefresh( 
       
    90         MSimRefreshCompletion& aSimRefreshCompletion )
       
    91     {
       
    92     // It's assumed that GSM ADN store init reads only SAT defined EFs
       
    93     aSimRefreshCompletion.SatRefreshCompleted( *this, EFalse );
       
    94     }
       
    95     
       
    96 // ----------------------------------------------------------------------------
       
    97 // CAdnStore::AllowOpeningL
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 TBool CAdnStore::AllowOpeningL()
       
   101     {
       
   102     if ( SimStateInformation().ActiveFdnBlocksAdnStoreL( Phone() ) || 
       
   103     		!CStoreBase::AllowOpeningL() )
       
   104         {
       
   105         return EFalse;
       
   106         }
       
   107     return ETrue;
       
   108     }
       
   109 
       
   110 // ----------------------------------------------------------------------------
       
   111 // CAdnStore::ElementaryFiles
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 TUint32 CAdnStore::ElementaryFiles()
       
   115     {
       
   116     return KADNRefresh | KADNExtRefresh | KSimReset | KSimInit |
       
   117 			KSimInitFullFileChangeNotification | KUsimApplicationReset |
       
   118 			K3GSessionReset;
       
   119     }
       
   120 
       
   121 // ----------------------------------------------------------------------------
       
   122 // CAdnStore::PhoneOpened
       
   123 // -----------------------------------------------------------------------------
       
   124 //    
       
   125 void CAdnStore::PhoneOpened( MVPbkSimPhone& /*aPhone*/ )
       
   126     {
       
   127     // Phone is already opened before store
       
   128     }
       
   129 
       
   130 // ----------------------------------------------------------------------------
       
   131 // CAdnStore::PhoneError
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 void CAdnStore::PhoneError( MVPbkSimPhone& /*aPhone*/, 
       
   135         TErrorIdentifier /*aIdentifier*/, TInt /*aError*/ )
       
   136     {
       
   137     // Phone is already opened before store
       
   138     }
       
   139 
       
   140 // ----------------------------------------------------------------------------
       
   141 // CAdnStore::ServiceTableUpdated
       
   142 // -----------------------------------------------------------------------------
       
   143 //      
       
   144 void CAdnStore::ServiceTableUpdated( TUint32 /*aServiceTable*/ )
       
   145     {
       
   146     // Not interested in service table
       
   147     }
       
   148     
       
   149 // ----------------------------------------------------------------------------
       
   150 // CAdnStore::FixedDiallingStatusChanged
       
   151 // -----------------------------------------------------------------------------
       
   152 //    
       
   153 void CAdnStore::FixedDiallingStatusChanged( TInt /*aFDNStatus*/ )
       
   154     {
       
   155     FUNC_ENTRY();
       
   156     TRAPD( res, HandleFDNStatusChangeL() );
       
   157     if ( res != KErrNone )
       
   158         {
       
   159         SendStoreErrorEvent( res );
       
   160         }
       
   161     FUNC_EXIT();
       
   162     }
       
   163 
       
   164 // ----------------------------------------------------------------------------
       
   165 // CAdnStore::HandleFDNStatusChangeL
       
   166 // -----------------------------------------------------------------------------
       
   167 //    
       
   168 void CAdnStore::HandleFDNStatusChangeL()
       
   169     {
       
   170     TBool adnBlocked = SimStateInformation().ActiveFdnBlocksAdnStoreL( Phone() );
       
   171     
       
   172     // If store hasn't been open (because FDN blocking) the store must
       
   173     // be constructed.
       
   174     if ( CurrentState() == EStoreNotOpen && !adnBlocked )
       
   175         {
       
   176         ConstructStoreL();
       
   177         }
       
   178     // If store is not available (it has been constructed before)
       
   179     // send store ready event.
       
   180     else if ( CurrentState() == EStoreNotAvailable && !adnBlocked )
       
   181         {
       
   182         SendStoreReadyEvent();
       
   183         }
       
   184     // If store is open and FDN is activated and it blocks ADN
       
   185     // then set store to not available state
       
   186     else if ( CurrentState() == EStoreOpen && adnBlocked )
       
   187         {
       
   188         SendStoreUnavailableEvent();
       
   189         }
       
   190     }
       
   191 } // namespace VPbkSimStoreImpl 
       
   192 //  End of File