1.1 --- a/epoc32/include/mw/aiwcommon.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/aiwcommon.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,314 @@
1.4 -aiwcommon.h
1.5 +/*
1.6 +* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description: Declares common constants, types, classes etc. to be used both
1.19 +* consumer and provider side.
1.20 +*
1.21 +*/
1.22 +
1.23 +
1.24 +
1.25 +
1.26 +
1.27 +#ifndef AIW_COMMON_H
1.28 +#define AIW_COMMON_H
1.29 +
1.30 +// INCLUDES
1.31 +#include <aiwcommon.hrh>
1.32 +#include <barsread.h>
1.33 +#include <aiwgenericparam.h>
1.34 +
1.35 +// CONSTANTS
1.36 +
1.37 +// MACROS
1.38 +
1.39 +// FUNCTION PROTOTYPES
1.40 +
1.41 +// FORWARD DECLARATIONS
1.42 +class CEikMenuPane;
1.43 +class CAiwGenericParamList;
1.44 +
1.45 +// CLASS DECLARATION
1.46 +
1.47 +/**
1.48 + * Criteria item data.
1.49 + * This class encapsulates an AIW criteria item. Criteria items are building
1.50 + * blocks for AIW interests, i.e. an interest is a list of criteria items.
1.51 + * A criteria item can be defined dynamically (by using this class) or
1.52 + * in a resource file.
1.53 + *
1.54 + * @lib ServiceHandler.lib
1.55 + * @since Series 60 2.6
1.56 + */
1.57 +class CAiwCriteriaItem : public CBase
1.58 + {
1.59 + public: // Constructors and destructor
1.60 + /**
1.61 + * Constructs a criteria item instance with null items.
1.62 + *
1.63 + * @return A pointer to the new object.
1.64 + */
1.65 + IMPORT_C static CAiwCriteriaItem* NewL();
1.66 +
1.67 + /**
1.68 + * Constructs a criteria item instance with null items. Leaves the
1.69 + * pointer to the cleanup stack.
1.70 + *
1.71 + * @return A pointer to the new object.
1.72 + */
1.73 + IMPORT_C static CAiwCriteriaItem* NewLC();
1.74 +
1.75 + /**
1.76 + * Constructs a criteria item instance.
1.77 + *
1.78 + * @param aCriteriaId The criteria ID.
1.79 + * @param aServiceCmd The service command.
1.80 + * @param aContentType The content type.
1.81 + * @return A pointer to the new object.
1.82 + */
1.83 + IMPORT_C static CAiwCriteriaItem* NewL(
1.84 + TInt aCriteriaId,
1.85 + TInt aServiceCmd,
1.86 + const TDesC8& aContentType);
1.87 +
1.88 + /**
1.89 + * Constructs a criteria item instance. Leaves the pointer to the
1.90 + * cleanup stack.
1.91 + *
1.92 + * @param aCriteriaId The criteria ID.
1.93 + * @param aServiceCmd The service command.
1.94 + * @param aContentType The content type.
1.95 + * @return A pointer to the new object.
1.96 + */
1.97 + IMPORT_C static CAiwCriteriaItem* NewLC(
1.98 + TInt aCriteriaId,
1.99 + TInt aServiceCmd,
1.100 + const TDesC8& aContentType);
1.101 +
1.102 + /**
1.103 + * Destructor.
1.104 + */
1.105 + IMPORT_C virtual ~CAiwCriteriaItem();
1.106 +
1.107 + public: // New functions
1.108 + /**
1.109 + * Sets the criteria ID.
1.110 + *
1.111 + * @param aId The criteria ID.
1.112 + */
1.113 + IMPORT_C void SetId(TInt aId);
1.114 +
1.115 + /**
1.116 + * Sets the service class.
1.117 + *
1.118 + * @param aServiceUid The service class, see TAiwServiceClass.
1.119 + */
1.120 + IMPORT_C void SetServiceClass(const TUid& aServiceUid);
1.121 +
1.122 + /**
1.123 + * Sets the service command UID.
1.124 + *
1.125 + * @param aServiceCmd The AIW service command, see TAiwServiceCommands.
1.126 + */
1.127 + IMPORT_C void SetServiceCmd(TInt aServiceCmd);
1.128 +
1.129 + /**
1.130 + * Sets the content type. Makes a copy of the string data.
1.131 + *
1.132 + * @param aContentType Content MIME type, event type or any agreed one.
1.133 + */
1.134 + IMPORT_C void SetContentTypeL(const TDesC8& aContentType);
1.135 +
1.136 + /**
1.137 + * Gets the criteria ID, 0 if not defined.
1.138 + *
1.139 + * @return The criteria ID.
1.140 + */
1.141 + IMPORT_C TInt Id() const;
1.142 +
1.143 + /**
1.144 + * Gets the service class UID.
1.145 + *
1.146 + * @return The service class UID, see TAiwServiceClass.
1.147 + */
1.148 + IMPORT_C const TUid& ServiceClass() const;
1.149 +
1.150 + /**
1.151 + * Gets the service command UID. KNullUid, if not defined.
1.152 + *
1.153 + * @return The service command UID, see TAiwServiceCommands.
1.154 + */
1.155 + IMPORT_C TInt ServiceCmd() const;
1.156 +
1.157 + /**
1.158 + * Gets the content type.
1.159 + *
1.160 + * @return The content type.
1.161 + */
1.162 + IMPORT_C const TDesC8& ContentType() const;
1.163 +
1.164 + /**
1.165 + * Sets the options.
1.166 + *
1.167 + * @param aOptions Options.
1.168 + */
1.169 + IMPORT_C void SetOptions(TUint aOptions);
1.170 +
1.171 + /**
1.172 + * Gets the options.
1.173 + *
1.174 + * @return Options.
1.175 + */
1.176 + IMPORT_C TUint Options() const;
1.177 +
1.178 + /**
1.179 + * Maximum number of providers allowed for this criteria item.
1.180 + *
1.181 + * @return Maximum number of providers allowed for this criteria item.
1.182 + */
1.183 + IMPORT_C TInt MaxProviders() const;
1.184 +
1.185 + /**
1.186 + * Reads a criteria item from a resource.
1.187 + *
1.188 + * @param aReader A resource reader pointing to a criteria item.
1.189 + */
1.190 + IMPORT_C void ReadFromResoureL(TResourceReader& aReader);
1.191 +
1.192 + /**
1.193 + * Returns the default provider.
1.194 + *
1.195 + * @return The default provider UID.
1.196 + */
1.197 + IMPORT_C TUid DefaultProvider() const;
1.198 +
1.199 + /**
1.200 + * Sets the default provider.
1.201 + *
1.202 + * @param aDefault The UID of a default provider.
1.203 + */
1.204 + IMPORT_C void SetDefaultProvider(TInt aDefault);
1.205 +
1.206 + /**
1.207 + * Equality operator. Two criteria items are considered equal only if all
1.208 + * parameters match. The parameters are: criteria id, service command,
1.209 + * content type, service class, default provider, max providers and options).
1.210 + *
1.211 + * @param aItem Criteria item to compare.
1.212 + * @return ETrue if criteria items are equal, EFalse otherwise.
1.213 + */
1.214 + IMPORT_C TBool operator==(const CAiwCriteriaItem& aItem);
1.215 +
1.216 + /**
1.217 + * Sets the maximum number of providers.
1.218 + *
1.219 + * @param aMaxProviders The maximum number of providers.
1.220 + */
1.221 + IMPORT_C void SetMaxProviders(TInt aMaxProviders);
1.222 +
1.223 + public:
1.224 + /**
1.225 + * If set, only ROM based providers can be attached to this criteria.
1.226 + *
1.227 + * @return ETrue if AIW_OPTIONS_ROM_ONLY bit is set, EFalse otherwise.
1.228 + */
1.229 + inline TBool RomOnly() const;
1.230 +
1.231 + private:
1.232 + /**
1.233 + * C++ default constructor.
1.234 + */
1.235 + CAiwCriteriaItem();
1.236 +
1.237 + /**
1.238 + * By default Symbian 2nd phase constructor is private.
1.239 + */
1.240 + void ConstructL();
1.241 +
1.242 + /**
1.243 + * By default Symbian 2nd phase constructor is private.
1.244 + */
1.245 + void ConstructL(
1.246 + TInt aCriteriaId,
1.247 + TInt aServiceCmd,
1.248 + const TDesC8& aContentType);
1.249 +
1.250 + private:
1.251 + // Criteria ID.
1.252 + TInt iCriteriaId;
1.253 + // Service class UID
1.254 + TUid iServiceClass;
1.255 + // Service command UID
1.256 + TInt iServiceCmd;
1.257 + // Content type (MIME type).
1.258 + HBufC8* iContentType;
1.259 + // Additional options
1.260 + TAiwVariant iOptions;
1.261 + //Default provider implementation uid
1.262 + TUid iDefaultProvider;
1.263 + // Reserved member
1.264 + TAiwVariant iReserved;
1.265 + // Max providers
1.266 + TInt iMaxProviders;
1.267 + };
1.268 +
1.269 +
1.270 +inline TBool CAiwCriteriaItem::RomOnly() const
1.271 + {
1.272 + return (Options() & AIW_OPTIONS_ROM_ONLY) != 0;
1.273 + }
1.274 +
1.275 +
1.276 +/**
1.277 +* Interest is an array of criteria items.
1.278 +*/
1.279 +typedef RPointerArray<CAiwCriteriaItem> RCriteriaArray;
1.280 +
1.281 +/**
1.282 +* Abstract callback interface to handle callbacks or events
1.283 +* from providers. This callback is needed when
1.284 +* - Consumer wants to pre-check output parameters before returning
1.285 +* synchronous Handle*Cmd.
1.286 +* - Asynchronous Handle*Cmd is used.
1.287 +* - An asynchronous event occurs in the system.
1.288 +*
1.289 +* @lib ServiceHandler.lib
1.290 +* @since Series 60 2.6
1.291 +*/
1.292 +class MAiwNotifyCallback
1.293 + {
1.294 + public:
1.295 + /**
1.296 + * Handles notifications caused by an asynchronous Execute*CmdL call
1.297 + * or an event.
1.298 + *
1.299 + * @param aCmdId The service command associated to the event.
1.300 + * @param aEventId Occured event, see AiwCommon.hrh.
1.301 + * @param aEventParamList Event parameters, if any, as defined per
1.302 + * each event.
1.303 + * @param aInParamList Input parameters, if any, given in the
1.304 + * related HandleCommmandL.
1.305 + * @return Error code for the callback.
1.306 + */
1.307 + virtual TInt HandleNotifyL(
1.308 + TInt aCmdId,
1.309 + TInt aEventId,
1.310 + CAiwGenericParamList& aEventParamList,
1.311 + const CAiwGenericParamList& aInParamList) = 0;
1.312 + };
1.313 +
1.314 +#endif // AIW_COMMON_H
1.315 +
1.316 +// End of File
1.317 +
1.318 +