activityfw/activitydatabase/hsactivitydbserver/src/afobservertask.cpp
changeset 102 8b8b34fa9751
parent 100 0920c6a9b6c8
child 106 e78d6e055a5b
--- a/activityfw/activitydatabase/hsactivitydbserver/src/afobservertask.cpp	Tue Jun 29 10:20:30 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#include "afobservertask.h"
-#include "activitycmd.h"
-
-// -----------------------------------------------------------------------------
-/**
- * Constructor for performing 1st stage construction
- * @param globalStorage - global observers storage
- * @param localStorage - local observers storage
- * @param msg - request message
- */
-CAfObserverTask::CAfObserverTask(MAfTaskStorage& globalStorage, 
-                                 MAfTaskStorage& localStorage, 
-                                 const RMessage2& msg)
-:
-    mGlobalStorage(globalStorage),
-    mLocalStorage(localStorage),
-    mMsg(msg)
-{
-    // No implementation required
-}
-
-// -----------------------------------------------------------------------------
-/**
- * Destructor.
- */
-CAfObserverTask::~CAfObserverTask()
-{
-    mData.Close();
-}
-
-// -----------------------------------------------------------------------------
-/**
- * Handle observer request. 
- * @param globalStorage - global observers storage
- * @param localStorage - local observers storage
- * @param msg - request message
- */
-
-void CAfObserverTask::ExecuteLD(MAfTaskStorage& globalStorage, 
-                                MAfTaskStorage& localStorage, 
-                                const RMessage2& msg)
-{
-    CAfObserverTask *self = new(ELeave)CAfObserverTask(globalStorage, 
-                                                       localStorage, 
-                                                       msg);
-    CleanupStack::PushL(self);
-    globalStorage.PushL(self);
-    CleanupStack::Pop(self);
-}
-
-// -----------------------------------------------------------------------------
-/**
- * Interface implementation
- * @see CActivityTask::Data()
- */
-const TDesC8& CAfObserverTask::Data() const
-{
-    return mData;
-}
-
-// -----------------------------------------------------------------------------
-/**
- * Interface implementation
- * @see CActivityTask::BroadcastReceivedL(const RMessage2&)
- */
-void CAfObserverTask::BroadcastReceivedL(const RMessage2& msg)
-{
-    if(EFalse != mMsg.IsNull()) {
-        mGlobalStorage.Pop(this);//
-        mLocalStorage.Pop(this);
-        delete this;
-    } else if (WaitActivity == mMsg.Function() &&
-               LaunchActivity == msg.Function()) {
-               TPckgBuf<TInt> observerdId;
-               mMsg.ReadL(KRequestAppIdOffset, observerdId);
-
-        TPckgBuf<TInt> requestedId;
-        msg.ReadL(KRequestAppIdOffset, requestedId);
-        if (observerdId() == requestedId()) {
-            if (msg.GetDesLength(KRequestActOffset) > mData.MaxLength()) {
-                mData.ReAllocL(msg.GetDesLength(1));
-            }
-            msg.ReadL(KRequestActOffset, mData, 0);
-            WriteResponseL();
-            mLocalStorage.PushL(this);
-            mGlobalStorage.Pop(this);
-            mMsg.Complete(KErrNone);
-        }
-    } else if (WaitActivity == mMsg.Function() &&
-               CancelWait == msg.Function() &&
-               mMsg.Session() == msg.Session()) {
-        mGlobalStorage.Pop(this);
-        mMsg.Complete(KErrCancel);
-        delete this;
-    } else if (NotifyChange == mMsg.Function() &&
-               CancelNotify == msg.Function() &&
-               mMsg.Session() == msg.Session()) {
-        mGlobalStorage.Pop(this);
-        mMsg.Complete(KErrCancel);
-        delete this;
-    } else if(NotifyChange == mMsg.Function() &&
-              (AddActivity == msg.Function() ||
-               UpdateActivity == msg.Function() ||
-               RemoveActivity == msg.Function() ||
-               RemoveApplicationActivities == msg.Function())){
-        mMsg.Complete(KErrNone);
-        mGlobalStorage.Pop(this);
-        delete this;
-    }
-}
-
-// -----------------------------------------------------------------------------
-/**
- * Write response data to requested message 
- */
-void CAfObserverTask::WriteResponseL()
-{
-    mMsg.WriteL(KResponseDataSizeOffset, TPckgBuf<TInt>(mData.Length()));//write data size
-    mMsg.WriteL(KResponseIdOffset, TPckgBuf<CBase*>(this));//task identyfier
-}
-
-// -----------------------------------------------------------------------------
-/**
- * Returns ETrue if task is related with session argument
- */
-TBool CAfObserverTask::IsSessionTask(const CSession2* session)
-{
-    return mMsg.Session() == session ? ETrue : EFalse;
-}