supl/locationomasuplprotocolhandler/notifier/ecom/src/epos_omasuplnotifierplugin.cpp
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 2007 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:   SUPL Notifiers Entry functions and ECom implementation table
       
    15 *                definitions
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // System Includes
       
    22 #include <ecom/implementationproxy.h>
       
    23 #include <AknNotifierWrapper.h>
       
    24 
       
    25 //User Includes
       
    26 #include "epos_omasuplnotifierpluginuid.hrh"
       
    27 #include "epos_omasuplnotifierinterface.h"
       
    28 
       
    29 const MEikSrvNotifierBase2::TNotifierPriority KNotifierPriority = 
       
    30                                         MEikSrvNotifierBase2::ENotifierPriorityHigh;
       
    31                                         
       
    32 // Constant Definitions
       
    33 const TInt KMaxSynchReplyBufLength = 256;                                        
       
    34 	
       
    35 // ======== LOCAL FUNCTIONS ========
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // Helper method to perform cleanup of the CArrayPtrFlat array object.
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 void CleanupArray( TAny*        aArray )
       
    42     {
       
    43     CArrayPtrFlat< MEikSrvNotifierBase2 >* subjects = 
       
    44             static_cast< CArrayPtrFlat< MEikSrvNotifierBase2 >* >( aArray );
       
    45     TInt lastInd = subjects->Count() - 1;
       
    46     for ( TInt i = lastInd; i >= 0; i-- )
       
    47         {
       
    48         subjects->At( i )->Release();
       
    49         }    	    
       
    50     delete subjects;
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // Creates an array of Notifer objects
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 CArrayPtr< MEikSrvNotifierBase2 >* DoCreateNotifierArrayL()
       
    58     {
       
    59     // Create an array of Notifier objects
       
    60     CArrayPtrFlat< MEikSrvNotifierBase2 >* subjects =
       
    61                     new ( ELeave )CArrayPtrFlat< MEikSrvNotifierBase2 >( 1 );    
       
    62     CleanupStack::PushL( TCleanupItem( CleanupArray, subjects ));
       
    63 
       
    64     CAknCommonNotifierWrapper* master = 
       
    65         CAknCommonNotifierWrapper::NewL( 
       
    66                                     KSuplHomeNotifier,
       
    67                                     KSuplHomeNotifierChannel,
       
    68                                     KNotifierPriority,
       
    69                                     _L("epos_omasuplnotifier.dll"),
       
    70                                    KMaxSynchReplyBufLength);
       
    71 	  		   
       
    72     subjects->AppendL( master );
       
    73     
       
    74     // Notifiers using masters session 
       
    75     subjects->AppendL( new ( ELeave ) CAknNotifierWrapperLight( *master, 
       
    76                                                                 KSuplRoamingNotifier,
       
    77                                    			 				    KSuplRoamingNotifierChannel,
       
    78                                    			 				    KNotifierPriority ));
       
    79                                    			 				
       
    80     // Notifiers using masters session 
       
    81     subjects->AppendL( new ( ELeave ) CAknNotifierWrapperLight( *master, 
       
    82                                                                 KSuplTimeoutNotifier,
       
    83                                    			 				    KSuplTimeoutNotifierChannel,
       
    84                                    			 				    KNotifierPriority ));
       
    85     
       
    86     CleanupStack::Pop( subjects );
       
    87     return( subjects );
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // ECOM plugin instantiation function
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 CArrayPtr< MEikSrvNotifierBase2 >* NotifierArray()
       
    95     {
       
    96     CArrayPtr< MEikSrvNotifierBase2 >* array = NULL;
       
    97     TRAPD( error, array = DoCreateNotifierArrayL());
       
    98     if ( error )
       
    99         {
       
   100         return NULL;
       
   101         }
       
   102     return array;
       
   103     }
       
   104 
       
   105 /**
       
   106  * SUPL Notifier ECom implementation table.
       
   107  */
       
   108 const TImplementationProxy KOmaSuplPosImplTable[] = 
       
   109 	{
       
   110 	IMPLEMENTATION_PROXY_ENTRY( KOmaSuplNotPluginImplUid, NotifierArray )
       
   111 	};
       
   112 
       
   113 // ======== GLOBAL FUNCTIONS ========
       
   114 
       
   115 // ---------------------------------------------------------------------------
       
   116 // ImplementationGroupProxy
       
   117 // Gate/factory function
       
   118 //
       
   119 // ---------------------------------------------------------------------------
       
   120 //
       
   121 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
   122 	{
       
   123 	aTableCount = sizeof( KOmaSuplPosImplTable ) / sizeof( TImplementationProxy );
       
   124 	return KOmaSuplPosImplTable;
       
   125 	}