usbmgmt/usbmgr/usbman/server/INC/cusbhostwatcher.h
changeset 0 c9bc50fca66e
equal deleted inserted replaced
-1:000000000000 0:c9bc50fca66e
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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  @file
       
    20  @internalComponent
       
    21  @released
       
    22 */
       
    23 
       
    24 
       
    25 #ifndef CUSBHOSTWATCHER_H
       
    26 #define CUSBHOSTWATCHER_H
       
    27 
       
    28 #include "usbhoststack.h"
       
    29 #include <usb/usbshared.h>
       
    30 
       
    31 enum TUsbHostMonitor
       
    32 	{
       
    33 	EHostEventMonitor 	= 0,
       
    34 	EHostMessageMonitor = 1,
       
    35 	ENumMonitor			= 2,
       
    36 	};	
       
    37 
       
    38 const TUint KHostEventMonitor = EHostEventMonitor;
       
    39 const TUint KHostMessageMonitor = EHostMessageMonitor;
       
    40 
       
    41 class MUsbHostObserver;
       
    42 
       
    43 class CActiveUsbHostWatcher : public CActive
       
    44 	{
       
    45 public:
       
    46 
       
    47 	CActiveUsbHostWatcher(RUsbHostStack& aUsbHostStack, 
       
    48 						  MUsbHostObserver& aOwner,
       
    49 						  TUint aWatcherId);
       
    50 	virtual ~CActiveUsbHostWatcher();
       
    51 
       
    52 public:
       
    53 	virtual void Post() = 0;
       
    54 
       
    55 protected: // from CActive
       
    56 	virtual void RunL();
       
    57 	virtual void DoCancel() = 0;
       
    58 
       
    59 protected: // unowned
       
    60 	RUsbHostStack& iUsbHostStack;
       
    61 	MUsbHostObserver& iOwner;
       
    62 	TUint iWatcherId;
       
    63 	};
       
    64 
       
    65 
       
    66 class CActiveUsbHostEventWatcher: public CActiveUsbHostWatcher
       
    67 	{
       
    68 public:
       
    69 	static CActiveUsbHostEventWatcher* NewL(RUsbHostStack& aUsbHostStack, 
       
    70 											MUsbHostObserver& aOwner,
       
    71 											TDeviceEventInformation& aDeviceEventInfo);
       
    72 	virtual ~CActiveUsbHostEventWatcher();
       
    73 private:
       
    74 	CActiveUsbHostEventWatcher(RUsbHostStack& aUsbHostStack, 
       
    75 							   MUsbHostObserver& aOwner,
       
    76 							   TDeviceEventInformation& aHostEventInfo);
       
    77 
       
    78 private: // from CActive
       
    79 	virtual void DoCancel();
       
    80 public:
       
    81 	// from CActiveUsbHostWatcher
       
    82 	virtual void Post();
       
    83 
       
    84 private:
       
    85 	TDeviceEventInformation& iHostEventInfo;
       
    86 };
       
    87 
       
    88 
       
    89 class CActiveUsbHostMessageWatcher: public CActiveUsbHostWatcher
       
    90 	{
       
    91 public:
       
    92 	static CActiveUsbHostMessageWatcher* NewL(RUsbHostStack& aUsbHostStack, 
       
    93 											  MUsbHostObserver& aOwner,
       
    94 											  TInt& aHostMessage);
       
    95 	virtual ~CActiveUsbHostMessageWatcher();
       
    96 private:
       
    97 	CActiveUsbHostMessageWatcher(RUsbHostStack& aUsbHostStack, 
       
    98 								 MUsbHostObserver& aOwner,
       
    99 								 TInt& aHostMessage);
       
   100 
       
   101 private: // from CActive
       
   102 	virtual void DoCancel();
       
   103 public:
       
   104 	// from CActiveUsbHostWatcher
       
   105 	virtual void Post();
       
   106 	
       
   107 private:
       
   108 	TInt& iHostMessage;
       
   109 	};
       
   110 
       
   111 #endif //CUSBHOSTWATCHER_H