coreapplicationuis/accfwuinotifier/src/AccFwUiNotifierProxy.cpp
changeset 0 2e3d3ce01487
child 21 c4cbaa4fb734
child 62 924385140d98
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  Entry point to notifier server
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32std.h>
       
    21 #include <ecom/implementationproxy.h>
       
    22 
       
    23 #include "AccFwUiNoteNotifier.h"
       
    24 #include "AccFwUiDialogNotifier.h"
       
    25 #include "acc_debug.h"
       
    26 
       
    27 // EXTERNAL DATA STRUCTURES
       
    28 
       
    29 // EXTERNAL FUNCTION PROTOTYPES
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 const TInt KNumberOfImplementations(2);
       
    34 
       
    35 // MACROS
       
    36 
       
    37 // LOCAL CONSTANTS AND MACROS
       
    38 
       
    39 // MODULE DATA STRUCTURES
       
    40 
       
    41 // LOCAL FUNCTION PROTOTYPES
       
    42 
       
    43 // FORWARD DECLARATIONS
       
    44 
       
    45 // ============================= LOCAL FUNCTIONS ===============================
       
    46 
       
    47 // Creates notifiers on the array
       
    48 void CreateNotifiersL( CArrayPtrFlat<MEikSrvNotifierBase2>* aSubjects )
       
    49     {
       
    50     
       
    51     API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CreateNotifiersL() - enter" );
       
    52     MEikSrvNotifierBase2* note = CAccFwUiNoteNotifier::NewL();
       
    53     CleanupStack::PushL( note );
       
    54     
       
    55     MEikSrvNotifierBase2* dialog = CAccFwUiDialogNotifier::NewL();
       
    56     CleanupStack::PushL( dialog );        
       
    57     
       
    58     aSubjects->AppendL( note );
       
    59     aSubjects->AppendL( dialog );
       
    60     
       
    61     CleanupStack::Pop( dialog );
       
    62     CleanupStack::Pop( note );
       
    63     API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CreateNotifiersL() - return void" );
       
    64     
       
    65     }
       
    66     
       
    67 CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
       
    68     {
       
    69     CArrayPtrFlat<MEikSrvNotifierBase2>* subjects =
       
    70         new CArrayPtrFlat<MEikSrvNotifierBase2>(KNumberOfImplementations);
       
    71     
       
    72     API_TRACE_( "[AccFW: ACCFWUINOTIFIER] NotifierArray() - enter" );
       
    73     // if allocation succeeded
       
    74     if( subjects )
       
    75         {
       
    76         TRAPD( err, CreateNotifiersL( subjects ) );
       
    77         
       
    78         // release if creation failed
       
    79         if( err != KErrNone )
       
    80             {
       
    81             TInt count = subjects->Count();
       
    82             
       
    83             while( count-- )
       
    84                 {
       
    85                 // calling release on a MEikSrvNotifierBase2 will delete the instance
       
    86                 (*subjects)[count]->Release();
       
    87                 }
       
    88                 
       
    89             delete subjects;
       
    90             subjects = NULL;
       
    91             }
       
    92         }        
       
    93     API_TRACE_( "[AccFW: ACCFWUINOTIFIER] NotifierArray() - return" );
       
    94     return subjects;
       
    95     }
       
    96 
       
    97 const TImplementationProxy ImplementationTable[] =
       
    98 	{
       
    99 	{{0x10205060},  (TFuncPtr)NotifierArray}
       
   100 	};
       
   101 
       
   102 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
   103 	{
       
   104 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy) ;
       
   105 	return ImplementationTable;
       
   106 	}
       
   107     
       
   108 // ============================ MEMBER FUNCTIONS ===============================
       
   109 
       
   110 //End of file