diff -r f5d4820de50d -r 4fde310f06fe memspy/MemSpyServer/Source/MemSpyServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspy/MemSpyServer/Source/MemSpyServer.cpp Mon Jun 14 11:37:33 2010 +0300 @@ -0,0 +1,124 @@ +/* +* 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: +* Implementation of the new MemSpyServer +*/ + +//user includes +#include "MemSpyServer.h" +#include "MemSpyServerSession.h" + +// System includes +#include + +// User includes +#include +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +// --------------------------------------------------------- +// CMemSpyServer( CMemSpyEngine& aEngine ) +// --------------------------------------------------------- +// +CMemSpyServer::CMemSpyServer( CMemSpyEngine& aEngine ) +: CServer2( EPriorityNormal ), iEngine( aEngine ) + { + } + +// --------------------------------------------------------- +// ~CMemSpyServer() +// --------------------------------------------------------- +// +CMemSpyServer::~CMemSpyServer() + { + iLog.CloseLog(); + iLog.Close(); + } + +// --------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------- +// +void CMemSpyServer::ConstructL() + { + StartL( KMemSpyServer2 ); + //TInt error = Start( KMemSpyServerName ); + RDebug::Printf( "[MemSpy] CMemSpyServer::ConstructL() - server started" ); + + iLog.Connect(); + iLog.CreateLog(_L("memspy"), _L("server.txt"), EFileLoggingModeAppend); + iLog.Write(_L("[MemSpy] CMemSpyServer::ConstructL() - server started")); + iLog.Write(_L("[MemSpy] CMemSpyServer::ConstructL() - server name: ")); + iLog.Write(KMemSpyServer2); + } + +// --------------------------------------------------------- +// NewL( CMemSpyEngine& aEngine ) +// Two phased constructor +// --------------------------------------------------------- +// +CMemSpyServer* CMemSpyServer::NewL( CMemSpyEngine& aEngine ) + { + CMemSpyServer* self = CMemSpyServer::NewLC(aEngine); + CleanupStack::Pop(self); + return (self); + } + +// --------------------------------------------------------- +// NewLC( CMemSpyEngine& aEngine ) +// Two phased constructor +// --------------------------------------------------------- +// +CMemSpyServer* CMemSpyServer::NewLC( CMemSpyEngine& aEngine ) + { + CMemSpyServer* self = new(ELeave) CMemSpyServer( aEngine ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------- +// NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) +// Creates new client server session +// --------------------------------------------------------- +// +CSession2* CMemSpyServer::NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const + { + if ( aVersion.iMajor != KMemSpyClientServerVersion ) + { + RDebug::Printf( "[MemSpy] CMemSpyServerSession::NewSessionL() - BAD VERSION" ); + User::Leave( KErrNotSupported ); + } + // + CMemSpyServerSession* session = CMemSpyServerSession::NewL( iEngine, aMessage ); + return session; + } + +// END OF FILE