locationtriggering/ltstrategyengine/src/lbtstatusmanager.cpp
author hgs
Wed, 03 Nov 2010 23:28:39 +0530
changeset 56 4e949f03ecc5
permissions -rw-r--r--
201044
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
56
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:  Implementation of Status Manager
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
#include <e32base.h>
hgs
parents:
diff changeset
    21
#include <lbtstatuspskeys.h>
hgs
parents:
diff changeset
    22
#include "lbtstatusmanager.h"
hgs
parents:
diff changeset
    23
#include "lbtlogger.h"
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
// ======== MEMBER FUNCTIONS ========
hgs
parents:
diff changeset
    26
hgs
parents:
diff changeset
    27
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    28
// CLbtStatusManager::NewL
hgs
parents:
diff changeset
    29
// CLbtStatusManager instantiation method.
hgs
parents:
diff changeset
    30
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    31
//
hgs
parents:
diff changeset
    32
CLbtStatusManager* CLbtStatusManager::NewL()
hgs
parents:
diff changeset
    33
    {
hgs
parents:
diff changeset
    34
    CLbtStatusManager* self = new ( ELeave ) CLbtStatusManager;
hgs
parents:
diff changeset
    35
    CleanupStack::PushL( self );
hgs
parents:
diff changeset
    36
    self->ConstructL();
hgs
parents:
diff changeset
    37
    CleanupStack::Pop();
hgs
parents:
diff changeset
    38
    return self;
hgs
parents:
diff changeset
    39
    }
hgs
parents:
diff changeset
    40
	
hgs
parents:
diff changeset
    41
hgs
parents:
diff changeset
    42
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    43
// CLbtStatusManager::~CLbtStatusManager
hgs
parents:
diff changeset
    44
// Destructor
hgs
parents:
diff changeset
    45
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    46
//
hgs
parents:
diff changeset
    47
CLbtStatusManager::~CLbtStatusManager()
hgs
parents:
diff changeset
    48
    {
hgs
parents:
diff changeset
    49
    iStatusInfo.Close();
hgs
parents:
diff changeset
    50
    }
hgs
parents:
diff changeset
    51
	
hgs
parents:
diff changeset
    52
	
hgs
parents:
diff changeset
    53
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    54
// CLbtStatusManager::ReportLocationAcquisitionStatus
hgs
parents:
diff changeset
    55
// 
hgs
parents:
diff changeset
    56
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    57
//
hgs
parents:
diff changeset
    58
void CLbtStatusManager::ReportLocationAcquisitionStatus( 
hgs
parents:
diff changeset
    59
                            TAcquisitionStatus aStatus )
hgs
parents:
diff changeset
    60
    {
hgs
parents:
diff changeset
    61
    TInt msg;
hgs
parents:
diff changeset
    62
    if( KErrNone == aStatus )
hgs
parents:
diff changeset
    63
        {
hgs
parents:
diff changeset
    64
        msg = iStatusInfo.Set( ELbtLocationTriggeringSupervisionSuccessful );
hgs
parents:
diff changeset
    65
        }
hgs
parents:
diff changeset
    66
    else
hgs
parents:
diff changeset
    67
        {
hgs
parents:
diff changeset
    68
        msg = iStatusInfo.Set( ELbtLocationTriggeringSupervisionFailed );
hgs
parents:
diff changeset
    69
        }
hgs
parents:
diff changeset
    70
        
hgs
parents:
diff changeset
    71
    iLastLocAcqStatus = aStatus;        
hgs
parents:
diff changeset
    72
    if( KErrNone != msg )
hgs
parents:
diff changeset
    73
        {
hgs
parents:
diff changeset
    74
        LOG1("Error updating status info:%d",msg);
hgs
parents:
diff changeset
    75
        }
hgs
parents:
diff changeset
    76
    }
hgs
parents:
diff changeset
    77
hgs
parents:
diff changeset
    78
hgs
parents:
diff changeset
    79
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    80
// CLbtStatusManager::ReportLocationAcquisitionStatus
hgs
parents:
diff changeset
    81
// 
hgs
parents:
diff changeset
    82
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    83
//
hgs
parents:
diff changeset
    84
TBool CLbtStatusManager::LocationAcqSuccess()
hgs
parents:
diff changeset
    85
    {
hgs
parents:
diff changeset
    86
    if( KErrNone == iLastLocAcqStatus )
hgs
parents:
diff changeset
    87
        {
hgs
parents:
diff changeset
    88
        return ETrue;
hgs
parents:
diff changeset
    89
        }
hgs
parents:
diff changeset
    90
    return EFalse;
hgs
parents:
diff changeset
    91
    }
hgs
parents:
diff changeset
    92
hgs
parents:
diff changeset
    93
hgs
parents:
diff changeset
    94
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    95
// CLbtStatusManager::CLbtStatusManager
hgs
parents:
diff changeset
    96
// Constructor
hgs
parents:
diff changeset
    97
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    98
//
hgs
parents:
diff changeset
    99
CLbtStatusManager::CLbtStatusManager()
hgs
parents:
diff changeset
   100
    {
hgs
parents:
diff changeset
   101
    }
hgs
parents:
diff changeset
   102
	
hgs
parents:
diff changeset
   103
hgs
parents:
diff changeset
   104
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   105
// CLbtStatusManager::ConstructL
hgs
parents:
diff changeset
   106
// 2nd phase constructor
hgs
parents:
diff changeset
   107
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   108
//
hgs
parents:
diff changeset
   109
void CLbtStatusManager::ConstructL()
hgs
parents:
diff changeset
   110
    {
hgs
parents:
diff changeset
   111
    User::LeaveIfError( iStatusInfo.Attach( 
hgs
parents:
diff changeset
   112
                KPSUidLbtStatusInformation,
hgs
parents:
diff changeset
   113
                KLbtLocationTriggeringSupervisionStatus,
hgs
parents:
diff changeset
   114
                EOwnerThread ) );
hgs
parents:
diff changeset
   115
    }