Studio:Scl msg bind: Difference between revisions
		
		
		
		Jump to navigation
		Jump to search
		
| m (Text replace - 'Category: Messages' to 'Category:Studio:Messages') | |||
| (4 intermediate revisions by 2 users not shown) | |||
| Line 32: | Line 32: | ||
| == Examples == | == Examples == | ||
| <source lang=c> | |||
| /* 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 ) | |||
| </source> | |||
| == See Also == | == See Also == | ||
| Line 62: | Line 63: | ||
| * The [[SCL_Structure|SCL Structure]] page for more information on the SMID format. | * The [[SCL_Structure|SCL Structure]] page for more information on the SMID format. | ||
| [[Category:  | [[Category:Studio:Messages]] | ||
| [[Category:Studio:SCL]] | |||
Latest revision as of 00:44, 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.