0
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-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 "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 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
/**
|
|
21 |
@file Server.h
|
|
22 |
*/
|
|
23 |
|
|
24 |
#if (!defined __TESTEXECUTE_LOG_SERVER_H__)
|
|
25 |
#define __TESTEXECUTE_LOG_SERVER_H__
|
|
26 |
#include <e32base.h>
|
|
27 |
#include <f32file.h>
|
|
28 |
#include <testexecutelog.h>
|
|
29 |
|
|
30 |
class CActiveBase : public CActive
|
|
31 |
{
|
|
32 |
public:
|
|
33 |
inline TRequestStatus& Status();
|
|
34 |
inline void SetActive();
|
|
35 |
inline void Kick();
|
|
36 |
inline void Prime();
|
|
37 |
inline void Complete(TInt aCode);
|
|
38 |
inline virtual ~CActiveBase();
|
|
39 |
protected:
|
|
40 |
inline CActiveBase();
|
|
41 |
};
|
|
42 |
|
|
43 |
class CLogBuffer : public CBase
|
|
44 |
{
|
|
45 |
public:
|
|
46 |
CLogBuffer(HBufC8& aBuffer);
|
|
47 |
~CLogBuffer();
|
|
48 |
inline const TDesC8& Buf();
|
|
49 |
inline static TInt LinkOffset();
|
|
50 |
private:
|
|
51 |
TSglQueLink iLink;
|
|
52 |
HBufC8& iLogBuffer;
|
|
53 |
};
|
|
54 |
|
|
55 |
class CLogServer;
|
|
56 |
class CLogFileControl : public CActiveBase
|
|
57 |
{
|
|
58 |
public:
|
|
59 |
static CLogFileControl* NewL(CLogServer& aParent, const TDesC& aLogFilePath,RTestExecuteLogServ::TLogMode aMode);
|
|
60 |
~CLogFileControl();
|
|
61 |
void RunL();
|
|
62 |
inline void AddLogBuffer(CLogBuffer& aBuffer);
|
|
63 |
inline const TDesC& LogFile();
|
|
64 |
inline void DoCancel();
|
|
65 |
inline void AddSession();
|
|
66 |
inline void RemoveSession();
|
|
67 |
inline TInt SessionCount() const;
|
|
68 |
inline TBool QueueEmpty() const;
|
|
69 |
|
|
70 |
private:
|
|
71 |
void ConstructL(RTestExecuteLogServ::TLogMode aMode);
|
|
72 |
CLogFileControl(CLogServer& aParent, const TDesC& aLogFilePath);
|
|
73 |
private:
|
|
74 |
CLogServer& iParent;
|
|
75 |
TBuf<KMaxTestExecuteLogFilePath> iLogFileName;
|
|
76 |
RFile iLogFile;
|
|
77 |
TSglQue<CLogBuffer> iQueue;
|
|
78 |
TInt iSessionCount;
|
|
79 |
TBool iTransmitted;
|
|
80 |
};
|
|
81 |
|
|
82 |
class CLogServer : public CServer2
|
|
83 |
{
|
|
84 |
public:
|
|
85 |
static CLogServer* NewL();
|
|
86 |
~CLogServer();
|
|
87 |
void ControlComplete(CLogFileControl& aControl);
|
|
88 |
|
|
89 |
inline RPointerArray<CLogFileControl>& LogControl();
|
|
90 |
inline RFs& Fs();
|
|
91 |
|
|
92 |
CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
|
|
93 |
void SessionClosed();
|
|
94 |
private:
|
|
95 |
CLogServer();
|
|
96 |
void ConstructL();
|
|
97 |
private:
|
|
98 |
RFs iFs;
|
|
99 |
RPointerArray<CLogFileControl> iControl;
|
|
100 |
};
|
|
101 |
|
|
102 |
class CLogSession : public CSession2
|
|
103 |
{
|
|
104 |
public:
|
|
105 |
inline const CLogServer& LogServer() const;
|
|
106 |
CLogSession();
|
|
107 |
~CLogSession();
|
|
108 |
void ServiceL(const RMessage2& aMessage);
|
|
109 |
private:
|
|
110 |
CLogFileControl* iControl;
|
|
111 |
};
|
|
112 |
|
|
113 |
#include "Server.inl"
|
|
114 |
|
|
115 |
#endif
|