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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Component test of Publish and Subscribe
23 #ifndef __CPROPERTYWATCH_H__
24 #define __CPROPERTYWATCH_H__
27 #include <e32property.h>
28 #include "usbmsshared.h"
30 class CPropertyHandler;
35 EUsbMsState_Read = EUsbMsDriveState_Error + 100,
40 An active object that subscribes to a specified Mass Storage property and
41 calls a provided handler each time the property is published.
43 class CPropertyWatch : public CActive
46 static CPropertyWatch* NewLC(TUsbMsDriveState_Subkey aSubkey, CPropertyHandler& aHandler);
49 CPropertyWatch(CPropertyHandler& aHandler);
50 void ConstructL(TUsbMsDriveState_Subkey aSubkey);
56 CPropertyHandler& iHandler;
60 A property handler class that handles the change of ms drive status
62 class CPropertyHandler : public CBase
65 virtual void HandleStatusChange(RProperty& aProperty) = 0;
68 CPropertyHandler(TInt aDriveNo, CStateMachine& aSm);
69 virtual ~CPropertyHandler();
73 CStateMachine& iStateMachine;
76 class CMsDriveStatusHandler : public CPropertyHandler
79 static CMsDriveStatusHandler* NewLC(TInt aDriveNo, CStateMachine& aSm);
80 void HandleStatusChange(RProperty& aProperty);
83 CMsDriveStatusHandler(TInt aDriveNo, CStateMachine& aSm);
86 class CMsReadStatusHandler : public CPropertyHandler
89 static CMsReadStatusHandler* NewLC(TInt aDriveNo, CStateMachine& aSm);
90 void HandleStatusChange(RProperty& aProperty);
93 CMsReadStatusHandler(TInt aDriveNo, CStateMachine& aSm);
96 class CMsWrittenStatusHandler : public CPropertyHandler
99 static CMsWrittenStatusHandler* NewLC(TInt aDriveNo, CStateMachine& aSm);
100 void HandleStatusChange(RProperty& aProperty);
103 CMsWrittenStatusHandler(TInt aDriveNo, CStateMachine& aSm);
106 #endif // __CPROPERTYWATCH_H__