os/kernelhwsrv/kernel/eka/include/e32property.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/e32property.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,179 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32\include\e32property.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __E32PROPERTY_H__
    1.22 +#define __E32PROPERTY_H__
    1.23 +
    1.24 +#include <e32cmn.h>
    1.25 +
    1.26 +/**
    1.27 +@publishedAll
    1.28 +@released
    1.29 +
    1.30 +Property category UID value reserved for System services.
    1.31 +*/
    1.32 +static const TInt32 KUidSystemCategoryValue=0x101f75b6;
    1.33 +
    1.34 +
    1.35 +/**
    1.36 +@publishedAll
    1.37 +@released
    1.38 +
    1.39 +Property category UID reserved for System services
    1.40 +*/
    1.41 +static const TUid KUidSystemCategory={KUidSystemCategoryValue};
    1.42 +
    1.43 +
    1.44 +/**
    1.45 +@publishedAll
    1.46 +@released
    1.47 +
    1.48 +The lowest value for Property categories at which additional
    1.49 +security restrictions are applied when defining properties.
    1.50 +
    1.51 +Properties with category values above this threshold may only be defined
    1.52 +if the category matches the defining process's Secure ID.
    1.53 +
    1.54 +Below this threashold, properties may be defined either by processes with
    1.55 +a matching Secure ID, or by processes with the WriteDeviceData capability.
    1.56 +*/
    1.57 +static const TInt32 KUidSecurityThresholdCategoryValue=0x10273357;
    1.58 +
    1.59 +
    1.60 +/**
    1.61 +@publishedAll
    1.62 +@released
    1.63 +
    1.64 +User side interface to Publish & Subscribe.
    1.65 +
    1.66 +The class defines a handle to a property, a single data value representing
    1.67 +an item of state information. Threads can publish (change) a property value
    1.68 +through this handle. Threads can also subscribe
    1.69 +(request notification of changes) to a property value through this handle;
    1.70 +they can also retrieve the current property value.
    1.71 +*/
    1.72 +class RProperty : public RHandleBase
    1.73 +	{
    1.74 +public:
    1.75 +	/**
    1.76 +	The largest supported property value, in bytes, for byte-array (binary)
    1.77 +	types and text types.
    1.78 +    */
    1.79 +	enum { KMaxPropertySize = 512 };
    1.80 +	/**
    1.81 +	The largest supported property value, in bytes, for large byte-array (binary)
    1.82 +	types and large text types.
    1.83 +    */
    1.84 +	enum { KMaxLargePropertySize = 65535 };
    1.85 +
    1.86 +
    1.87 +	/**
    1.88 +	Property type attribute.
    1.89 +	*/
    1.90 +	enum TType
    1.91 +		{
    1.92 +		/**
    1.93 +		Integral property type.
    1.94 +		*/
    1.95 +		EInt,
    1.96 +		
    1.97 +		
    1.98 +		/**
    1.99 +		Byte-array (binary data) property type.
   1.100 +		This type provides real-time guarantees but is limited to a maximum size
   1.101 +		of 512 bytes.
   1.102 +
   1.103 +		@see KMaxPropertySize 
   1.104 +		*/
   1.105 +		EByteArray,
   1.106 +		
   1.107 +		
   1.108 +		/**
   1.109 +		Text property type. 
   1.110 +		This is just a programmer friendly view of a byte-array property, and
   1.111 +		is implemented in the same way as EByteArray.
   1.112 +		*/
   1.113 +		EText = EByteArray,
   1.114 +
   1.115 +
   1.116 +		/**
   1.117 +		Large byte-array (binary data) property type.
   1.118 +		This type provides no real-time guarantees but supports properties
   1.119 +		of up to 65536 bytes.
   1.120 +
   1.121 +		@see KMaxLargePropertySize 
   1.122 +		*/
   1.123 +		ELargeByteArray,
   1.124 +		
   1.125 +		
   1.126 +		/**
   1.127 +		Large text property type. 
   1.128 +		This is just a programmer friendly view of a byte-array property, and
   1.129 +		is implemented in the same way as EByteArray.
   1.130 +		*/
   1.131 +		ELargeText = ELargeByteArray,
   1.132 +
   1.133 +
   1.134 +		/**
   1.135 +		Upper limit for TType values.
   1.136 +		It is the maximal legal TType value plus 1.
   1.137 +		*/ 
   1.138 +		ETypeLimit,
   1.139 +		
   1.140 +		
   1.141 +		/**
   1.142 +		Bitmask for TType values coded within TInt attributes.
   1.143 +		*/ 
   1.144 +		ETypeMask = 0xff
   1.145 +		};
   1.146 +
   1.147 +
   1.148 +public:
   1.149 +	IMPORT_C static TInt Define(TUid aCategory, TUint aKey, TInt aAttr, TInt aPreallocate=0);
   1.150 +	IMPORT_C static TInt Define(TUid aCategory, TUint aKey, TInt aAttr, const TSecurityPolicy& aReadPolicy, const TSecurityPolicy& aWritePolicy, TInt aPreallocated=0);
   1.151 +	IMPORT_C static TInt Define(TUint aKey, TInt aAttr, const TSecurityPolicy& aReadPolicy, const TSecurityPolicy& aWritePolicy, TInt aPreallocated=0);
   1.152 +	IMPORT_C static TInt Delete(TUid aCategory, TUint aKey);
   1.153 +	IMPORT_C static TInt Delete(TUint aKey);
   1.154 +	IMPORT_C static TInt Get(TUid aCategory, TUint aKey, TInt& aValue);
   1.155 +	IMPORT_C static TInt Get(TUid aCategory, TUint aKey, TDes8& aValue);
   1.156 +#ifndef __KERNEL_MODE__
   1.157 +	IMPORT_C static TInt Get(TUid aCategory, TUint aKey, TDes16& aValue);
   1.158 +#endif
   1.159 +	IMPORT_C static TInt Set(TUid aCategory, TUint aKey, TInt aValue);
   1.160 +	IMPORT_C static TInt Set(TUid aCategory, TUint aKey, const TDesC8& aValue);
   1.161 +#ifndef __KERNEL_MODE__
   1.162 +	IMPORT_C static TInt Set(TUid aCategory, TUint aKey, const TDesC16& aValue);
   1.163 +#endif
   1.164 +
   1.165 +	IMPORT_C TInt Attach(TUid aCategory, TUint aKey, TOwnerType aType = EOwnerProcess);
   1.166 +
   1.167 +	IMPORT_C void Subscribe(TRequestStatus& aRequest);
   1.168 +	IMPORT_C void Cancel();
   1.169 +
   1.170 +	IMPORT_C TInt Get(TInt& aValue);
   1.171 +	IMPORT_C TInt Get(TDes8& aValue);
   1.172 +#ifndef __KERNEL_MODE__
   1.173 +	IMPORT_C TInt Get(TDes16& aValue);
   1.174 +#endif
   1.175 +	IMPORT_C TInt Set(TInt aValue);
   1.176 +	IMPORT_C TInt Set(const TDesC8& aValue);
   1.177 +#ifndef __KERNEL_MODE__
   1.178 +	IMPORT_C TInt Set(const TDesC16& aValue);
   1.179 +#endif
   1.180 +	};
   1.181 +
   1.182 +#endif