os/kernelhwsrv/kernel/eka/include/e32property.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32\include\e32property.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#ifndef __E32PROPERTY_H__
sl@0
    19
#define __E32PROPERTY_H__
sl@0
    20
sl@0
    21
#include <e32cmn.h>
sl@0
    22
sl@0
    23
/**
sl@0
    24
@publishedAll
sl@0
    25
@released
sl@0
    26
sl@0
    27
Property category UID value reserved for System services.
sl@0
    28
*/
sl@0
    29
static const TInt32 KUidSystemCategoryValue=0x101f75b6;
sl@0
    30
sl@0
    31
sl@0
    32
/**
sl@0
    33
@publishedAll
sl@0
    34
@released
sl@0
    35
sl@0
    36
Property category UID reserved for System services
sl@0
    37
*/
sl@0
    38
static const TUid KUidSystemCategory={KUidSystemCategoryValue};
sl@0
    39
sl@0
    40
sl@0
    41
/**
sl@0
    42
@publishedAll
sl@0
    43
@released
sl@0
    44
sl@0
    45
The lowest value for Property categories at which additional
sl@0
    46
security restrictions are applied when defining properties.
sl@0
    47
sl@0
    48
Properties with category values above this threshold may only be defined
sl@0
    49
if the category matches the defining process's Secure ID.
sl@0
    50
sl@0
    51
Below this threashold, properties may be defined either by processes with
sl@0
    52
a matching Secure ID, or by processes with the WriteDeviceData capability.
sl@0
    53
*/
sl@0
    54
static const TInt32 KUidSecurityThresholdCategoryValue=0x10273357;
sl@0
    55
sl@0
    56
sl@0
    57
/**
sl@0
    58
@publishedAll
sl@0
    59
@released
sl@0
    60
sl@0
    61
User side interface to Publish & Subscribe.
sl@0
    62
sl@0
    63
The class defines a handle to a property, a single data value representing
sl@0
    64
an item of state information. Threads can publish (change) a property value
sl@0
    65
through this handle. Threads can also subscribe
sl@0
    66
(request notification of changes) to a property value through this handle;
sl@0
    67
they can also retrieve the current property value.
sl@0
    68
*/
sl@0
    69
