os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/SDevSound/SDSCapTestServer/src/captestinfoserver.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2008-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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Example file/test code to demonstrate how to develop a TestExecute Server
    15 // Developers should take this project as a template and substitute their own
    16 // code at the __EDIT_ME__ tags
    17 // for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
    18 // in the process of the client. The client initialises the server by calling the
    19 // one and only ordinal.
    20 // 
    21 //
    22 
    23 /**
    24  @file captestinfoserver.cpp
    25 */
    26 
    27 #include "captestinfoserver.h"
    28 
    29 CCapTestInfoServer* CCapTestInfoServer::NewL()
    30 /**
    31  * @return - Instance of the test server
    32  * CServer2 derived server.
    33  */
    34 	{
    35 	CCapTestInfoServer * server = new (ELeave) CCapTestInfoServer();
    36 	CleanupStack::PushL(server);
    37 	
    38 	server->StartL(KInfoServerName); 
    39 	CleanupStack::Pop(server);
    40 	return server;
    41 	}
    42 
    43 CCapTestInfoServer::CCapTestInfoServer() :
    44 	CServer2(EPriorityStandard)
    45 	{
    46 	iSessionConnected = EFalse;
    47 	}
    48 	
    49 CCapTestInfoServer::~CCapTestInfoServer()
    50 	{
    51 	}
    52 
    53 CSession2* CCapTestInfoServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const
    54 	{
    55 	CCapTestInfoServerSession* session = CCapTestInfoServerSession::NewL();
    56 	return session;
    57 	}
    58 
    59 
    60 CCapTestInfoServerSession* CCapTestInfoServerSession::NewL()
    61 	{
    62 	CCapTestInfoServerSession* self = new (ELeave) CCapTestInfoServerSession();
    63 	return self;
    64 	}
    65 
    66 CCapTestInfoServerSession::CCapTestInfoServerSession()
    67 	: CSession2()
    68 	{
    69 	}
    70 
    71 CCapTestInfoServerSession::~CCapTestInfoServerSession()
    72 	{
    73 	}
    74 
    75 void CCapTestInfoServerSession::ServiceL(const RMessage2 &aMessage)
    76 	{
    77 	TInt err = KErrNone;
    78 	switch (aMessage.Function())
    79         {
    80     case ECapTestInfoThreadId:
    81         DoGetThreadIdL(aMessage);
    82         break;
    83     default:
    84         User::Leave(KErrNotSupported);
    85         break;
    86         }
    87 	aMessage.Complete(err);
    88 	}
    89 
    90 void CCapTestInfoServerSession::DoGetThreadIdL(const RMessage2 &aMessage)
    91 	{
    92 	RThread thisThread;
    93 	TPckgBuf<TThreadId> tid(thisThread.Id());
    94 	aMessage.WriteL(0, tid);
    95 	}
    96