Studio:Scl msg bind: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
Line 32: Line 32:


== Examples ==
== Examples ==
 
<source lang=c>
    /* SUID = 1, Message Type = One-way Command, Send Type = By Value */
/* SUID = 1, Message Type = One-way Command, Send Type = By Value */
    #define OneWayCmd 1 | srMT_ONEc | srST_CMD_VAL
#define OneWayCmd 1 | srMT_ONEc | srST_CMD_VAL
   
   
    /* SUID = 2, Message Type = One-way Respone, Send Type = No Value */
/* SUID = 2, Message Type = One-way Respone, Send Type = No Value */
    #define OneWayRsp 2 | srMT_ONEr | srST_RSP_VAL
#define OneWayRsp 2 | srMT_ONEr | srST_RSP_VAL
   
   
    /* Structure defining the command payload */
/* Structure defining the command payload */
    typedef struct {
typedef struct {
      int f1;
  int f1;
      char f2;
  char f2;
    }CmdPayload_t;
}CmdPayload_t;
   
   
    /* Structure defining the response payload */
/* Structure defining the response payload */
    typedef struct {
typedef struct {
      short f1;
  short f1;
      float f2;
  float f2;
    }RspPayload_t;
}RspPayload_t;
   
   
    /* Use the scl_msg pragma to associate the SMIDS with their respective payloads */
/* Use the scl_msg pragma to associate the SMIDS with their respective payloads */
    #pragma scl_msg( OneWayCmd, CmdPayload_t )
#pragma scl_msg( OneWayCmd, CmdPayload_t )
    #pragma scl_msg( OneWayRsp, RspPayload_t )
#pragma scl_msg( OneWayRsp, RspPayload_t )
   
   
    /* Use the scl_msg_bind pragma to bind the one-way command and response messages */
/* Use the scl_msg_bind pragma to bind the one-way command and response messages */
    #pragma scl_msg_bind( OneWayCmd, OneWayRsp )
#pragma scl_msg_bind( OneWayCmd, OneWayRsp )
</source>


== See Also ==
== See Also ==

Revision as of 00:17, 2 October 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 )

See Also