Studio:Scl msg bind: Difference between revisions
Jump to navigation
Jump to search
m (Scl msg bind moved to Studio:Scl msg bind) |
m (Text replace - 'Category: SCL' to 'Category:Studio:SCL') |
||
Line 64: | Line 64: | ||
[[Category: Messages]] | [[Category: Messages]] | ||
[[Category: SCL]] | [[Category:Studio:SCL]] |
Revision as of 00:10, 21 August 2009
The scl_msg_bind pragma
The scl_msg_bind pragma directs the SCL compiler to bind one or more one-way response messages to a one-way command message. This pragma has no direct effect on the messages; rather, it allows the message display user interface to associate the cmd-SMID and rsp-SMID as if they were a single two-way message.
Syntax
#pragma scl_msg_bind(cmd-SMID, rsp-SMID1, rsp-SMID2..n)
Parameters | Type | Description |
cmd-SMID | Integer | STRIDE message ID; ID of the one-way command. |
rsp-SMID1 | Integer | Message ID of the one-way response to bind to the one-way command. The SMID attributes determine the behavior. |
rsp-SMID2..n | Integer | Optional additional response messages to bind to the one-way command. |
Notes
- More than one response can be bound to a specific command. Conversely, a specific response can be bound to more than one command.
- The cmd-SMID must have the one-way command attribute set.
- The rsp-SMID must have the one-way response attribute set.
- The cmd-SMID and rsp-SMID must have already been defined as one-way messages in prior scl_msg() definitions.
- The cmd-SMID and rsp-SMID cannot be the same.
Examples
/* SUID = 1, Message Type = One-way Command, Send Type = By Value */
#define OneWayCmd 1 | srMT_ONEc | srST_CMD_VAL
/* SUID = 2, Message Type = One-way Respone, Send Type = No Value */
#define OneWayRsp 2 | srMT_ONEr | srST_RSP_VAL
/* Structure defining the command payload */
typedef struct {
int f1;
char f2;
}CmdPayload_t;
/* Structure defining the response payload */
typedef struct {
short f1;
float f2;
}RspPayload_t;
/* Use the scl_msg pragma to associate the SMIDS with their respective payloads */
#pragma scl_msg( OneWayCmd, CmdPayload_t )
#pragma scl_msg( OneWayRsp, RspPayload_t )
/* Use the scl_msg_bind pragma to bind the one-way command and response messages */
#pragma scl_msg_bind( OneWayCmd, OneWayRsp )
See Also
- The scl_msg pragma.
- The SCL Structure page for more information on the SMID format.