Calling a Custom Command

This section describes the how to call the custom command with the parameters.

STRUCT SSM_START_CUSTOM_COMMAND is an API to start synchronous or asynchronous custom command. Custom commands are implemented using the MSsmCustomCommand interface. It can be called with parameters. This functionality is provided by the dll_info part of the custom command struct.

Required background

Before you start, you must know:

  • File name for the DLL containing this custom command.

  • Ordinal of the position of the custom command creation function in the specified DLL.

  • A link to a resource containing data to be passed as a parameter to the custom command (optional).

Procedure

Follow the steps given below to call a custom command:


  1. Create a custom command as shown in the code snippet.
    CreateCustomCommand::CreateCustomCommand()

  2. Initialize the custom command as shown in the code snippet.
    TInt CreateCustomCommand::Initialize( CSsmCustomCommandEnv* aCmdEnv )

  3. Call the custom command using SSM_START_CUSTOM_COMMAND as shown in the code snippet.
    
    // Valid ESsmWaitForStart struct with data
    RESOURCE SSM_START_CUSTOM_COMMAND r_command_custom_cmd1
    {
        severity = ECmdCriticalSeverity;
        execution_behaviour = ESsmWaitForStart;
        dllname = "tcust_cmd.dll";
        ordinal = 1;
        unload_on_finish = EUnloadImmediately;
        retries = 3;
        dll_data = r_command_custom_cmd_good_data;
    }
    
    // Custom command data
    RESOURCE SSM_COMMAND_CUSTOM_CMD_DATA r_command_custom_cmd_good_data
    {
        val1 = '1';
        val2 = '2';
        val3 = '3';
        val4 = '4';
        val5 = '5';
    }
    

The custom command is called.

Related concepts
Running a Custom Command