Monitor Happened Message

Checks if at a specified byte index, a message has a specific value at least once during a timeout.

The call to this function will block the execution until the message that satisfies the conditions is found or the timeout is expired.

Arguments Description

message_path (str): The message path should be in the format: BusName::MsgId.

byte_indexs (list[int]): The list of bytes indexes to be checked.

byte_values (list[int]): The list of bytes values.

byte_masks (list[int]): The list of bytes masks.

timeout (int): The timeout in millliseconds.

Returns

bool: True if at a specified byte index, the message has a specific value at least once during a timeout; otherwise, False.

Examples

# In example 1, the keyword will check that at least one recieved value satisfies the conditions during the timeout (1000 ms).
# Which means they have a payload of ${0x1,0x2,0x3,0x4,0xF4,0xF6,0x05,0x01}.
${path} Set Variable ${BusName}::${MsgId}
${byte_indxs} Create List ${0} ${1} ${2} ${3} ${4} ${5} ${6} ${7}
${byte_vals} Create List ${0x1} ${0x2} ${0x3} ${0x4} ${0xF4} ${0xF6} ${0x05} ${0x01}
${byte_masks} Create List ${0xFF} ${0xFF} ${0xFF} ${0xFF} ${0xFF} ${0xFF} ${0xFF} ${0xFF}
${timeout} Set Variable ${1000}
Monitor Happened Message ${path} ${byte_indxs} ${byte_vals} ${byte_masks} ${timeout}
# In example 2, the keyword will check that at least one recieved value satisfies the conditions during the timeout (1000 ms).
# But in this case the byte id 1 and will be ignored.
${path} Set Variable ${BusName}::${MsgId}
${byte_indxs} Create List ${0} ${2} ${3} ${4} ${5} ${6} ${7}
${byte_vals} Create List ${0x1} ${0x3} ${0x4} ${0xF4} ${0xF6} ${0x05} ${0x01}
${byte_masks} Create List ${0xFF} ${0xFF} ${0xFF} ${0xFF} ${0xFF} ${0xFF} ${0xFF} ${0xFF}
${timeout} Set Variable ${1000}
Monitor Happened Message ${path} ${byte_indxs} ${byte_vals} ${byte_masks} ${timeout}
# In example 3, the keyword will check that at least one recieved value satisfies the conditions during the timeout (1000 ms).
# NB: The check on the Bytes with index 0 and index 1 is ignored since the mask is null.
# The bytes mask enables the selective exclusion of specific bits from the comparison (the bits corresponding to a null mask).
${path} | Set Variable ${BusName}::${MsgId}
${byte_indxs} | Create List ${0} ${1} ${2} ${3} ${4} ${5} ${6} ${7}
${byte_vals} | Create List ${0x1} ${0x2} ${0x3} ${0x4} ${0xF4} ${0xF6} ${0x05} ${0x01}
${byte_masks} | Create List ${0x00} ${0x00} ${0xFF} ${0xFF} ${0xFF} ${0xFF} ${0xFF} ${0xFF}
${timeout} | Set Variable ${1000} |
Monitor Happened Message ${path} ${byte_indxs} ${byte_vals} ${byte_masks} ${timeout}

Note

No message observer needs to be started to monitor the message.

If a message observer on that message is already active, all the received values of that observer will be cleared. Nevertheless, the observer will not be stopped after the timeout and will continue monitoring the message.