2
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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 |
#ifndef EVENTSYSTEMSERVER_H_
|
|
18 |
#define EVENTSYSTEMSERVER_H_
|
|
19 |
|
|
20 |
#include "stfeventsystemdefs.h"
|
|
21 |
#include "waitingevent.h"
|
|
22 |
#include "stateevent.h"
|
|
23 |
|
|
24 |
// Constant values
|
|
25 |
TInt const KShutdownDelay = 60000000; //Automatic shutdown delay: 60s
|
|
26 |
|
|
27 |
// Class for shutting down server when inactive
|
|
28 |
class CShutdown: public CTimer
|
|
29 |
{
|
|
30 |
public:
|
|
31 |
inline CShutdown();
|
|
32 |
inline void ConstructL();
|
|
33 |
inline void Start();
|
|
34 |
|
|
35 |
private:
|
|
36 |
void RunL();
|
|
37 |
};
|
|
38 |
|
|
39 |
// Main class of TestEngine server
|
|
40 |
class CEventSystemServer : public CServer2
|
|
41 |
{
|
|
42 |
public:
|
|
43 |
// Creats a new server object
|
|
44 |
static CEventSystemServer* NewL(CActive::TPriority aActiveObjectPriority);
|
|
45 |
static CEventSystemServer* NewLC(CActive::TPriority aActiveObjectPriority);
|
|
46 |
|
|
47 |
// Creates a new session with the server; the function implements
|
|
48 |
// pure virtual function defined in class CServer2
|
|
49 |
CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const;
|
|
50 |
|
|
51 |
// Adds session
|
|
52 |
void AddSession(void);
|
|
53 |
|
|
54 |
// Removes session
|
|
55 |
void RemoveSession(void);
|
|
56 |
|
|
57 |
public :
|
|
58 |
// Constructor
|
|
59 |
CEventSystemServer(CActive::TPriority aActiveObjectPriority);
|
|
60 |
|
|
61 |
// Second phase constructor
|
|
62 |
void ConstructL();
|
|
63 |
|
|
64 |
// Returns an object container, and guaranteed to produce object
|
|
65 |
// containers with unique ids within the server.
|
|
66 |
// Called by a new session to create a container
|
|
67 |
CObjectCon* NewContainerL();
|
|
68 |
|
|
69 |
// Remove session object from container
|
|
70 |
void RemoveContainer(CObjectCon *aObj);
|
|
71 |
|
|
72 |
// Destructor
|
|
73 |
~CEventSystemServer();
|
|
74 |
|
|
75 |
// Search for state event and give its index
|
|
76 |
TInt SearchForState(const TDesC& aEventName);
|
|
77 |
|
|
78 |
// Search for waiting event, starting from aIndex
|
|
79 |
TBool SearchForWaiting(const TDesC& aEventName, const TInt aOwnerId, TInt& aIndex);
|
|
80 |
|
|
81 |
// Search for waiting event, starting from aIndex
|
|
82 |
TBool SearchForWaiting(const TDesC& aEventName, TInt& aIndex);
|
|
83 |
|
|
84 |
// List of waiting events
|
|
85 |
RPointerArray<CWaitingEvent> iWaitingEvents;
|
|
86 |
|
|
87 |
// State events container
|
|
88 |
RPointerArray<CStateEvent> iStateEvents;
|
|
89 |
|
|
90 |
private:
|
|
91 |
// Panic class with given error code
|
|
92 |
void PanicClass(const TInt aErrorCode);
|
|
93 |
|
|
94 |
// Check condition and start shudown timer.
|
|
95 |
void CheckAndStartShutdownTimer(void);
|
|
96 |
|
|
97 |
// The server has an object container index that
|
|
98 |
// creates an object container for each session.
|
|
99 |
CObjectConIx* iContainerIndex;
|
|
100 |
|
|
101 |
// Session counter
|
|
102 |
TInt iSessionCounter;
|
|
103 |
|
|
104 |
// Shutdown object
|
|
105 |
CShutdown iShutdown;
|
|
106 |
};
|
|
107 |
|
|
108 |
|
|
109 |
#endif /* EVENTSYSTEMSERVER_H_ */
|
|
110 |
// EOF
|