kerneltest/e32test/resourceman/d_rescontrolclisync.h
changeset 247 d8d70de2bd36
equal deleted inserted replaced
201:43365a9b78a3 247:d8d70de2bd36
       
     1 // Copyright (c) 2010 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 // e32test\resourceman\d_rescontrolclisync.h
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __D_RESCONTROLCLISYNC_H__
       
    19 #define __D_RESCONTROLCLISYNC_H__
       
    20 
       
    21 #include <e32cmn.h>
       
    22 #include <e32ver.h>
       
    23 #ifndef __KERNEL_MODE__
       
    24 #include <e32std.h>
       
    25 #endif   
       
    26 
       
    27 _LIT(KLddFileName, "D_RESCONTROLCLISYNC.LDD");
       
    28 _LIT(KLddName, "D_RESCONTROLCLISYNC.LDD");
       
    29 _LIT(KPddFileName, "resourcecontroller.pdd");
       
    30 _LIT(KPddName, "resourcecontroller.pdd");
       
    31 
       
    32 
       
    33 /** User side logical channel */
       
    34 class RTestResMan : public RBusLogicalChannel
       
    35 	{
       
    36 public:
       
    37 	// Structure for holding driver capabilities information
       
    38 	class TCaps
       
    39 		{
       
    40 	public:
       
    41 		TVersion iVersion;
       
    42 		};
       
    43 
       
    44 private:
       
    45 	enum TControl //Request types for synchronous operation.
       
    46 		{ 
       
    47 		ERegisterClient,
       
    48         EDeRegisterClient,	
       
    49         EPrintResourceInfo,
       
    50         ERegisterNotification,
       
    51         EDeRegisterNotification,
       
    52 		EMaxControl,
       
    53 		
       
    54 		};
       
    55 	enum TRequest //Request types for asynchronous operation
       
    56 		{
       
    57         EWaitAndChangeResource = EMaxControl + 1,
       
    58         EChangeResourceAndSignal, 
       
    59 	    EMaxRequest, 
       
    60 		};
       
    61 	friend class DTestResManLdd;
       
    62 public:
       
    63    	TInt Open();
       
    64    	TInt PrintResourceInfo()
       
    65    	    {return DoControl(EPrintResourceInfo);}
       
    66    	TInt RegisterClient()
       
    67    	    {return DoControl(ERegisterClient);}
       
    68     TInt DeRegisterClient()
       
    69         {return DoControl(EDeRegisterClient);}
       
    70     TInt RegisterNotification()
       
    71         {return DoControl(ERegisterNotification);}
       
    72     TInt DeRegisterNotification()
       
    73         {return DoControl(EDeRegisterNotification);}
       
    74     void WaitAndChangeResource(TRequestStatus& aStatus)
       
    75         {DoRequest(EWaitAndChangeResource, aStatus);}    
       
    76     void ChangeResourceAndSignal(TRequestStatus& aStatus)
       
    77         {DoRequest(EChangeResourceAndSignal, aStatus);}    
       
    78 
       
    79     inline static TVersion VersionRequired();
       
    80     
       
    81     };
       
    82 
       
    83 inline TVersion RTestResMan::VersionRequired()
       
    84 	{
       
    85 	const TInt KMajorVersionNumber=1;
       
    86 	const TInt KMinorVersionNumber=0;
       
    87 	const TInt KBuildVersionNumber=KE32BuildVersionNumber;
       
    88 	return TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
       
    89 	}
       
    90 
       
    91 #ifndef __KERNEL_MODE__
       
    92 
       
    93 /** Open a channel for the driver.*/ 
       
    94 TInt RTestResMan::Open()
       
    95 	{
       
    96     return DoCreate(KLddName, VersionRequired(), KNullUnit, &KPddName, NULL, EOwnerProcess, EFalse);
       
    97 	}
       
    98 
       
    99 
       
   100 #endif //__KERNEL_MODE__
       
   101 #endif //__D_RESCONTROLCLISYNC_H__