Update contrib.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "LogClientObserver.h"
24 #include "logservcli.h"
25 #include <logclientchangeobserver.h>
27 /////////////////////////////////////////////////////////////////////////////////////////
28 // -----> CLogClientObserver (source)
29 /////////////////////////////////////////////////////////////////////////////////////////
31 CLogClientObserver::CLogClientObserver(CLogClient& aClient, MLogClientChangeObserver& aObserver, TInt aPriority)
32 : CActive(aPriority), iClient(aClient), iObserver(aObserver)
34 CActiveScheduler::Add(this);
37 CLogClientObserver::~CLogClientObserver()
42 CLogClientObserver* CLogClientObserver::NewL(CLogClient& aClient, MLogClientChangeObserver& aObserver, TInt aPriority)
44 CLogClientObserver* self = new(ELeave) CLogClientObserver(aClient, aObserver, aPriority);
45 self->RequestChanges();
49 /////////////////////////////////////////////////////////////////////////////////////////
50 /////////////////////////////////////////////////////////////////////////////////////////
51 /////////////////////////////////////////////////////////////////////////////////////////
53 void CLogClientObserver::RunL()
55 if (iStatus.Int() == KErrNone)
60 void CLogClientObserver::DoCancel()
62 RequestChangesCancel();
65 TInt CLogClientObserver::RunError(TInt /*aError*/)
67 // Ignore any leave when notifying the client
71 /////////////////////////////////////////////////////////////////////////////////////////
72 /////////////////////////////////////////////////////////////////////////////////////////
73 /////////////////////////////////////////////////////////////////////////////////////////
75 void CLogClientObserver::RequestChanges()
77 __ASSERT_DEBUG(!IsActive(), User::Invariant());
78 iClient.Session().Send(ELogNotifyExtended, TIpcArgs(&iContextBuf,&iParamBuf1,&iParamBuf2,&iParamBuf3), iStatus);
82 void CLogClientObserver::RequestChangesCancel()
84 iClient.Session().Send(ELogNotifyExtendedCancel, TIpcArgs());
87 void CLogClientObserver::NotifyObserverL()
89 const TUid contextUid = { iContextBuf() };
90 const TInt param1 = iParamBuf1();
91 const TInt param2 = iParamBuf2();
92 const TInt param3 = iParamBuf3();
94 iObserver.HandleLogClientChangeEventL(contextUid, param1, param2, param3);