class RProperty : public RHandleBase
sl@0
    70
	{
sl@0
    71
public:
sl@0
    72
	/**
sl@0
    73
	The largest supported property value, in bytes, for byte-array (binary)
sl@0
    74
	types and text types.
sl@0
    75
    */
sl@0
    76
	enum { KMaxPropertySize = 512 };
sl@0
    77
	/**
sl@0
    78
	The largest supported property value, in bytes, for large byte-array (binary)
sl@0
    79
	types and large text types.
sl@0
    80
    */
sl@0
    81
	enum { KMaxLargePropertySize = 65535 };
sl@0
    82
sl@0
    83
sl@0
    84
	/**
sl@0
    85
	Property type attribute.
sl@0
    86
	*/
sl@0
    87
	enum TType
sl@0
    88
		{
sl@0
    89
		/**
sl@0
    90
		Integral property type.
sl@0
    91
		*/
sl@0
    92
		EInt,
sl@0
    93
		
sl@0
    94
		
sl@0
    95
		/**
sl@0
    96
		Byte-array (binary data) property type.
sl@0
    97
		This type provides real-time guarantees but is limited to a maximum size
sl@0
    98
		of 512 bytes.
sl@0
    99
sl@0
   100
		@see KMaxPropertySize 
sl@0
   101
		*/
sl@0
   102
		EByteArray,
sl@0
   103
		
sl@0
   104
		
sl@0
   105
		/**
sl@0
   106
		Text property type. 
sl@0
   107
		This is just a programmer friendly view of a byte-array property, and
sl@0
   108
		is implemented in the same way as EByteArray.
sl@0
   109
		*/
sl@0
   110
		EText = EByteArray,
sl@0
   111
sl@0
   112
sl@0
   113
		/**
sl@0
   114
		Large byte-array (binary data) property type.
sl@0
   115
		This type provides no real-time guarantees but supports properties
sl@0
   116
		of up to 65536 bytes.
sl@0
   117
sl@0
   118
		@see KMaxLargePropertySize 
sl@0
   119
		*/
sl@0
   120
		ELargeByteArray,
sl@0
   121
		
sl@0
   122
		
sl@0
   123
		/**
sl@0
   124
		Large text property type. 
sl@0
   125
		This is just a programmer friendly view of a byte-array property, and
sl@0
   126
		is implemented in the same way as EByteArray.
sl@0
   127
		*/
sl@0
   128
		ELargeText = ELargeByteArray,
sl@0
   129
sl@0
   130
sl@0
   131
		/**
sl@0
   132
		Upper limit for TType values.
sl@0
   133
		It is the maximal legal TType value plus 1.
sl@0
   134
		*/ 
sl@0
   135
		ETypeLimit,
sl@0
   136
		
sl@0
   137
		
sl@0
   138
		/**
sl@0
   139
		Bitmask for TType values coded within TInt attributes.
sl@0
   140
		*/ 
sl@0
   141
		ETypeMask = 0xff
sl@0
   142
		};
sl@0
   143
sl@0
   144
sl@0
   145
public:
sl@0
   146
	IMPORT_C static TInt Define(TUid aCategory, TUint aKey, TInt aAttr, TInt aPreallocate=0);
sl@0
   147
	IMPORT_C static TInt Define(TUid aCategory, TUint aKey, TInt aAttr, const TSecurityPolicy& aReadPolicy, const TSecurityPolicy& aWritePolicy, TInt aPreallocated=0);
sl@0
   148
	IMPORT_C static TInt Define(TUint aKey, TInt aAttr, const TSecurityPolicy& aReadPolicy, const TSecurityPolicy& aWritePolicy, TInt aPreallocated=0);
sl@0
   149
	IMPORT_C static TInt Delete(TUid aCategory, TUint aKey);
sl@0
   150
	IMPORT_C static TInt Delete(TUint aKey);
sl@0
   151
	IMPORT_C static TInt Get(TUid aCategory, TUint aKey, TInt& aValue);
sl@0
   152
	IMPORT_C static TInt Get(TUid aCategory, TUint aKey, TDes8& aValue);
sl@0
   153
#ifndef __KERNEL_MODE__
sl@0
   154
	IMPORT_C static TInt Get(TUid aCategory, TUint aKey, TDes16& aValue);
sl@0
   155
#endif
sl@0
   156
	IMPORT_C static TInt Set(TUid aCategory, TUint aKey, TInt aValue);
sl@0
   157
	IMPORT_C static TInt Set(TUid aCategory, TUint aKey, const TDesC8& aValue);
sl@0
   158
#ifndef __KERNEL_MODE__
sl@0
   159
	IMPORT_C static TInt Set(TUid aCategory, TUint aKey, const TDesC16& aValue);
sl@0
   160
#endif
sl@0
   161
sl@0
   162
	IMPORT_C TInt Attach(TUid aCategory, TUint aKey, TOwnerType aType = EOwnerProcess);
sl@0
   163
sl@0
   164
	IMPORT_C void Subscribe(TRequestStatus& aRequest);
sl@0
   165
	IMPORT_C void Cancel();
sl@0
   166
sl@0
   167
	IMPORT_C TInt Get(TInt& aValue);
sl@0
   168
	IMPORT_C TInt Get(TDes8& aValue);
sl@0
   169
#ifndef __KERNEL_MODE__
sl@0
   170
	IMPORT_C TInt Get(TDes16& aValue);
sl@0
   171
#endif
sl@0
   172
	IMPORT_C TInt Set(TInt aValue);
sl@0
   173
	IMPORT_C TInt Set(const TDesC8& aValue);
sl@0
   174
#ifndef __KERNEL_MODE__
sl@0
   175
	IMPORT_C TInt Set(const TDesC16& aValue);
sl@0
   176
#endif
sl@0
   177
	};
sl@0
   178
sl@0
   179
#endif