ncdengine/provider/deviceinteraction/inc/ncdactiveoperationobserver.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     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:   CNcdActiveOperationObserver
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef NCD_ACTIVE_OPERATION_OBSERVER_H
       
    20 #define NCD_ACTIVE_OPERATION_OBSERVER_H
       
    21 
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 class MNcdAsyncOperationObserver;
       
    26 
       
    27 
       
    28 /**
       
    29  * CNcdActiveOperationObserver
       
    30  *
       
    31  * This is a simple CActive class that observes when another
       
    32  * operation has finished. When this observer is informed
       
    33  * about the completion of another operation 
       
    34  * this class object informs the MNcdAsyncOperationObserver
       
    35  * about the completion.
       
    36  *
       
    37  * @see MNcdAsyncOperationObserver
       
    38  */
       
    39 class CNcdActiveOperationObserver : public CActive
       
    40 {
       
    41 
       
    42 public:
       
    43 
       
    44     /**
       
    45      * @param MNcdAsyncOperationObserver& The information about the completion of
       
    46      * an operation is forwarded to this observer by calling its callback
       
    47      * function.
       
    48      * @return CNcdActiveOperationObserver* Newly created object.
       
    49      */
       
    50     static CNcdActiveOperationObserver* NewL( MNcdAsyncOperationObserver& aObserver );
       
    51 
       
    52     /**
       
    53      * @see NewL
       
    54      */
       
    55     static CNcdActiveOperationObserver* NewLC( MNcdAsyncOperationObserver& aObserver );
       
    56 
       
    57 
       
    58     /**
       
    59      * Destructor
       
    60      */
       
    61     virtual ~CNcdActiveOperationObserver();
       
    62 
       
    63 
       
    64     /**
       
    65      * Sets this object active for observing.
       
    66      *
       
    67      * @note iStatus has to be set to value KRequestPending
       
    68      * by some other object before calling this function.
       
    69      */
       
    70     void StartToObserve();
       
    71     
       
    72     
       
    73 protected: // CActive
       
    74 
       
    75     /**
       
    76      * @see CActive::DoCancel
       
    77      */
       
    78     virtual void DoCancel();
       
    79 
       
    80     /**
       
    81      * @see CActive::RunL
       
    82      */
       
    83     virtual void RunL();
       
    84 
       
    85 
       
    86 protected:
       
    87 
       
    88     /**
       
    89      * @see NewL
       
    90      */ 
       
    91     CNcdActiveOperationObserver( MNcdAsyncOperationObserver& aObserver );
       
    92 
       
    93     /**
       
    94      * @see NewL
       
    95      */ 
       
    96     virtual void ConstructL();
       
    97     
       
    98     
       
    99     /**
       
   100      * @return MNcdAsyncOperationObserver& The information 
       
   101      * about the completion of an operation is forwarded to 
       
   102      * this observer by calling its callback function.
       
   103      * Ownership is not transferred.
       
   104      */
       
   105     MNcdAsyncOperationObserver& AsyncObserver() const;
       
   106 
       
   107 
       
   108 private:
       
   109 
       
   110     // Prevent these if not implemented
       
   111     CNcdActiveOperationObserver( const CNcdActiveOperationObserver& aObject );
       
   112     CNcdActiveOperationObserver& operator =( const CNcdActiveOperationObserver& aObject );
       
   113 
       
   114 
       
   115 private: // data
       
   116 
       
   117     // The information about the completion of
       
   118     // an operation is forwarded to this observer 
       
   119     // by calling its callback function.
       
   120     MNcdAsyncOperationObserver& iObserver;
       
   121 
       
   122 };
       
   123 
       
   124 #endif // NCD_ACTIVE_OPERATION_OBSERVER_H