|
1 /* |
|
2 * Copyright (c) 2006 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: XIMP Framework process starter. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef XIMPPROCESSSTARTER_H |
|
19 #define XIMPPROCESSSTARTER_H |
|
20 |
|
21 #include <e32std.h> |
|
22 class TXIMPProcessStartupParam; |
|
23 |
|
24 |
|
25 |
|
26 /** |
|
27 * |
|
28 * |
|
29 * |
|
30 * |
|
31 * @lib ?library |
|
32 * @since S60 v4.0 |
|
33 */ |
|
34 class XIMPProcessStarter |
|
35 { |
|
36 public: // New methods |
|
37 /** |
|
38 * |
|
39 * |
|
40 * |
|
41 * |
|
42 */ |
|
43 IMPORT_C static void FullExePathForClienLocation( |
|
44 const TDesC& aExeName, |
|
45 TFileName& aFullExePath ); |
|
46 |
|
47 /** |
|
48 * |
|
49 * Usage example: |
|
50 * TFixedArray< TXIMPProcessStartupParam, 2 > params; |
|
51 * params[ 0 ].Set( 1, 1001 ); |
|
52 * params[ 2 ].Set( 2, _L("value") ); |
|
53 * TArray< TXIMPProcessStartupParam> paramsArray = params.Array(); |
|
54 * TInt err = XIMPProcessStarter::StartInstance( KMySrvServerExe, |
|
55 * _L("command line"), |
|
56 * ¶msArray ); |
|
57 */ |
|
58 IMPORT_C static TInt StartInstance( |
|
59 const TDesC& aFullExePath, |
|
60 const TDesC& aCommand, |
|
61 const TArray< TXIMPProcessStartupParam >* aParams ); |
|
62 |
|
63 |
|
64 /** |
|
65 * |
|
66 * |
|
67 * |
|
68 * |
|
69 */ |
|
70 IMPORT_C static TInt ConnectToServer( |
|
71 const TDesC& aFullExePath, |
|
72 const TDesC& aCommand, |
|
73 const TArray< TXIMPProcessStartupParam >* aParams, |
|
74 RSessionBase& aSessionToConnect, |
|
75 const TDesC& aServerName, |
|
76 const TVersion& aClientVersion, |
|
77 TInt aAsyncMessageSlots ); |
|
78 |
|
79 |
|
80 |
|
81 private: // Helpers |
|
82 static TInt DoStartInstance( |
|
83 const TDesC& aFullExePath, |
|
84 const TDesC& aCommand, |
|
85 const TArray< TXIMPProcessStartupParam >* aParams ); |
|
86 |
|
87 static TInt ApplyParameters( |
|
88 const TArray< TXIMPProcessStartupParam >* aParams, |
|
89 RProcess& aProcess ); |
|
90 |
|
91 }; |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 /** |
|
97 * Generic process startup parameters. |
|
98 * |
|
99 * |
|
100 * |
|
101 */ |
|
102 class TXIMPProcessStartupParam |
|
103 { |
|
104 public: |
|
105 |
|
106 /** |
|
107 * C++ constructor |
|
108 */ |
|
109 IMPORT_C TXIMPProcessStartupParam(); |
|
110 |
|
111 /** |
|
112 * |
|
113 */ |
|
114 void Set( TInt aSlot, const RHandleBase& aHandle ); |
|
115 void Set( TInt aSlot, const RSubSessionBase& aSubSession ); |
|
116 void Set( TInt aSlot, const TDesC16& aDes ); |
|
117 void Set( TInt aSlot, const TDesC8& aDes ); |
|
118 IMPORT_C void Set( TInt aSlot, TInt aInt ); |
|
119 |
|
120 |
|
121 /** |
|
122 * |
|
123 * |
|
124 * @return |
|
125 */ |
|
126 TInt ApplyParam( RProcess& aProcess ) const; |
|
127 |
|
128 |
|
129 |
|
130 private: //data |
|
131 |
|
132 enum TParamType{ EUnknown, EHandle, ESubSession, |
|
133 EDes16, EDes8, EInt }; |
|
134 //OWN: |
|
135 TParamType iType; |
|
136 |
|
137 //OWN: |
|
138 TInt iSlot; |
|
139 |
|
140 //OWN: |
|
141 const RHandleBase* iHandle; |
|
142 const RSubSessionBase* iSubSession; |
|
143 TPtrC16 iDes16; |
|
144 TPtrC8 iDes8; |
|
145 TInt iInt; |
|
146 }; |
|
147 |
|
148 |
|
149 #endif // XIMPPROCESSSTARTER_H |
|
150 |
|
151 |