PECengine/AttributeLibrary2/SrcAttributeBase/CPEngAttrModelAsyncDataSetHook.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Attribute asynhronous data set hook.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CPENGATTRMODELASYNCDATASETHOOK_H
       
    19 #define CPENGATTRMODELASYNCDATASETHOOK_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <E32Base.h>
       
    23 
       
    24 
       
    25 //FORWARD DECLARATION
       
    26 class CPEngPresenceAttrModel;
       
    27 class MPEngPresenceAttrModelTypeImp;
       
    28 
       
    29 
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33  * Attribute asynhronous data set hook.
       
    34  *
       
    35  * @since 3.0
       
    36  */
       
    37 NONSHARABLE_CLASS( CPEngAttrModelAsyncDataSetHook ) : public CActive
       
    38     {
       
    39 public: //Constructor and destructor
       
    40 
       
    41     /**
       
    42      * C++ default constructor.
       
    43      */
       
    44     CPEngAttrModelAsyncDataSetHook();
       
    45 
       
    46 
       
    47     /**
       
    48      * Destructor.
       
    49      * Cancels any outstanding request.
       
    50      */
       
    51     ~CPEngAttrModelAsyncDataSetHook();
       
    52 
       
    53 
       
    54 public: // New functions
       
    55 
       
    56     /**
       
    57      * Initializess the hook.
       
    58      *
       
    59      * Sets the request status where to hook in
       
    60      * and also the attribute objects which to callback
       
    61      * when the request is completed or gets canceled.
       
    62      *
       
    63      * If hook is already active, leaves with KErrInUse.
       
    64      *
       
    65      * @since 3.0
       
    66      * @param aStatus The request status to hook in.
       
    67      * @param aAttributeModel The attribute model owning the hook.
       
    68      * @param aTypeImp The attribute model implementation
       
    69      * which data set to hook in.
       
    70      */
       
    71     void InitializeLC( TRequestStatus& aRequestStatus,
       
    72                        CPEngPresenceAttrModel& aAttributeModel,
       
    73                        MPEngPresenceAttrModelTypeImp& aTypeImp );
       
    74 
       
    75 
       
    76 
       
    77     /**
       
    78      * Gets the hooks own request status.
       
    79      *
       
    80      * This request status is given prior
       
    81      * starting the hook to concrete asynchronous
       
    82      * request.
       
    83      *
       
    84      * @since 3.0
       
    85      * @param The hook own request status.
       
    86      */
       
    87     TRequestStatus& Status();
       
    88 
       
    89 
       
    90     /**
       
    91      * Starts the data set hook.
       
    92      *
       
    93      * The hook must be properly initialized before a
       
    94      * call to start.
       
    95      *
       
    96      * Registered attribute object callbacks are called
       
    97      * when something happens in the hook.
       
    98      *
       
    99      * If the hook wasn't properly initialized before
       
   100      * starting, panics.
       
   101      *
       
   102      * @since 3.0
       
   103      */
       
   104     void Activate();
       
   105 
       
   106 
       
   107 protected:  // Functions from CActive
       
   108 
       
   109     /**
       
   110      * Gets called when actual request completes.
       
   111      *
       
   112      * @since 3.0
       
   113      */
       
   114     void RunL();
       
   115 
       
   116 
       
   117     /**
       
   118      * Gets called when hook is cancelled.
       
   119      *
       
   120      * @since 3.0
       
   121      */
       
   122     void DoCancel();
       
   123 
       
   124 
       
   125 protected:  // Helpers
       
   126     void Reset();
       
   127     static void ResetTheHook( TAny* aHook );
       
   128 
       
   129 
       
   130 private:    // Data
       
   131 
       
   132     //REF: Attribute model (owner) to update after complete
       
   133     CPEngPresenceAttrModel*  iHookOwner;
       
   134 
       
   135     //REF: Attribute model implementation to cancel
       
   136     MPEngPresenceAttrModelTypeImp* iHookedImp;
       
   137 
       
   138     //REF: Request status to complete after hook operation
       
   139     TRequestStatus* iStatusToComplete;
       
   140 
       
   141     };
       
   142 
       
   143 #endif      // CPENGATTRMODELASYNCDATASETHOOK_H
       
   144 
       
   145 // End of File
       
   146 
       
   147 
       
   148 
       
   149 
       
   150