syncmlfw/syncmlnotifier/ecom/SyncMLNotifierWrapper.cpp
branchRCL_3
changeset 25 b183ec05bd8c
parent 24 13d7c31c74e0
child 26 19bba8228ff0
equal deleted inserted replaced
24:13d7c31c74e0 25:b183ec05bd8c
     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:  Methods for SyncML notifier Ecom Plugins entry point
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <implementationproxy.h>
       
    21 #include <AknNotifierWrapper.h> // link against aknnotifierwrapper.lib
       
    22 
       
    23 #include "SyncMLNotifierBase.h"
       
    24 #include "SyncMLNotifDebug.h"
       
    25 
       
    26 
       
    27 // CONSTANTS
       
    28 const TInt KMaxSynchReplyBufLength = 256;
       
    29 
       
    30 const TInt KSmlNAppLaunchPriority = MEikSrvNotifierBase2::ENotifierPriorityVHigh;
       
    31 const TInt KSmlNDlgPriority       = MEikSrvNotifierBase2::ENotifierPriorityHigh;
       
    32 const TInt KSmlNFwUpdPriority     = MEikSrvNotifierBase2::ENotifierPriorityHigh;
       
    33 
       
    34 #ifdef __SERIES60_30__
       
    35     const TUid KSmlNAppServerUid = { 0x102072bf }; 
       
    36 #else // __SERIES60_30__
       
    37     _LIT( KSmlSyncMLNotifierDll, "syncmlnotifier.dll" );
       
    38 #endif // __SERIES60_30__
       
    39 
       
    40 
       
    41 // Provides pointer to the notifier creation function.
       
    42 const TImplementationProxy ImplementationTable[] =
       
    43 	{
       
    44 #ifdef __EABI__
       
    45 	{{0x101F876A},(TFuncPtr)NotifierArray}
       
    46 #else
       
    47 	{{0x101F876A},NotifierArray}
       
    48 #endif
       
    49 	};
       
    50 
       
    51 // ============================= LOCAL FUNCTIONS ===============================
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CleanupArray
       
    55 // Deletes notifiers
       
    56 // -----------------------------------------------------------------------------
       
    57 void CleanupArray( TAny* aArray )
       
    58     {
       
    59     FLOG(_L("[SmlNotif]\t CleanupArray()"));
       
    60     
       
    61     CArrayPtrFlat<MEikSrvNotifierBase2>*     
       
    62         subjects = static_cast<CArrayPtrFlat<MEikSrvNotifierBase2>*>(aArray);
       
    63     TInt lastInd = subjects->Count() - 1;
       
    64     for ( TInt i = lastInd; i >= 0; i-- )
       
    65         {
       
    66         subjects->At(i)->Release();	    	    
       
    67         }
       
    68     delete subjects;
       
    69     
       
    70     FLOG(_L("[SmlNotif]\t CleanupArray() completed"));
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // DoCreateNotifierArrayL
       
    75 // -----------------------------------------------------------------------------
       
    76 CArrayPtr<MEikSrvNotifierBase2>* DoCreateNotifierArrayL()
       
    77     {
       
    78     FLOG(_L("[SmlNotif]\t DoCreateNotifierArrayL()"));
       
    79     CArrayPtrFlat<MEikSrvNotifierBase2>* subjects =
       
    80         new ( ELeave ) CArrayPtrFlat<MEikSrvNotifierBase2>( KSmlNotifierArrayIncrement );
       
    81     
       
    82     CleanupStack::PushL( TCleanupItem( CleanupArray, subjects ) );
       
    83 
       
    84     // Create Wrappers
       
    85 
       
    86     // Session owning notifier
       
    87 #ifdef __SERIES60_30__
       
    88 
       
    89 
       
    90     CAknNotifierWrapper* master = 
       
    91         CAknNotifierWrapper::NewL( KSyncMLAppLaunchNotifierUid,
       
    92                                    KSmlAppLaunchChannel,
       
    93                                    KSmlNAppLaunchPriority,
       
    94                                    KSmlNAppServerUid,
       
    95                                    KMaxSynchReplyBufLength);
       
    96 
       
    97 #else // __SERIES60_30__
       
    98 
       
    99     CAknCommonNotifierWrapper* master = 
       
   100         CAknCommonNotifierWrapper::NewL( KSyncMLAppLaunchNotifierUid,
       
   101                                          KSmlAppLaunchChannel,
       
   102                                          KSmlNAppLaunchPriority,
       
   103                                          KSmlSyncMLNotifierDll(),
       
   104                                          KMaxSynchReplyBufLength);
       
   105 
       
   106 #endif // __SERIES60_30__
       
   107 		
       
   108     subjects->AppendL( master );
       
   109     
       
   110    // Notifiers using masters session 
       
   111     subjects->AppendL(new (ELeave) CAknNotifierWrapperLight(*master, 
       
   112                                                             KSyncMLDlgNotifierUid,
       
   113                                    			 				KSmlDlgChannel,
       
   114                                    			 				KSmlNDlgPriority));
       
   115                                    			 				
       
   116    // Notifiers using masters session 
       
   117     subjects->AppendL(new (ELeave) CAknNotifierWrapperLight(*master, 
       
   118                                                             KSyncMLFwUpdNotifierUid,
       
   119                                    			 				KSmlFwUpdChannel,
       
   120                                    			 				KSmlNFwUpdPriority));
       
   121                                    			 				
       
   122     CleanupStack::Pop();	// array cleanup
       
   123     FLOG(_L("[SmlNotif]\t DoCreateNotifierArrayL() completed"));
       
   124     return( subjects );
       
   125     }
       
   126 
       
   127 
       
   128 // -----------------------------------------------------------------------------
       
   129 // NotifierArray
       
   130 // Lib main entry point: Creates a notifiers array.
       
   131 // -----------------------------------------------------------------------------
       
   132 CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
       
   133     {
       
   134     FLOG(_L("[SmlNotif]\t NotifierArray()"));
       
   135     CArrayPtr<MEikSrvNotifierBase2>* array = 0;
       
   136     TRAPD( ignore, array = DoCreateNotifierArrayL() );
       
   137     if (ignore != KErrNone) 
       
   138     	{
       
   139     	ignore = KErrNone;
       
   140     	}
       
   141     FLOG(_L("[SmlNotif]\t NotifierArray() completed"));
       
   142     return array;
       
   143     }
       
   144 
       
   145 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   146 
       
   147 // -----------------------------------------------------------------------------
       
   148 // ImplementationGroupProxy
       
   149 // DLL entry point
       
   150 // -----------------------------------------------------------------------------
       
   151 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
   152 	{
       
   153 	FLOG(_L("[SmlNotif]\t ImplementationGroupProxy()"));
       
   154 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   155 	FTRACE( FPrint(
       
   156 	    _L("[SmlNotif]\t ImplementationGroupProxy completed, Table count = %d"),
       
   157 	    aTableCount ) );
       
   158 	return ImplementationTable;
       
   159 	}
       
   160