lbs/common/inc/LbsLogWriterEngine.h
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 /**
       
     2 * Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file
       
    24  @internalTechnology
       
    25  @released
       
    26 */
       
    27 
       
    28 #ifndef LBS_LOG_WRITER_ENGINE_H
       
    29 #define LBS_LOG_WRITER_ENGINE_H
       
    30 
       
    31 #include <e32base.h>
       
    32 #include <lbslogevent.h>
       
    33 
       
    34 enum TLbsLogEventType
       
    35 /**
       
    36  enum for type of LbsLogging event handled by Lbs Logging Engine	
       
    37 */
       
    38 	{
       
    39 	ELbsLogNoEvent = 0,
       
    40 	ELbsLogAddEvent,
       
    41 	ELbsLogUpdateEvent
       
    42 	};
       
    43 	
       
    44 	
       
    45 typedef TUint32 TLbsLogWriterEventTypeGroup;
       
    46 
       
    47 enum TLbsLogWriterEventTypes
       
    48 	{
       
    49 	ELbsNoEventType = 				0x00000000,
       
    50 	ELbsSelfLocateEventType = 		0x00000001,
       
    51 	ELbsExternalLocateEventType = 	0x00000002,
       
    52 	ELbsTransmitLocationEventType = 0x00000004,
       
    53 	ELbsNetworkLocateEventType = 	0x00000008,
       
    54 	ELbsAssistanceDataEventType = 	0x00000010
       
    55 	};
       
    56 	
       
    57 class CLbsLogWriterEngine : public CActive
       
    58 /**
       
    59  Active class which does the logging of LBS events. When it receives a new event, 
       
    60  if it isn't processing anything it starts logging that event, otherwise it elaves it 
       
    61  on a waiting queue.
       
    62  
       
    63 */
       
    64 	{
       
    65 public:
       
    66 	static CLbsLogWriterEngine* NewL(TUint aMaxBufferSize);
       
    67 	~CLbsLogWriterEngine();
       
    68 	
       
    69 	TInt AddEventL(CLbsLogEvent& aLogEvent);
       
    70 	TInt UpdateEventL(CLbsLogEvent& aLogEvent);
       
    71 	// Start to log the event request asyn
       
    72 	TInt StartAddingEventType(CLogEventType& aType);
       
    73 	
       
    74 private:
       
    75 	CLbsLogWriterEngine(TUint aMaxBufferSize);
       
    76 	void ConstructL();
       
    77 
       
    78 	// Start to log the event request asyn
       
    79 	void StartLoggingEventL(CLbsLogEvent& aLogEvent);
       
    80 	void InitialiseLogEventTypeL(CLbsLogEvent& aLogEvent);
       
    81 	void AddLogEventToQueueL(CLbsLogEvent& aLogEvent);
       
    82 	
       
    83 private: // from CActive
       
    84 	void RunL();
       
    85 	void DoCancel();
       
    86 	TInt RunError(TInt aError);
       
    87 
       
    88 private:
       
    89 	/** The maximum numer of events that can be queued */
       
    90 	TUint 							iMaxBufferSize;
       
    91 	/** Flag indicating if there is an ID available of the last logged event */
       
    92 	TBool 							iLastLogIdAvailable;
       
    93 	/** The ID of the last logged event */
       
    94 	TLogId 							iLastLogId;
       
    95 	/** The array with the queued events */
       
    96 	RPointerArray<CLbsLogEvent> 	iLogEvents;
       
    97 	/** The array with the queued event types */
       
    98 	RArray<TLbsLogEventType>		iLogEventTypes;
       
    99 	/** Current processing event type */
       
   100 	TLbsLogEventType				iLastLogEventType;
       
   101 	/** Bitmask listing which event types have already been added */
       
   102 	TLbsLogWriterEventTypeGroup		iInitLogEventTypes;
       
   103 	/** The event type currently being logged */
       
   104 	CLogEventType* 					iEventTypeBeingLogged; 
       
   105 	/** Flag indicating if an event type is currently being added */
       
   106 	TBool 							iLogEventTypeInit;
       
   107 	/** The event that is being logged now */
       
   108 	CLogEvent* 						iEventBeingLogged;
       
   109 
       
   110 	/***/
       
   111 	TBool							iLoggingType;
       
   112 	/** Handle to the db file file sesstion */
       
   113 	RFs 							iFs;
       
   114 	/** CLogClient handler */
       
   115 	CLogClient* 					iClient;	
       
   116 	
       
   117 
       
   118 	
       
   119 __DECLARE_TEST; // Declaration for the invariant
       
   120 	}; // class CLbsLogWriterEngine
       
   121 
       
   122 #endif // LBS_LOG_WRITER_ENGINE_H