serviceproviders/sapi_landmarks/landmarksservice/src/clandmarkdummyao.cpp
changeset 26 5d0ec8b709be
child 27 02682e02e51f
equal deleted inserted replaced
23:50974a8b132e 26:5d0ec8b709be
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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 the License "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:  CLandmarkCmdGetLandmarks class
       
    15  *
       
    16 */
       
    17 
       
    18 #include <EPos_CPosLandmarkDatabase.h>
       
    19 #include <EPos_CPosLmCategoryManager.h>
       
    20 #include "landmarkservice.h"
       
    21 #include "mlandmarkobserver.h"
       
    22 #include "clandmarkmanageobjects.h"
       
    23 #include "clandmarkdummyao.h"
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CLandmarkDummyAO::CLandmarkDummyAO( CLandmarkManageObjects* aManageObjects )
       
    29 // C++ default constructor can NOT contain any code, that might leave.
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CLandmarkDummyAO::CLandmarkDummyAO(MLandmarkObserver* aObserver,
       
    33 		CLandmarkManageObjects* aManageObjects) :
       
    34 	CActive(EPriorityNormal), iObserver(aObserver), iManageObjects(
       
    35 			aManageObjects)
       
    36 	{
       
    37 	CActiveScheduler::Add(this);
       
    38 	}
       
    39 
       
    40 CLandmarkDummyAO::~CLandmarkDummyAO()
       
    41 	{
       
    42 	Cancel();
       
    43 	}
       
    44 
       
    45 void CLandmarkDummyAO::DoCancel()
       
    46 	{
       
    47 	}
       
    48 
       
    49 void CLandmarkDummyAO::Start(TInt32 aTransactionId,
       
    50 		CLandmarkDummyAO::TCommand aCmd, TPosLmItemId aId,
       
    51 		TInt aError)
       
    52 	{
       
    53 	iTransactionId = aTransactionId;
       
    54 	iCmd = aCmd;
       
    55 	iId = aId;
       
    56 	SetActive();
       
    57 	TRequestStatus* status = &iStatus;
       
    58 	User::RequestComplete(status, aError);
       
    59 	}
       
    60 
       
    61 void CLandmarkDummyAO::RunL()
       
    62 	{
       
    63 	switch(iCmd)
       
    64 	 {
       
    65 	 case EAdd: TRAP_IGNORE(iObserver->HandleAddItemsL(iId,iTransactionId,iStatus.Int()));
       
    66 				break;
       
    67 	 case EUpdate:
       
    68 	 case ERemove: TRAP_IGNORE(iObserver->HandleItemsL(iTransactionId,iStatus.Int()));
       
    69 	 				break;
       
    70 	 default:
       
    71 		 break;
       
    72 	 }
       
    73 	
       
    74 	if (!iManageObjects->IsActive())
       
    75 		{
       
    76 		iManageObjects->Start();
       
    77 		}
       
    78 	}
       
    79