Back to Responder Commands
CMD_MSGRESP_ADD

Command:             CMD_MSGRESP_ADD
Destination:         SD_RESP
Destination Channel: Vehicle Network Protocol Channel ID

Description

Clients use this command to add a condition filter and a list of messages to a table of entries that can be used to respond to Data or Event messages from the server. Multiple responses may be specified for a channel. Incoming messages will be checked against each condition in the order that they were added. The response of each conforming condition will cause the responses to be sent to the server.

A message conforms to a condition if and only if it conforms to all the conditions Filter Block(s).

Command Data Format
Flags Number of Filter Blocks Number of Responses Old Handle Action reserved Action Value
1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 2 bytes

Byte Offset of First Filter Field Length of First Filter Field Data Type Operator reserved First Value Second Value Padding
2 bytes 2 bytes 1 byte 1 byte 2 bytes n bytes n bytes 0-3 bytes
One Filter Block (The total number of blocks is defined in the second byte of the command)

Frame Header Command/Data/Event/Misc Header Remainder of Message Padding
8 bytes variable variable 0-3 bytes
One Response Block (The total number of blocks is defined in the third byte of the command)

Flags
There is one flag in this field which is used to specify whether the response is on or off

Active/Inactive Flag
FILTER_FLAG_ACTIVE Every incoming message will be checked against the filter.
FILTER_FLAG_INACTIVE No incoming messages will be checked against the filter.


Number of Filter Blocks

This field is used to specify the number (unsigned) of blocks contained in this condition. Each block defines a starting location and the number of bytes to be checked starting at that location. In order for a message to conform to the condition, it must conform to all of the Filter Blocks. If this is set to zero, the response will not be triggered by any data message. However, an EVENT_RESPONSE message sent to the Message Responder will trigger the response if it is active.


Number of Responses

This field is used to specify the number (unsigned) of response messages contained in the command. Each response is a complete message including the Frame Header and any required padding.
Old Handle
This is the handle of a response to replace. If set to zero, this response is added to the current list of responses. If it is non-zero, the existing response is replaced with this response. The same response handle is used and the new response is placed at the same position in the list of responses as held by the old response.


Action

This entry specifies what should be done upon receipt of conforming data frames. The first three are values, only one of which may be present. The rest are flags which may be ORed with any of the three values.

Action Codes
FR_RESP_AFTER_EVENT The response messages are sent upon receipt of a message that conforms to the filter conditions.
FR_RESP_AFTER_PERIOD The response messages are sent after the specified time has expired following the receipt of a message that conforms to the filter conditions. If conforming messages continue to arrive before the specified time has elapsed, no messages are sent. If no conforming message is received, the response messages are send out periodically.
FR_IGNORE_DURING_PER The response messages are not sent for the specified time following the receipt of a message that conforms to the filter conditions. This effectively causes incoming messages to be ignored for the specified time after a response has been sent.
Action Flags
FR_PERIOD_MSGS This is a flag that can be ORed with one of the above values. When present, the time value referred to is changed to be a message counter.
FR_DEACT_AFTER_PER This is a flag that can be ORed with one of the above values. When present, the response will deactivate itself after the specified time period following the receipt of a message that conforms to the filter. This option may be used limit the amount of time that a given response is valid.
FR_DEACT_ON_EVENT This is a flag that can be ORed with one of the above values. When present, the response will deactivate itself upon the receipt of a conforming message.
FR_DELETE This is a flag that can be ORed with either of the two previous flags to change the action from deactivating a response to deleting it.

Action Value
The amount of time in tens of milliseconds or the number of conforming messages to use for the period specified by the Action entry.

Filter Block

Each filter block specifies a section of the message to be checked. In order for a message to conform to a condition, it must conform to all of the defined blocks.

The Byte Offset is from the beginning of the portion of the message specified in the Data Type Index. Note that the message header is right justified in its byte field.

The field length defines the number of bytes to be checked at the specified location in the message.

The Data Type specifies which portion of the message the Byte Offset references.

FILTER_DATA_TYPE_HEADER_FRAME Message Header Frame (prepended to the message by the ) 
FILTER_DATA_TYPE_HEADER Message header
FILTER_DATA_TYPE_DATA Message data
FILTER_DATA_TYPE_EXTRA_DATA Message extra data
FILTER_EVENT_TYPE_HEADER Event Header Frame
FILTER_EVENT_TYPE_DATA Event data

Operator Value 1 Value 2 notes
BIT_FIELD_CHECK Pattern Mask Bit check with 0, 1 and don't care.
SVALUE_GT Value not used Signed value compare
SVALUE_GE Value not used Signed value compare
SVALUE_LT Value not used Signed value compare
SVALUE_LE Value not used Signed value compare
VALUE_EQ Value not used Check for value equality
VALUE_NE Value not used Check for value inequality
UVALUE_GT Value not used Unsigned value compare
UVALUE_GE Value not used Unsigned value compare
UVALUE_LT Value not used Unsigned value compare
UVALUE_LE Value not used Unsigned value compare
DIG_LOW_TO_HIGH Bit Mask not used Check for 0 to 1
DIG_HIGH_TO_LOW Bit Mask not used Check for 1 to 0
DIG_TRANSITION Bit Mask not used Check for change

BIT_FIELD_CHECK

A message conforms to a BIT_FIELD_CHECK Filter Block when the specified message byte(s) are identical to those in the Pattern. The Mask allows portions of one or more message bytes to be ignored. Each bit set in the Mask, indicates that the corresponding bit in the message must match the corresponding Pattern bit. Each bit cleared in the Mask, indicates that the corresponding bit in the message may be either set or reset.
SVALUE, VALUE and UVALUE comparisons
A message conforms to one of these Filter Blocks when the specified message byte(s) when taken as a signed or unsigned character, short or long value (8, 16 or 32 bits) is greater than, etc. the value present in Value1.
DIG comparisons
A message conforms to one of these Filter Blocks when the specified bit makes a low to high or high to low transition or changes state. The Bit Mask is used to isolate a single bit to be checked in a byte. If bit 0, the least significant bit, is to be checked, the Bit Mask should be set to 1.
Response Block
Each response block is a complete message including the Frame Header. The Source and Source Channel will be overwritten when the message is sent and may be set to zero. Multi-byte fields such as the Data Length in the Frame Header must be in network order.

Two flag bits are present in the two most significant bits of the Frame Type Field of the Frame Header of each response.  These bits are used by the responder and are stripped off when the message is sent.

 
Bit 7 Set:     Don't wait for a response from this command before sending the next response.
Clear: Wait for a response from this command before sending the next response.
Bit 6 Set:     Send out this command after all outstanding responses have been received.
Clear: Send out this command without regard to any outstanding responses.
Response Data Format
Filter Handle Padding
1 byte 3 bytes

Response handles range from 1 through 255. Response handles are shared between channels and client. That is, no more than 255 responses may be defined for a single .


Response Return Codes

RESP_OK Execution of the command was successful.
RESP_INVAL_CHAN The specified channel is invalid.
RESP_UNSUPPORTED This command is not supported on the specified channel.
RESP_UNREG The specified source channel is not registered with the server.
RESP_UNKNOWN_ERR An unknown error occurred.
RESP_MEM_ALLOC_ERROR Could not allocate memory for the filter or response.
RESP_INVAL_LEN The filter or response is either too long or too short according to its fields.

|Top|