MessageUtil¶
-
class
kanzi::connect::MessageUtil¶ Collection of utility functions related to message handling.
Public Static Functions
Builds a reply message to the provided message package.
- Parameters
source – The message package.
- Returns
The allocated message.
-
template<class
_T>
static inline _TbuildReplyTo(const MessagePackage &source)¶ Builds a reply message to provided package.
- Parameters
source – source message package.
- Returns
new message - passed by value.
-
template<class
_T>
static inline voidbuildReplyTo(const MessagePackage &source, _T &messageObject)¶ Builds a reply message to the provided package.
- Parameters
source – Source message package.
messageObject – Target message object.
-
static bool
matchEventToMessage(const string &service, const string &eventname, const MessagePackage &package)¶ Matches an event name (as written to xml interface definition) into a message package.
- Parameters
service – The name of the service. For example, “Media”.
eventname – The name of the event as it is written to XML. For example, “play_state_changed”
package – The message in package to match.
- Returns
If the event name matches a message package, true, otherwise false.
-
static bool
matchMethodToMessage(const string &service, const string &methodname, const MessagePackage &package)¶ Matches a method name (as written to xml interface definition) into a message package.
- Parameters
service – The name of the service. For example, “Media”.
methodname – The name of the method as it is written to XML. For example, “play_track”.
package – The message in package to match.
- Returns
If the method name matches a message package, true, otherwise false.
-
static bool
matchPropertySetterToMessage(const string &service, const string &pathtodata, const MessagePackage &package)¶ Matches a write request to a writable service property into a message package.
- Parameters
service – The name of the service. For example, “Cluster”.
pathtodata – Dotted path to data to be written. For example, “Engine.gear”.
package – The message in package to match.
- Returns
If the write reques matches a message package, true, otherwise false.
-
static MessagePackageSharedPtr
packageMessage(MessagePackage &message)¶ Inserts a given message inside a message package.
- Parameters
message – The message to insert into the package
- Returns
Packaged message returned by value.
-
static void
packageMessage(MessagePackage &message, MessagePackage &to)¶ Inserts a given message inside a given message package.
- Parameters
message – The message to incsert into the package.
to – The package container into which to insert the message.