os/kernelhwsrv/kerneltest/f32test/smassstorage/inc/cpropertywatch.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) 2004-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
// Component test of Publish and Subscribe
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
/**
sl@0
    19
 @file
sl@0
    20
 @internalTechnology
sl@0
    21
*/
sl@0
    22
sl@0
    23
#ifndef __CPROPERTYWATCH_H__
sl@0
    24
#define __CPROPERTYWATCH_H__
sl@0
    25
sl@0
    26
#include <e32base.h>
sl@0
    27
#include <e32property.h>
sl@0
    28
#include "usbmsshared.h"
sl@0
    29
sl@0
    30
class CPropertyHandler;
sl@0
    31
class CStateMachine;
sl@0
    32
sl@0
    33
enum 
sl@0
    34
	{
sl@0
    35
	EUsbMsState_Read = EUsbMsDriveState_Error + 100,
sl@0
    36
	EUsbMsState_Written
sl@0
    37
	};
sl@0
    38
	
sl@0
    39
/**
sl@0
    40
 An active object that subscribes to a specified Mass Storage property and
sl@0
    41
 calls a provided handler each time the property is published.
sl@0
    42
 */
sl@0
    43
class CPropertyWatch : public CActive
sl@0
    44
	{
sl@0
    45
public:
sl@0
    46
	static CPropertyWatch* NewLC(TUsbMsDriveState_Subkey aSubkey, CPropertyHandler& aHandler);
sl@0
    47
sl@0
    48
private:
sl@0
    49
	CPropertyWatch(CPropertyHandler& aHandler);
sl@0
    50
	void ConstructL(TUsbMsDriveState_Subkey aSubkey);
sl@0
    51
	~CPropertyWatch();
sl@0
    52
	void RunL();
sl@0
    53
	void DoCancel();
sl@0
    54
	
sl@0
    55
	RProperty iProperty;
sl@0
    56
	CPropertyHandler& iHandler;
sl@0
    57
	};
sl@0
    58
	
sl@0
    59
/**
sl@0
    60
 A property handler class that handles the change of ms drive status
sl@0
    61
 */
sl@0
    62
 class CPropertyHandler : public CBase
sl@0
    63
 	{
sl@0
    64
 public:
sl@0
    65
 	virtual void HandleStatusChange(RProperty& aProperty) = 0;
sl@0
    66
 	
sl@0
    67
 protected:
sl@0
    68
 	CPropertyHandler(TInt aDriveNo, CStateMachine& aSm);
sl@0
    69
 	virtual ~CPropertyHandler();
sl@0
    70
 
sl@0
    71
 protected:
sl@0
    72
 	TInt iDriveNo; 
sl@0
    73
 	CStateMachine& iStateMachine;
sl@0
    74
 	};
sl@0
    75
 	
sl@0
    76
 class CMsDriveStatusHandler : public CPropertyHandler
sl@0
    77
 	{
sl@0
    78
 public:
sl@0
    79
 	static CMsDriveStatusHandler* NewLC(TInt aDriveNo, CStateMachine& aSm);
sl@0
    80
 	void HandleStatusChange(RProperty& aProperty);
sl@0
    81
 	
sl@0
    82
 protected:
sl@0
    83
  	CMsDriveStatusHandler(TInt aDriveNo, CStateMachine& aSm);
sl@0
    84
 	};
sl@0
    85
 	
sl@0
    86
 class CMsReadStatusHandler : public CPropertyHandler
sl@0
    87
 	{
sl@0
    88
 public:
sl@0
    89
 	static CMsReadStatusHandler* NewLC(TInt aDriveNo, CStateMachine& aSm);
sl@0
    90
 	void HandleStatusChange(RProperty& aProperty);
sl@0
    91
 	
sl@0
    92
 private:
sl@0
    93
  	CMsReadStatusHandler(TInt aDriveNo, CStateMachine& aSm);
sl@0
    94
 	};
sl@0
    95
sl@0
    96
 class CMsWrittenStatusHandler : public CPropertyHandler
sl@0
    97
 	{
sl@0
    98
 public:
sl@0
    99
 	static CMsWrittenStatusHandler* NewLC(TInt aDriveNo, CStateMachine& aSm);
sl@0
   100
 	void HandleStatusChange(RProperty& aProperty);
sl@0
   101
 	
sl@0
   102
 private:
sl@0
   103
  	CMsWrittenStatusHandler(TInt aDriveNo, CStateMachine& aSm);
sl@0
   104
 	};
sl@0
   105
sl@0
   106
#endif // __CPROPERTYWATCH_H__
sl@0
   107