usbengines/usbotgwatcher/inc/cusbnotenotifier.h
changeset 35 9d8b04ca6939
child 63 ef2686f7597e
equal deleted inserted replaced
34:7858bc6ead78 35:9d8b04ca6939
       
     1 /*
       
     2  * Copyright (c) 2008 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:  Base classes for Usb notifier wrapper  
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef C_CUSBNOTENOTIFIER_H
       
    19 #define C_CUSBNOTENOTIFIER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include "cusbnotifier.h"
       
    23 
       
    24 class CUsbNotifManager;
       
    25 class RNotifier;
       
    26 
       
    27 /**
       
    28  * Base class of wrapper for showing RNotifier note.
       
    29  * Class implements showing note notifier by RNotifier API in asynchronized way 
       
    30  * which doesn't block the caller. When user gives some feedback on the note, 
       
    31  * the event will be forwarded to CUsbNotifManager and it does some handling.
       
    32  */
       
    33 NONSHARABLE_CLASS( CUsbNoteNotifier) : public CUsbNotifier
       
    34     {
       
    35     /**
       
    36      * Active object of asynchronous showing notifier 
       
    37      */
       
    38     class CNotifierActive : public CActive
       
    39         {
       
    40     public:
       
    41         /**
       
    42          * Default constructor
       
    43          * @param aNotifier RNotifier API
       
    44          * @param aUsbNoteNotifier the note notifier container
       
    45          */
       
    46         CNotifierActive(RNotifier& aNotifier, CUsbNoteNotifier& aUsbNoteNotifier);
       
    47 
       
    48         /**
       
    49          * Destructor
       
    50          */
       
    51         virtual ~CNotifierActive();
       
    52 
       
    53         /**
       
    54          * Start to show the notifier
       
    55          */
       
    56         void StartL();
       
    57 
       
    58     protected:
       
    59         // From base class CActive
       
    60         /**
       
    61          * Caled when outstanding request completed
       
    62          */
       
    63         void RunL();
       
    64 
       
    65         /**
       
    66          * Called when outstanding request cancelled
       
    67          */
       
    68         void DoCancel();
       
    69 
       
    70         /**
       
    71          * Called when RunL leaves   
       
    72          * @param aError errorcode
       
    73          * @return errorcode 
       
    74          */
       
    75         TInt RunError(TInt aError);
       
    76 
       
    77     private:
       
    78         // data
       
    79 
       
    80         /**
       
    81          * The note notifier container 
       
    82          * Not Own 
       
    83          */
       
    84         CUsbNoteNotifier& iUsbNoteNotifier;
       
    85 
       
    86         /**
       
    87          * RNotifier API
       
    88          * Not Own 
       
    89          */
       
    90         RNotifier& iNotifier;
       
    91 
       
    92             /**
       
    93              * Response from notifier 
       
    94              */
       
    95             TPckg<TInt> iRes;
       
    96             
       
    97             /**
       
    98              * Notifier id pckg buffer
       
    99              */
       
   100             TPckgBuf<TInt> iNotifIdPckg;
       
   101         };
       
   102 public:
       
   103 
       
   104     /**
       
   105      * Destructor
       
   106      */
       
   107     virtual ~CUsbNoteNotifier();
       
   108 
       
   109     //From base class CUsbNotifier
       
   110     /**
       
   111      * Start to show notifier
       
   112      */
       
   113     virtual void ShowL();
       
   114 
       
   115     /**
       
   116      * Stop showing notifier
       
   117      */
       
   118     virtual void Close();
       
   119 
       
   120 protected:
       
   121 
       
   122     /**
       
   123      * Default constructor
       
   124      * @param aNotifier RNotifier API
       
   125      * @param aNotifManager Manager
       
   126      * @param acat Category
       
   127      * @param aNotidId id 
       
   128      */
       
   129     CUsbNoteNotifier(RNotifier& aNotifier, CUsbNotifManager& aNotifManager,
       
   130             TUid aCat, TUint aNotifId);
       
   131 
       
   132     /**
       
   133      * 2nd phase constructor.
       
   134      */
       
   135     void ConstructL();
       
   136 
       
   137 private:
       
   138     // data
       
   139 
       
   140     /**
       
   141      * Active object of handling RNotifier instance
       
   142      * Own 
       
   143      */
       
   144     CNotifierActive* iNotifierActive;
       
   145 
       
   146     /**
       
   147      * RNotifier API
       
   148      * Not Own 
       
   149      */
       
   150     RNotifier& iNotifier;
       
   151     };
       
   152 
       
   153 #endif // C_CUSBNOTENOTIFIER_H