mmsengine/mmswatcher/src/mmspollingtimer.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2004-2007 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:  
       
    15 *     This creates an event at regular intervals.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <e32base.h>
       
    23 #include <msvapi.h>
       
    24 #include <msvids.h>
       
    25 
       
    26 #include "mmspollingtimer.h"
       
    27 #include "mmswatcherdebuglogging.h"
       
    28 #include "mmsconst.h"
       
    29 
       
    30 // EXTERNAL DATA STRUCTURES
       
    31 
       
    32 // EXTERNAL FUNCTION PROTOTYPES  
       
    33 
       
    34 // CONSTANTS
       
    35 
       
    36 // MACROS
       
    37 
       
    38 // LOCAL CONSTANTS AND MACROS
       
    39 const TInt KMmsFirstPollingInterval = 5000000; // 5 seconds
       
    40 
       
    41 // MODULE DATA STRUCTURES
       
    42 
       
    43 // LOCAL FUNCTION PROTOTYPES
       
    44 
       
    45 // ==================== LOCAL FUNCTIONS ====================
       
    46 
       
    47 // ================= MEMBER FUNCTIONS =======================
       
    48 
       
    49 // ---------------------------------------------------------
       
    50 // CMmsPollingTimer::CMmsPollingTimer
       
    51 // ---------------------------------------------------------
       
    52 //
       
    53 CMmsPollingTimer::CMmsPollingTimer()
       
    54     :CTimer ( EPriorityStandard )
       
    55     {   
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // CMmsPollingTimer::ConstructL
       
    60 // ---------------------------------------------------------
       
    61 //
       
    62 void CMmsPollingTimer::ConstructL()
       
    63     {
       
    64     CTimer::ConstructL();
       
    65     CActiveScheduler::Add( this );
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------
       
    69 // CMmsPollingTimer::NewL
       
    70 // ---------------------------------------------------------
       
    71 //
       
    72 CMmsPollingTimer* CMmsPollingTimer::NewL()
       
    73     {
       
    74     CMmsPollingTimer* self = new ( ELeave ) CMmsPollingTimer;
       
    75     CleanupStack::PushL( self );
       
    76     self->ConstructL();
       
    77     CleanupStack::Pop( self );
       
    78     return self;
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------
       
    82 // CMmsPollingTimer::~CMmsPollingTimer
       
    83 // ---------------------------------------------------------
       
    84 //
       
    85 CMmsPollingTimer::~CMmsPollingTimer()
       
    86     {
       
    87     Cancel();        
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------
       
    91 // CMmsPollingTimer::Start
       
    92 // ---------------------------------------------------------
       
    93 //
       
    94 void CMmsPollingTimer::Start( MMsvSessionObserver* aRequester, const TInt aTimerValue )
       
    95     {
       
    96     // Store reference to object that will be called back
       
    97     iRequester = (MMsvSessionObserver*) aRequester;
       
    98     // Store timeout value that will be used regularly
       
    99     iTimeout = aTimerValue;
       
   100     // First timeout however will occur after fixed 5 seconds in order to give time for
       
   101     // emulator statup
       
   102     After( KMmsFirstPollingInterval ); 
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------
       
   106 // CMmsPollingTimer::RunL()
       
   107 // ---------------------------------------------------------
       
   108 //
       
   109 void CMmsPollingTimer::RunL()
       
   110     {
       
   111     LOG( _L("CMmsPollingTimer::RunL") );
       
   112     TMsvId tid = KMsvSentEntryId;
       
   113     iRequester->HandleSessionEventL( 
       
   114         MMsvSessionObserver::EMsvEntriesCreated,
       
   115         NULL, 
       
   116         &tid, 
       
   117         NULL );
       
   118     
       
   119     After( iTimeout );
       
   120     }
       
   121 
       
   122 // ---------------------------------------------------------
       
   123 // CMmsPollingTimer::DoCancel()
       
   124 // ---------------------------------------------------------
       
   125 //
       
   126 void CMmsPollingTimer::DoCancel()
       
   127     {
       
   128     LOG( _L("CMmsPollingTimer::DoCancel") );
       
   129     CTimer::DoCancel();
       
   130     }
       
   131 
       
   132 // ================= OTHER EXPORTED FUNCTIONS ==============
       
   133 
       
   134 //  End of File  
       
   135