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