locationtriggering/ltclientlib/src/lbttriggerfiringeventnotifier.cpp
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 2005 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:  location triggering server client interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32base.h>
       
    21 #include "lbttriggerfiringeventnotifier.h"
       
    22 #include "lbterrors.h"
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 // ================= LOCAL FUNCTIONS ========================
       
    29  
       
    30 // ================= MEMBER FUNCTIONS =======================
       
    31 
       
    32 // ---------------------------------------------------------
       
    33 // CLbtTriggerFiringEventNotifier::CLbtTriggerFiringEventNotifier
       
    34 //
       
    35 // Default constructor
       
    36 // ---------------------------------------------------------
       
    37 //
       
    38 CLbtTriggerFiringEventNotifier::CLbtTriggerFiringEventNotifier(RLbt& aLbt,
       
    39                                 MLbtTriggerFiringEventObserver& aObserver,
       
    40                                 TInt aPriority):CActive(aPriority),
       
    41                                 iLbt(aLbt),iObserver(aObserver)
       
    42     {
       
    43     CActiveScheduler::Add(this);
       
    44     }
       
    45 
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // CLbtTriggerFiringEventNotifier::ConstructL()
       
    49 // Symbian 2nd phase constructor can leave.
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 void CLbtTriggerFiringEventNotifier::ConstructL()
       
    53     {
       
    54     
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // CLbtTriggerFiringEventNotifier::NewL()
       
    59 //
       
    60 // (other items were commented in a header).
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 EXPORT_C CLbtTriggerFiringEventNotifier* CLbtTriggerFiringEventNotifier::NewL(RLbt& aLbt,MLbtTriggerFiringEventObserver& aObserver,
       
    64             TInt aPriority )
       
    65     {
       
    66     __ASSERT_ALWAYS(aLbt.SubSessionHandle(), User::Panic(KLbtClientPanicCategory, ELbtServerBadHandle));
       
    67     CLbtTriggerFiringEventNotifier* self = new (ELeave) CLbtTriggerFiringEventNotifier(aLbt,aObserver,aPriority);
       
    68     CleanupStack::PushL(self);
       
    69     self->ConstructL();
       
    70     CleanupStack::Pop(self);
       
    71     return self;
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // CLbtTriggerFiringEventNotifier::~CLbtTriggerFiringEventNotifier()
       
    76 // Destructor
       
    77 // ---------------------------------------------------------------------------
       
    78 // 
       
    79 EXPORT_C CLbtTriggerFiringEventNotifier::~CLbtTriggerFiringEventNotifier()
       
    80     {
       
    81     if (IsActive())      
       
    82       	Cancel();
       
    83     }
       
    84 
       
    85 
       
    86 // ---------------------------------------------------------
       
    87 // CLbtTriggerFiringEventNotifier::Start
       
    88 //
       
    89 // (other items were commented in a header).
       
    90 // ---------------------------------------------------------
       
    91 //
       
    92 EXPORT_C void CLbtTriggerFiringEventNotifier::Start()
       
    93     {
       
    94     iStatus = KRequestPending;
       
    95 	iLbt.NotifyTriggerFired(iFiringEvent,iStatus);
       
    96 	SetActive();
       
    97     }
       
    98 
       
    99 // ---------------------------------------------------------
       
   100 // CLbtTriggerFiringEventNotifier::RunL
       
   101 //
       
   102 // (other items were commented in a header).
       
   103 // ---------------------------------------------------------
       
   104 //
       
   105 void CLbtTriggerFiringEventNotifier::RunL()
       
   106     {
       
   107     TInt error = iStatus.Int();
       
   108     if( error != KErrCancel )
       
   109         {
       
   110         Start();
       
   111         }
       
   112     if( error == KErrNone )
       
   113         {
       
   114         iObserver.TriggerFiredL(iFiringEvent);
       
   115         }
       
   116     }
       
   117 
       
   118 // ---------------------------------------------------------
       
   119 // CLbtTriggerFiringEventNotifier::RunError
       
   120 //
       
   121 // (other items were commented in a header).
       
   122 // ---------------------------------------------------------
       
   123 //
       
   124 TInt CLbtTriggerFiringEventNotifier::RunError(TInt /*aError*/)
       
   125     {
       
   126     return KErrNone;
       
   127     }
       
   128 
       
   129 // ---------------------------------------------------------
       
   130 // CLbtTriggerFiringEventNotifier::DoCancel
       
   131 //
       
   132 // (other items were commented in a header).
       
   133 // ---------------------------------------------------------
       
   134 //
       
   135 void CLbtTriggerFiringEventNotifier::DoCancel()
       
   136     {
       
   137     iLbt.CancelNotifyTriggerFired();
       
   138     }
       
   139 
       
   140 //  End of File
       
   141