contentstorage/casrv/casatmonitor/src/casatnotifier.cpp
author hgs
Fri, 28 May 2010 16:17:03 +0300
changeset 96 5d243a69bdda
parent 85 7feec50967db
child 98 d2f833ab7940
permissions -rw-r--r--
201021
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
7feec50967db 201003_02
hgs
parents:
diff changeset
     1
/*
7feec50967db 201003_02
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
7feec50967db 201003_02
hgs
parents:
diff changeset
     3
* All rights reserved.
7feec50967db 201003_02
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
7feec50967db 201003_02
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
7feec50967db 201003_02
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
7feec50967db 201003_02
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
7feec50967db 201003_02
hgs
parents:
diff changeset
     8
*
7feec50967db 201003_02
hgs
parents:
diff changeset
     9
* Initial Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
7feec50967db 201003_02
hgs
parents:
diff changeset
    11
*
7feec50967db 201003_02
hgs
parents:
diff changeset
    12
* Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    13
*
7feec50967db 201003_02
hgs
parents:
diff changeset
    14
* Description: casatnotifier.cpp
7feec50967db 201003_02
hgs
parents:
diff changeset
    15
*
7feec50967db 201003_02
hgs
parents:
diff changeset
    16
*/
7feec50967db 201003_02
hgs
parents:
diff changeset
    17
7feec50967db 201003_02
hgs
parents:
diff changeset
    18
#include "casatnotifier.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    19
7feec50967db 201003_02
hgs
parents:
diff changeset
    20
// ============================ MEMBER FUNCTIONS =============================
7feec50967db 201003_02
hgs
parents:
diff changeset
    21
// -----------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    22
// CCaSatNotifier::CCaSatNotifier
7feec50967db 201003_02
hgs
parents:
diff changeset
    23
// C++ default constructor
7feec50967db 201003_02
hgs
parents:
diff changeset
    24
// -----------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    25
//
7feec50967db 201003_02
hgs
parents:
diff changeset
    26
CCaSatNotifier::CCaSatNotifier( MCaSatNotifierCallback* aCallback,
7feec50967db 201003_02
hgs
parents:
diff changeset
    27
        TUid aCategory, TUint aKey ) :
7feec50967db 201003_02
hgs
parents:
diff changeset
    28
    CActive( EPriorityNormal )
7feec50967db 201003_02
hgs
parents:
diff changeset
    29
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    30
    CActiveScheduler::Add( this );
7feec50967db 201003_02
hgs
parents:
diff changeset
    31
7feec50967db 201003_02
hgs
parents:
diff changeset
    32
    iCallback = aCallback;
7feec50967db 201003_02
hgs
parents:
diff changeset
    33
    iCategory = aCategory;
7feec50967db 201003_02
hgs
parents:
diff changeset
    34
    iKey = aKey;
7feec50967db 201003_02
hgs
parents:
diff changeset
    35
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    36
7feec50967db 201003_02
hgs
parents:
diff changeset
    37
// -----------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    38
// CCaSatNotifier::ConstructL
7feec50967db 201003_02
hgs
parents:
diff changeset
    39
// S2nd phase constructor.
7feec50967db 201003_02
hgs
parents:
diff changeset
    40
// -----------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    41
//
7feec50967db 201003_02
hgs
parents:
diff changeset
    42
void CCaSatNotifier::ConstructL()
7feec50967db 201003_02
hgs
parents:
diff changeset
    43
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    44
    // Prepare automatically
7feec50967db 201003_02
hgs
parents:
diff changeset
    45
    iProperty.Attach( iCategory, iKey );
7feec50967db 201003_02
hgs
parents:
diff changeset
    46
    SetActive();
7feec50967db 201003_02
hgs
parents:
diff changeset
    47
    iStatus = KRequestPending;
7feec50967db 201003_02
hgs
parents:
diff changeset
    48
    iProperty.Subscribe( iStatus );
7feec50967db 201003_02
hgs
parents:
diff changeset
    49
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    50
7feec50967db 201003_02
hgs
parents:
diff changeset
    51
// ---------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    52
// CCaSatNotifier::NewLC
7feec50967db 201003_02
hgs
parents:
diff changeset
    53
// ---------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    54
//
7feec50967db 201003_02
hgs
parents:
diff changeset
    55
CCaSatNotifier* CCaSatNotifier::NewLC(
7feec50967db 201003_02
hgs
parents:
diff changeset
    56
        MCaSatNotifierCallback* aCallback, TUid aCategory, TUint aKey )
7feec50967db 201003_02
hgs
parents:
diff changeset
    57
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    58
    CCaSatNotifier* self = new ( ELeave ) CCaSatNotifier( aCallback,
7feec50967db 201003_02
hgs
parents:
diff changeset
    59
            aCategory, aKey );
