MessageUtil

class kanzi::connect::MessageUtil

Collection of utility functions related to message handling.

Public Static Functions

template<class _T>
shared_ptr<_T> buildPtrReplyTo(const MessagePackage &source)

Builds a reply message to the provided message package.

Return

The allocated message.

Parameters
  • source: The message package.

template<class _T>
_T buildReplyTo(const MessagePackage &source)

Builds a reply message to provided package.

Return

new message - passed by value.

Parameters
  • source: source message package.

template<class _T>
void buildReplyTo(const MessagePackage &source, _T &messageObject)

Builds a reply message to the provided package.

Parameters
  • source: Source message package.

  • messageObject: Target message object.

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.

Return

If the event name matches a message package, true, otherwise false.

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.

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.

Return

If the method name matches a message package, true, otherwise false.

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.

bool matchPropertySetterToMessage(const string &service, const string &pathtodata, const MessagePackage &package)

Matches a write request to a writable service property into a message package.

Return

If the write reques matches a message package, true, otherwise false.

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.

MessagePackageSharedPtr packageMessage(MessagePackage &message)

Inserts a given message inside a message package.

Return

Packaged message returned by value.

Parameters
  • message: The message to insert into the package

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.