devel:development_documentation
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Next revision | |||
— | devel:development_documentation [2008/08/27 13:56] – created pkubanek | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Messaging ====== | ||
+ | |||
+ | RTS2 uses its own messaging system. Messages contains name of the originator, type (debug, info, warning, error) and message text, which is unformated string. Please note that this message subsystem is intended only to pass string messages. It was not invited to pass some structured infromation from one component to the other - for such tasks are commands. | ||
+ | |||
+ | To send message from any RTS2 code, use: | ||
+ | |||
+ | <code c++> | ||
+ | logStream (type) | ||
+ | << 1234 // use it as stream, add others values if necessary | ||
+ | << sendLog; | ||
+ | </ | ||
+ | |||
+ | where type is one of **MESSAGE_ERROR**, | ||
+ | |||
+ | So for example to send warning message, use: | ||
+ | |||
+ | <code c++> | ||
+ | logStream (MESSAGE_WARNING) | ||
+ | << | ||
+ | << | ||
+ | << | ||
+ | << | ||
+ | << | ||
+ | << | ||
+ | </ | ||
+ | |||
+ | To process messages coming from other connected devices over TCP/IP, hook on to public virtual function | ||
+ | |||
+ | <code c++> | ||
+ | virtual void message (Rts2Message & msg) | ||
+ | </ | ||
+ | |||
+ | Please see [[http:// | ||
+ | |||
+ | To process messages which are generated inside application, | ||
+ | |||
+ | <code c++> | ||
+ | void Rts2Centrald:: | ||
+ | </ | ||
+ | |||
+ | You get message type and string to send. In order to send generated message to all connected devices, you need to call sendMessageAll. However, please note that usual infrastructure of RTS2 assumes that you send message only to centrald, and then centrald distributed message to log and to other components in the system. So you should not care about sending messages. | ||
devel/development_documentation.txt · Last modified: 2009/01/04 00:00 (external edit)