|
1 /* |
|
2 * Copyright (c) 2004 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: Implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include <flogger.h> |
|
22 #include "TCmdTerminateProcess.h" |
|
23 #include "MCEConstants.h" |
|
24 |
|
25 |
|
26 /** |
|
27 * INPUT: |
|
28 * Headers: - |
|
29 * Parameters: Process |
|
30 * IDs: - |
|
31 * |
|
32 * OUTPUT: |
|
33 * Parameters: - |
|
34 * IDs: - |
|
35 */ |
|
36 |
|
37 //_LIT(KFileDir, "Sip"); |
|
38 //_LIT(KFileName, "Tester.txt"); |
|
39 |
|
40 void TCmdTerminateProcess::ExecuteL() |
|
41 { |
|
42 // -- Setup --------------------------------------------------------------- |
|
43 |
|
44 |
|
45 // -- Execution ----------------------------------------------------------- |
|
46 /* |
|
47 // Terminate Ssc Server |
|
48 |
|
49 #if ( !defined(EKA2) && ( defined(__WINS__) || defined(__WINSCW__) ) ) |
|
50 // WINS doesn't have a concept of process (in EKA1) |
|
51 RThread process; |
|
52 TFindThread processFinder (_L("*MceServer*")); |
|
53 #else |
|
54 RProcess process; |
|
55 TFindProcess processFinder (_L("*MceServer*")); |
|
56 #endif |
|
57 |
|
58 // Find the process |
|
59 TFullName processName; |
|
60 while ( processFinder.Next( processName ) == KErrNone ) |
|
61 { |
|
62 User::InfoPrint(_L("Found Ssc server")); |
|
63 RFileLogger::Write (KFileDir,KFileName,EFileLoggingModeAppend,processName); |
|
64 User::LeaveIfError( process.Open( processFinder ) ); |
|
65 // ..and terminate it |
|
66 // process.Terminate( KErrNone ); |
|
67 process.Kill( KErrNone ); |
|
68 process.Close(); |
|
69 } |
|
70 */ |
|
71 // Terminate Sip profile server |
|
72 |
|
73 #if ( !defined(EKA2) && ( defined(__WINS__) || defined(__WINSCW__) ) ) |
|
74 // WINS doesn't have a concept of process (in EKA1) |
|
75 RThread sipProcess; |
|
76 TFindThread sipProcessFinder (_L("*SipProfile*")); |
|
77 #else |
|
78 RProcess sipProcess; |
|
79 TFindProcess sipProcessFinder (_L("*SipProfile*")); |
|
80 #endif |
|
81 |
|
82 // Find the process |
|
83 TFullName sipProcessName; |
|
84 while ( sipProcessFinder.Next( sipProcessName ) == KErrNone ) |
|
85 { |
|
86 User::InfoPrint(_L("Found profile server")); |
|
87 //RFileLogger::Write (KFileDir,KFileName,EFileLoggingModeAppend,sipProcessName); |
|
88 /*User::LeaveIfError( sipProcess.Open( sipProcessFinder ) ); |
|
89 // ..and terminate it |
|
90 // process.Terminate( KErrNone ); |
|
91 sipProcess.Kill( KErrNone ); |
|
92 sipProcess.Close();*/ |
|
93 } |
|
94 |
|
95 |
|
96 // -- Response creation --------------------------------------------------- |
|
97 } |
|
98 |
|
99 TBool TCmdTerminateProcess::Match( const TTcIdentifier& aId ) |
|
100 { |
|
101 return TTcMceCommandBase::Match( aId, _L8("TerminateProcess") ); |
|
102 } |
|
103 |
|
104 TTcCommandBase* TCmdTerminateProcess::CreateL( MTcTestContext& aContext ) |
|
105 { |
|
106 return new( ELeave ) TCmdTerminateProcess( aContext ); |
|
107 } |
|
108 /* |
|
109 |
|
110 |
|
111 |
|
112 This should be |
|
113 _LIT(KProcess,"A["); |
|
114 |
|
115 Match expects wildcards. The 0 means it only considers it found if it is |
|
116 the start of the string. |
|
117 |
|
118 > TInt perr = User::LeaveIfError (processHandle.Open |
|
119 > (processFinder,EOwnerThread)); |
|
120 > RProcess processHandle; |
|
121 > if ( perr == KErrNone ) processHandle.Kill(0); |
|
122 > CleanupClosePushL (processHandle); |
|
123 |
|
124 The CleanupClosePushL should be immediatly after the Open - least chance |
|
125 of a leaving statment being added before it is on the cleanup stack. |
|
126 |
|
127 |
|
128 > CleanupStack::PopAndDestroy (&processHandle); |
|
129 */ |