Studio:Scl msg bind

From STRIDE Wiki
Revision as of 17:52, 16 July 2008 by Stevel (talk | contribs)
Jump to navigation Jump to search

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 format of the STRIDE Unique ID (SUID), and SMIDs.