Studio:Scl msg bind: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
(New page: = 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 o...)
 
No edit summary
Line 15: Line 15:
| STRIDE message ID; ID of the one-way command.
| STRIDE message ID; ID of the one-way command.
|-  
|-  
| ''rsp_SMID1''
| ''rsp-SMID1''
| Integer
| Integer
| Message ID of the one-way response to bind to the one-way command. The SMID attributes determine the behavior.
| Message ID of the one-way response to bind to the one-way command. The SMID attributes determine the behavior.
Line 27: Line 27:
* More than one response can be bound to a specific command. Conversely, a specific response can be bound to more than one command.
* 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 cmd-SMID must have the one-way command attribute set.
* The rsp_SMID must have the one-way response 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 must have already been defined as one-way messages in prior scl_msg() definitions.
* The cmd-SMID and rsp-SMID cannot be the same.
* The cmd-SMID and rsp-SMID cannot be the same.
Line 40: Line 40:
   
   
     /* Structure defining the command payload */
     /* Structure defining the command payload */
     typedef struct
     typedef struct {
    {
       int f1;
       int f1;
       char f2;
       char f2;
Line 47: Line 46:
   
   
     /* Structure defining the response payload */
     /* Structure defining the response payload */
     typedef struct
     typedef struct {
    {
       short f1;
       short f1;
       float f2;
       float f2;

Revision as of 16:58, 16 July 2008

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 )