author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:50:07 +0300 | |
changeset 201 | 43365a9b78a3 |
parent 0 | a41df078684a |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 2002-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". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// \e32\include\kernel\sproperty.h |
|
15 |
// |
|
16 |
// WARNING: This file contains some APIs which are internal and are subject |
|
17 |
// to change without notice. Such APIs should therefore not be used |
|
18 |
// outside the Kernel and Hardware Services package. |
|
19 |
// |
|
20 |
||
21 |
#ifndef __SPROPERTY_H__ |
|
22 |
#define __SPROPERTY_H__ |
|
23 |
||
24 |
#include <nklib.h> |
|
25 |
||
26 |
class DProcess; |
|
27 |
class TProperty; |
|
28 |
||
29 |
||
30 |
||
31 |
||
32 |
/** |
|
33 |
@publishedPartner |
|
34 |
@released |
|
35 |
||
36 |
Defines the type of the function that will be called when a |
|
37 |
request to be notified of the publication of a property completes. |
|
38 |
||
39 |
A function of this type is passed via a TPropertySubsRequest object. |
|
40 |
||
41 |
@see RPropertyRef::Subscribe() |
|
42 |
@see TPropertySubsRequest |
|
43 |
*/ |
|
44 |
typedef void (*TPropertyCompleteFn)(TAny* aPtr, TInt aReason); |
|
45 |
||
46 |
||
47 |
||
48 |
||
49 |
/** |
|
50 |
@publishedPartner |
|
51 |
@released |
|
52 |
||
53 |
Represents a pending request to be notified of the publication |
|
54 |
of a property. |
|
55 |
||
56 |
A pending request is also known as a pending subscription. |
|
57 |
||
58 |
An object of this type is passed to RPropertyRef::Subscribe() when making |
|
59 |
a request to be notified when a property is published. |
|
60 |
||
61 |
The same object is also passed to RPropertyRef::Cancel() if the outstanding |
|
62 |
subscription request is to be cancelled. |
|
63 |
||
64 |
@see RPropertyRef::Subscribe() |
|
65 |
@see RPropertyRef::Cancel() |
|
66 |
*/ |
|
67 |
class TPropertySubsRequest : |
|
68 |
public SDblQueLink // protected by the system lock |
|
69 |
{ |
|
70 |
public: |
|
71 |
/** |
|
72 |
Constructor. |
|
73 |
||
74 |
@param aCompleteFn The function that will be called when the subscription |
|
75 |
request completes. |
|
76 |
@param aPtr A pointer that is passed to the request completion |
|
77 |
function. |
|
78 |
*/ |
|
79 |
TPropertySubsRequest(TPropertyCompleteFn aCompleteFn, TAny* aPtr) |
|
80 |
{ |
|
81 |
iNext = NULL; |
|
82 |
iCompleteFn = aCompleteFn; |
|
83 |
iPtr = aPtr; |
|
84 |
} |
|
85 |
||
86 |
/** |
|
87 |
The function that will be called when the subscription request completes. |
|
88 |
*/ |
|
89 |
TPropertyCompleteFn iCompleteFn; |
|
90 |
||
91 |
/** |
|
92 |
A pointer that is passed to the request completion function. |
|
93 |
*/ |
|
94 |
TAny* iPtr; |
|
95 |
||
96 |
private: |
|
97 |
friend class TProperty; |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
98 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
99 |
/** |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
100 |
Defines the context of iProcess. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
101 |
@internalComponent |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
102 |
*/ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
103 |
enum {KScheduledForCompletion = 1, KProcessPtrMask = 0xfffffffe}; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
104 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
105 |
/** |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
106 |
The process that has required notification. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
107 |
LSB is set if the request is scheduled for completition. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
108 |
*/ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
109 |
DProcess* iProcess; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
110 |
|
0 | 111 |
}; |
112 |
||
113 |
||
114 |
||
115 |
||
116 |
/** |
|
117 |
@publishedPartner |
|
118 |
@released |
|
119 |
||
120 |
An object that encapsulates information about a property. |
|
121 |
||
122 |
An object of this type is passed to RPropertyRef::GetStatus(), which |
|
123 |
fills in the fields. |
|
124 |
||
125 |
@see RPropertyRef::GetStatus() |
|
126 |
*/ |
|
127 |
class TPropertyStatus |
|
128 |
{ |
|
129 |
public: |
|
130 |
||
131 |
/** |
|
132 |
Additional property attributes. |
|
133 |
||
134 |
These are not currently defined, and are reserved for future use. |
|
135 |
*/ |
|
136 |
TUint iAttr; |
|
137 |
||
138 |
/** |
|
139 |
Byte-array size, in bytes, for |
|
140 |
property types: EByteArray and ELargeByteArray. |
|
141 |
||
142 |
@see RProperty |
|
143 |
*/ |
|
144 |
TUint16 iSize; |
|
145 |
||
146 |
/** |
|
147 |
The type of the property. |
|
148 |
*/ |
|
149 |
RProperty::TType iType; |
|
150 |
||
151 |
/** |
|
152 |
The owner of the property. |
|
153 |
||
154 |
This is a pointer to a DProcess object, and represents the process that |
|
155 |
was current when the property was defined. |
|
156 |
||
157 |
@see RPropertyRef::Define() |
|
158 |
*/ |
|
159 |
TUint32 iOwner; |
|
160 |
}; |
|
161 |
||
162 |
||
163 |
||
164 |
||
165 |
/** |
|
166 |
@publishedPartner |
|
167 |
@released |
|
168 |
||
169 |
A reference to a property. |
|
170 |
||
171 |
The class provides the interface to a property for code |
|
172 |
running kernel side. |
|
173 |
*/ |
|
174 |
class RPropertyRef |
|
175 |
{ |
|
176 |
public: |
|
177 |
/** |
|
178 |
Default constructor. |
|
179 |
*/ |
|
180 |
RPropertyRef() |
|
181 |
{ |
|
182 |
iProp = NULL; |
|
183 |
} |
|
184 |
||
185 |
IMPORT_C TInt Attach(TUid aCategory, TInt aKey); |
|
186 |
IMPORT_C TInt Open(TUid aCategory, TInt aKey); |
|
187 |
IMPORT_C void Close(); |
|
188 |
||
189 |
IMPORT_C TInt Define(TInt aAttr, const TSecurityPolicy& aReadPolicy, const TSecurityPolicy& aWritePolicy, TInt aPreallocate=0, DProcess* aProcess = NULL); |
|
190 |
IMPORT_C TInt Delete(DProcess* aProcess = NULL); |
|
191 |
||
192 |
IMPORT_C TInt Subscribe(TPropertySubsRequest& aRequest, DProcess* aProcess = NULL); |
|
193 |
IMPORT_C void Cancel(TPropertySubsRequest& aRequest); |
|
194 |
||
195 |
IMPORT_C TInt Get(TInt& aValue, DProcess* aProcess = NULL); |
|
196 |
IMPORT_C TInt Set(TInt aValue, DProcess* aProcess = NULL); |
|
197 |
IMPORT_C TInt Get(TDes8& aDes, DProcess* aProcess = NULL); |
|
198 |
IMPORT_C TInt Set(const TDesC8& aDes, DProcess* aProcess = NULL); |
|
199 |
||
200 |
IMPORT_C TBool GetStatus(TPropertyStatus& aStatus); |
|
201 |
||
202 |
private: |
|
203 |
TProperty* iProp; |
|
204 |
}; |
|
205 |
||
206 |
/** |
|
207 |
@internalTechnology |
|
208 |
*/ |
|
209 |
TInt PubSubPropertyInit(); |
|
210 |
||
211 |
#endif |