Update contrib.
1 // Copyright (c) 2002-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Implementation of the RTestServ and RTestSession API's
21 //#include "..\..\SampleServer\src\SampleServer.h"
22 #include <simulprocserver.h>
23 #include <simulprocclient.h>
26 TVersion RTestServ::Version() const
28 return(TVersion(1,0,1));
31 EXPORT_C TInt RTestServ::Connect(const TDesC& aServerName)
33 * @param aServerName - Human readable name of the test server
34 * @param aDebugMode - Set to true for just in time debugging
35 * @return int - Standard error codes
36 * Secure version of the API call. Expects the server binary to be
40 if(aServerName.Length() > iServerName.MaxLength())
42 iServerName = aServerName;
43 // Assume the server is already running and attempt to create a session
45 TInt err = CreateSession(aServerName,Version(),4);
46 if(err == KErrNotFound)
49 // Construct the server binary name
50 TBuf<KMaxServerNameLength> serverFile;
55 serverFile.Copy(aServerName);
56 serverFile.Append(KExe);
57 err = server.Create(serverFile,KEmpty);
60 // Synchronise with the server
61 TRequestStatus reqStatus;
62 server.Rendezvous(reqStatus);
64 if (reqStatus!=KRequestPending)
70 // Start the test harness
72 // Server will call the reciprocal static synchronise call
74 User::WaitForRequest(reqStatus); // wait for start or death
76 if(reqStatus.Int() != KErrNone)
77 return reqStatus.Int();
79 // Create the root server session
80 err = CreateSession(aServerName,Version(),4);
85 EXPORT_C const TDesC& RTestServ::ServerName() const
87 * @return - The human readable server name
94 EXPORT_C TInt RTestSession::Open(RTestServ& aServ, const TDesC& aStepName, TBool aSharedData)
96 * @param aServ - Reference to the root server session
97 * @param aStepName - Reference to the name of the test step owned by the server
98 * @return Standard error codes
99 * Secure and Non-secure variants
100 * Synchronously open a server test step session
103 if(aStepName.Length() > KMaxServerNameLength)
106 args.Set(0,&aStepName);
107 args.Set(1,aSharedData);
108 return CreateSubSession(aServ,EMMTSOpenTestStep,args);
111 EXPORT_C void RTestSession::StartProcessing(TRequestStatus& aStatus)
114 * @param aCommandString - The arguments to the RUN_TEST_STEP command
115 * @return aPanicString - If the test step panics, this member is set up with the panic string
116 * @param aStatus - For completion to the caller
117 * Secure and Non-secure variants
118 * Send the RUN_TEST_STEP arguments to the test server
121 SendReceive(EMMTSStartProcessing,aStatus);
124 EXPORT_C TVerdict RTestSession::EndProcessingAndReturnResult(TDes8& aMessage)
127 * @return - Standard Epoc error codes
128 * Secure and Non-secure variants
129 * Synchronous abort of the the test step
133 TPckgBuf<TVerdict> v;
136 args.Set(1,&aMessage);
137 SendReceive(EMMTSStopProcessing, args);
141 EXPORT_C void RTestSession::Close()
143 CloseSubSession(EMMTSClose);