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