op_ima_obj_command()
Abstract
Executes a command supported by the specified object.
Syntax
op_ima_obj_command (objid, cmd_name)
| Argument | Type | Description |
|---|---|---|
objid |
Objid |
object ID of the object-of-interest [An object ID of a channel object can be obtained via a KP in the Topo package ( op_topo_child()), which is applied to the object ID of a receiver or transmitter object; transceiver object ID’s can be obtained via the KP op_id_from_name().] |
cmd_name |
const char* |
name of the command to be executed [This is a character string which must be one of the valid commands accepted by the specified object (see Table 64 "Object Command String Symbolic Constants" on page 17); supported object commands are also listed in the Details section.] |
Return Type
Compcode
Completion code indicating whether the operation completed successfully.
This code can be compared to the two symbolic constants OPC_COMPCODE_SUCCESS and OPC_COMPCODE_FAILURE.
Example
Excerpt from: example model (models/std/eth_net); process model (eth_mac); state (TX_ABORT); enter execs.
/* jamming bit sequence has been transmitted. */
/* stop the remainder of the packet from being */
/* transmitted */
op_ima_obj_command (tx_channel_objid, "abort");
/* if the length of the fragment is greater */
/* than a slot time, this is termed a late collision */
if (frag_time > SLOT_TIME)
tx_comp_status = STATUS_ERR_LATE_COLL;
Details
Commands are named internal functions that an object supports, and which can be remotely invoked by a process. The commands supported by objects are limited to a few special purposes, as listed below:
Table 10-1: Object Commands by Object Type
| Object Type | Supported Command |
|---|---|
| point-to-point link bus link radio transmitter channel |
abort—immediately aborts the current packet transmission |
| radio receiver channel | flush—immediately removes all packets in the process of being received |
Purpose
Provides a mechanism for a process to remotely control an object in a specialized way (i.e., by executing an accepted command). Commands are not supported by modules which run processes (i.e., processors and queues), since these objects can be remotely controlled using the general remote interrupt facility provided by op_intrpt_schedule_remote(). The currently supported set of object commands are limited to transmission and reception issues, and the objects which support commands are limited to broadcast transceiver channels.
Errors
- Program Abort: Segmentation violation. (due to a malformed
cmd_nameargument) - Recoverable Error: Object ID (
<objid>) is out-of-range. - Recoverable Error: Object (
<objid>) does not support use of commands. - Recoverable Error: Execution of command (
<cmd_name>) failed for object (<objid>). (due to an incorrect command name or a logical error encountered in executing the command) - Recoverable Error: Object ID (
<objid>) refers to a restricted object.
Reference
- Use the KPs op_ima_obj_attr_set(), op_ima_obj_attr_set_dbl(), op_ima_obj_attr_set_int32(), op_ima_obj_attr_set_objid(), op_ima_obj_attr_set_str(), and op_ima_obj_attr_set_toggle() to assign a value to an object attribute
- Use the KP op_intrpt_schedule_remote() to schedule a remote interrupt for an remote object
- Use the KP op_pk_deliver() to deliver a packet to a remote object
- Use the KP op_id_self() to obtain the object ID of the surrounding processor or queue
- Use the KP op_id_from_name() to obtain the object ID of an arbitrary object