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