localconnectivityservice/dun/server/inc/DunCloseWait.h
author hgs
Fri, 15 Oct 2010 15:05:57 +0800
changeset 54 4dc88a4ac6f4
parent 29 3ae5cb0b4c02
permissions -rw-r--r--
201041_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     1
/*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     2
* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     3
* All rights reserved.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     8
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     9
* Initial Contributors:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    11
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    12
* Contributors:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    13
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    14
* Description:  Common waiter for closing self-destruct plugins
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    15
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    16
*/
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    17
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    18
#ifndef C_CDUNCLOSEWAIT_H
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    19
#define C_CDUNCLOSEWAIT_H
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    20
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    21
#include <e32base.h>
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    22
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    23
class MDunLocalMediaPlugin;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    24
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    25
/**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    26
 *  Notification interface class to report requst for closing a plugin
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    27
 *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    28
 *  @since S60 v5.0
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    29
 */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    30
NONSHARABLE_CLASS( MDunCloseWait )
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    31
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    32
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    33
public:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    34
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    35
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    36
     * Gets called when closing of plugins should be done
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    37
     *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    38
     * @since S60 5.0
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    39
     * @param aPluginsToClose Plugins to be closed
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    40
     * @return Symbian error code on error, KErrNone otherwise
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    41
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    42
    virtual void NotifyPluginCloseAfterWait(
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    43
        RPointerArray<MDunLocalMediaPlugin>& aPluginsToClose ) = 0;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    44
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    45
    };
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    46
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    47
/**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    48
 *  Common waiter for closing self-destruct plugins
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    49
 *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    50
 *  @since S60 v5.0
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    51
 */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    52
NONSHARABLE_CLASS( CDunCloseWait ) : public CActive
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    53
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    54
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    55
public:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    56
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    57
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    58
     * Two-phased constructor.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    59
     * @param aCallback Callback to call when notification via MDunCloseWait
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    60
     *                  to be made
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    61
     * @return Instance of self
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    62
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    63
	static CDunCloseWait* NewL( MDunCloseWait* aCallback );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    64
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    65
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    66
    * Destructor.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    67
    */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    68
    virtual ~CDunCloseWait();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    69
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    70
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    71
     * Resets data to initial values
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    72
     *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    73
     * @since S60 5.0
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    74
     * @return None
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    75
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    76
    void ResetData();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    77
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    78
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    79
     * Adds a new plugin to be closed to the list
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    80
     *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    81
     * @since S60 5.0
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    82
     * @param aPluginToClose The plugin to be closed
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    83
     * @return Symbian error code on error, KErrNone otherwise
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    84
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    85
    TInt AddPluginToClose( MDunLocalMediaPlugin* aPluginToClose );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    86
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    87
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    88
     * Issues request to start closing the objects in the close list
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    89
     *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    90
     * @since S60 5.0
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    91
     * @return Symbian error code on error, KErrNone otherwise
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    92
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    93
    TInt IssueRequest();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    94
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    95
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    96
     * Stops closing the objects in the close list
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    97
     *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    98
     * @since S60 5.0
54
4dc88a4ac6f4 201041_02
hgs
parents: 29
diff changeset
    99
     * @return None
29
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   100
     */
54
4dc88a4ac6f4 201041_02
hgs
parents: 29
diff changeset
   101
    void Stop();
29
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   102
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   103
private:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   104
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   105
    CDunCloseWait( MDunCloseWait* aCallback );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   106
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   107
    void ConstructL();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   108
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   109
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   110
     * Initializes this class
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   111
     *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   112
     * @since S60 5.0
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   113
     * @return None
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   114
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   115
    void Initialize();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   116
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   117
// from base class CActive
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   118
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   119
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   120
     * From CActive.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   121
     * Gets called when closing of the plugins should be done
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   122
     *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   123
     * @since S60 5.0
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   124
     * @return None
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   125
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   126
    void RunL();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   127
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   128
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   129
     * From CActive.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   130
     * Gets called on cancel
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   131
     *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   132
     * @since S60 5.0
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   133
     * @return None
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   134
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   135
    void DoCancel();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   136
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   137
private:  // data
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   138
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   139
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   140
     * Callback to call when notification via MDunCloseWait to be made
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   141
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   142
    MDunCloseWait* iCallback;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   143
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   144
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   145
     * List of plugins to be closed
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   146
     * Not own.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   147
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   148
    RPointerArray<MDunLocalMediaPlugin> iCloseList;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   149
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   150
};
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   151
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   152
#endif  // C_CDUNCLOSEWAIT_H