convergedconnectionhandler/cchclientapi/cchuinotif/ecom/cchuinotifwrapper.cpp
changeset 0 a4daefaec16c
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     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:  ECOM wrapper for CCH UI Notifier plugin
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <AknNotifierWrapper.h> // link against aknnotifierwrapper.lib
       
    20 #include <implementationproxy.h>
       
    21 
       
    22 #include "cchuicommon.hrh"
       
    23 
       
    24 const TInt KMaxSynchReplyBufLength = 256;
       
    25 const TInt KCchUiNotifierPriority  = 
       
    26     MEikSrvNotifierBase2::ENotifierPriorityVHigh;
       
    27 const TInt KCchUiNotifierArrayIncrement = 1;
       
    28 
       
    29 
       
    30 // ======== LOCAL FUNCTIONS ========
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // CleanupArray.
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 void CleanupArray(TAny* aArray)
       
    37     {
       
    38     CArrayPtrFlat<MEikSrvNotifierBase2>*     
       
    39         subjects=static_cast<CArrayPtrFlat<MEikSrvNotifierBase2>*>(aArray);
       
    40     TInt lastInd = subjects->Count()-1;
       
    41     for (TInt i=lastInd; i >= 0; i--)
       
    42         subjects->At(i)->Release();             
       
    43     delete subjects;
       
    44     }
       
    45 
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // DoCreateNotifierArrayL.
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 CArrayPtr<MEikSrvNotifierBase2>* DoCreateNotifierArrayL()
       
    52     {       
       
    53     CArrayPtrFlat<MEikSrvNotifierBase2>* subjects=
       
    54         new (ELeave)CArrayPtrFlat<MEikSrvNotifierBase2>(
       
    55                 KCchUiNotifierArrayIncrement);
       
    56     
       
    57     CleanupStack::PushL(TCleanupItem(CleanupArray, subjects));
       
    58 
       
    59     // Create Wrappers
       
    60 
       
    61     // Session owning notifier
       
    62     CAknCommonNotifierWrapper* master = 
       
    63         CAknCommonNotifierWrapper::NewL( KCchUiNotifierUid,
       
    64                                    KCchUiNotifierChannel,
       
    65                                    KCchUiNotifierPriority,
       
    66                                    _L("cchuinotif.dll"),
       
    67                                    KMaxSynchReplyBufLength);               
       
    68                
       
    69     subjects->AppendL( master );
       
    70     
       
    71     CleanupStack::Pop();    // array cleanup
       
    72     return(subjects);
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // NotifierArray.
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
       
    80     // old Lib main entry point
       
    81     {            
       
    82     CArrayPtr<MEikSrvNotifierBase2>* array = 0;
       
    83     TRAPD(ignore, array = DoCreateNotifierArrayL());
       
    84     if (ignore != KErrNone) 
       
    85         {
       
    86         ignore = KErrNone;
       
    87         }
       
    88     return array;
       
    89     }
       
    90 
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // ImplementationTable.
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 const TImplementationProxy ImplementationTable[] =
       
    97     {
       
    98 #ifdef __EABI__
       
    99     {{0x200195A7},(TFuncPtr)NotifierArray}
       
   100 #else
       
   101     {{0x200195A7},NotifierArray}
       
   102 #endif
       
   103     };
       
   104 
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // ImplementationGroupProxy.
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
       
   111     TInt& aTableCount )
       
   112     {       
       
   113     
       
   114     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   115     return ImplementationTable;
       
   116     }
       
   117 
       
   118