51
|
1 |
/*
|
|
2 |
* Copyright (c) 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 |
#ifndef MEMSPYENGINESERVER_H
|
|
19 |
#define MEMSPYENGINESERVER_H
|
|
20 |
|
|
21 |
// System includes
|
|
22 |
#include <e32base.h>
|
|
23 |
|
|
24 |
// User includes
|
|
25 |
#include <memspyengineclientinterface.h>
|
|
26 |
#include <memspy/engine/memspydevicewideoperations.h>
|
62
|
27 |
#include <memspy/engine/memspyengineobserver.h>
|
51
|
28 |
|
|
29 |
// Classes referenced
|
|
30 |
class CMemSpyEngine;
|
|
31 |
class CMemSpyDwOperationTracker;
|
62
|
32 |
class CMemSpyNotificationTracker;
|
51
|
33 |
|
|
34 |
NONSHARABLE_CLASS( CShutdown ) : public CTimer
|
|
35 |
{
|
|
36 |
enum {KMyShutdownDelay=10 * 1000000}; // 10s
|
|
37 |
public:
|
|
38 |
inline CShutdown();
|
|
39 |
inline void ConstructL();
|
|
40 |
inline void Start();
|
|
41 |
private:
|
|
42 |
void RunL();
|
|
43 |
};
|
|
44 |
|
|
45 |
NONSHARABLE_CLASS( CMemSpyEngineServer ) : public CServer2
|
|
46 |
{
|
|
47 |
public:
|
|
48 |
static CMemSpyEngineServer* NewL( CMemSpyEngine& aEngine );
|
|
49 |
~CMemSpyEngineServer();
|
|
50 |
|
|
51 |
CMemSpyDwOperationTracker* CurrentOperationTracker() const { return iCurrentOperationTracker; }
|
|
52 |
void SetCurrentOperationTracker(CMemSpyDwOperationTracker* aTracker) { iCurrentOperationTracker = aTracker; }
|
|
53 |
|
62
|
54 |
CMemSpyNotificationTracker* NotificationTracker() const { return iNotificationTracker; }
|
|
55 |
|
51
|
56 |
CMemSpyEngine& Engine() { return iEngine; }
|
|
57 |
|
|
58 |
void AddSession(TBool aCliRequest);
|
|
59 |
void DropSession(TBool aCliRequest);
|
|
60 |
|
|
61 |
private:
|
|
62 |
CMemSpyEngineServer( CMemSpyEngine& aEngine );
|
|
63 |
void ConstructL();
|
|
64 |
|
|
65 |
protected: // From CServer2
|
|
66 |
CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
|
|
67 |
|
|
68 |
private:
|
|
69 |
CMemSpyEngine& iEngine;
|
|
70 |
CMemSpyDwOperationTracker* iCurrentOperationTracker;
|
62
|
71 |
CMemSpyNotificationTracker* iNotificationTracker;
|
51
|
72 |
|
|
73 |
TInt iSessionCount;
|
|
74 |
TBool iCliConnected;
|
|
75 |
|
|
76 |
CShutdown iShutdown;
|
|
77 |
};
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
NONSHARABLE_CLASS( CMemSpyEngineSession ) : public CSession2
|
|
82 |
{
|
|
83 |
public:
|
|
84 |
static CMemSpyEngineSession* NewL( CMemSpyEngine& aEngine, const RMessage2& aMessage );
|
|
85 |
~CMemSpyEngineSession();
|
|
86 |
|
|
87 |
void CreateL();
|
|
88 |
|
|
89 |
private:
|
|
90 |
CMemSpyEngineSession( CMemSpyEngine& aEngine );
|
|
91 |
void ConstructL( const RMessage2& aMessage );
|
|
92 |
|
|
93 |
private: // From CSession2
|
|
94 |
void ServiceL( const RMessage2& aMessage );
|
|
95 |
|
|
96 |
private: // Internal methods
|
|
97 |
void DoServiceL( const RMessage2& aMessage );
|
|
98 |
void DoAsyncServiceL( const RMessage2& aMessage );
|
|
99 |
void DoUiServiceL( const RMessage2& aMessage );
|
|
100 |
void DoCmdServiceL( const RMessage2& aMessage );
|
|
101 |
static TInt ValidateFunction( TInt aFunction, TBool aIncludesThreadId, TBool aIncludesThreadName );
|
|
102 |
void HandleThreadSpecificOpL( TInt aFunction, const TThreadId& aThreadId );
|
|
103 |
void HandleThreadSpecificOpL( TInt aFunction, const TDesC& aThreadName );
|
|
104 |
void HandleThreadAgnosticOpL( TInt aFunction, const RMessage2& aMessage );
|
|
105 |
void StartDeviceWideOperationL(CMemSpyDeviceWideOperations::TOperation aOperation, const RMessage2& aMessage);
|
|
106 |
|
|
107 |
inline CMemSpyEngineServer& Server() const { return *static_cast<CMemSpyEngineServer*>(const_cast<CServer2*>(CSession2::Server())); }
|
|
108 |
|
|
109 |
private:
|
|
110 |
CMemSpyEngine& iEngine;
|
|
111 |
HBufC* iClientThreadName;
|
|
112 |
TUint32 iClientThreadId;
|
|
113 |
TBool iIsCliRequest;
|
|
114 |
};
|
|
115 |
|
|
116 |
/**
|
|
117 |
* CMemSpyDwOperationTracker
|
|
118 |
* Tracks device wide operation progress and calls iOperationMessage.Complete upon completion.
|
|
119 |
*/
|
|
120 |
NONSHARABLE_CLASS( CMemSpyDwOperationTracker ) : public MMemSpyDeviceWideOperationsObserver
|
|
121 |
{
|
|
122 |
public:
|
|
123 |
static CMemSpyDwOperationTracker* NewL(CMemSpyDeviceWideOperations::TOperation aOperation,
|
|
124 |
const RMessage2& aOperationMessage,
|
|
125 |
CMemSpyEngineServer& aServer);
|
|
126 |
~CMemSpyDwOperationTracker();
|
|
127 |
|
|
128 |
void AddNotificationL(const RMessage2& aMessage);
|
|
129 |
|
|
130 |
void Cancel();
|
|
131 |
|
|
132 |
public: // From MMemSpyDeviceWideOperationsObserver
|
|
133 |
void HandleDeviceWideOperationEvent(TEvent aEvent, TInt aParam1, const TDesC& aParam2);
|
|
134 |
|
|
135 |
private:
|
|
136 |
CMemSpyDwOperationTracker(const RMessage2& aOperationMessage, CMemSpyEngineServer& aServer);
|
|
137 |
void ConstructL(CMemSpyDeviceWideOperations::TOperation aOperation);
|
|
138 |
|
|
139 |
private:
|
|
140 |
RMessage2 iOperationMessage;
|
|
141 |
CMemSpyEngineServer& iServer;
|
|
142 |
CArrayFixFlat<RMessage2>* iPendingNotifications;
|
|
143 |
CMemSpyDeviceWideOperations* iOperation;
|
|
144 |
TInt iProgress;
|
|
145 |
};
|
|
146 |
|
62
|
147 |
/**
|
|
148 |
* CMemSpyNotificationTracker
|
|
149 |
* Tracks notification requests for various events on server site.
|
|
150 |
* Currently only notifications of process changes are supported.
|
|
151 |
*/
|
|
152 |
NONSHARABLE_CLASS( CMemSpyNotificationTracker ) : public CBase, public MMemSpyEngineObserver
|
|
153 |
{
|
|
154 |
public:
|
|
155 |
static CMemSpyNotificationTracker* NewL();
|
|
156 |
~CMemSpyNotificationTracker();
|
|
157 |
|
|
158 |
void AddNotificationL( const RMessage2& aMessage );
|
|
159 |
|
|
160 |
void CancelNotification(const RMessage2& aMessage);
|
|
161 |
|
|
162 |
public: // From MMemSpyEngineObserver
|
|
163 |
void HandleMemSpyEngineEventL( TEvent aEvent, TAny* aContext = NULL );
|
|
164 |
|
|
165 |
private:
|
|
166 |
CMemSpyNotificationTracker() {};
|
|
167 |
void ConstructL();
|
|
168 |
|
|
169 |
private:
|
|
170 |
CArrayFixFlat<RMessage2>* iPendingNotifications;
|
|
171 |
};
|
|
172 |
|
51
|
173 |
|
|
174 |
#endif
|