os/kernelhwsrv/kerneltest/f32test/smassstorage/inc/cpropertywatch.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.
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Component test of Publish and Subscribe
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20  @internalTechnology
    21 */
    22 
    23 #ifndef __CPROPERTYWATCH_H__
    24 #define __CPROPERTYWATCH_H__
    25 
    26 #include <e32base.h>
    27 #include <e32property.h>
    28 #include "usbmsshared.h"
    29 
    30 class CPropertyHandler;
    31 class CStateMachine;
    32 
    33 enum 
    34 	{
    35 	EUsbMsState_Read = EUsbMsDriveState_Error + 100,
    36 	EUsbMsState_Written
    37 	};
    38 	
    39 /**
    40  An active object that subscribes to a specified Mass Storage property and
    41  calls a provided handler each time the property is published.
    42  */
    43 class CPropertyWatch : public CActive
    44 	{
    45 public:
    46 	static CPropertyWatch* NewLC(TUsbMsDriveState_Subkey aSubkey, CPropertyHandler& aHandler);
    47 
    48 private:
    49 	CPropertyWatch(CPropertyHandler& aHandler);
    50 	void ConstructL(TUsbMsDriveState_Subkey aSubkey);
    51 	~CPropertyWatch();
    52 	void RunL();
    53 	void DoCancel();
    54 	
    55 	RProperty iProperty;
    56 	CPropertyHandler& iHandler;
    57 	};
    58 	
    59 /**
    60  A property handler class that handles the change of ms drive status
    61  */
    62  class CPropertyHandler : public CBase
    63  	{
    64  public:
    65  	virtual void HandleStatusChange(RProperty& aProperty) = 0;
    66  	
    67  protected:
    68  	CPropertyHandler(TInt aDriveNo, CStateMachine& aSm);
    69  	virtual ~CPropertyHandler();
    70  
    71  protected:
    72  	TInt iDriveNo; 
    73  	CStateMachine& iStateMachine;
    74  	};
    75  	
    76  class CMsDriveStatusHandler : public CPropertyHandler
    77  	{
    78  public:
    79  	static CMsDriveStatusHandler* NewLC(TInt aDriveNo, CStateMachine& aSm);
    80  	void HandleStatusChange(RProperty& aProperty);
    81  	
    82  protected:
    83   	CMsDriveStatusHandler(TInt aDriveNo, CStateMachine& aSm);
    84  	};
    85  	
    86  class CMsReadStatusHandler : public CPropertyHandler
    87  	{
    88  public:
    89  	static CMsReadStatusHandler* NewLC(TInt aDriveNo, CStateMachine& aSm);
    90  	void HandleStatusChange(RProperty& aProperty);
    91  	
    92  private:
    93   	CMsReadStatusHandler(TInt aDriveNo, CStateMachine& aSm);
    94  	};
    95 
    96  class CMsWrittenStatusHandler : public CPropertyHandler
    97  	{
    98  public:
    99  	static CMsWrittenStatusHandler* NewLC(TInt aDriveNo, CStateMachine& aSm);
   100  	void HandleStatusChange(RProperty& aProperty);
   101  	
   102  private:
   103   	CMsWrittenStatusHandler(TInt aDriveNo, CStateMachine& aSm);
   104  	};
   105 
   106 #endif // __CPROPERTYWATCH_H__
   107