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 Harvester Server |
|
103 TFindProcess findProcess( KHarvesterServerProcess ); |
|
104 if ( findProcess.Next(name) == KErrNone ) |
|
105 { |
|
106 PRINT(_L("CWatchdog::Start() - server already running, start listening")); |
|
107 |
|
108 iProcess.Close(); |
|
109 res = iProcess.Open(name); |
|
110 if ( res != KErrNone ) |
|
111 { |
|
112 PRINT(_L("CWatchdog::Start() - error in starting listening ")); |
|
113 return; |
|
114 } |
|
115 iState = EWaitingRendezvous; |
|
116 SetActive(); |
|
117 return; |
|
118 } |
|
119 |
103 // Create the server process |
120 // Create the server process |
104 TInt res( KErrNone ); |
|
105 |
|
106 // KNullDesC param causes server's E32Main() to be run |
121 // KNullDesC param causes server's E32Main() to be run |
107 res = iProcess.Create( KHarvesterServerExe, KNullDesC ); |
122 res = iProcess.Create( KHarvesterServerExe, KNullDesC ); |
108 if ( res != KErrNone ) |
123 if ( res != KErrNone ) |
109 { |
124 { |
110 PRINT(_L("CWatchdog::ConstructL() - error in server creation")); |
125 PRINT(_L("CWatchdog::ConstructL() - error in server creation")); |