srsf/nssvasapi/nssvasdb/src/nssvascvasdbmgr.cpp
branchRCL_3
changeset 19 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
18:cad71a31b7fc 19:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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:  CNssVASDBMgr is the starting point to begin interaction with VAS. 
       
    15 *               The client must first create and Initialize the CNssVASDBMgr; then 
       
    16 *               request the ContextMgr, TagMgr, VASDBEventNotifier, or 
       
    17 *               TagSelectNotifier to begin using VAS services. 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <f32file.h>
       
    25 #include "nssvascvasdbmgr.h"
       
    26 #include "nssvascvasdbbuilder.h"
       
    27 #include "rubydebug.h"
       
    28 
       
    29 
       
    30 // ================= MEMBER FUNCTIONS =======================
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // CVASDbMgr::CVASDbMgr
       
    34 // C++ default constructor can NOT contain any code, that
       
    35 // might leave.
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 CNssVASDBMgr::CNssVASDBMgr ()
       
    39     {
       
    40     }
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // CVASDbMgr::ConstructL
       
    44 // EPOC constructor
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 void CNssVASDBMgr::ConstructL()
       
    48     {
       
    49 	iVasDBBuilder = CNssVASDBBuilder::InstanceL();
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CVASDbMgr::NewL
       
    54 // 2-phase constructor
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 EXPORT_C CNssVASDBMgr* CNssVASDBMgr::NewL()
       
    58     {
       
    59     RUBY_DEBUG_BLOCK( "CNssVASDBMgr::NewL" );
       
    60     
       
    61 	CNssVASDBMgr* self = NewLC();
       
    62 	CleanupStack::Pop( self );
       
    63 	return( self );
       
    64     }
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // CVASDbMgr::NewLC
       
    68 // 2-phase constructor
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 EXPORT_C CNssVASDBMgr* CNssVASDBMgr::NewLC()
       
    72     {
       
    73 	CNssVASDBMgr* self = new(ELeave)CNssVASDBMgr;
       
    74 	CleanupStack::PushL( self );
       
    75 	self->ConstructL();
       
    76 	return( self );
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CVASDbMgr::~CNssVASDBMgr
       
    81 // 2-phase constructor
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 CNssVASDBMgr::~CNssVASDBMgr()
       
    85     {
       
    86     RUBY_DEBUG0( "CNssVASDBMgr::~CNssVASDBMgr" );
       
    87 
       
    88     if ( iVasDBBuilder )
       
    89         {
       
    90         CNssVASDBBuilder::RemoveInstance();
       
    91         }
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CVASDbMgr::InitializeL
       
    96 // Initializes the VAS DB Manager
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 #ifdef __SIND_RD_BREAK_PHONEBOOK_COMPATIBILITY 
       
   100 EXPORT_C void CNssVASDBMgr::InitializeL()
       
   101     {
       
   102 	iVasDBBuilder->InitializeL();
       
   103     }
       
   104 #else
       
   105 EXPORT_C TInt CNssVASDBMgr::InitializeL()
       
   106     {
       
   107 	iVasDBBuilder->InitializeL();
       
   108 	return KErrNone;
       
   109     }
       
   110 #endif // __SIND_RD_BREAK_PHONEBOOK_COMPATIBILITY
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CVASDbMgr::GetContextMgr
       
   114 // gets the context manager
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 EXPORT_C MNssContextMgr* CNssVASDBMgr::GetContextMgr()
       
   118     {
       
   119 	return iVasDBBuilder->GetContextMgr();
       
   120     }
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // CVASDbMgr::GetContextMgr
       
   124 // gets the tag manager
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 EXPORT_C MNssTagMgr* CNssVASDBMgr::GetTagMgr()
       
   128     {
       
   129 	return  iVasDBBuilder->GetTagMgr();
       
   130     }
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // CVASDbMgr::GetContextMgr
       
   134 // gets the VAS DB Event notifier
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 EXPORT_C MNssVASDBEventNotifier* CNssVASDBMgr::GetVASDBEventNotifier()
       
   138     {
       
   139 	return iVasDBBuilder->GetVASDBEventNotifier();
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CVASDbMgr::GetContextMgr
       
   144 // gets the tag select notifier
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 EXPORT_C CNssDBTagSelectNotifier* CNssVASDBMgr::GetTagSelectNotifier()
       
   148     {
       
   149 	return iVasDBBuilder->GetTagSelectNotifier();
       
   150     }
       
   151 
       
   152 // -----------------------------------------------------------------------------
       
   153 // CVASDbMgr::GetContextMgr
       
   154 // Resets factory models
       
   155 // -----------------------------------------------------------------------------
       
   156 //
       
   157 EXPORT_C void CNssVASDBMgr::ResetFactoryModelsL( MNssResetFactoryModelsClient* aClient )
       
   158     {
       
   159     User::LeaveIfError( 
       
   160         iVasDBBuilder->GetContextMgr()->ResetFactoryModels( aClient )
       
   161         );
       
   162     }
       
   163