0
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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 |
#ifndef __JAVA_DEBUG_AGENT_DRIVER_H_
|
|
20 |
#define __JAVA_DEBUG_AGENT_DRIVER_H_
|
|
21 |
|
|
22 |
#include <es_sock.h>
|
|
23 |
#include "Driver.h"
|
|
24 |
#include "JavaDebugAgentKeepAlive.h"
|
|
25 |
|
|
26 |
class CTcpServer;
|
|
27 |
class CTcpServerHandler;
|
|
28 |
class MJavaDebugAgentLog;
|
|
29 |
class MJavaDebugAgentObserver;
|
|
30 |
class CJavaDebugAgentConnector;
|
|
31 |
class CJavaDebugAgentDriver : public CDriver
|
|
32 |
{
|
|
33 |
public:
|
|
34 |
enum TState {
|
|
35 |
EIdle,
|
|
36 |
EConnecting,
|
|
37 |
EListening,
|
|
38 |
EConnected,
|
|
39 |
EDisconnected,
|
|
40 |
EDeleted
|
|
41 |
};
|
|
42 |
|
|
43 |
private:
|
|
44 |
RFs iFs;
|
|
45 |
RSocketServ iSocketServ;
|
|
46 |
CAgentEngine* iEngine;
|
|
47 |
CTcpServer* iServer;
|
|
48 |
CAsyncCallBack* iAsyncCleanup;
|
|
49 |
RPointerArray<CTcpServerHandler> iHandlers;
|
|
50 |
RPointerArray<CTcpServerHandler> iDeadHandlers;
|
|
51 |
RPointerArray<CJavaDebugAgentKeepAlive> iKeepAliveList;
|
|
52 |
MJavaDebugAgentLog* iLog;
|
|
53 |
MJavaDebugAgentObserver* iObserver;
|
|
54 |
CJavaDebugAgentConnector* iConnector;
|
|
55 |
TInt iApId;
|
|
56 |
TInt iKeepAlivePeriod; // in milliseconds
|
|
57 |
TState iState;
|
|
58 |
|
|
59 |
public:
|
|
60 |
static CJavaDebugAgentDriver* NewLC(MJavaDebugAgentLog* aLog);
|
|
61 |
static CJavaDebugAgentDriver* NewL(MJavaDebugAgentLog* aLog);
|
|
62 |
~CJavaDebugAgentDriver();
|
|
63 |
|
|
64 |
void StartListeningL();
|
|
65 |
void ConnectL();
|
|
66 |
void SetObserver(MJavaDebugAgentObserver* aObserver);
|
|
67 |
MJavaDebugAgentLog* Log();
|
|
68 |
RSocketServ& SocketServ();
|
|
69 |
TState State() const;
|
|
70 |
|
|
71 |
// Access to parameters not defined in the base class
|
|
72 |
TInt ApId() const;
|
|
73 |
TInt KeepAlivePeriod() const;
|
|
74 |
void SetApId(TInt aApId);
|
|
75 |
void SetKeepAlivePeriod(TInt aMilliSeconds);
|
|
76 |
|
|
77 |
// Notification from CJavaDebugAgentConnector
|
|
78 |
void ConnectionFailed();
|
|
79 |
|
|
80 |
// CDriver
|
|
81 |
virtual void InitL();
|
|
82 |
virtual void Log(const TDesC& aString);
|
|
83 |
virtual void Message(const TDesC& aString);
|
|
84 |
virtual RFs& Fs();
|
|
85 |
virtual CAgentEngine* Engine();
|
|
86 |
virtual void Shutdown();
|
|
87 |
virtual void SettingsChange();
|
|
88 |
|
|
89 |
// Notifications from CTcpServerHandler
|
|
90 |
virtual void ClientConnected(CTcpServerHandler* aHandler);
|
|
91 |
virtual void ClientDisconnected(CTcpServerHandler* aHandler);
|
|
92 |
|
|
93 |
private:
|
|
94 |
void ConstructL();
|
|
95 |
CJavaDebugAgentDriver(MJavaDebugAgentLog* aLog);
|
|
96 |
TBool CheckIfIdle() const;
|
|
97 |
void SetState(TState aState);
|
|
98 |
void InitKeepAliveL(const TSockAddr* aRemoteAddr);
|
|
99 |
void DeleteConnector();
|
|
100 |
static TInt AsyncCleanup(TAny* aThis);
|
|
101 |
};
|
|
102 |
|
|
103 |
// Observer interface
|
|
104 |
class MJavaDebugAgentObserver
|
|
105 |
{
|
|
106 |
public:
|
|
107 |
virtual void StateChanged(CJavaDebugAgentDriver::TState aState) = 0;
|
|
108 |
};
|
|
109 |
|
|
110 |
// INLINE METHODS
|
|
111 |
|
|
112 |
inline MJavaDebugAgentLog* CJavaDebugAgentDriver::Log()
|
|
113 |
{ return iLog; }
|
|
114 |
inline RSocketServ& CJavaDebugAgentDriver::SocketServ()
|
|
115 |
{ return iSocketServ; }
|
|
116 |
inline TInt CJavaDebugAgentDriver::ApId() const
|
|
117 |
{ return iApId; }
|
|
118 |
inline TInt CJavaDebugAgentDriver::KeepAlivePeriod() const
|
|
119 |
{ return iKeepAlivePeriod; }
|
|
120 |
inline void CJavaDebugAgentDriver::SetApId(TInt aApId)
|
|
121 |
{ iApId = aApId; }
|
|
122 |
inline void CJavaDebugAgentDriver::SetKeepAlivePeriod(TInt aMilliSeconds)
|
|
123 |
{ iKeepAlivePeriod = aMilliSeconds; }
|
|
124 |
inline void CJavaDebugAgentDriver::SetObserver(MJavaDebugAgentObserver* aObserver)
|
|
125 |
{ iObserver = aObserver; }
|
|
126 |
inline CJavaDebugAgentDriver::TState CJavaDebugAgentDriver::State() const
|
|
127 |
{ return iState; }
|
|
128 |
|
|
129 |
#endif // __JAVA_DEBUG_AGENT_DRIVER_H_
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Local Variables:
|
|
133 |
* mode: c++
|
|
134 |
* c-basic-offset: 4
|
|
135 |
* indent-tabs-mode: nil
|
|
136 |
* End:
|
|
137 |
*/
|