os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/controller/include/cusbhostmsdevice.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/controller/include/cusbhostmsdevice.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,110 @@
     1.4 +// Copyright (c) 2008-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 + @file
    1.21 + @internalTechnology
    1.22 +*/
    1.23 +
    1.24 +#ifndef CUSBHOSTMSDEVICE_H
    1.25 +#define CUSBHOSTMSDEVICE_H
    1.26 +
    1.27 +#include "tlogicalunitlist.h"
    1.28 +
    1.29 +class MTransport;
    1.30 +class CUsbMsIfaceSuspendResume;
    1.31 +class TLogicalUnitList;
    1.32 +
    1.33 +class CUsbHostMsDevice : public CBase
    1.34 +	{
    1.35 +public:
    1.36 +
    1.37 +	static CUsbHostMsDevice* NewL(THostMassStorageConfig& aConfig);
    1.38 +	~CUsbHostMsDevice();
    1.39 +	void InitialiseL(const RMessage2& aMessage);
    1.40 +    void UnInitialiseL();
    1.41 +
    1.42 +	TInt AddLunL(TLun aLun);
    1.43 +	void RemoveLunL(TLun aLun);
    1.44 +	TLun GetAndSetLunL(const RMessage2& aMessage);
    1.45 +    CUsbHostMsLogicalUnit& GetLuL(TInt aLunNum) const;
    1.46 +
    1.47 +	void SetLunL(TLun aLun);
    1.48 +	void SetMaxLun(TLun aMaxLun);
    1.49 +	TLun GetMaxLun() const;
    1.50 +
    1.51 +	TBool IsReady() const;
    1.52 +	TBool IsSuspended() const;
    1.53 +
    1.54 +	void InitLunL(TLun aLun);
    1.55 +
    1.56 +	void SuspendLunL(TLun aLun);
    1.57 +	void Resume(TRequestStatus& aStatus);
    1.58 +	void ResumeLogicalUnitsL();
    1.59 +	void ResumeCompletedL();
    1.60 +
    1.61 +	void DoHandleRemoteWakeupL();
    1.62 +	void DoLunReadyCheckEventL();
    1.63 +	void DoResumeLogicalUnitsL();
    1.64 +
    1.65 +private:
    1.66 +    void ConstructL();
    1.67 +    CUsbHostMsDevice(THostMassStorageConfig& aConfig);
    1.68 +	MTransport* InitialiseTransportL(TTransportType aTransportId);
    1.69 +	void StartTimer();
    1.70 +	void StopTimer();
    1.71 +	static TInt TimerCallback(TAny* obj);
    1.72 +
    1.73 +private:
    1.74 +    enum TDeviceState
    1.75 +        {
    1.76 +        EReady,
    1.77 +        ESuspended
    1.78 +        };
    1.79 +
    1.80 +	MTransport* iTransport;
    1.81 +	TLun iMaxLun;
    1.82 +    TLogicalUnitList iLuList;
    1.83 +	THostMassStorageConfig iConfig;
    1.84 +	CUsbMsIfaceSuspendResume* iDeviceSuspendResume;
    1.85 +	TDeviceState iState;
    1.86 +    /** The polling interval time as set by the MM - passed as part of THostMassStorageConfig */
    1.87 +	TUint8 iStatusPollingInterval;
    1.88 +    /** An active object which triggers periodic check. */
    1.89 +	CPeriodic* iTimer;
    1.90 +    /** The Timer status */
    1.91 +    TBool iTimerRunning;
    1.92 +	};
    1.93 +
    1.94 +
    1.95 +inline TLun CUsbHostMsDevice::GetMaxLun() const
    1.96 +    {
    1.97 +    return iMaxLun;
    1.98 +    }
    1.99 +
   1.100 +
   1.101 +inline TBool CUsbHostMsDevice::IsReady() const
   1.102 +	{
   1.103 +	return (iState == EReady)? ETrue : EFalse;
   1.104 +	}
   1.105 +
   1.106 +
   1.107 +inline TBool CUsbHostMsDevice::IsSuspended() const
   1.108 +	{
   1.109 +	return (iState == ESuspended)? ETrue : EFalse;
   1.110 +	}
   1.111 +
   1.112 +#endif // CUSBHOSTMSDEVICE_H
   1.113 +