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 // Transient server example - test client implementation 00015 // 00016 00017 #include <e32base.h> 00018 #include <t-client.h> 00019 #include "testclient.h" 00020 00021 class CMyClient : public CClient 00022 { 00023 IMPORT_C static CClient* NewL(); 00024 ~CMyClient(); 00025 TInt Send(const TDesC& aMessage); 00026 void Receive(TRequestStatus& aStatus,TDes& aMessage); 00027 void CancelReceive(); 00028 private: 00029 RMySession iSession; 00030 }; 00031 00032 EXPORT_C CClient* CMyClient::NewL() 00033 { 00034 CMyClient* self=new(ELeave) CMyClient; 00035 CleanupClosePushL(*self); 00036 User::LeaveIfError(self->iSession.Connect()); 00037 CleanupStack::Pop(); 00038 return self; 00039 } 00040 00041 CMyClient::~CMyClient() 00042 { 00043 iSession.Close(); 00044 } 00045 00046 TInt CMyClient::Send(const TDesC& aMessage) 00047 { 00048 return iSession.Send(aMessage); 00049 } 00050 00051 void CMyClient::Receive(TRequestStatus& aStatus,TDes& aMessage) 00052 { 00053 iSession.Receive(aStatus,aMessage); 00054 } 00055 00056 void CMyClient::CancelReceive() 00057 { 00058 iSession.CancelReceive(); 00059 }
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.