7feec50967db 201003_02
hgs
parents:
diff changeset
    60
    CleanupStack::PushL( self );
7feec50967db 201003_02
hgs
parents:
diff changeset
    61
    self->ConstructL();
7feec50967db 201003_02
hgs
parents:
diff changeset
    62
7feec50967db 201003_02
hgs
parents:
diff changeset
    63
    return self;
7feec50967db 201003_02
hgs
parents:
diff changeset
    64
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    65
7feec50967db 201003_02
hgs
parents:
diff changeset
    66
// ---------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    67
// CCaSatNotifier::NewL
7feec50967db 201003_02
hgs
parents:
diff changeset
    68
// ---------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    69
//
7feec50967db 201003_02
hgs
parents:
diff changeset
    70
CCaSatNotifier* CCaSatNotifier::NewL(
7feec50967db 201003_02
hgs
parents:
diff changeset
    71
        MCaSatNotifierCallback* aCallback, TUid aCategory, TUint aKey )
7feec50967db 201003_02
hgs
parents:
diff changeset
    72
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    73
    CCaSatNotifier* self = CCaSatNotifier::NewLC( aCallback, aCategory,
7feec50967db 201003_02
hgs
parents:
diff changeset
    74
            aKey );
7feec50967db 201003_02
hgs
parents:
diff changeset
    75
    CleanupStack::Pop();//self
7feec50967db 201003_02
hgs
parents:
diff changeset
    76
    return self;
7feec50967db 201003_02
hgs
parents:
diff changeset
    77
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    78
7feec50967db 201003_02
hgs
parents:
diff changeset
    79
// ---------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    80
// CCaSatNotifier::~CCaSatNotifier
7feec50967db 201003_02
hgs
parents:
diff changeset
    81
// ---------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    82
//
7feec50967db 201003_02
hgs
parents:
diff changeset
    83
7feec50967db 201003_02
hgs
parents:
diff changeset
    84
CCaSatNotifier::~CCaSatNotifier()
7feec50967db 201003_02
hgs
parents:
diff changeset
    85
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    86
    Cancel();
7feec50967db 201003_02
hgs
parents:
diff changeset
    87
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    88
7feec50967db 201003_02
hgs
parents:
diff changeset
    89
// ---------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    90
// CCaSatNotifier::DoCancel
7feec50967db 201003_02
hgs
parents:
diff changeset
    91
// ---------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    92
//
7feec50967db 201003_02
hgs
parents:
diff changeset
    93
void CCaSatNotifier::DoCancel()
7feec50967db 201003_02
hgs
parents:
diff changeset
    94
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    95
    iProperty.Cancel();
7feec50967db 201003_02
hgs
parents:
diff changeset
    96
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    97
7feec50967db 201003_02
hgs
parents:
diff changeset
    98
// ---------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    99
// CCaSatNotifier::RunError
7feec50967db 201003_02
hgs
parents:
diff changeset
   100
// ---------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
   101
//
7feec50967db 201003_02
hgs
parents:
diff changeset
   102
TInt CCaSatNotifier::RunError( TInt /*aError*/)
7feec50967db 201003_02
hgs
parents:
diff changeset
   103
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
   104
    return KErrNone;
7feec50967db 201003_02
hgs
parents:
diff changeset
   105
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   106
7feec50967db 201003_02
hgs
parents:
diff changeset
   107
// ---------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
   108
// CCaSatNotifier::RunL
7feec50967db 201003_02
hgs
parents:
diff changeset
   109
// ---------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
   110
//
7feec50967db 201003_02
hgs
parents:
diff changeset
   111
void CCaSatNotifier::RunL()
7feec50967db 201003_02
hgs
parents:
diff changeset
   112
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
   113
    // Filter out cancel status
7feec50967db 201003_02
hgs
parents:
diff changeset
   114
    if( iStatus != KErrCancel )
7feec50967db 201003_02
hgs
parents:
diff changeset
   115
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
   116
        // Re-issue request before notifying
7feec50967db 201003_02
hgs
parents:
diff changeset
   117
        SetActive();
7feec50967db 201003_02
hgs
parents:
diff changeset
   118
        iStatus = KRequestPending;
7feec50967db 201003_02
hgs
parents:
diff changeset
   119
        iProperty.Subscribe( iStatus );
7feec50967db 201003_02
hgs
parents:
diff changeset
   120
        iCallback->SatChangeL();
7feec50967db 201003_02
hgs
parents:
diff changeset
   121
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   122
    else
7feec50967db 201003_02
hgs
parents:
diff changeset
   123
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
   124
        // For PC-Lint
7feec50967db 201003_02
hgs
parents:
diff changeset
   125
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   126
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   127
// End of File