upnp/upnpstack/serviceframework/inc/upnpmoderatedeventqueuemanager.h
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 /** @file
       
     2 * Copyright (c) 2008-2008 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:  Implements algoritms for modereted events
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_UPNPMODERATEDEVENTQUEUEMANAGER_H
       
    20 #define C_UPNPMODERATEDEVENTQUEUEMANAGER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 
       
    26 #include "upnphttptransaction.h"
       
    27 #include "upnpserviceimplementation.h"
       
    28 #include "upnpeventcontroller.h"
       
    29 #include "upnpeventqueuemanagerbase.h"
       
    30 
       
    31 #include "upnpsubscriberlibrary.h"
       
    32 
       
    33 
       
    34 class CUpnpNotifyTimer;
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 *  Implements algoritms for serving moderated events
       
    39 * 
       
    40 */
       
    41 NONSHARABLE_CLASS( CUpnpModeratedEventQueueManager ): public CUpnpEventQueueManagerBase, 
       
    42                                                       public MUpnpNotifyTimerObserver
       
    43     {
       
    44 public:
       
    45     // Constructors and destructor
       
    46 
       
    47     /**
       
    48     * Destructor.
       
    49     */
       
    50     ~CUpnpModeratedEventQueueManager();
       
    51 
       
    52     /**
       
    53     * Two-phased constructor.
       
    54     */
       
    55     static CUpnpModeratedEventQueueManager* NewL( CUpnpServiceImplementation& aServiceImpl,
       
    56                                                   CUpnpEventController& aEventController,
       
    57                                                   CUpnpSubscriberLibrary* aSubscriberLibrary );
       
    58 
       
    59     /**
       
    60     * Two-phased constructor.
       
    61     */
       
    62     static CUpnpModeratedEventQueueManager* NewLC( CUpnpServiceImplementation& aServiceImpl,
       
    63                                                    CUpnpEventController& aEventController,
       
    64                                                    CUpnpSubscriberLibrary* aSubscriberLibrary );
       
    65        
       
    66 /*from MUpnpNotifyTimerObserver*/
       
    67 public:
       
    68     /**
       
    69     * Handles expired messages
       
    70     */
       
    71     void TimerEventL( CUpnpNotifyTimer* aTimer );     
       
    72     
       
    73 
       
    74 private:    
       
    75     /**
       
    76     * Dalays message sending
       
    77     */ 
       
    78     void WaitBeforeSending();
       
    79 
       
    80     /**
       
    81     * Initiates sending process
       
    82     */
       
    83     void StartSendingEventL();
       
    84     
       
    85 private:
       
    86     
       
    87     /**
       
    88     * algoritm implemetation
       
    89     */
       
    90     void SendEvent();
       
    91     
       
    92     /**
       
    93     * algoritm implemetation
       
    94     * @param aEvent buffer for message body
       
    95     * @param aVariableList list of evented variables
       
    96     * @return number of evented variables
       
    97     */
       
    98     TInt FillEventBodyL( TDes8& aEvent, const RPointerArray<CUpnpStateVariable>& aVariableList );
       
    99     
       
   100     /**
       
   101     * Creates event message
       
   102     * @param aMessage will be encapsulete into http transaction
       
   103     * @return Http transcaction with event message
       
   104     */
       
   105     CUpnpHttpTransaction* CreateTransactionL( CUpnpHttpMessage* aMessage ); 
       
   106     
       
   107     
       
   108 private:
       
   109 
       
   110     /**
       
   111     * Constructor for performing 1st stage construction
       
   112     */
       
   113     CUpnpModeratedEventQueueManager( CUpnpServiceImplementation& iServiceImpl,
       
   114                                      CUpnpEventController& iEventController,
       
   115                                      CUpnpSubscriberLibrary* aSubscriberLibrary );
       
   116     /**
       
   117     * Constructor for performing 2st stage construction
       
   118     */    
       
   119     void ConstructL();
       
   120 
       
   121 private:
       
   122     
       
   123     /*Dalayes message sending*/
       
   124     CUpnpNotifyTimer* iModerationTimer; //owned
       
   125     
       
   126     };
       
   127 
       
   128 #endif // C_UPNPMODERATEDEVENTQUEUEMANAGER_H
       
   129 //end of file