87 } |
87 } |
88 |
88 |
89 PRINT(_L("CWatchdog::ConstructL() - create observer")); |
89 PRINT(_L("CWatchdog::ConstructL() - create observer")); |
90 iShutdownObserver = CWDShutdownObserver::NewL( *this ); |
90 iShutdownObserver = CWDShutdownObserver::NewL( *this ); |
91 iSelfShutdownObserver = CWDSelfShutdownObserver::NewL( *this ); |
91 iSelfShutdownObserver = CWDSelfShutdownObserver::NewL( *this ); |
92 |
|
93 RProcess process; |
|
94 process.SetPriority( EPriorityBackground ); |
|
95 process.Close(); |
|
96 } |
92 } |
97 |
93 |
98 void CWatchdog::Start() |
94 void CWatchdog::Start() |
99 { |
95 { |
100 |
|
101 PRINT(_L("CWatchdog::Start()")); |
96 PRINT(_L("CWatchdog::Start()")); |
102 |
97 |
|
98 // Double check that harvester server is not already running |
|
99 TFullName name; |
|
100 TInt res( KErrNone ); |
|
101 |
|
102 // find really Harvester Server, using TFindServer to avoid logon a dead process |
|
103 TFindServer findServer( KHarvesterServerProcess ); |
|
104 if ( findServer.Next(name) == KErrNone ) |
|
105 { |
|
106 TFindProcess findProcess( KHarvesterServerProcess ); |
|
107 if ( findProcess.Next(name) == KErrNone ) |
|
108 { |
|
109 PRINT(_L("CWatchdog::Start() - server already running, start listening")); |
|
110 |
|
111 iProcess.Close(); |
|
112 res = iProcess.Open(name); |
|
113 if ( res != KErrNone ) |
|
114 { |
|
115 PRINT(_L("CWatchdog::Start() - error in starting listening ")); |
|
116 return; |
|
117 } |
|
118 iState = EWaitingRendezvous; |
|
119 SetActive(); |
|
120 return; |
|
121 } |
|
122 } |
|
123 |
|
124 // close the panic process |
|
125 TFindProcess findProcess( KHarvesterServerProcess ); |
|
126 if ( findProcess.Next(name) == KErrNone ) |
|
127 { |
|
128 iProcess.Close(); |
|
129 } |
|
130 |
103 // Create the server process |
131 // Create the server process |
104 TInt res( KErrNone ); |
|
105 |
|
106 // KNullDesC param causes server's E32Main() to be run |
132 // KNullDesC param causes server's E32Main() to be run |
107 res = iProcess.Create( KHarvesterServerExe, KNullDesC ); |
133 res = iProcess.Create( KHarvesterServerExe, KNullDesC ); |
108 if ( res != KErrNone ) |
134 if ( res != KErrNone ) |
109 { |
135 { |
110 PRINT(_L("CWatchdog::ConstructL() - error in server creation")); |
136 PRINT(_L("CWatchdog::ConstructL() - error in server creation")); |