Running a Custom Command

This section describes how to run a custom command.

Required background

Before you start, you must refer to the CommandList resource file that contains the list of custom commands.

Introduction

The SSM_START_CUSTOM_COMMAND resource struct provides data to be interpreted by the custom command as arguments. The MSsmCustomCommand interface provides a mechanism to initialise Thread Local Storage (TLS). TLS is used by multiple custom command implementations within a single DLL. This interface provides a mechanism for the plug-in to perform some clean-up before the DLL is unloaded.

Procedure

Follow the procedure given below to run the 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';
    }
    
  4. Run the custom command as shown in the code snippet.

    void CreateCustomCommand::Execute( const TDesC8& aParams, TRequestStatus& aRequest )
    

Result

The custom command is succesfully implemented.