mmsharing/mmshui/inc/musuicallbackservice.h
branchRCL_3
changeset 33 bc78a40cd63c
parent 0 f0cf47e981f9
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
       
     1 /*
       
     2 * Copyright (c) 2005 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MUSUICALLBACKSERVICE_H
       
    20 #define MUSUICALLBACKSERVICE_H
       
    21 
       
    22 #include "musuidefinitions.h"
       
    23 #include <e32base.h>
       
    24 
       
    25 class MMusUiCallbackObserver;
       
    26 
       
    27 
       
    28 /**
       
    29  * Callback Service used to pass asynchronous events
       
    30  */
       
    31 class CMusUiCallbackService : public CActive
       
    32     {
       
    33 
       
    34 public: // Constructors and destructor
       
    35 
       
    36     /**
       
    37     * Two-phased constructor.
       
    38     * @param aCallbackObserver the observer that will receive the callbacks.
       
    39     * @return new instance of CMusUiCallbackService.
       
    40     */
       
    41     static CMusUiCallbackService* NewL( 
       
    42                             MMusUiCallbackObserver& aCallbackObserver );
       
    43     
       
    44     /**
       
    45     * Destructor.
       
    46     */
       
    47     ~CMusUiCallbackService();
       
    48 
       
    49 private: // Constructors
       
    50 
       
    51     /**
       
    52     * C++ default constructor.
       
    53     * @param aCallbackObserver the observer that will receive the callbacks.
       
    54     */
       
    55     CMusUiCallbackService( MMusUiCallbackObserver& aCallbackObserver );
       
    56     
       
    57     /**
       
    58     * By default Symbian 2nd phase constructor is private.
       
    59     */
       
    60     void ConstructL();
       
    61 
       
    62 
       
    63 public: // New functions
       
    64 
       
    65     /**
       
    66     * Buffer a request to trigger an event.
       
    67     * @param aEventId    Id of the event
       
    68     */
       
    69     void AsyncEventL( TMusUiAsyncEvent aEventId );
       
    70 
       
    71     /**
       
    72     * Called when the notifier has been deactivated so resources can be 
       
    73     * freed and outstanding messages completed.
       
    74     */
       
    75     void Cancel();
       
    76     
       
    77     /**
       
    78     * Check what event is currently pending
       
    79     * @return EMusUiAsyncUninitialized is no events are pending
       
    80     */
       
    81     TMusUiAsyncEvent CurrentEvent() const;
       
    82 
       
    83 
       
    84 public: // Functions from CActive base class
       
    85     
       
    86     /**
       
    87     * From CActive.  Called when a request completes.
       
    88     */
       
    89     void RunL();
       
    90 
       
    91     /**
       
    92     * From CActive.  Called when a leave occurres in RunL.
       
    93     * @param aError Symbian OS errorcode.
       
    94     * @return Error Code.
       
    95     */
       
    96     TInt RunError(TInt aError);
       
    97     
       
    98     /**
       
    99     * From CActive.  Called when a request is cancelled.
       
   100     */
       
   101     void DoCancel();  
       
   102 
       
   103 
       
   104 private: // New functions
       
   105 
       
   106     /**
       
   107     * Activate the object.
       
   108     */
       
   109     void Activate();
       
   110 
       
   111 
       
   112 private:    // Data
       
   113 
       
   114     /**  Handle to callback observer. */
       
   115     MMusUiCallbackObserver& iCallbackObserver;
       
   116 
       
   117     /**  Event ID to pass through. */
       
   118     TMusUiAsyncEvent iEventId;
       
   119 
       
   120     };
       
   121 
       
   122 #endif // MUSUICALLBACKSERVICE_H