installationservices/swcomponentregistry/test/tscraccessor/inc/tscraccessor_server_session.h
branchRCL_3
changeset 25 7333d7932ef7
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * Scr Acessor - server and session classes
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @test
       
    23  @internalComponent
       
    24 */
       
    25 
       
    26 #ifndef TSCRACCESSOR_SERVER_SESSION_H
       
    27 #define TSCRACCESSOR_SERVER_SESSION_H
       
    28 
       
    29 #include <e32base.h>
       
    30 #include <usif/scr/scr.h>
       
    31 
       
    32 //////////////////////// Server declarations /////////////////////////
       
    33 
       
    34 enum TScrAccessPanic
       
    35 	{
       
    36 	EPanicBadDescriptor,
       
    37 	EPanicIllegalFunction
       
    38 	};
       
    39 
       
    40 void PanicClient(const RMessagePtr2& aMessage, TScrAccessPanic aPanic);
       
    41 
       
    42 class CScrAccessServer : public CServer2
       
    43 	{
       
    44 public:
       
    45 	static CServer2* NewLC();
       
    46 	virtual ~CScrAccessServer();
       
    47 	void AddSession();
       
    48 	void DropSession();
       
    49 	inline Usif::RSoftwareComponentRegistry& ScrSession();
       
    50 private:
       
    51 	CScrAccessServer();
       
    52 	void ConstructL();
       
    53 	CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
       
    54 private:
       
    55 	TInt iSessionCount;
       
    56 	Usif::RSoftwareComponentRegistry iScrSession;
       
    57 	};
       
    58 
       
    59 inline Usif::RSoftwareComponentRegistry& CScrAccessServer::ScrSession()
       
    60 	{
       
    61 	return iScrSession;
       
    62 	}
       
    63 
       
    64 //////////////////////// Session declarations /////////////////////////
       
    65 
       
    66 class CScrAccessSession : public CSession2
       
    67 	{
       
    68 public:
       
    69 	CScrAccessSession();
       
    70 	void CreateL();
       
    71 private:
       
    72 	~CScrAccessSession();
       
    73 	inline CScrAccessServer& Server();
       
    74 	void ServiceL(const RMessage2& aMessage);
       
    75 	void ServiceError(const RMessage2& aMessage, TInt aError);
       
    76 private:
       
    77 	RMessagePtr2 iReceiveMsg;
       
    78 	};
       
    79 
       
    80 inline CScrAccessServer& CScrAccessSession::Server()
       
    81 	{return *static_cast<CScrAccessServer*>(const_cast<CServer2*>(CSession2::Server()));}
       
    82 
       
    83 #endif	// TSCRACCESSOR_SERVER_SESSION_H
       
    84