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