ncdengine/provider/protocol/inc/ncdparserobserver.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 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:   MNCDParserObserver declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef NCDPARSEROBSERVER_H
       
    20 #define NCDPARSEROBSERVER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 
       
    25 class MNcdConfigurationProtocolActionRequest;
       
    26 class MNcdConfigurationProtocolClientConfiguration;
       
    27 class MNcdConfigurationProtocolDetail;
       
    28 class MNcdConfigurationProtocolError;
       
    29 class MNcdConfigurationProtocolError;
       
    30 class MNcdConfigurationProtocolQuery;
       
    31 class MNcdConfigurationProtocolServerDetails;
       
    32 class MNcdPreminetProtocolCookie;
       
    33 class MNcdPreminetProtocolDataBlock;
       
    34 class MNcdPreminetProtocolDataEntity;
       
    35 class MNcdPreminetProtocolDataEntity;
       
    36 class MNcdPreminetProtocolError;
       
    37 class MNcdPreminetProtocolFolderRef;
       
    38 class MNcdPreminetProtocolInformation;
       
    39 class MNcdPreminetProtocolItemRef;
       
    40 class MNcdPreminetProtocolPurchaseInformation;
       
    41 class MNcdPreminetProtocolPurchaseProcessed;
       
    42 class MNcdPreminetProtocolSubscription;
       
    43 
       
    44 /**
       
    45  * Main parser observer interface for watching parser events.
       
    46  */
       
    47 class MNcdParserObserver
       
    48     {
       
    49 public:
       
    50     /**
       
    51     * Called when an error occurs during parsing. The parsing
       
    52     * will not continue after this.
       
    53     * The error code should tell things such as:
       
    54     * - syntax error
       
    55     * - protocol error
       
    56     */
       
    57     virtual void ParseError( TInt aErrorCode ) = 0;
       
    58 
       
    59     /**
       
    60      * This method is called after the user has called MNCDParser::EndL()
       
    61      * and all data has been processed. 
       
    62      */
       
    63     virtual void ParseCompleteL( TInt aError ) = 0;
       
    64     };
       
    65 
       
    66 
       
    67 /**
       
    68  * Observer for entities received from the parser.
       
    69  */
       
    70 class MNcdParserEntityObserver
       
    71     {
       
    72 public:
       
    73     /**
       
    74      * Folder ref entity.
       
    75      * @param aData Ownership is transfered.
       
    76      */
       
    77     virtual void FolderRefL( MNcdPreminetProtocolFolderRef* aData ) = 0;
       
    78     /**
       
    79      * Folder metadata entity.
       
    80      * @param aData Ownership is transfered.
       
    81      */
       
    82     virtual void FolderDataL( MNcdPreminetProtocolDataEntity* aData ) = 0;
       
    83     /**
       
    84      * Item ref entity.
       
    85      * @param aData Ownership is transfered.
       
    86      */
       
    87     virtual void ItemRefL( MNcdPreminetProtocolItemRef* aData ) = 0;
       
    88     /**
       
    89      * Item metadata entity.
       
    90      * @param aData Ownership is transfered.
       
    91      */
       
    92     virtual void ItemDataL( MNcdPreminetProtocolDataEntity* aData ) = 0;
       
    93     };
       
    94 
       
    95 /**
       
    96  * Observer for purchase information received from the parser.
       
    97  */
       
    98 class MNcdParserPurchaseObserver
       
    99     {
       
   100 public:
       
   101     /**
       
   102      * Purchase information.
       
   103      * @param aData Ownership is transfered.
       
   104      */
       
   105     virtual void InformationL( 
       
   106         MNcdPreminetProtocolPurchaseInformation* aData ) = 0;
       
   107 
       
   108     /**
       
   109      * Processed purchase data.
       
   110      * @param aData Ownership is transfered.
       
   111      */
       
   112     virtual void ProcessedL( 
       
   113         MNcdPreminetProtocolPurchaseProcessed* aData ) = 0;
       
   114     };
       
   115 
       
   116 /**
       
   117  * Observer for subscription information received from the parser.
       
   118  */
       
   119 class MNcdParserSubscriptionObserver
       
   120     {
       
   121 public:
       
   122     /**
       
   123      * Purchase information.
       
   124      * @param aData Ownership is transfered.
       
   125      */
       
   126     virtual void ValidSubscriptionL( 
       
   127         MNcdPreminetProtocolSubscription* aData ) = 0;
       
   128 
       
   129     /**
       
   130      * Processed purchase data.
       
   131      * @param aData Ownership is transfered.
       
   132      */
       
   133     virtual void OldSubscriptionL( 
       
   134         MNcdPreminetProtocolSubscription* aData ) = 0;
       
   135     };
       
   136 
       
   137 /**
       
   138  * Observer for session information.
       
   139  */ 
       
   140 class MNcdParserSessionObserver
       
   141     {
       
   142 public:
       
   143     /**
       
   144      * Session with an id has been received.
       
   145      * @param aSessionId
       
   146      * @param aServerURI Server where this session originated.
       
   147      * @param aNameSpace
       
   148      */
       
   149     virtual void SessionL( const TDesC& aSessionId,
       
   150                            const TDesC& aServerURI,
       
   151                            const TDesC& aNameSpace ) = 0;
       
   152     };
       
   153 
       
   154 class MNcdParserInformationObserver
       
   155     {
       
   156 public:
       
   157     virtual void InformationL( 
       
   158         MNcdPreminetProtocolInformation* aData ) = 0;
       
   159     };
       
   160 
       
   161 class MNcdParserDataBlocksObserver
       
   162     {
       
   163 public:
       
   164     virtual void DataBlocksL( 
       
   165         CArrayPtr<MNcdPreminetProtocolDataBlock>* aData ) = 0;
       
   166     };
       
   167 
       
   168 class MNcdParserErrorObserver
       
   169     {
       
   170 public:
       
   171     virtual void ErrorL( 
       
   172         MNcdPreminetProtocolError* aData ) = 0;
       
   173     };
       
   174 
       
   175 class MNcdParserQueryObserver
       
   176     {
       
   177 public:
       
   178     virtual void QueryL( 
       
   179         MNcdConfigurationProtocolQuery* aData ) = 0;
       
   180     };
       
   181 
       
   182 
       
   183 /**
       
   184  * Observer for configuration protocol information.
       
   185  */ 
       
   186 class MNcdParserConfigurationProtocolObserver
       
   187     {
       
   188 public:
       
   189     virtual void ConfigurationBeginL( const TDesC& version, 
       
   190                                       TInt expirationdelta ) = 0;
       
   191     virtual void ConfigurationQueryL( MNcdConfigurationProtocolQuery* aQuery ) = 0;
       
   192 
       
   193     virtual void ClientConfigurationL(
       
   194         MNcdConfigurationProtocolClientConfiguration* aConfiguration ) = 0;
       
   195     virtual void ConfigurationDetailsL( CArrayPtr<MNcdConfigurationProtocolDetail>* aDetails ) = 0;
       
   196     virtual void ConfigurationActionRequestL( MNcdConfigurationProtocolActionRequest* aActionRequest ) = 0;
       
   197     virtual void ConfigurationErrorL( MNcdConfigurationProtocolError* aError ) = 0;
       
   198     virtual void ConfigurationServerDetailsL( MNcdConfigurationProtocolServerDetails* aServerDetails ) = 0;
       
   199     virtual void ConfigurationEndL() = 0;
       
   200     };
       
   201 
       
   202 class MNcdParserObserverBundle
       
   203     {
       
   204 public:
       
   205     virtual ~MNcdParserObserverBundle() {}
       
   206 
       
   207     /**
       
   208      * Sets the main observer. 
       
   209      * This is mandatory prior to beginning the parsing!
       
   210      * @param aObserver
       
   211      */ 
       
   212     virtual void SetParserObserver( MNcdParserObserver* aObserver ) = 0;
       
   213     /**
       
   214      * Retrieves the observer pointer.
       
   215      * @return Observer pointer or null.
       
   216      */
       
   217     virtual MNcdParserObserver* ParserObserver() const = 0;
       
   218 
       
   219     /**
       
   220      * Sets the entity observer.
       
   221      * @param aObserver
       
   222      */
       
   223     virtual void SetEntityObserver( MNcdParserEntityObserver* aObserver ) = 0;
       
   224     /**
       
   225      * Retrieves the entity observer.
       
   226      * @return Observer pointer or null.
       
   227      */
       
   228     virtual MNcdParserEntityObserver* EntityObserver() const = 0;
       
   229 
       
   230     /**
       
   231      * Sets the purchase observer.
       
   232      * @param aObserver
       
   233      */
       
   234     virtual void SetPurchaseObserver( MNcdParserPurchaseObserver* aObserver ) = 0;
       
   235     /**
       
   236      * Retrieves the purchase observer.
       
   237      * @return Observer pointer or null.
       
   238      */
       
   239     virtual MNcdParserPurchaseObserver* PurchaseObserver() const = 0;
       
   240 
       
   241     /**
       
   242      * Sets the subscription observer.
       
   243      * @param aObserver
       
   244      */
       
   245     virtual void SetSubscriptionObserver( MNcdParserSubscriptionObserver* aObserver ) = 0;
       
   246     /**
       
   247      * Retrieves the subscription observer.
       
   248      * @return Observer pointer or null.
       
   249      */
       
   250     virtual MNcdParserSubscriptionObserver* SubscriptionObserver() const = 0;
       
   251 
       
   252     /**
       
   253      * Sets the session observer.
       
   254      * @param aObserver
       
   255      */
       
   256     virtual void SetSessionObserver( MNcdParserSessionObserver* aObserver ) = 0;
       
   257     
       
   258     /**
       
   259      * Retrieves the observer.
       
   260      * @return Observer pointer or null.
       
   261      */
       
   262     virtual MNcdParserSessionObserver* SessionObserver() const = 0;
       
   263 
       
   264     /**
       
   265      * Sets the information observer.
       
   266      * @param aObserver
       
   267      */
       
   268     virtual void SetInformationObserver( MNcdParserInformationObserver* aObserver ) = 0;
       
   269     
       
   270     /**
       
   271      * Retrieves the observer.
       
   272      * @return Observer pointer or null.
       
   273      */
       
   274     virtual MNcdParserInformationObserver* InformationObserver() const = 0;
       
   275     
       
   276     /**
       
   277      * Sets the data blocks observer.
       
   278      * @param aObserver
       
   279      */
       
   280     virtual void SetDataBlocksObserver( MNcdParserDataBlocksObserver* aObserver ) = 0;
       
   281     
       
   282     /**
       
   283      * Retrieves the observer.
       
   284      * @return Observer pointer or null.
       
   285      */
       
   286     virtual MNcdParserDataBlocksObserver* DataBlocksObserver() const = 0;
       
   287     
       
   288     /**
       
   289      * Sets the configuration protocol observer.
       
   290      * @param aObserver
       
   291      */
       
   292     virtual void SetConfigurationProtocolObserver( MNcdParserConfigurationProtocolObserver* aObserver ) = 0;
       
   293     /**
       
   294      * Retrieves the observer.
       
   295      * @return Observer pointer or null.
       
   296      */
       
   297     virtual MNcdParserConfigurationProtocolObserver* ConfigurationProtocolObserver() const = 0;
       
   298     
       
   299     /**
       
   300      * Sets the error observer.
       
   301      * @param aObserver
       
   302      */
       
   303     virtual void SetErrorObserver( MNcdParserErrorObserver* aObserver ) = 0;
       
   304     /**
       
   305      * Retrieves the observer.
       
   306      * @return Observer pointer or null.
       
   307      */
       
   308     virtual MNcdParserErrorObserver* ErrorObserver() const = 0;
       
   309     
       
   310     /**
       
   311      * Sets the query observer.
       
   312      * @param aObserver
       
   313      */
       
   314     virtual void SetQueryObserver( MNcdParserQueryObserver* aObserver ) = 0;
       
   315     /**
       
   316      * Retrieves the observer.
       
   317      * @return Observer pointer or null.
       
   318      */
       
   319     virtual MNcdParserQueryObserver* QueryObserver() const = 0;
       
   320     
       
   321     /**
       
   322      * Retrieves the origin of the current session.
       
   323      * @return Server URI or KNullDesC if not available.
       
   324      */
       
   325     virtual const TDesC& SessionOrigin() const = 0;
       
   326     };
       
   327 
       
   328 #endif
       
   329