sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\include\e32property.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __E32PROPERTY_H__ sl@0: #define __E32PROPERTY_H__ sl@0: sl@0: #include sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Property category UID value reserved for System services. sl@0: */ sl@0: static const TInt32 KUidSystemCategoryValue=0x101f75b6; sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Property category UID reserved for System services sl@0: */ sl@0: static const TUid KUidSystemCategory={KUidSystemCategoryValue}; sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: The lowest value for Property categories at which additional sl@0: security restrictions are applied when defining properties. sl@0: sl@0: Properties with category values above this threshold may only be defined sl@0: if the category matches the defining process's Secure ID. sl@0: sl@0: Below this threashold, properties may be defined either by processes with sl@0: a matching Secure ID, or by processes with the WriteDeviceData capability. sl@0: */ sl@0: static const TInt32 KUidSecurityThresholdCategoryValue=0x10273357; sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: User side interface to Publish & Subscribe. sl@0: sl@0: The class defines a handle to a property, a single data value representing sl@0: an item of state information. Threads can publish (change) a property value sl@0: through this handle. Threads can also subscribe sl@0: (request notification of changes) to a property value through this handle; sl@0: they can also retrieve the current property value. sl@0: */ sl@0: class RProperty : public RHandleBase sl@0: { sl@0: public: sl@0: /** sl@0: The largest supported property value, in bytes, for byte-array (binary) sl@0: types and text types. sl@0: */ sl@0: enum { KMaxPropertySize = 512 }; sl@0: /** sl@0: The largest supported property value, in bytes, for large byte-array (binary) sl@0: types and large text types. sl@0: */ sl@0: enum { KMaxLargePropertySize = 65535 }; sl@0: sl@0: sl@0: /** sl@0: Property type attribute. sl@0: */ sl@0: enum TType sl@0: { sl@0: /** sl@0: Integral property type. sl@0: */ sl@0: EInt, sl@0: sl@0: sl@0: /** sl@0: Byte-array (binary data) property type. sl@0: This type provides real-time guarantees but is limited to a maximum size sl@0: of 512 bytes. sl@0: sl@0: @see KMaxPropertySize sl@0: */ sl@0: EByteArray, sl@0: sl@0: sl@0: /** sl@0: Text property type. sl@0: This is just a programmer friendly view of a byte-array property, and sl@0: is implemented in the same way as EByteArray. sl@0: */ sl@0: EText = EByteArray, sl@0: sl@0: sl@0: /** sl@0: Large byte-array (binary data) property type. sl@0: This type provides no real-time guarantees but supports properties sl@0: of up to 65536 bytes. sl@0: sl@0: @see KMaxLargePropertySize sl@0: */ sl@0: ELargeByteArray, sl@0: sl@0: sl@0: /** sl@0: Large text property type. sl@0: This is just a programmer friendly view of a byte-array property, and sl@0: is implemented in the same way as EByteArray. sl@0: */ sl@0: ELargeText = ELargeByteArray, sl@0: sl@0: sl@0: /** sl@0: Upper limit for TType values. sl@0: It is the maximal legal TType value plus 1. sl@0: */ sl@0: ETypeLimit, sl@0: sl@0: sl@0: /** sl@0: Bitmask for TType values coded within TInt attributes. sl@0: */ sl@0: ETypeMask = 0xff sl@0: }; sl@0: sl@0: sl@0: public: sl@0: IMPORT_C static TInt Define(TUid aCategory, TUint aKey, TInt aAttr, TInt aPreallocate=0); sl@0: IMPORT_C static TInt Define(TUid aCategory, TUint aKey, TInt aAttr, const TSecurityPolicy& aReadPolicy, const TSecurityPolicy& aWritePolicy, TInt aPreallocated=0); sl@0: IMPORT_C static TInt Define(TUint aKey, TInt aAttr, const TSecurityPolicy& aReadPolicy, const TSecurityPolicy& aWritePolicy, TInt aPreallocated=0); sl@0: IMPORT_C static TInt Delete(TUid aCategory, TUint aKey); sl@0: IMPORT_C static TInt Delete(TUint aKey); sl@0: IMPORT_C static TInt Get(TUid aCategory, TUint aKey, TInt& aValue); sl@0: IMPORT_C static TInt Get(TUid aCategory, TUint aKey, TDes8& aValue); sl@0: #ifndef __KERNEL_MODE__ sl@0: IMPORT_C static TInt Get(TUid aCategory, TUint aKey, TDes16& aValue); sl@0: #endif sl@0: IMPORT_C static TInt Set(TUid aCategory, TUint aKey, TInt aValue); sl@0: IMPORT_C static TInt Set(TUid aCategory, TUint aKey, const TDesC8& aValue); sl@0: #ifndef __KERNEL_MODE__ sl@0: IMPORT_C static TInt Set(TUid aCategory, TUint aKey, const TDesC16& aValue); sl@0: #endif sl@0: sl@0: IMPORT_C TInt Attach(TUid aCategory, TUint aKey, TOwnerType aType = EOwnerProcess); sl@0: sl@0: IMPORT_C void Subscribe(TRequestStatus& aRequest); sl@0: IMPORT_C void Cancel(); sl@0: sl@0: IMPORT_C TInt Get(TInt& aValue); sl@0: IMPORT_C TInt Get(TDes8& aValue); sl@0: #ifndef __KERNEL_MODE__ sl@0: IMPORT_C TInt Get(TDes16& aValue); sl@0: #endif sl@0: IMPORT_C TInt Set(TInt aValue); sl@0: IMPORT_C TInt Set(const TDesC8& aValue); sl@0: #ifndef __KERNEL_MODE__ sl@0: IMPORT_C TInt Set(const TDesC16& aValue); sl@0: #endif sl@0: }; sl@0: sl@0: #endif