C
<message.h>
The <message.h> header defines message formats used by Qt Safe Monitor. More...
This module was introduced in QtSafeRenderer 2.1.
Classes
Message struct requesting a state change for an item | |
Message struct requesting output verification status | |
Message struct carrying a list of items for output verification. Produced as a reply to EventOutputVerificationStatusRequest | |
Message struct requesting verification of a specific item | |
Message requesting text change for an item | |
Message requesting visibility change for an item | |
Payload struct describing a single item verification entry |
Detailed Description
Event Encoding
All events are encoded to big-endian formatted text arrays before transmission. The encoding process involves:
- Converting all numeric fields to big-endian format using qToBigEndianUint32()
- Copying the event structure to a buffer
- Padding the buffer with zeros to the specified message buffer size
- Sending the encoded buffer via sendEvent()
Example: Creating a SetText Event
The following example demonstrates how to create and encode a SetTextMessageEvent:
static void setText(const quint32 itemId,
const char *text,
qchar *buf,
const size_t len,
errorFunc errorHandler)
{
struct SetTextMessageEvent request;
const quint32 eventStructSize = (quint32)sizeof(struct SetTextMessageEvent);
quint32 textLen;
int32_t ret;
if ((text == NULL) || (buf == NULL) || (len < eventStructSize)) {
return;
}
(void)memset(&request, 0, sizeof(request));
qToBigEndianUint32(EventSetText, &request.eventId);
qToBigEndianUint32(itemId, &request.itemId);
textLen = (quint32)strnlen(text, SETTEXT_MAX_TEXT_LEN);
if (textLen >= SETTEXT_MAX_TEXT_LEN) {
textLen = SETTEXT_MAX_TEXT_LEN - 1U;
}
(void)memcpy(request.text, text, textLen);
request.text[textLen] = '\0';
(void)memcpy(buf, &request, eventStructSize);
(void)memset(&buf[eventStructSize], 0x0, len - eventStructSize);
ret = sendEvent(buf, len);
if (ret < 0) {
errorHandler(FailedToSendRequest, (int64_t)ret, __LINE__);
}
}Available under certain Qt licenses.
Find out more.