FireSync API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kMsgInfo Class Reference

Description

Represents message source information and an attached message.

kMsgInfo is a top-level container for a FireSync data message. Message content can be accessed via the Message property.

Each kMsgInfo instance also contains a small amount of metadata related to message routing. The Source property describes the origin of a message (node id, block id, port id). The Tag property is provided for use within data processing envionments, for implementation-specific purposes; this property should typically be ignored in application code.

The following example illustrates how to log various information related to a standard FireSync video message.

kStatus PrintVideoMessage(kMsgInfo msgInfo)
{
kMsgSet message = kMsgInfo_Message(msgInfo);
kMsgSource source = kMsgInfo_Source(msgInfo);
kLogf("Received %s from Node-%u, Block-%u, Port-%u", kType_Name(kObject_Type(message)),
source.nodeId, source.blockId, source.portId);
//verify that the message is of type kMsg (the most common message type; used for video messages)
if (kObject_Is(message, kTypeOf(kMsg)))
{
const kStamp* stamp = kMsg_Stamp(message);
kObject content = kMsg_Data(message);
kLogf(" Time: %llu", stamp->time);
kLogf(" Encoder: %lld", stamp->encoder);
kLogf(" Content Type: %s", kType_Name(kObject_Type(content)));
if (kObject_Is(content, kTypeOf(kImage)))
{
kLogf(" Pixel Type: %s", kType_Name(kImage_PixelType(content)));
kLogf(" Width: %u", kImage_Width(content));
kLogf(" Height: %u", kImage_Height(content));
}
}
return kOK;
}
Inheritance diagram for kMsgInfo:
Inheritance graph

Public Member Functions

kStatus kMsgInfo_Construct (kMsgInfo *info, kMsgSource source, kSize tag, kMsgSet message, kAlloc allocator)
 Constructs a kMsgInfo object. More...
 
kMsgSet kMsgInfo_Message (kMsgInfo info)
 Gets the message object. More...
 
kStatus kMsgInfo_SetMessage (kMsgInfo info, kMsgSet message)
 Sets the message object. More...
 
kStatus kMsgInfo_SetSource (kMsgInfo info, kMsgSource source)
 Sets the message source. More...
 
kStatus kMsgInfo_SetTag (kMsgInfo info, kSize tag)
 Sets the message tag. More...
 
kMsgSource kMsgInfo_Source (kMsgInfo info)
 Gets the message source. More...
 
kSize kMsgInfo_Tag (kMsgInfo info)
 Gets the message tag. More...
 

The documentation for this class was generated from the following file: