williamr@2: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // CLogEvent williamr@2: // williamr@2: // williamr@2: williamr@2: inline TLogId CLogEvent::Id() const williamr@2: /** Gets the unique event ID associated with this log event. williamr@2: williamr@2: Unique event IDs are allocated by the Log Engine when an event is added to williamr@2: the log. williamr@2: williamr@2: @return The unique event ID. williamr@2: @see CLogClient::GetEvent() williamr@2: @see CLogClient::AddEvent() williamr@2: @see CLogClient::ChangeEvent() williamr@2: @see CLogClient::DeleteEvent() */ williamr@2: { williamr@2: return iId; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetId(TLogId aId) williamr@2: /** Sets the unique event ID. williamr@2: williamr@2: @param aId The unique event ID. */ williamr@2: { williamr@2: iId = aId; williamr@2: } williamr@2: williamr@2: inline TUid CLogEvent::EventType() const williamr@2: /** Gets the type of this log event. Event types are identified by a UID. williamr@2: williamr@2: @return The event type UID. williamr@2: @see CLogEvent::Description() */ williamr@2: { williamr@2: return iEventType; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetEventType(TUid aId) williamr@2: /** Sets the type of this log event. Event types are identified by a UID. williamr@2: williamr@2: @param aId The event type UID. williamr@2: @see CLogEvent::Description() */ williamr@2: { williamr@2: iEventType = aId; williamr@2: } williamr@2: williamr@2: inline const TDesC& CLogEvent::RemoteParty() const williamr@2: /** Gets the remote party associated with this event. williamr@2: williamr@2: @return A reference to a non-modifiable descriptor containing the remote party. */ williamr@2: { williamr@2: return *iRemoteParty; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetRemoteParty(const TDesC& aRemote) williamr@2: /** Sets the remote party associated with this event. This describes the destination williamr@2: of an outgoing event or the source of an incoming event. williamr@2: williamr@2: The remote party is represented by a string. williamr@2: williamr@2: The string is copied into a pre-allocated heap descriptor that has a maximum williamr@2: length of KLogMaxRemoteLength. If the length of the specified descriptor is williamr@2: greater than KLogMaxRemoteLength, then the data is truncated. williamr@2: williamr@2: @param aRemote The remote party. */ williamr@2: { williamr@2: TPtr ptr(iRemoteParty->Des()); williamr@2: iRemoteParty->Des().Copy(aRemote.Ptr(), Min(aRemote.Length(), ptr.MaxLength())); williamr@2: } williamr@2: williamr@2: inline const TDesC& CLogEvent::Direction() const williamr@2: /** Gets the direction of the call represented by this event. The direction of williamr@2: a call means incoming, outgoing etc. williamr@2: williamr@2: The direction is represented by a string. williamr@2: williamr@2: @return A reference to a non-modifiable descriptor containing the string representing williamr@2: the direction of the call. */ williamr@2: { williamr@2: return *iDirection; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetDirection(const TDesC& aDirection) williamr@2: /** Sets the direction of the call represented by this event. The direction of williamr@2: a call means incoming, outgoing etc. williamr@2: williamr@2: The direction is represented by a string. Standard strings are available in williamr@2: the log wrapper resource file and can be accessed through the resource IDs: williamr@2: R_LOG_DIR_IN, R_LOG_DIR_OUT, R_LOG_DIR_IN_ALT, R_LOG_DIR_OUT_ALT, R_LOG_DIR_FETCHED williamr@2: and R_LOG_DIR_MISSED. williamr@2: williamr@2: The string is copied into a pre-allocated heap descriptor that has a maximum williamr@2: length of KLogMaxDirectionLength. If the length of the specified descriptor williamr@2: is greater than KLogMaxDirectionLength, then the data is truncated. williamr@2: williamr@2: @param aDirection The readable name. williamr@2: @see CLogClient::GetString() */ williamr@2: { williamr@2: TPtr ptr(iDirection->Des()); williamr@2: ptr.Copy(aDirection.Ptr(), Min(aDirection.Length(), ptr.MaxLength())); williamr@2: } williamr@2: williamr@2: inline const TTime& CLogEvent::Time() const williamr@2: /** Gets the UTC time that this event was created. williamr@2: williamr@2: @return The time of the event. */ williamr@2: { williamr@2: return iTime; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetTime(const TTime& aTime) williamr@2: /** Sets the UTC time that this event was created. williamr@2: williamr@2: Note that this field is used when ordering events in a view; changing this williamr@2: value may change the position of the event in a view. williamr@2: williamr@2: @param aTime The UTC time of the event. */ williamr@2: { williamr@2: iTime = aTime; williamr@2: } williamr@2: williamr@2: inline TLogDurationType CLogEvent::DurationType() const williamr@2: /** Gets the duration type. williamr@2: williamr@2: This applies meaning to the idea of a duration. williamr@2: williamr@2: The duration type is implemented as a UI variant-specific enumeration. The williamr@2: following duration types are generic: KLogDurationNone, KLogDurationValid williamr@2: and KLogDurationData. williamr@2: williamr@2: @return The duration type. */ williamr@2: { williamr@2: return iDurationType; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetDurationType(TLogDurationType aDurationType) williamr@2: /** Sets the duration type. This applies meaning to the idea of a duration. williamr@2: williamr@2: @param aDurationType The duration type. */ williamr@2: { williamr@2: iDurationType = aDurationType; williamr@2: } williamr@2: williamr@2: inline TLogDuration CLogEvent::Duration() const williamr@2: /** Gets the duration of the event. williamr@2: williamr@2: @return The duration of the event, expressed as the number of seconds since williamr@2: the time of the event. */ williamr@2: { williamr@2: return iDuration; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetDuration(TLogDuration aDuration) williamr@2: /** Sets the duration of the event. williamr@2: williamr@2: @param aDuration The duration of the event, expressed as the number of seconds williamr@2: since the time of the event. */ williamr@2: { williamr@2: iDuration = aDuration; williamr@2: } williamr@2: williamr@2: inline const TDesC& CLogEvent::Status() const williamr@2: /** Gets the delivery status of this event. williamr@2: williamr@2: @return A reference to a non-modifiable descriptor containing the delivery williamr@2: status. */ williamr@2: { williamr@2: return *iStatus; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetStatus(const TDesC& aStatus) williamr@2: /** Sets the delivery status of this event. williamr@2: williamr@2: The delivery status is represented by a string. Standard strings are available williamr@2: in the log wrapper resource file and can be accessed through the resource williamr@2: IDs: R_LOG_DEL_PENDING, R_LOG_DEL_SENT, R_LOG_DEL_FAILED, R_LOG_DEL_NONE, williamr@2: R_LOG_DEL_DONE and R_LOG_DEL_NOT_SENT. williamr@2: williamr@2: The string is copied into a pre-allocated heap descriptor that has a maximum williamr@2: length of KLogMaxStatusLength. If the length of the specified descriptor is williamr@2: greater than KLogMaxStatusLength, then the data is truncated. williamr@2: williamr@2: @param aStatus The delivery status. williamr@2: @see CLogClient::GetString() */ williamr@2: { williamr@2: TPtr ptr(iStatus->Des()); williamr@2: ptr.Copy(aStatus.Ptr(), Min(aStatus.Length(), ptr.MaxLength())); williamr@2: } williamr@2: williamr@2: inline const TDesC& CLogEvent::Subject() const williamr@2: /** Gets the subject of this event. williamr@2: williamr@2: @return A reference to a non-modifiable descriptor containing the subject. */ williamr@2: { williamr@2: return *iSubject; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetSubject(const TDesC& aSubject) williamr@2: /** Sets the subject of this event. williamr@2: williamr@2: The subject is represented by a string. williamr@2: williamr@2: The string is copied into a pre-allocated heap descriptor that has a maximum williamr@2: length of KLogMaxSubjectLength. If the length of the specified descriptor williamr@2: is greater than KLogMaxSubjectLength, then the data is truncated. williamr@2: williamr@2: @param aSubject The subject. */ williamr@2: { williamr@2: TPtr ptr(iSubject->Des()); williamr@2: ptr.Copy(aSubject.Ptr(), Min(aSubject.Length(), ptr.MaxLength())); williamr@2: } williamr@2: williamr@2: inline const TDesC& CLogEvent::Number() const williamr@2: /** Gets the phone number associated with the event. williamr@2: williamr@2: @return A reference to a non-modifiable descriptor containing the phone number. */ williamr@2: { williamr@2: return *iNumber; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetNumber(const TDesC& aNumber) williamr@2: /** Sets the phone number associated with this event. This is used when the number williamr@2: cannot be stored in any other field. williamr@2: williamr@2: The number is specified as a string and is copied into a pre-allocated heap williamr@2: descriptor that has a maximum length of KLogMaxNumberLength. If the length williamr@2: of the specified descriptor is greater than KLogMaxNumberLength, then the williamr@2: number is truncated. williamr@2: williamr@2: @param aNumber The number. */ williamr@2: { williamr@2: TPtr ptr(iNumber->Des()); williamr@2: ptr.Copy(aNumber.Ptr(), Min(aNumber.Length(), ptr.MaxLength())); williamr@2: } williamr@2: williamr@2: inline TLogContactItemId CLogEvent::Contact() const williamr@2: /** Gets the contact ID associated with the event. williamr@2: williamr@2: @return The contact ID. */ williamr@2: { williamr@2: return iContact; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetContact(TLogContactItemId aContact) williamr@2: /** Sets the contact ID associated with the event. williamr@2: williamr@2: @param aContact The contact ID. */ williamr@2: { williamr@2: iContact = aContact; williamr@2: } williamr@2: williamr@2: inline TLogLink CLogEvent::Link() const williamr@2: /** Gets the link value. williamr@2: williamr@2: @return The link value. */ williamr@2: { williamr@2: return iLink; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetLink(TLogLink aLink) williamr@2: /** Sets the link value. williamr@2: williamr@2: The link can be used to relate this event to an entity in another application. williamr@2: For example, it can be used to associate the event with the call ID or the williamr@2: message ID for emails and faxes. williamr@2: williamr@2: @param aLink The link value. */ williamr@2: { williamr@2: iLink = aLink; williamr@2: } williamr@2: williamr@2: inline const TDesC& CLogEvent::Description() const williamr@2: /** Gets the human readable name describing the event type. williamr@2: williamr@2: Note that this is set automatically by the Log Engine. williamr@2: williamr@2: @return A reference to a non-modifiable descriptor containing the readable williamr@2: name. */ williamr@2: { williamr@2: return *iDescription; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetDescription(const TDesC& aDescription) williamr@2: { williamr@2: TPtr ptr(iDescription->Des()); williamr@2: ptr.Copy(aDescription.Ptr(), Min(aDescription.Length(), ptr.MaxLength())); williamr@2: } williamr@2: williamr@2: inline const TDesC8& CLogEvent::Data() const williamr@2: /** Gets event specific data. williamr@2: williamr@2: @return A reference to a non-modifiable descriptor containing the data that williamr@2: is specific to the event.KNullDesC8, if there is no data. */ williamr@2: { williamr@2: if (iData) williamr@2: return *iData; williamr@2: else williamr@2: return KNullDesC8; williamr@2: } williamr@2: williamr@2: inline TLogFlags CLogEvent::Flags() const williamr@2: /** Gets the flags set for this event. williamr@2: williamr@2: @return The flags. */ williamr@2: { williamr@2: return iFlags; williamr@2: } williamr@2: williamr@2: inline void CLogEvent::SetFlags(TLogFlags aFlags) williamr@2: /** Sets the specified flags for this event. williamr@2: williamr@2: The function does not change any of the other flag bit settings. williamr@2: williamr@2: Only the low order 4 bits are stored in the Log Engine Database; the constant williamr@2: KLogFlagsMask can be used as a mask. williamr@2: williamr@2: @param aFlags The flags to be set. */ williamr@2: { williamr@2: __ASSERT_DEBUG(aFlags <= KLogFlagsMask, User::Invariant()); williamr@2: iFlags = (TLogFlags)(iFlags | aFlags); williamr@2: } williamr@2: williamr@2: inline void CLogEvent::ClearFlags(TLogFlags aFlags) williamr@2: /** Clears the specified flags for this event. williamr@2: williamr@2: The function does not change any of the other flag bit settings. williamr@2: williamr@2: The constant KLogFlagsMask may be used to clear all the flags in an event. williamr@2: williamr@2: @param aFlags The flags to be cleared. */ williamr@2: { williamr@2: __ASSERT_DEBUG(aFlags <= KLogFlagsMask, User::Invariant()); williamr@2: iFlags = (TLogFlags)(iFlags & ~aFlags); williamr@2: } williamr@2: williamr@2: //********************************** williamr@2: // CLogBase williamr@2: //********************************** williamr@2: williamr@2: inline const CResourceFile* CLogBase::ResourceFile() const williamr@2: { williamr@2: return iResourceFile; williamr@2: } williamr@2: williamr@2: inline CLogBase& CLogWrapper::Log() williamr@2: /** Gets a reference to the Log Engine object. williamr@2: williamr@2: @return If the Log Engine is installed, this is a reference to a CLogClient williamr@2: object. If there is no Log Engine, this is a reference to an instance of the williamr@2: Log Engine base class, CLogBase. williamr@2: @see CLogClient */ williamr@2: { williamr@2: return *iBase; williamr@2: }