videofeeds/clientapi/inc/CIptvEventListener.h
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     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 the License "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:    Listens events from server (CIptvEventGenerator).*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CIPTVEVENTLISTENER_H
       
    22 #define CIPTVEVENTLISTENER_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // MACROS
       
    30 
       
    31 // DATA TYPES
       
    32 
       
    33 // FUNCTION PROTOTYPES
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class CIptvClientBase;
       
    37 class MIptvEvent;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42  * Listens events on client side. Events are sent by CIptvEventGenerator on server side.
       
    43  * This is a general purpose event system. Events can be anything, they just have to
       
    44  * inherit MIptvEvent virtual class.
       
    45  */
       
    46 class CIptvEventListener : public CActive
       
    47     {
       
    48     public:  // Constructors and destructor
       
    49         
       
    50         /**
       
    51         * Two-phased constructor.
       
    52         *
       
    53         * @param aClient             Reference to client instance
       
    54         * @param aEventProto         Pointer to MIptvEvent derived class. This defines the event
       
    55         *                            type which this event listener listens to. Pointer contains function
       
    56         *                            implementations which are used when handling MIptvEvent type
       
    57         *                            objects. Ownership moves, i.e CIptvEventListener will free the pointer.
       
    58         * @param aSizeReqMsgId       Message ID which is used when client side requests incoming event size.
       
    59         * @param aDataMsgId          Message ID which is used when client side queries data (syncronously).
       
    60         * @param aCancelSizeReqMsgId Message ID which is used when client size cancels pending size request.
       
    61         */
       
    62         static CIptvEventListener* NewL( CIptvClientBase& aClient,
       
    63                                          MIptvEvent* aEventProto,
       
    64                                          TInt aSizeReqMsgId,
       
    65                                          TInt aDataMsgId,
       
    66                                          TInt aCancelSizeReqMsgId );
       
    67         
       
    68         /**
       
    69         * Destructor.
       
    70         */
       
    71         virtual ~CIptvEventListener();
       
    72 
       
    73     private:
       
    74 
       
    75         /**
       
    76         * From CActive, handles an active object’s request completion event
       
    77         */
       
    78         void RunL();
       
    79 
       
    80         /**
       
    81         * From CActive, implements cancellation of an outstanding request.
       
    82         * This function is called as part of the active object’s Cancel().
       
    83         */
       
    84         void DoCancel();
       
    85                     
       
    86     private:
       
    87 
       
    88         /**
       
    89         * C++ default constructor.
       
    90         *
       
    91         * @param aClient             Reference to client instance
       
    92         * @param aEventProto         Pointer to MIptvEvent derived class. This defines the event
       
    93         *                            type which this event listener listens to. Pointer contains function
       
    94         *                            implementations which are used when handling MIptvEvent type
       
    95         *                            objects. Ownership moves, i.e CIptvEventListener will free the pointer.
       
    96         * @param aSizeReqMsgId       Message ID which is used when client side requests incoming event size.
       
    97         * @param aDataMsgId          Message ID which is used when client side queries data (syncronously).
       
    98         * @param aCancelSizeReqMsgId Message ID which is used when client size cancels pending size request.
       
    99         */
       
   100         CIptvEventListener( CIptvClientBase& aClient,
       
   101                             MIptvEvent* aEventProto,
       
   102                             TInt aSizeReqMsgId,
       
   103                             TInt aDataMsgId,
       
   104                             TInt aCancelSizeReqMsgId );
       
   105 
       
   106         /**
       
   107         * By default Symbian 2nd phase constructor is private.
       
   108         */
       
   109         void ConstructL();
       
   110         
       
   111         void SendSizeReqL();
       
   112 
       
   113     private:    // Data
       
   114 
       
   115         CIptvClientBase&  iClient;
       
   116 
       
   117         /**
       
   118          * Client provides this. It is used to make new instances of the event (GetCopy() method).
       
   119          */                
       
   120         MIptvEvent* iEventProto;
       
   121         
       
   122         /**
       
   123          * Memory area allocated for size request ipc msg.
       
   124          */
       
   125         TBuf8<4> iSizeRequestIpcMsg;
       
   126                 
       
   127         /**
       
   128          * Pending message id is stored when the request is made.
       
   129          */        
       
   130         TInt    iPendingMsgId;
       
   131 
       
   132         /**
       
   133          * If size request is completed with error code (for example server side leaved)
       
   134          * this value is increased and new size request is sent.
       
   135          */        
       
   136         TInt    iErrorCounter;
       
   137         
       
   138         /**
       
   139         * Message ID which is used when client side requests incoming event size.
       
   140         */
       
   141         TInt iSizeReqMsgId;
       
   142         
       
   143         /**
       
   144         * Message ID which is used when client side queries data (syncronously).
       
   145         */
       
   146         TInt iDataMsgId;
       
   147 
       
   148         /**
       
   149         * Message ID which is used when client size cancels pending size request.
       
   150         */        
       
   151         TInt iCancelSizeReqMsgId;
       
   152 
       
   153     };
       
   154 
       
   155 #endif      // CIPTVSMEVENTLISTENER_H   
       
   156             
       
   157 // End of File