os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/inc/cusbotg.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/inc/cusbotg.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,99 @@
     1.4 +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +
    1.20 +#ifndef CUSBOTG_H
    1.21 +#define CUSBOTG_H
    1.22 +
    1.23 +class CUsbOtgEventWatcher;
    1.24 +class CRequestSessionWatcher;
    1.25 +
    1.26 +class MUsbRequestSessionObserver
    1.27 +    {
    1.28 +public:
    1.29 +    virtual void BusRequestL() = 0;
    1.30 +    };
    1.31 +
    1.32 +
    1.33 +class ROtgStateChangeNotifier
    1.34 +    {
    1.35 +public:
    1.36 +    ROtgStateChangeNotifier();
    1.37 +    ~ROtgStateChangeNotifier();
    1.38 +
    1.39 +	void Register(const RMessage2& aMessage);
    1.40 +    void DoNotifyL();
    1.41 +    void DoCancelL();
    1.42 +
    1.43 +private:
    1.44 +	void CompleteNotifierL(TInt);
    1.45 +
    1.46 +private:
    1.47 +    /** Notification service */
    1.48 +	RMessage2 iMessage;
    1.49 +    /** Flag to indicate that media change notification is active */
    1.50 +	TBool iRegistered;
    1.51 +    };
    1.52 +
    1.53 +
    1.54 +
    1.55 +
    1.56 +
    1.57 +class CUsbOtg: public CBase,
    1.58 +               public MUsbRequestSessionObserver
    1.59 +    {
    1.60 +public:
    1.61 +    enum TOtgState {KOtgStateStart,
    1.62 +                    KOtgStateAPlugInserted,
    1.63 +                    KOtgStateSessionOpen,
    1.64 +                    KOtgStateSessionClose};
    1.65 +
    1.66 +
    1.67 +public:
    1.68 +	static CUsbOtg* NewL();
    1.69 +	~CUsbOtg();
    1.70 +protected:
    1.71 +	CUsbOtg();
    1.72 +	void ConstructL();
    1.73 +
    1.74 +public:
    1.75 +
    1.76 +    // MUsbRequestSessionObserver
    1.77 +    void BusRequestL();
    1.78 +
    1.79 +    void HandleUsbOtgEvent(RUsbOtgDriver::TOtgEvent aEvent);
    1.80 +
    1.81 +    TBool DeviceInserted();
    1.82 +    void NotifyChange(const RMessage2& aMessage);
    1.83 +    void NotifyChangeCancel();
    1.84 +    TInt BusDrop();
    1.85 +
    1.86 +private:
    1.87 +    void StartL();
    1.88 +    void Stop();
    1.89 +
    1.90 +
    1.91 +private:
    1.92 +    TOtgState iOtgState;
    1.93 +	RUsbOtgDriver iUsbOtgDriver;
    1.94 +
    1.95 +    CUsbOtgEventWatcher* iOtgEventWatcher;
    1.96 +
    1.97 +    CRequestSessionWatcher* iRequestSessionWatcher;
    1.98 +
    1.99 +    ROtgStateChangeNotifier iNotifier;
   1.100 +    };
   1.101 +
   1.102 +#endif