os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/controller/include/cusbhostmsdevice.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2008-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
 @file
sl@0
    18
 @internalTechnology
sl@0
    19
*/
sl@0
    20
sl@0
    21
#ifndef CUSBHOSTMSDEVICE_H
sl@0
    22
#define CUSBHOSTMSDEVICE_H
sl@0
    23
sl@0
    24
#include "tlogicalunitlist.h"
sl@0
    25
sl@0
    26
class MTransport;
sl@0
    27
class CUsbMsIfaceSuspendResume;
sl@0
    28
class TLogicalUnitList;
sl@0
    29
sl@0
    30
class CUsbHostMsDevice : public CBase
sl@0
    31
	{
sl@0
    32
public:
sl@0
    33
sl@0
    34
	static CUsbHostMsDevice* NewL(THostMassStorageConfig& aConfig);
sl@0
    35
	~CUsbHostMsDevice();
sl@0
    36
	void InitialiseL(const RMessage2& aMessage);
sl@0
    37
    void UnInitialiseL();
sl@0
    38
sl@0
    39
	TInt AddLunL(TLun aLun);
sl@0
    40
	void RemoveLunL(TLun aLun);
sl@0
    41
	TLun GetAndSetLunL(const RMessage2& aMessage);
sl@0
    42
    CUsbHostMsLogicalUnit& GetLuL(TInt aLunNum) const;
sl@0
    43
sl@0
    44
	void SetLunL(TLun aLun);
sl@0
    45
	void SetMaxLun(TLun aMaxLun);
sl@0
    46
	TLun GetMaxLun() const;
sl@0
    47
sl@0
    48
	TBool IsReady() const;
sl@0
    49
	TBool IsSuspended() const;
sl@0
    50
sl@0
    51
	void InitLunL(TLun aLun);
sl@0
    52
sl@0
    53
	void SuspendLunL(TLun aLun);
sl@0
    54
	void Resume(TRequestStatus& aStatus);
sl@0
    55
	void ResumeLogicalUnitsL();
sl@0
    56
	void ResumeCompletedL();
sl@0
    57
sl@0
    58
	void DoHandleRemoteWakeupL();
sl@0
    59
	void DoLunReadyCheckEventL();
sl@0
    60
	void DoResumeLogicalUnitsL();
sl@0
    61
sl@0
    62
private:
sl@0
    63
    void ConstructL();
sl@0
    64
    CUsbHostMsDevice(THostMassStorageConfig& aConfig);
sl@0
    65
	MTransport* InitialiseTransportL(TTransportType aTransportId);
sl@0
    66
	void StartTimer();
sl@0
    67
	void StopTimer();
sl@0
    68
	static TInt TimerCallback(TAny* obj);
sl@0
    69
sl@0
    70
private:
sl@0
    71
    enum TDeviceState
sl@0
    72
        {
sl@0
    73
        EReady,
sl@0
    74
        ESuspended
sl@0
    75
        };
sl@0
    76
sl@0
    77
	MTransport* iTransport;
sl@0
    78
	TLun iMaxLun;
sl@0
    79
    TLogicalUnitList iLuList;
sl@0
    80
	THostMassStorageConfig iConfig;
sl@0
    81
	CUsbMsIfaceSuspendResume* iDeviceSuspendResume;
sl@0
    82
	TDeviceState iState;
sl@0
    83
    /** The polling interval time as set by the MM - passed as part of THostMassStorageConfig */
sl@0
    84
	TUint8 iStatusPollingInterval;
sl@0
    85
    /** An active object which triggers periodic check. */
sl@0
    86
	CPeriodic* iTimer;
sl@0
    87
    /** The Timer status */
sl@0
    88
    TBool iTimerRunning;
sl@0
    89
	};
sl@0
    90
sl@0
    91
sl@0
    92
inline TLun CUsbHostMsDevice::GetMaxLun() const
sl@0
    93
    {
sl@0
    94
    return iMaxLun;
sl@0
    95
    }
sl@0
    96
sl@0
    97
sl@0
    98
inline TBool CUsbHostMsDevice::IsReady() const
sl@0
    99
	{
sl@0
   100
	return (iState == EReady)? ETrue : EFalse;
sl@0
   101
	}
sl@0
   102
sl@0
   103
sl@0
   104
inline TBool CUsbHostMsDevice::IsSuspended() const
sl@0
   105
	{
sl@0
   106
	return (iState == ESuspended)? ETrue : EFalse;
sl@0
   107
	}
sl@0
   108
sl@0
   109
#endif // CUSBHOSTMSDEVICE_H
sl@0
   110