localconnectivityservice/dun/server/inc/DunCloseWait.h
branchRCL_3
changeset 20 4a793f564d72
parent 19 0aa8cc770c8a
child 21 74aa6861c87d
equal deleted inserted replaced
19:0aa8cc770c8a 20:4a793f564d72
     1 /*
       
     2 * Copyright (c) 2006-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:  Common waiter for closing self-destruct plugins
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_CDUNCLOSEWAIT_H
       
    19 #define C_CDUNCLOSEWAIT_H
       
    20 
       
    21 #include <e32base.h>
       
    22 
       
    23 class MDunLocalMediaPlugin;
       
    24 
       
    25 /**
       
    26  *  Notification interface class to report requst for closing a plugin
       
    27  *
       
    28  *  @since S60 v5.0
       
    29  */
       
    30 NONSHARABLE_CLASS( MDunCloseWait )
       
    31     {
       
    32 
       
    33 public:
       
    34 
       
    35     /**
       
    36      * Gets called when closing of plugins should be done
       
    37      *
       
    38      * @since S60 5.0
       
    39      * @param aPluginsToClose Plugins to be closed
       
    40      * @return Symbian error code on error, KErrNone otherwise
       
    41      */
       
    42     virtual void NotifyPluginCloseAfterWait(
       
    43         RPointerArray<MDunLocalMediaPlugin>& aPluginsToClose ) = 0;
       
    44 
       
    45     };
       
    46 
       
    47 /**
       
    48  *  Common waiter for closing self-destruct plugins
       
    49  *
       
    50  *  @since S60 v5.0
       
    51  */
       
    52 NONSHARABLE_CLASS( CDunCloseWait ) : public CActive
       
    53     {
       
    54 
       
    55 public:
       
    56 
       
    57     /**
       
    58      * Two-phased constructor.
       
    59      * @param aCallback Callback to call when notification via MDunCloseWait
       
    60      *                  to be made
       
    61      * @return Instance of self
       
    62      */
       
    63 	static CDunCloseWait* NewL( MDunCloseWait* aCallback );
       
    64 
       
    65     /**
       
    66     * Destructor.
       
    67     */
       
    68     virtual ~CDunCloseWait();
       
    69 
       
    70     /**
       
    71      * Resets data to initial values
       
    72      *
       
    73      * @since S60 5.0
       
    74      * @return None
       
    75      */
       
    76     void ResetData();
       
    77 
       
    78     /**
       
    79      * Adds a new plugin to be closed to the list
       
    80      *
       
    81      * @since S60 5.0
       
    82      * @param aPluginToClose The plugin to be closed
       
    83      * @return Symbian error code on error, KErrNone otherwise
       
    84      */
       
    85     TInt AddPluginToClose( MDunLocalMediaPlugin* aPluginToClose );
       
    86 
       
    87     /**
       
    88      * Issues request to start closing the objects in the close list
       
    89      *
       
    90      * @since S60 5.0
       
    91      * @return Symbian error code on error, KErrNone otherwise
       
    92      */
       
    93     TInt IssueRequest();
       
    94 
       
    95     /**
       
    96      * Stops closing the objects in the close list
       
    97      *
       
    98      * @since S60 5.0
       
    99      * @return Symbian error code on error, KErrNone otherwise
       
   100      */
       
   101     TInt Stop();
       
   102 
       
   103 private:
       
   104 
       
   105     CDunCloseWait( MDunCloseWait* aCallback );
       
   106 
       
   107     void ConstructL();
       
   108 
       
   109     /**
       
   110      * Initializes this class
       
   111      *
       
   112      * @since S60 5.0
       
   113      * @return None
       
   114      */
       
   115     void Initialize();
       
   116 
       
   117 // from base class CActive
       
   118 
       
   119     /**
       
   120      * From CActive.
       
   121      * Gets called when closing of the plugins should be done
       
   122      *
       
   123      * @since S60 5.0
       
   124      * @return None
       
   125      */
       
   126     void RunL();
       
   127 
       
   128     /**
       
   129      * From CActive.
       
   130      * Gets called on cancel
       
   131      *
       
   132      * @since S60 5.0
       
   133      * @return None
       
   134      */
       
   135     void DoCancel();
       
   136 
       
   137 private:  // data
       
   138 
       
   139     /**
       
   140      * Callback to call when notification via MDunCloseWait to be made
       
   141      */
       
   142     MDunCloseWait* iCallback;
       
   143 
       
   144     /**
       
   145      * List of plugins to be closed
       
   146      * Not own.
       
   147      */
       
   148     RPointerArray<MDunLocalMediaPlugin> iCloseList;
       
   149 
       
   150 };
       
   151 
       
   152 #endif  // C_CDUNCLOSEWAIT_H