Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

Command

Group

Generic

Description

Run an RT-LAB command for a certain RT-Lab object.
See the OP_COMMAND enumeration for a complete list of available commands and their specific requirements.

Required Control

Specific to each command, see OP_COMMAND

Usage

outputId = RtlabApi.Command (ownerId, command, attributes, values)

Input

  • ownerId: The ID of the object that owns the command. Where there is ambiguity, the owner of the two objects is the expected ID. For example, CMD_REMOVE: when the owner is a project, the command removes a model.

  • command: The command to be executed (see OP_COMMAND).

  • attributes: The tuple of attributes to send as command arguments (see OP_ATTRIBUTE). The size of the tuple must match the size of the attributeValues tuple.

  • values: The tuple of attribute values to send as command arguments. The size of the tuple must match the size of the attributes tuple.

Output

  • outputId: The ID corresponding to the object directly affected by the command. If no other object than the parent is affected, the parent ID is returned.

Return Value

  • EOK: Success.

  • EBADF: Unsupported ownerId.

  • EINVAL: Invalid arguments specified.

  • EIO: Error sending the request or receiving the reply.

  • ENOMEM: Error allocation memory for request or reply.

Examples

None

Related Items

OP_COMMAND, OP_ATTRIBUTE

Modules

import RtlabApi

Example code

import sys import RtlabApi RtlabApi.OpenProject("CommandTest") target_id = RtlabApi.FindObjectId(RtlabApi.OP_TYPE_TARGET, "test") timeout = 2000 target_cmd_arg = (RtlabApi.ATT_VALUE, RtlabApi.ATT_WAIT_FOR_COMPLETION) target_cmd_val = ("uname -a", True) RtlabApi.RegisterDisplay(RtlabApi.DISPLAY_REGISTER_ALL) RtlabApi.Command(target_id, RtlabApi.CMD_EXECUTE, target_cmd_arg, target_cmd_val) result = '' done = '' while not done: done, _, tmp = RtlabApi.DisplayInformation(timeout) result = result + tmp print(result)

 

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323
Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter