locationtriggering/ltstrategyengine/src/lbtstatusmanager.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 01:06:48 +0200
changeset 0 667063e416a2
child 13 19bff11d6c18
permissions -rw-r--r--
Revision: 201003 Kit: 201005

/*
* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Implementation of Status Manager
*
*/



#include <e32base.h>
#include <lbtstatuspskeys.h>

#include "lbtstatusmanager.h"


// ======== MEMBER FUNCTIONS ========

// -----------------------------------------------------------------------------
// CLbtStatusManager::NewL
// CLbtStatusManager instantiation method.
// -----------------------------------------------------------------------------
//
CLbtStatusManager* CLbtStatusManager::NewL()
    {
    CLbtStatusManager* self = new ( ELeave ) CLbtStatusManager;
    CleanupStack::PushL( self );
    self->ConstructL();
    CleanupStack::Pop();
    return self;
    }
	

// -----------------------------------------------------------------------------
// CLbtStatusManager::~CLbtStatusManager
// Destructor
// -----------------------------------------------------------------------------
//
CLbtStatusManager::~CLbtStatusManager()
    {
    iStatusInfo.Close();
    }
	
	
// -----------------------------------------------------------------------------
// CLbtStatusManager::ReportLocationAcquisitionStatus
// 
// -----------------------------------------------------------------------------
//
void CLbtStatusManager::ReportLocationAcquisitionStatus( 
                            TAcquisitionStatus aStatus )
    {
    TInt msg;
    if( KErrNone == aStatus )
        {
        msg = iStatusInfo.Set( ELbtLocationTriggeringSupervisionSuccessful );
        }
    else
        {
        msg = iStatusInfo.Set( ELbtLocationTriggeringSupervisionFailed );
        }
        
    iLastLocAcqStatus = aStatus;        
    if( KErrNone != msg )
        {
        // TODO: log error message here
        }
    }


// -----------------------------------------------------------------------------
// CLbtStatusManager::ReportLocationAcquisitionStatus
// 
// -----------------------------------------------------------------------------
//
TBool CLbtStatusManager::LocationAcqSuccess()
    {
    if( KErrNone == iLastLocAcqStatus )
        {
        return ETrue;
        }
    return EFalse;
    }


// -----------------------------------------------------------------------------
// CLbtStatusManager::CLbtStatusManager
// Constructor
// -----------------------------------------------------------------------------
//
CLbtStatusManager::CLbtStatusManager()
    {
    }
	

// -----------------------------------------------------------------------------
// CLbtStatusManager::ConstructL
// 2nd phase constructor
// -----------------------------------------------------------------------------
//
void CLbtStatusManager::ConstructL()
    {
    User::LeaveIfError( iStatusInfo.Attach( 
                KPSUidLbtStatusInformation,
                KLbtLocationTriggeringSupervisionStatus,
                EOwnerThread ) );
    }