|
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 provides the implementation for the process entry. |
|
15 // @internalComponent |
|
16 // @prototype |
|
17 // |
|
18 // |
|
19 |
|
20 #include "e32base.h" // defines CleanupStack, Active Scheduler |
|
21 |
|
22 #include "netupsdatabaseentry.h" |
|
23 #include "netupsprocessentry.h" |
|
24 #include "netupsthreadentry.h" |
|
25 #include "netupsprocessmonitor.h" |
|
26 #include "netupsstatedef.h" |
|
27 |
|
28 #include <comms-infras/commsdebugutility.h> // defines the comms debug logging utility |
|
29 |
|
30 |
|
31 namespace NetUps |
|
32 { |
|
33 __FLOG_STMT(_LIT8(KNetUpsSubsys, "esock");) |
|
34 __FLOG_STMT(_LIT8(KNetUpsComponent, "NetUps");) /*esockloader*/ |
|
35 |
|
36 CProcessEntry* CProcessEntry::NewL(CDatabaseEntry& aDatabaseEntry, const TProcessId& aProcessId, CUpsStateMachine& aUpsStateMachine) |
|
37 { |
|
38 CProcessEntry* self = new (ELeave) CProcessEntry(aProcessId, aUpsStateMachine); |
|
39 |
|
40 CleanupStack::PushL(self); |
|
41 self->ConstructL(aDatabaseEntry); |
|
42 CleanupStack::Pop(self); |
|
43 |
|
44 return self; |
|
45 } |
|
46 |
|
47 CProcessEntry::~CProcessEntry() |
|
48 { |
|
49 __FLOG_1(_L("CProcessEntry %08x:\t~CProcessEntry()"), this); |
|
50 |
|
51 |
|
52 for (TInt j = iThreadEntry.Count() - 1; j >= 0; --j) |
|
53 { |
|
54 CThreadEntry* threadEntry = iThreadEntry[j]; |
|
55 __FLOG_3(_L("CProcessEntry %08x:\t~CProcessEntry(), j = %d, threadEntry = %08x"), this, j, threadEntry); |
|
56 delete threadEntry; |
|
57 } |
|
58 |
|
59 iThreadEntry.Reset(); |
|
60 iThreadEntry.Close(); |
|
61 |
|
62 delete iProcessMonitor; |
|
63 |
|
64 __FLOG_CLOSE; |
|
65 } |
|
66 |
|
67 void CProcessEntry::ConstructL(CDatabaseEntry& aDatabaseEntry) |
|
68 { |
|
69 __FLOG_OPEN(KNetUpsSubsys, KNetUpsComponent); |
|
70 __FLOG_3(_L("CProcessEntry %08x:\tConstructL(), iNetUpsState = %d, process id = %d"), this, iNetUpsState, iProcessId.Id()); |
|
71 |
|
72 iProcessMonitor = CProcessMonitor::NewL(aDatabaseEntry, *this); |
|
73 } |
|
74 |
|
75 CProcessEntry::CProcessEntry(const TProcessId& aProcessId, CUpsStateMachine& aUpsStateMachine) |
|
76 : iNetUpsState(ENull), iProcessMonitor(NULL), iProcessId(aProcessId), iUpsStateMachine(aUpsStateMachine) |
|
77 { |
|
78 } |
|
79 |
|
80 void CProcessEntry::SetNetUpsState(TNetUpsState aNetUpsState) |
|
81 { |
|
82 iNetUpsState = aNetUpsState; |
|
83 } |
|
84 |
|
85 TNetUpsState CProcessEntry::NetUpsState() const |
|
86 { |
|
87 return iNetUpsState; |
|
88 } |
|
89 |
|
90 CUpsStateMachine& CProcessEntry::UpsStateMachine() const |
|
91 { |
|
92 return iUpsStateMachine; |
|
93 } |
|
94 |
|
95 RPointerArray<CThreadEntry>& CProcessEntry::ThreadEntry() |
|
96 { |
|
97 return iThreadEntry; |
|
98 } |
|
99 |
|
100 void CProcessEntry::SetProcessMonitor(CProcessMonitor* aProcessMonitor) |
|
101 { |
|
102 iProcessMonitor = aProcessMonitor; |
|
103 __FLOG_4(_L("CProcessEntry %08x:\t SetProcessMonitor(), iNetUpsState = %d, iProcessMonitor = %08x, process id = %d"), this, iNetUpsState, iProcessMonitor, iProcessId.Id()); |
|
104 |
|
105 } |
|
106 |
|
107 CProcessMonitor* CProcessEntry::ProcessMonitor() const |
|
108 { |
|
109 return iProcessMonitor; |
|
110 } |
|
111 |
|
112 const TProcessId& CProcessEntry::ProcessId() const |
|
113 { |
|
114 return iProcessId; |
|
115 } |
|
116 |
|
117 } // end of namespace |
|
118 |