locationtriggering/ltcontainer/src/lbtcreateasyncoperation.cpp
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 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 "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:  This file defines the container trigger entry class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <lbttriggerdynamicinfo.h>
       
    20 #include "lbtcreateasyncoperation.h"
       
    21 #include <lbtsessiontrigger.h>
       
    22 #include <lbtstartuptrigger.h>
       
    23 #include <lbttriggerentry.h>
       
    24 #include <lbttriggerconditionbase.h>
       
    25 #include <lbttriggerconditionarea.h>
       
    26 #include <lbtgeoareabase.h>
       
    27 #include <lbtgeocircle.h>
       
    28 #include <lbtgeorect.h>
       
    29 #include "lbtcontainertriggerentry.h"
       
    30 #include "lbtlogger.h"
       
    31 
       
    32 // ======== MEMBER FUNCTIONS ========
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // CLbtCreateAsyncOperation::NewL(
       
    36 //    CLbtTriggerEntry* aEntry,
       
    37 //    TLbtTriggerDynamicInfo* aDynInfo,
       
    38 //    TLbtDerivedTriggerInfo* aDerivedInfo)
       
    39 //
       
    40 // (other items were commented in a header).
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 CLbtCreateAsyncOperation* CLbtCreateAsyncOperation::NewL(CLbtContainerTriggerEntry* aEntry,TRequestStatus& aClientStatus)
       
    44     {
       
    45     CLbtCreateAsyncOperation* self=new( ELeave ) CLbtCreateAsyncOperation;
       
    46 	CleanupStack::PushL( self );
       
    47     self->ConstructL(aEntry,aClientStatus);
       
    48     CleanupStack::Pop( self ); 
       
    49     return self;
       
    50     }    
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // CLbtCreateAsyncOperation::StartAOOperationL
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 void CLbtCreateAsyncOperation::StartAOOperationL(MLbtTriggerStore* aStore,TRequestStatus &aStatus)
       
    57     {
       
    58     FUNC_ENTER("CLbtCreateAsyncOperation::StartAOOperationL");
       
    59     aStatus = KRequestPending;
       
    60     CLbtTriggerEntry* trigger = iEntry->TriggerEntry();
       
    61 	if ( aStore->SupportedTriggerTypes() & trigger->Type() )
       
    62 		{
       
    63 		TRAPD(error, aStore->CreateTriggerL(*iEntry,aStatus));
       
    64 		
       
    65 		if(error != KErrNone && aStatus == KRequestPending)
       
    66 			{
       
    67 			TRequestStatus* status = &aStatus;
       
    68 			User::RequestComplete(status, error);
       
    69 			}
       
    70 		}
       
    71 	else 
       
    72 		{
       
    73 		TRequestStatus *status = &aStatus;
       
    74 		User::RequestComplete(status, KErrNotFound); 
       
    75 		}           
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // CLbtCreateAsyncOperation::ConstructL
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 void CLbtCreateAsyncOperation::ConstructL( CLbtContainerTriggerEntry* aEntry,TRequestStatus& aClientStatus)  
       
    83     {
       
    84 	iEntry = aEntry;  
       
    85     iClientStatus = &aClientStatus;    
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CLbtCreateAsyncOperation::TriggerEntry
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 const CLbtContainerTriggerEntry* CLbtCreateAsyncOperation::ContainerTriggerEntry()
       
    93 	{
       
    94 	return iEntry;
       
    95 	}
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CLbtCreateAsyncOperation::GetStatus
       
    99 // ---------------------------------------------------------------------------
       
   100 //	
       
   101 TRequestStatus* CLbtCreateAsyncOperation::GetStatus()
       
   102     {
       
   103     return iClientStatus;
       
   104     }
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // CLbtCreateAsyncOperation::~CLbtCreateAsyncOperation()
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110  CLbtCreateAsyncOperation::~CLbtCreateAsyncOperation()
       
   111     {
       
   112    
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------------------------
       
   116 // CLbtCreateAsyncOperation::GetAOOperationType
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 TContainerAOOperation CLbtCreateAsyncOperation::GetAOOperationType()
       
   120 	{
       
   121 	return EOpCreateTrigger;
       
   122 	}
       
   123 
       
   124 // ---------------------------------------------------------------------------
       
   125 // Constructor
       
   126 // ---------------------------------------------------------------------------
       
   127 //
       
   128 CLbtCreateAsyncOperation::CLbtCreateAsyncOperation()
       
   129     {   
       
   130 
       
   131     }
       
   132 
       
   133 // end of file
       
   134