examples/Base/IPC/ClientServer/Complex/ComplexClientSession.cpp

00001 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // This component and the accompanying materials are made available
00004 // under the terms of "Eclipse Public License v1.0"
00005 // which accompanies this distribution, and is available
00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00007 //
00008 // Initial Contributors:
00009 // Nokia Corporation - initial contribution.
00010 //
00011 // Contributors:
00012 //
00013 // Description:
00014 // Implementation of the RCountSession class
00015 //
00016 
00017 
00018 
00019 #include "ComplexClientAndServer.h"
00020 #include "ComplexClient.h"
00021 
00022 
00023 // number of message slots.
00024 const TUint kDefaultMessageSlots=4;
00025 
00029 RCountSession::RCountSession()
00030         {
00031         }
00032 
00033 
00043 TInt RCountSession::Connect()
00044         {
00045         TInt r=StartThread(iServerThread);
00046         if (r==KErrNone)
00047                 r=CreateSession(KCountServerName,Version(),kDefaultMessageSlots);
00048         return(r); 
00049         }
00050         
00051 
00055 TVersion RCountSession::Version(void) const
00056         {
00057         return(TVersion(KCountServMajorVersionNumber,KCountServMinorVersionNumber,KCountServBuildVersionNumber));
00058         }
00059 
00060 
00067 void RCountSession::Close()
00068         {
00069         SendReceive(ECountServCloseSession);
00070         RHandleBase::Close();
00071         iServerThread.Close();
00072         }
00073 
00074 
00079 TInt RCountSession::ResourceCount()
00080         {
00081         TInt count=0;
00082         TPckgBuf<TInt> pckgcount;
00083         
00084           // Note that TPckgBuf is of type TDes8
00085         TIpcArgs args(&pckgcount);
00086         SendReceive(ECountServResourceCount, args);
00087         
00088           // Extract the value returned from the server. 
00089         count = pckgcount();
00090         return count;
00091         }
00092 
00093 
00094 

Generated by  doxygen 1.6.2