contentstorage/casrv/casatmonitor/src/casatnotifier.cpp
changeset 60 f62f87b200ec
child 98 d2f833ab7940
equal deleted inserted replaced
4:1a2a00e78665 60:f62f87b200ec
       
     1 /*
       
     2 * Copyright (c) 2009 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: casatnotifier.cpp
       
    15 *
       
    16 */
       
    17 
       
    18 #include "casatnotifier.h"
       
    19 
       
    20 // ============================ MEMBER FUNCTIONS =============================
       
    21 // -----------------------------------------------------------------------------
       
    22 // CCaSatNotifier::CCaSatNotifier
       
    23 // C++ default constructor
       
    24 // -----------------------------------------------------------------------------
       
    25 //
       
    26 CCaSatNotifier::CCaSatNotifier( MCaSatNotifierCallback* aCallback,
       
    27         TUid aCategory, TUint aKey ) :
       
    28     CActive( EPriorityNormal )
       
    29     {
       
    30     CActiveScheduler::Add( this );
       
    31 
       
    32     iCallback = aCallback;
       
    33     iCategory = aCategory;
       
    34     iKey = aKey;
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CCaSatNotifier::ConstructL
       
    39 // S2nd phase constructor.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 void CCaSatNotifier::ConstructL()
       
    43     {
       
    44     // Prepare automatically
       
    45     iProperty.Attach( iCategory, iKey );
       
    46     SetActive();
       
    47     iStatus = KRequestPending;
       
    48     iProperty.Subscribe( iStatus );
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // CCaSatNotifier::NewLC
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 CCaSatNotifier* CCaSatNotifier::NewLC(
       
    56         MCaSatNotifierCallback* aCallback, TUid aCategory, TUint aKey )
       
    57     {
       
    58     CCaSatNotifier* self = new ( ELeave ) CCaSatNotifier( aCallback,
       
    59             aCategory, aKey );
       
    60     CleanupStack::PushL( self );
       
    61     self->ConstructL();
       
    62 
       
    63     return self;
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // CCaSatNotifier::NewL
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 CCaSatNotifier* CCaSatNotifier::NewL(
       
    71         MCaSatNotifierCallback* aCallback, TUid aCategory, TUint aKey )
       
    72     {
       
    73     CCaSatNotifier* self = CCaSatNotifier::NewLC( aCallback, aCategory,
       
    74             aKey );
       
    75     CleanupStack::Pop();//self
       
    76     return self;
       
    77     }
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // CCaSatNotifier::~CCaSatNotifier
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 
       
    84 CCaSatNotifier::~CCaSatNotifier()
       
    85     {
       
    86     Cancel();
       
    87     }
       
    88 
       
    89 // ---------------------------------------------------------------------------
       
    90 // CCaSatNotifier::DoCancel
       
    91 // ---------------------------------------------------------------------------
       
    92 //
       
    93 void CCaSatNotifier::DoCancel()
       
    94     {
       
    95     iProperty.Cancel();
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // CCaSatNotifier::RunError
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 TInt CCaSatNotifier::RunError( TInt /*aError*/)
       
   103     {
       
   104     return KErrNone;
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // CCaSatNotifier::RunL
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 void CCaSatNotifier::RunL()
       
   112     {
       
   113     // Filter out cancel status
       
   114     if( iStatus != KErrCancel )
       
   115         {
       
   116         // Re-issue request before notifying
       
   117         SetActive();
       
   118         iStatus = KRequestPending;
       
   119         iProperty.Subscribe( iStatus );
       
   120         iCallback->SatChangeL();
       
   121         }
       
   122     else
       
   123         {
       
   124         // For PC-Lint
       
   125         }
       
   126     }
       
   127 // End of File