securitydialogs/Securitynotifier/Src/Securitynotifierwrapper.cpp
changeset 0 164170e6151a
child 26 aad866c37519
child 49 09b1ac925e3f
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Securitynotifierwrapper acts as a proxy between
       
    15 *               clients and Securitynotifierappserver. 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include <ecom/implementationproxy.h>
       
    21 
       
    22 #include <AknNotifierWrapper.h> // link against aknnotifierwrapper.lib
       
    23 
       
    24 #define KMyNotifierUid TUid::Uid(0x10005988) //  uid
       
    25 #define KMyPriority TInt(MEikSrvNotifierBase2::ENotifierPriorityHigh)
       
    26 #define KMyAppServerUid TUid::Uid(0x102071FB)
       
    27  
       
    28 void CleanupArray(TAny* aArray)
       
    29     {
       
    30     CArrayPtrFlat<MEikSrvNotifierBase2>*     
       
    31         subjects=static_cast<CArrayPtrFlat<MEikSrvNotifierBase2>*>(aArray);
       
    32     TInt lastInd = subjects->Count()-1;
       
    33     for (TInt i=lastInd; i >= 0; i--)
       
    34         subjects->At(i)->Release();	    	    
       
    35     delete subjects;
       
    36     }
       
    37 
       
    38 CArrayPtr<MEikSrvNotifierBase2>* DoCreateNotifierArrayL()
       
    39     {
       
    40     #if defined(_DEBUG)
       
    41     RDebug::Print(_L("(SECURITYNOTIFIER)WRAPPER DoCreateNotifierArrayL BEGIN"));
       
    42 	#endif
       
    43     CArrayPtrFlat<MEikSrvNotifierBase2>* subjects=
       
    44         new (ELeave)CArrayPtrFlat<MEikSrvNotifierBase2>(3);
       
    45     
       
    46     CleanupStack::PushL(TCleanupItem(CleanupArray, subjects));
       
    47 
       
    48     // Create Wrappers
       
    49 
       
    50     // Session owning notifier(if default implementation is enough)
       
    51     CAknCommonNotifierWrapper* master = 
       
    52         CAknCommonNotifierWrapper::NewL( KMyNotifierUid,
       
    53                                    KMyNotifierUid,
       
    54                                    KMyPriority,
       
    55                                    _L("SecurityNotifier.dll"),
       
    56                                    1, // we don't use synch reply
       
    57                                    ETrue); // preload library once app server is up and running 
       
    58 	  	
       
    59 	   
       
    60     subjects->AppendL( master );
       
    61     CleanupStack::Pop();	// array cleanup
       
    62     #if defined(_DEBUG)
       
    63     RDebug::Print(_L("(SECURITYNOTIFIER)WRAPPER DoCreateNotifierArrayL END"));
       
    64 	#endif
       
    65     
       
    66     return(subjects);
       
    67     }
       
    68 
       
    69 
       
    70 CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
       
    71     // old Lib main entry point
       
    72     {
       
    73     CArrayPtr<MEikSrvNotifierBase2>* array = 0;
       
    74     TRAP_IGNORE(array = DoCreateNotifierArrayL()); 	
       
    75     return array;
       
    76     }
       
    77 
       
    78 const TImplementationProxy ImplementationTable[] =
       
    79 	{
       
    80 #ifdef __EABI__
       
    81 	{{0x102071fa},(TFuncPtr)NotifierArray}
       
    82 #else
       
    83 	{{0x102071fa},NotifierArray}
       
    84 #endif
       
    85 	};
       
    86 
       
    87 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
    88 	{
       
    89 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy) ;
       
    90 	return ImplementationTable;
       
    91 	}