|
1 // Copyright (c) 2007-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This file specifies the generic statemachine container class |
|
15 // which encapsulates the states for a specific state machine. |
|
16 // @internalComponent |
|
17 // @prototype |
|
18 // |
|
19 // |
|
20 |
|
21 #ifndef NETUPSSTATEMACHINE_H |
|
22 #define NETUPSSTATEMACNINE_H |
|
23 |
|
24 #include <e32def.h> // defines TInt |
|
25 #include <e32std.h> |
|
26 #include <e32cmn.h> // defines RPointerArray |
|
27 #include <e32base.h> // defines CBase |
|
28 |
|
29 #include <comms-infras/ss_activities.h> |
|
30 #include <comms-infras/ss_nodemessages.h> // defines TCFMessage |
|
31 |
|
32 #include "netupstypes.h" // defines MPolicyCheckRequestOriginator |
|
33 #include "netupskeys.h" // defines keys used to access the netups database |
|
34 |
|
35 #include "netupsdatabaseentry.h" // defines the Database Entry |
|
36 #include "netupsprocessentry.h" // defines the Process Entry |
|
37 #include "netupsthreadentry.h" // defines the Thread Entry |
|
38 #include "netupsstatedef.h" // defines the NetUps Process and Network Lifetime States |
|
39 |
|
40 #include <comms-infras/commsdebugutility.h> // defines the comms debug logging utility |
|
41 |
|
42 namespace NetUps |
|
43 { |
|
44 class CNetUpsImpl; |
|
45 class CState; |
|
46 |
|
47 NONSHARABLE_CLASS(CUpsStateMachine) : public CBase |
|
48 { |
|
49 public: |
|
50 static CUpsStateMachine* NewL(CNetUpsImpl& aNetUpsImpl, TInt32 ServiceId); |
|
51 ~CUpsStateMachine(); |
|
52 |
|
53 void ProcessPolicyCheckRequestL(TThreadKey& aThreadKey, const TPolicyCheckRequestData& aPolicyCheckRequestData, TRequestId aRequestId); |
|
54 void ProcessPolicyCheckRequestL(TProcessKey& aProcessKey, const TPolicyCheckRequestData& aPolicyCheckRequestData, TRequestId aRequestId); |
|
55 void IncrementConnectionCountL(TCommsIdKey& aCommsIdKey); |
|
56 void DecrementConnectionCountL(TCommsIdKey& aCommsIdKey); |
|
57 void HandleUPSRequestCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TNetUpsDecision aNetUpsDecision); |
|
58 void HandleUPSErrorOnCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TInt aError); |
|
59 void HandleProcessTermination(TProcessKey& aProcessKey); |
|
60 void HandleThreadTermination(TThreadKey& aThreadKey); |
|
61 |
|
62 TInt32 ServiceId(); |
|
63 CNetUpsImpl& NetUpsImpl(); |
|
64 |
|
65 TUint32 GetIndex(TNetUpsState netUpsState); |
|
66 private: |
|
67 void ConstructL(); |
|
68 CUpsStateMachine(CNetUpsImpl& aNetUpsImpl, TInt32 aServiceId); |
|
69 |
|
70 // methods which are declared but not defined. |
|
71 CUpsStateMachine(); |
|
72 CUpsStateMachine(const CUpsStateMachine&); |
|
73 void operator=(const CUpsStateMachine&); |
|
74 bool operator==(const CUpsStateMachine&); |
|
75 |
|
76 TUint32 GetIndex(CProcessEntry& aProcessEntry); |
|
77 static TNetUpsState GetState(CProcessEntry& aProcessEntry); |
|
78 private: |
|
79 CNetUpsImpl& iNetUpsImpl; |
|
80 TInt32 iServiceId; |
|
81 RPointerArray<CState> iState; |
|
82 |
|
83 __FLOG_DECLARATION_MEMBER; |
|
84 }; |
|
85 |
|
86 } // end of name space NetUps |
|
87 |
|
88 #endif // NETUPSSTATEMACHINE_H |