279
|
1 |
// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
|
0
|
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 |
//
|
|
15 |
// WARNING: This file contains some APIs which are internal and are subject
|
|
16 |
// to change without notice. Such APIs should therefore not be used
|
|
17 |
// outside the Kernel and Hardware Services package.
|
|
18 |
//
|
|
19 |
|
|
20 |
#ifndef __DOMAIN_MEMBER_H__
|
|
21 |
#define __DOMAIN_MEMBER_H__
|
|
22 |
|
279
|
23 |
#include <e32base.h>
|
0
|
24 |
#include <e32property.h>
|
|
25 |
#include <domaindefs.h>
|
|
26 |
|
279
|
27 |
|
0
|
28 |
class RDmDomainSession : public RSessionBase
|
|
29 |
{
|
|
30 |
public:
|
|
31 |
TInt Connect(TDmHierarchyId aHierarchyId, TDmDomainId, TUint* aKey);
|
279
|
32 |
TInt Acknowledge(TInt aValue, TInt aError);
|
0
|
33 |
void RequestTransitionNotification();
|
|
34 |
void CancelTransitionNotification();
|
279
|
35 |
void DeferAcknowledgement(TRequestStatus& aStatus);
|
|
36 |
void CancelDeferral();
|
0
|
37 |
};
|
|
38 |
|
|
39 |
|
|
40 |
/**
|
|
41 |
The application's interface to the domain manager.
|
|
42 |
*/
|
|
43 |
class RDmDomain
|
|
44 |
{
|
|
45 |
public:
|
|
46 |
IMPORT_C TInt Connect(TDmDomainId aId);
|
|
47 |
IMPORT_C void Close();
|
|
48 |
|
|
49 |
IMPORT_C void RequestTransitionNotification(TRequestStatus& aStatus);
|
|
50 |
IMPORT_C void CancelTransitionNotification();
|
|
51 |
|
|
52 |
IMPORT_C TPowerState GetPowerState();
|
|
53 |
IMPORT_C void AcknowledgeLastState();
|
|
54 |
|
|
55 |
IMPORT_C TInt Connect(TDmHierarchyId aHierarchyId, TDmDomainId aDomainId);
|
|
56 |
IMPORT_C void AcknowledgeLastState(TInt aError);
|
|
57 |
IMPORT_C TDmDomainState GetState();
|
|
58 |
|
279
|
59 |
IMPORT_C void DeferAcknowledgement(TRequestStatus& aStatus);
|
|
60 |
IMPORT_C void CancelDeferral();
|
|
61 |
|
0
|
62 |
private:
|
279
|
63 |
friend class CDmDomainKeepAlive;
|
|
64 |
TInt AcknowledgeLastStatePriv(TInt aError);
|
|
65 |
|
0
|
66 |
RDmDomainSession iSession;
|
|
67 |
RProperty iStateProperty;
|
279
|
68 |
TInt iLastStatePropertyValue;
|
0
|
69 |
};
|
|
70 |
|
|
71 |
|
|
72 |
/**
|
|
73 |
An abstract class for interfacing to a domain managed by the domain manager.
|
|
74 |
|
279
|
75 |
To make use of this class an application must derive from it and implement a
|
|
76 |
RunL() method to handle notifications.
|
0
|
77 |
*/
|
|
78 |
class CDmDomain : public CActive
|
|
79 |
{
|
|
80 |
public:
|
|
81 |
IMPORT_C CDmDomain(TDmHierarchyId aHierarchyId, TDmDomainId aDomainId);
|
|
82 |
IMPORT_C ~CDmDomain();
|
|
83 |
|
|
84 |
IMPORT_C void RequestTransitionNotification();
|
|
85 |
IMPORT_C void AcknowledgeLastState(TInt aError);
|
|
86 |
IMPORT_C TDmDomainState GetState();
|
|
87 |
virtual void RunL() = 0;
|
279
|
88 |
|
0
|
89 |
protected:
|
|
90 |
// from CActive
|
|
91 |
IMPORT_C void DoCancel();
|
|
92 |
IMPORT_C void ConstructL();
|
|
93 |
|
279
|
94 |
RDmDomain iDomain;
|
|
95 |
|
0
|
96 |
private:
|
|
97 |
TDmHierarchyId iHierarchyId;
|
|
98 |
TDmDomainId iDomainId;
|
279
|
99 |
TInt iReserved[4];
|
0
|
100 |
};
|
|
101 |
|
|
102 |
|
279
|
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 |
|
0
|
166 |
#endif
|