usbmgmt/usbmgr/usbman/server/INC/CUsbOtg.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 * Implements the main object of Usbman that manages all the OTG-related activity
       
    16 * 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file
       
    24 */
       
    25 
       
    26 #ifndef __CUSBOTG_H__
       
    27 #define __CUSBOTG_H__
       
    28 
       
    29 #include <d32otgdi.h>
       
    30 #include <d32otgdi_errors.h>
       
    31 #include <e32std.h>
       
    32 #include <usb/usblogger.h>
       
    33 
       
    34 #include "musbinternalobservers.h"
       
    35 class CUsbServer;
       
    36 class CUsbOtgWatcher;
       
    37 class CUsbOtgIdPinWatcher;
       
    38 class CUsbOtgVbusWatcher;
       
    39 class CUsbOtgStateWatcher;
       
    40 class CUsbOtgEventWatcher;
       
    41 class CUsbOtgConnectionIdleWatcher;
       
    42 class MUsbOtgHostNotifyObserver;
       
    43 class RUsbOtgDriver;
       
    44 class CRequestSessionWatcher;
       
    45 
       
    46 
       
    47 /**
       
    48  * The CUsbOtg class
       
    49  *
       
    50  * Implements the main object of Usbman that manages all OTG related functionality
       
    51  * It owns one instance of CUsbOtgStateWatcher.
       
    52  * It also owns an instance of RUsbOtgDriver, a handle on the logical device
       
    53  * driver for USB OTG for Symbian OS.
       
    54  *
       
    55  * CUsbOtg is an active object which starts and stops internal CUsbOtgStateWatcher
       
    56  * in order to monitor ID-Pin and VBus state. Its RunL function will be called when
       
    57  * one of RUsbOtgDriver::TOtgEvent occurs.
       
    58  */
       
    59 NONSHARABLE_CLASS(CUsbOtg) : public CBase, public MUsbOtgObserver
       
    60 	{
       
    61 public:
       
    62 	static CUsbOtg* NewL();
       
    63 	virtual ~CUsbOtg();
       
    64 
       
    65 	void RegisterObserverL(MUsbOtgHostNotifyObserver& aObserver);
       
    66 	void DeRegisterObserver(MUsbOtgHostNotifyObserver& aObserver);
       
    67 
       
    68 	void StartL();
       
    69 	void Stop();
       
    70 	
       
    71 	TInt BusRequest();
       
    72 	TInt BusRespondSrp();
       
    73 	
       
    74 	TInt BusClearError();
       
    75 
       
    76 	TInt BusDrop();
       
    77 
       
    78 	void NotifyOtgEvent();
       
    79 	
       
    80 public:
       
    81 	// From MUsbMessageObserver
       
    82 	virtual void NotifyMessage(TInt aMessage);
       
    83 	
       
    84 protected:
       
    85 	CUsbOtg();
       
    86 	void ConstructL();
       
    87 	TInt TranslateOtgEvent();
       
    88 
       
    89 private:
       
    90 	RPointerArray<MUsbOtgHostNotifyObserver> iObservers;
       
    91 	TInt iLastError;
       
    92 	RUsbOtgDriver iOtgDriver;
       
    93 	RUsbOtgDriver::TOtgEvent iOtgEvent;
       
    94 	CUsbOtgWatcher* iOtgWatcher;
       
    95 	CUsbOtgIdPinWatcher* iIdPinWatcher;
       
    96 	CUsbOtgVbusWatcher* iVbusWatcher;
       
    97 	CUsbOtgStateWatcher* iOtgStateWatcher;
       
    98 	CUsbOtgEventWatcher* iOtgEventWatcher;
       
    99     CUsbOtgConnectionIdleWatcher* iOtgConnectionIdleWatcher;
       
   100 	TUint iOtgMessage;
       
   101 	CRequestSessionWatcher *iRequestSessionWatcher;
       
   102 	RCriticalSection iCriticalSection;
       
   103 	};
       
   104 
       
   105 #endif
       
   106