|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-F14A2C1F-7803-5D93-B871-6AAC30F50115" xml:lang="en"><title>Calling |
|
13 a Custom Command</title><shortdesc>This section describes the how to call the custom command with |
|
14 the parameters. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
15 <context><p> <codeph>STRUCT SSM_START_CUSTOM_COMMAND</codeph> is an API to |
|
16 start synchronous or asynchronous custom command. Custom commands are implemented |
|
17 using the <xref href="GUID-DEDD8780-C422-3239-ACDC-A66D209992E6.dita"><apiname>MSsmCustomCommand</apiname></xref> interface. It can be called |
|
18 with parameters. This functionality is provided by the <codeph>dll_info</codeph> part |
|
19 of the custom command struct. </p> <p><b>Required background</b></p><p>Before |
|
20 you start, you must know:</p><ul> |
|
21 <li><p>File name for the DLL containing this custom command.</p></li> |
|
22 <li><p>Ordinal of the position of the custom command creation function in |
|
23 the specified DLL.</p></li> |
|
24 <li><p>A link to a resource containing data to be passed as a parameter to |
|
25 the custom command (optional).</p></li> |
|
26 </ul><p><b>Procedure</b></p><p>Follow the steps given below to call a custom |
|
27 command:</p></context> |
|
28 <steps id="GUID-38AF9DBD-A973-5319-8D0C-309CBD56A672"> |
|
29 <step id="GUID-8FB256A0-F9A8-5EAA-A6B1-D4BB5326B86F"><cmd/> |
|
30 <info>Create a custom command as shown in the code snippet. </info> |
|
31 <stepxmp><codeblock id="GUID-9AF71EED-DE52-5459-8EF7-50179547F2CC" xml:space="preserve">CreateCustomCommand::CreateCustomCommand()</codeblock> </stepxmp> |
|
32 </step> |
|
33 <step id="GUID-122D2B5C-15DA-5AAD-BE30-E16C917C0EB0"><cmd/> |
|
34 <info>Initialize the custom command as shown in the code snippet. </info> |
|
35 <stepxmp><codeblock id="GUID-CB9868B4-1EDC-5C21-B429-E3E2B201CF40" xml:space="preserve">TInt CreateCustomCommand::Initialize( CSsmCustomCommandEnv* aCmdEnv )</codeblock> </stepxmp> |
|
36 </step> |
|
37 <step id="GUID-E52563F4-D40D-5F57-8F4E-E9461CEF1E2C"><cmd/> |
|
38 <info>Call the custom command using <codeph>SSM_START_CUSTOM_COMMAND</codeph> as |
|
39 shown in the code snippet. </info> |
|
40 <stepxmp><codeblock id="GUID-0D3E1107-2EAC-5F8A-A01A-B53BDE25B596" xml:space="preserve"> |
|
41 // Valid ESsmWaitForStart struct with data |
|
42 RESOURCE SSM_START_CUSTOM_COMMAND r_command_custom_cmd1 |
|
43 { |
|
44 severity = ECmdCriticalSeverity; |
|
45 execution_behaviour = ESsmWaitForStart; |
|
46 dllname = "tcust_cmd.dll"; |
|
47 ordinal = 1; |
|
48 unload_on_finish = EUnloadImmediately; |
|
49 retries = 3; |
|
50 dll_data = r_command_custom_cmd_good_data; |
|
51 } |
|
52 |
|
53 // Custom command data |
|
54 RESOURCE SSM_COMMAND_CUSTOM_CMD_DATA r_command_custom_cmd_good_data |
|
55 { |
|
56 val1 = '1'; |
|
57 val2 = '2'; |
|
58 val3 = '3'; |
|
59 val4 = '4'; |
|
60 val5 = '5'; |
|
61 } |
|
62 </codeblock> </stepxmp> |
|
63 </step> |
|
64 </steps> |
|
65 <result><p>The custom command is called. </p> </result> |
|
66 </taskbody><related-links> |
|
67 <link href="GUID-EFBBB53F-8402-5010-8B8D-96D0FC46F784.dita"><linktext>Creating |
|
68 a Custom Command</linktext></link> |
|
69 <link href="GUID-63F2124B-9B41-58D8-9439-CE4D8C3503D8.dita"><linktext>Running a |
|
70 Custom Command</linktext></link> |
|
71 </related-links></task> |