convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuinotifiermain.cpp
branchRCL_3
changeset 22 d38647835c2e
parent 0 a4daefaec16c
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2008-2008 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:  Implements notifier creation, required for notifier fw.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <eikenv.h>
       
    20 #include <cenrepnotifyhandler.h>
       
    21 
       
    22 #include "cchuinotifierimpl.h"
       
    23 
       
    24 const TInt KCchUiNotifierArrayIncrement = 10;
       
    25 
       
    26 
       
    27 // ======== LOCAL FUNCTIONS ========
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // Instantiate notifiers.
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 LOCAL_C void CreateCchUiNotifiersL( 
       
    34     CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers )
       
    35     {
       
    36     __ASSERT_ALWAYS( aNotifiers, User::Leave( KErrArgument ) );
       
    37     CCCHUiNotifierImpl* notifierImpl = 
       
    38         CCCHUiNotifierImpl::NewL();
       
    39     CleanupStack::PushL( notifierImpl );
       
    40     aNotifiers->AppendL( notifierImpl );
       
    41     CleanupStack::Pop( notifierImpl );
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // Creates a notifiers array.
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 EXPORT_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
       
    49     {    
       
    50     CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers = NULL;
       
    51 
       
    52     TRAPD(err, notifiers = 
       
    53                new (ELeave)CArrayPtrFlat<MEikSrvNotifierBase2>( 
       
    54                        KCchUiNotifierArrayIncrement ));
       
    55                
       
    56     if ( err == KErrNone )
       
    57         {
       
    58         if( notifiers )
       
    59             {
       
    60             TRAPD( err2, CreateCchUiNotifiersL( notifiers ));
       
    61             if( err2 )
       
    62                 {
       
    63                 TInt count = notifiers->Count();
       
    64                 while(count--)
       
    65                     (*notifiers)[count]->Release();
       
    66                 delete notifiers;
       
    67                 notifiers = NULL;
       
    68                 }
       
    69             }
       
    70         }
       
    71     else
       
    72         {   
       
    73         }
       
    74         
       
    75     return notifiers;
       
    76     }
       
    77 
       
    78 
       
    79