userlibandfileserver/domainmgr/inc/domainmember.h
changeset 279 957c583b417b
parent 0 a41df078684a
equal deleted inserted replaced
275:2b433474f2ba 279:957c583b417b
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    18 //
    18 //
    19 
    19 
    20 #ifndef __DOMAIN_MEMBER_H__
    20 #ifndef __DOMAIN_MEMBER_H__
    21 #define __DOMAIN_MEMBER_H__
    21 #define __DOMAIN_MEMBER_H__
    22 
    22 
    23 #include <e32std.h>
    23 #include <e32base.h>
    24 #include <e32property.h>
    24 #include <e32property.h>
    25 #include <domaindefs.h>
    25 #include <domaindefs.h>
    26 
    26 
    27 /**
    27 
    28 @internalComponent
       
    29 */
       
    30 class RDmDomainSession : public RSessionBase
    28 class RDmDomainSession : public RSessionBase
    31 	{
    29 	{
    32 public:
    30 public:
    33 	TInt Connect(TDmHierarchyId aHierarchyId, TDmDomainId, TUint* aKey);
    31 	TInt Connect(TDmHierarchyId aHierarchyId, TDmDomainId, TUint* aKey);
    34 	void Acknowledge(TInt aValue, TInt aError);
    32 	TInt Acknowledge(TInt aValue, TInt aError);
    35 	void RequestTransitionNotification();
    33 	void RequestTransitionNotification();
    36 	void CancelTransitionNotification();
    34 	void CancelTransitionNotification();
       
    35 	void DeferAcknowledgement(TRequestStatus& aStatus);
       
    36 	void CancelDeferral();
    37 	};
    37 	};
    38 
    38 
    39 
    39 
    40 /**
    40 /**
    41 @publishedPartner
       
    42 @released
       
    43 
       
    44 The application's interface to the domain manager.
    41 The application's interface to the domain manager.
    45 */
    42 */
    46 class RDmDomain
    43 class RDmDomain
    47 	{
    44 	{
    48 public:
    45 public:
    53 	IMPORT_C void CancelTransitionNotification();
    50 	IMPORT_C void CancelTransitionNotification();
    54 
    51 
    55 	IMPORT_C TPowerState GetPowerState();
    52 	IMPORT_C TPowerState GetPowerState();
    56 	IMPORT_C void AcknowledgeLastState();
    53 	IMPORT_C void AcknowledgeLastState();
    57 
    54 
    58 	/**
       
    59 	@internalAll
       
    60 	*/
       
    61 	IMPORT_C TInt Connect(TDmHierarchyId aHierarchyId, TDmDomainId aDomainId);
    55 	IMPORT_C TInt Connect(TDmHierarchyId aHierarchyId, TDmDomainId aDomainId);
    62 	/**
       
    63 	@internalAll
       
    64 	*/
       
    65 	IMPORT_C void AcknowledgeLastState(TInt aError);
    56 	IMPORT_C void AcknowledgeLastState(TInt aError);
    66 	/**
       
    67 	@internalAll
       
    68 	*/
       
    69 	IMPORT_C TDmDomainState GetState();
    57 	IMPORT_C TDmDomainState GetState();
    70 
    58 
       
    59 	IMPORT_C void DeferAcknowledgement(TRequestStatus& aStatus);
       
    60 	IMPORT_C void CancelDeferral();
       
    61 
    71 private:
    62 private:
       
    63 	friend class CDmDomainKeepAlive;
       
    64 	TInt AcknowledgeLastStatePriv(TInt aError);
       
    65 
    72 	RDmDomainSession	iSession;
    66 	RDmDomainSession	iSession;
    73 	RProperty			iStateProperty;
    67 	RProperty			iStateProperty;
    74 	TInt				iLastStatePropertyValue;	
    68 	TInt				iLastStatePropertyValue;
    75 	};
    69 	};
    76 
    70 
    77 
    71 
    78 
       
    79 /**
    72 /**
    80 @publishedPartner
       
    81 @released
       
    82 
       
    83 An abstract class for interfacing to a domain managed by the domain manager.
    73 An abstract class for interfacing to a domain managed by the domain manager.
    84 
    74 
    85 To make use of this class an application must derive from it and implement a RunL()
    75 To make use of this class an application must derive from it and implement a
    86 method to handle notifications.
    76 RunL() method to handle notifications.
    87 */
    77 */
    88 class CDmDomain : public CActive
    78 class CDmDomain : public CActive
    89 	{
    79 	{
    90 public:
    80 public:
    91 	IMPORT_C CDmDomain(TDmHierarchyId aHierarchyId, TDmDomainId aDomainId);
    81 	IMPORT_C CDmDomain(TDmHierarchyId aHierarchyId, TDmDomainId aDomainId);
    92 	IMPORT_C ~CDmDomain();
    82 	IMPORT_C ~CDmDomain();
    93 
    83 
    94 	IMPORT_C void RequestTransitionNotification();
    84 	IMPORT_C void RequestTransitionNotification();
    95 	/**
       
    96 	@internalTechnology
       
    97 	*/
       
    98 	IMPORT_C void AcknowledgeLastState(TInt aError);
    85 	IMPORT_C void AcknowledgeLastState(TInt aError);
    99 	/**
       
   100 	@internalTechnology
       
   101 	*/
       
   102 	IMPORT_C TDmDomainState GetState();
    86 	IMPORT_C TDmDomainState GetState();
   103 	virtual void RunL() = 0;
    87 	virtual void RunL() = 0;
       
    88 
   104 protected:
    89 protected:
   105 	// from CActive
    90 	// from CActive
   106 	IMPORT_C void DoCancel();
    91 	IMPORT_C void DoCancel();
   107 	IMPORT_C void ConstructL();
    92 	IMPORT_C void ConstructL();
   108 
    93 
       
    94 	RDmDomain iDomain;
       
    95 
   109 private:
    96 private:
   110 	RDmDomain iDomain;
       
   111 	TDmHierarchyId iHierarchyId;
    97 	TDmHierarchyId iHierarchyId;
   112 	TDmDomainId iDomainId;
    98 	TDmDomainId iDomainId;
   113 	TInt iReserved[4];	
    99 	TInt iReserved[4];
   114 	};
   100 	};
   115 
   101 
   116 
   102 
       
   103 class CDmKeepAlive;
       
   104 
       
   105 /**
       
   106 This derived class extends the parent class by automatically deferring
       
   107 transitions as long as possible after the original notification is received.
       
   108 
       
   109 To make use of this class, derive and implement the HandleTransitionL()
       
   110 function. HandleTransitionL() will be called when the transition notification
       
   111 comes in. Thereafter, the active object will continually defer the transition.
       
   112 
       
   113 This object is intended to simplify the handling of notifications and
       
   114 deferrals. The member must ensure that other active objects do not block or
       
   115 have long-running RunL()s; this is to ensure that the Active Scheduler will
       
   116 remain responsive to the expiry of deadline deferrals.
       
   117 
       
   118 The capabilities needed are the same as those needed for
       
   119 RDmDomain::DeferAcknowledgement() (which this active object uses).
       
   120 
       
   121 @capability WriteDeviceData
       
   122 @capability ProtServ
       
   123 @see RDmDomain::DeferAcknowledgement()
       
   124 */
       
   125 class CDmDomainKeepAlive : public CDmDomain
       
   126 	{
       
   127 public:
       
   128 	IMPORT_C CDmDomainKeepAlive(TDmHierarchyId aHierarchyId, TDmDomainId aDomainId);
       
   129 	IMPORT_C ~CDmDomainKeepAlive();
       
   130 
       
   131 	IMPORT_C void AcknowledgeLastState(TInt aError);
       
   132 
       
   133 	/**
       
   134 	The derived class active object will call this function to indicate the
       
   135 	completion of the asynchronous call RequestTransitionNotification().
       
   136 
       
   137 	The implementation of this function should be used first to call
       
   138 	RequestTransitionNotification() again if required, and then to initiate the
       
   139 	response to the transition. It should be kept as quick as possible, any
       
   140 	slow operations (e.g. File Server calls) should be initiated asynchronously
       
   141 	and handled using other active objects.
       
   142 
       
   143 	Once the Domain Member's transition operations are complete, it should call
       
   144 	AcknowledgeLastState() on this active object, to indicate it is ready to be
       
   145 	transitioned.
       
   146 
       
   147 	HandleTransitionL() should not call AcknowledgeLastState() unless it can
       
   148 	trivially determine that no action at all is required for the given
       
   149 	transition.
       
   150 	*/
       
   151 	virtual void HandleTransitionL() =0;
       
   152 
       
   153 	IMPORT_C virtual TInt HandleDeferralError(TInt aError);
       
   154 
       
   155 protected:
       
   156 	IMPORT_C void ConstructL();
       
   157 
       
   158 	IMPORT_C void RunL();
       
   159 
       
   160 private:
       
   161 	CDmKeepAlive* iKeepAlive;
       
   162 
       
   163 	TUint32 iReservedSpace[2];
       
   164 	};
       
   165 
   117 #endif
   166 #endif