Target Communication Framework Services - Context Reset

Context Reset Service

Version History

Version Date Change
1.0 2019-03-18 Initial

Overview

ContextReset allows to execute reset commands on the taget. The exact behavior of reset command depends on the taget.

Clients can use getCapabilities command to learn about available reset types.

The service uses standard format for error reports, see Error Report Format.

Commands

Get Capabilities


C • <token> • ContextReset • getCapabilities • <string: context ID>

The command reports reset service capabilities to clients so they can adjust to different implementations of the service. When called with a null ("") context ID the global capabilities are returned, otherwise context specific capabilities are returned.

Reply:


R • <token><error report><service capabilities><service capabilities><object>

Service capabilities consist of a list of properties. All properties are optional. Tools and targets can define additional properties.

Reset


C • <token> • ContextReset • reset • <string: context ID><string: reset type><reset parameters><reset parameters><object>

The command performs reset of a specified context.

Reset parametes are optional. Tools and targets can define additional properties.

Predefined parameters are:

Reply:


R • <token><error report>

API

public interface IContextReset extends IService {

    /**
     * Service name.
     */
    static final String NAME = "ContextReset";

    /** The name of the reset type, String. */
    static final String CAPABILITY_TYPE = "Type";

    /** Brief description of the reset type, String. */
    static final String CAPABILITY_DESCRIPTION = "Description";

    /**
     * Report context reset service capabilities to clients so they can adjust
     * to different implementations of the service.
     *
     * @param ctx - a context ID.
     * @param done - command result call back object.
     * @return - pending command handle.
     */
    IToken getCapabilities(String context_id, DoneGetCapabilities done);

    /**
     * Call back interface for 'getCapabilities' command.
     */
    interface DoneGetCapabilities {
        /**
         * Called when 'getCapabilities' command is done.
         *
         * @param token - command handle.
         * @param error - error object or null.
         * @param capabilities - context reset service capabilities description.
         */
        void doneGetCapabilities(IToken token, Exception error, Collection<Map<String,Object>> capabilities);
    }

    /**
     * If true, context gets suspended after reset, Boolean.
     */
    static final String PARAM_SUSPEND = "Suspend";

    /**
     * Reset a specified context.
     *
     * @param context_id - a context ID, usually one returned by Run Control or Memory services.
     * @param type - name of the reset type.
     * @param params - parameters to control the context reset.
     * @param done - command result call back object.
     * @return - pending command handle.
     */
    IToken reset(String context_id, String reset_type, Map<String,Object> params, DoneReset done);

    /**
     * Call back interface for 'reset' command.
     */
    interface DoneReset {
        /**
         * Called when reset is done.
         *
         * @param token - command handle.
         * @param error - error object or null.
         */
        void doneReset(IToken token, Exception error);
    }
}