serviceproviders/sapi_logging/loggingservice/src/loggingevent.cpp
changeset 5 989d2f495d90
child 16 44bb89c96acb
equal deleted inserted replaced
1:a36b1e19a461 5:989d2f495d90
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Implements sapievent class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <logwrap.h>
       
    21 #include <logcli.h>
       
    22 
       
    23 #include "loggingevent.h"
       
    24 
       
    25 /**
       
    26 * Default Constructor Method
       
    27 */
       
    28 
       
    29 CLogsEvent :: CLogsEvent()
       
    30     {
       
    31     }
       
    32 
       
    33 /**
       
    34 * Default Destructor
       
    35 */
       
    36 
       
    37 CLogsEvent :: ~CLogsEvent()
       
    38     {
       
    39     delete iLogEvent;
       
    40     delete iLogClient ;
       
    41     iFs.Close() ;
       
    42     }
       
    43 
       
    44 /**
       
    45 *Two phased constructor implementation
       
    46 */
       
    47 
       
    48 EXPORT_C CLogsEvent* CLogsEvent :: NewL()
       
    49     {
       
    50     CLogsEvent* self = CLogsEvent::NewLC();
       
    51     CleanupStack::Pop(self);
       
    52     return self;
       
    53     }
       
    54 
       
    55 /**
       
    56 * Two phased constructor implementation
       
    57 */
       
    58 
       
    59 CLogsEvent* CLogsEvent :: NewLC()
       
    60     {
       
    61     CLogsEvent* self = new (ELeave) CLogsEvent();
       
    62     CleanupStack::PushL(self);
       
    63     self->ConstructL();
       
    64     return self;
       
    65     }
       
    66 
       
    67 /**
       
    68 * This function constructs the member elements of CLogsEvent Class
       
    69 */
       
    70 void CLogsEvent :: ConstructL()
       
    71     {
       
    72     User::LeaveIfError(iFs.Connect());
       
    73     iLogClient = CLogClient::NewL(iFs);
       
    74     iLogEvent = CLogEvent::NewL();
       
    75     }
       
    76 
       
    77 /**
       
    78 * This function sets the direction of the event
       
    79 */
       
    80 EXPORT_C  void CLogsEvent ::  SetDirection(TInt aDirection)
       
    81     {
       
    82     TBuf<KLogMaxDirectionLength> direction;
       
    83     iLogClient->GetString(direction, aDirection);
       
    84     iLogEvent->SetDirection(direction) ;
       
    85     }
       
    86 
       
    87 
       
    88 /**
       
    89 * This function sets the status of the event
       
    90 *
       
    91 * @param aStatus , status of the event(pending, delivered etc.,)
       
    92 */
       
    93 EXPORT_C void CLogsEvent :: SetStatus(TInt aStatus)
       
    94     {
       
    95     TBuf<KLogMaxDirectionLength> status ;
       
    96     iLogClient->GetString(status , aStatus) ;
       
    97     iLogEvent->SetStatus(status) ;
       
    98     }
       
    99 
       
   100 
       
   101 
       
   102