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