os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/SDevSound/SDSCapTestServer/src/captestinfoserver.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/SDevSound/SDSCapTestServer/src/captestinfoserver.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,96 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Example file/test code to demonstrate how to develop a TestExecute Server
1.18 +// Developers should take this project as a template and substitute their own
1.19 +// code at the __EDIT_ME__ tags
1.20 +// for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
1.21 +// in the process of the client. The client initialises the server by calling the
1.22 +// one and only ordinal.
1.23 +//
1.24 +//
1.25 +
1.26 +/**
1.27 + @file captestinfoserver.cpp
1.28 +*/
1.29 +
1.30 +#include "captestinfoserver.h"
1.31 +
1.32 +CCapTestInfoServer* CCapTestInfoServer::NewL()
1.33 +/**
1.34 + * @return - Instance of the test server
1.35 + * CServer2 derived server.
1.36 + */
1.37 + {
1.38 + CCapTestInfoServer * server = new (ELeave) CCapTestInfoServer();
1.39 + CleanupStack::PushL(server);
1.40 +
1.41 + server->StartL(KInfoServerName);
1.42 + CleanupStack::Pop(server);
1.43 + return server;
1.44 + }
1.45 +
1.46 +CCapTestInfoServer::CCapTestInfoServer() :
1.47 + CServer2(EPriorityStandard)
1.48 + {
1.49 + iSessionConnected = EFalse;
1.50 + }
1.51 +
1.52 +CCapTestInfoServer::~CCapTestInfoServer()
1.53 + {
1.54 + }
1.55 +
1.56 +CSession2* CCapTestInfoServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const
1.57 + {
1.58 + CCapTestInfoServerSession* session = CCapTestInfoServerSession::NewL();
1.59 + return session;
1.60 + }
1.61 +
1.62 +
1.63 +CCapTestInfoServerSession* CCapTestInfoServerSession::NewL()
1.64 + {
1.65 + CCapTestInfoServerSession* self = new (ELeave) CCapTestInfoServerSession();
1.66 + return self;
1.67 + }
1.68 +
1.69 +CCapTestInfoServerSession::CCapTestInfoServerSession()
1.70 + : CSession2()
1.71 + {
1.72 + }
1.73 +
1.74 +CCapTestInfoServerSession::~CCapTestInfoServerSession()
1.75 + {
1.76 + }
1.77 +
1.78 +void CCapTestInfoServerSession::ServiceL(const RMessage2 &aMessage)
1.79 + {
1.80 + TInt err = KErrNone;
1.81 + switch (aMessage.Function())
1.82 + {
1.83 + case ECapTestInfoThreadId:
1.84 + DoGetThreadIdL(aMessage);
1.85 + break;
1.86 + default:
1.87 + User::Leave(KErrNotSupported);
1.88 + break;
1.89 + }
1.90 + aMessage.Complete(err);
1.91 + }
1.92 +
1.93 +void CCapTestInfoServerSession::DoGetThreadIdL(const RMessage2 &aMessage)
1.94 + {
1.95 + RThread thisThread;
1.96 + TPckgBuf<TThreadId> tid(thisThread.Id());
1.97 + aMessage.WriteL(0, tid);
1.98 + }
1.99 +