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