os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/inc/cusbotg.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
sl@0
    17
#ifndef CUSBOTG_H
sl@0
    18
#define CUSBOTG_H
sl@0
    19
sl@0
    20
class CUsbOtgEventWatcher;
sl@0
    21
class CRequestSessionWatcher;
sl@0
    22
sl@0
    23
class MUsbRequestSessionObserver
sl@0
    24
    {
sl@0
    25
public:
sl@0
    26
    virtual void BusRequestL() = 0;
sl@0
    27
    };
sl@0
    28
sl@0
    29
sl@0
    30
class ROtgStateChangeNotifier
sl@0
    31
    {
sl@0
    32
public:
sl@0
    33
    ROtgStateChangeNotifier();
sl@0
    34
    ~ROtgStateChangeNotifier();
sl@0
    35
sl@0
    36
	void Register(const RMessage2& aMessage);
sl@0
    37
    void DoNotifyL();
sl@0
    38
    void DoCancelL();
sl@0
    39
sl@0
    40
private:
sl@0
    41
	void CompleteNotifierL(TInt);
sl@0
    42
sl@0
    43
private:
sl@0
    44
    /** Notification service */
sl@0
    45
	RMessage2 iMessage;
sl@0
    46
    /** Flag to indicate that media change notification is active */
sl@0
    47
	TBool iRegistered;
sl@0
    48
    };
sl@0
    49
sl@0
    50
sl@0
    51
sl@0
    52
sl@0
    53
sl@0
    54
class CUsbOtg: public CBase,
sl@0
    55
               public MUsbRequestSessionObserver
sl@0
    56
    {
sl@0
    57
public:
sl@0
    58
    enum TOtgState {KOtgStateStart,
sl@0
    59
                    KOtgStateAPlugInserted,
sl@0
    60
                    KOtgStateSessionOpen,
sl@0
    61
                    KOtgStateSessionClose};
sl@0
    62
sl@0
    63
sl@0
    64
public:
sl@0
    65
	static CUsbOtg* NewL();
sl@0
    66
	~CUsbOtg();
sl@0
    67
protected:
sl@0
    68
	CUsbOtg();
sl@0
    69
	void ConstructL();
sl@0
    70
sl@0
    71
public:
sl@0
    72
sl@0
    73
    // MUsbRequestSessionObserver
sl@0
    74
    void BusRequestL();
sl@0
    75
sl@0
    76
    void HandleUsbOtgEvent(RUsbOtgDriver::TOtgEvent aEvent);
sl@0
    77
sl@0
    78
    TBool DeviceInserted();
sl@0
    79
    void NotifyChange(const RMessage2& aMessage);
sl@0
    80
    void NotifyChangeCancel();
sl@0
    81
    TInt BusDrop();
sl@0
    82
sl@0
    83
private:
sl@0
    84
    void StartL();
sl@0
    85
    void Stop();
sl@0
    86
sl@0
    87
sl@0
    88
private:
sl@0
    89
    TOtgState iOtgState;
sl@0
    90
	RUsbOtgDriver iUsbOtgDriver;
sl@0
    91
sl@0
    92
    CUsbOtgEventWatcher* iOtgEventWatcher;
sl@0
    93
sl@0
    94
    CRequestSessionWatcher* iRequestSessionWatcher;
sl@0
    95
sl@0
    96
    ROtgStateChangeNotifier iNotifier;
sl@0
    97
    };
sl@0
    98
sl@0
    99
#endif