|
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 #include <f32file.h> |
|
19 #include <sipclientinstaller.h> |
|
20 |
|
21 #include "TCmdInstallClient.h" |
|
22 #include "SIPConstants.h" |
|
23 |
|
24 /** |
|
25 * INPUT: |
|
26 * Headers: - |
|
27 * Parameters: ClientInfo |
|
28 * IDs: - |
|
29 * |
|
30 * OUTPUT: |
|
31 * Parameters: - |
|
32 * IDs: - |
|
33 */ |
|
34 void TCmdInstallClient::ExecuteL() |
|
35 { |
|
36 // -- Setup --------------------------------------------------------------- |
|
37 |
|
38 // Get ClientInfo XML document and write it to a file |
|
39 PrepareFileL(); |
|
40 |
|
41 // -- Execution ----------------------------------------------------------- |
|
42 |
|
43 // Create SIP client installer and install |
|
44 CSIPClientInstaller* clientInstaller = |
|
45 CSIPClientInstaller::NewLC( KInstallerPath ); |
|
46 clientInstaller->InstallL(); |
|
47 CleanupStack::PopAndDestroy(); // clientInstaller |
|
48 |
|
49 // -- Response creation --------------------------------------------------- |
|
50 } |
|
51 |
|
52 void TCmdInstallClient::PrepareFileL() |
|
53 { |
|
54 // Get ClientInfo XML document |
|
55 TPtrC8 info = ExtractTextL( KParamClientInfo ); |
|
56 |
|
57 // Write the document into a file. |
|
58 RFs fs; |
|
59 User::LeaveIfError( fs.Connect() ); |
|
60 CleanupClosePushL( fs ); |
|
61 |
|
62 RFile out; |
|
63 User::LeaveIfError( out.Replace( fs, CSIPClientInstaller::XMLFileName(), |
|
64 EFileWrite ) ); |
|
65 CleanupClosePushL( out ); |
|
66 User::LeaveIfError( out.Write( info ) ); |
|
67 |
|
68 out.Close(); |
|
69 fs.Close(); |
|
70 CleanupStack::PopAndDestroy( 2 ); // out, fs |
|
71 } |
|
72 |
|
73 TBool TCmdInstallClient::Match( const TTcIdentifier& aId ) |
|
74 { |
|
75 return TTcSIPCommandBase::Match( aId, _L8("InstallClient") ); |
|
76 } |
|
77 |
|
78 TTcCommandBase* TCmdInstallClient::CreateL( MTcTestContext& aContext ) |
|
79 { |
|
80 return new( ELeave ) TCmdInstallClient( aContext ); |
|
81 } |
|
82 |