http://wiki.linuxmce.org/index.php?title=Message_Interceptors&feed=atom&action=historyMessage Interceptors - Revision history2024-03-28T09:48:51ZRevision history for this page on the wikiMediaWiki 1.24.1http://wiki.linuxmce.org/index.php?title=Message_Interceptors&diff=6864&oldid=prevRwilson131 at 19:08, 30 October 20072007-10-30T19:08:12Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 19:08, 30 October 2007</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> {| align="right"</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">  | __TOC__</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">  |}</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>[[Category: Programmer's Guide]]</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>[[Category: Programmer's Guide]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Basics==</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Basics==</div></td></tr>
</table>Rwilson131http://wiki.linuxmce.org/index.php?title=Message_Interceptors&diff=5550&oldid=prevRwilson131: Reformatting for easier and quicker use2007-09-21T03:33:46Z<p>Reformatting for easier and quicker use</p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 03:33, 21 September 2007</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>[[Category: Programmer's Guide]]</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>[[Category: Programmer's Guide]]</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">==Basics==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">This allows your device to tell [[DCERouter]] that it wants to get copies of all messages that meet a certain criteria.  For example, a device may want to work with the lights and get copies of all messages going to a light, or another may want a copy of all events from the disk drive.  When you register a message interceptor with [[DCERouter]] you specify 6 numeric parameters which limit the messages you will receive.</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"><p>This allows your device to tell DCERouter that it wants to get copies of all messages that meet a certain criteria.  For example, a device may want to work with the lights and get copies of all messages going to a light, or another may want a copy of all events from the disk drive.  When you register a message interceptor with DCERouter you specify 6 numeric parameters which limit the messages you will receive.  </del>For each you can specify 0, which means match all, or a non-zero integer which means only match messages which match that criteria.  If you register a message interceptor with all 0's, you will get all messages.  Be sure to provide restrictions so you only get the messages you really need.  <del class="diffchange diffchange-inline">DCERouter processes lots of messages, so if you register a message interceptor that is too vague, you could get flooded.  For example, the media players typically broadcast a message every second with an updated time code.  If you register a message interceptor to grab all messages from a media device, you would get time-code messages every second.  Note that parameters act as 'AND' not 'OR'.  If you register for DeviceCategory="Media Player" and MessageID="Play Media" you will get messages that are both going to Media Players AND have an ID of Play Media.  If you wanted to get messages that go either to Media Players OR have an ID of Play Media, then register 2 separate interceptors.</p></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>For each you can specify 0, which means match all, or a non-zero integer which means only match messages which match that criteria.  If you register a message interceptor with all 0's, you will get all messages.  Be sure to provide restrictions so you only get the messages you really need.   </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"><p>From (PK_Device): If specified you will only get </del>messages <del class="diffchange diffchange-inline">from this particular device ID.</p></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">[[DCERouter]] processes lots of </ins>messages<ins class="diffchange diffchange-inline">, so if </ins>you <ins class="diffchange diffchange-inline">register a </ins>message <ins class="diffchange diffchange-inline">interceptor </ins>that is <ins class="diffchange diffchange-inline">too vague</ins>, you <ins class="diffchange diffchange-inline">could </ins>get <ins class="diffchange diffchange-inline">flooded</ins>.  <ins class="diffchange diffchange-inline">For example, </ins>the <ins class="diffchange diffchange-inline">media players typically broadcast a </ins>message <ins class="diffchange diffchange-inline">every second with </ins>an <ins class="diffchange diffchange-inline">updated time code</ins>.  <ins class="diffchange diffchange-inline">If </ins>you <ins class="diffchange diffchange-inline">register a </ins>message <ins class="diffchange diffchange-inline">interceptor </ins>to <ins class="diffchange diffchange-inline">grab all messages from a media device</ins>, you <ins class="diffchange diffchange-inline">would get time-code messages every second</ins>.   </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"><p>To (PK_Device): If specified </del>you <del class="diffchange diffchange-inline">will only get messages to this particular device ID.</p></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"><p>Template (PK_DeviceTemplate): If specified you will only get messages to devices of this particular DeviceTemplate.  Note that if the </del>message <del class="diffchange diffchange-inline">type is an Event, </del>that is <del class="diffchange diffchange-inline">coming from a device rather than going to it</del>, <del class="diffchange diffchange-inline">the Router will look at the template of the From device.</p></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"><p>Category (PK_DeviceCategory): If specified </del>you <del class="diffchange diffchange-inline">will only </del>get <del class="diffchange diffchange-inline">messages to devices of this particular DeviceCategory</del>.  <del class="diffchange diffchange-inline">Note that if </del>the message <del class="diffchange diffchange-inline">type is </del>an <del class="diffchange diffchange-inline">Event, that is coming from a device rather than going to it, the Router will look at the category of the From device.</p></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"><p>MessageType: The type of message, as defined in the source file DCE/Message.h</del>.  <del class="diffchange diffchange-inline">The 2 most common message types are 1 and 2 (MESSAGETYPE_COMMAND=1, MESSAGETYPE_EVENT=2). But </del>you <del class="diffchange diffchange-inline">can also receive </del>message <del class="diffchange diffchange-inline">of type 7 (MESSAGETYPE_SYSCOMMAND=7) if DCERouter is reloaded. In this case MessageID is 1 and it means 'Reload'</p></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"><p>MessageID: The ID of the message, as defined in the source file DCE/Message.h.  The ID depends on the message type.  Event ID's are defined in the table 'Event' in pluto_main.  Command ID's are defined in the table 'Command'.  In LinuxMCE Admin you can choose 'Advanced', 'DCE' </del>to <del class="diffchange diffchange-inline">see the command and event ID's.  If you specify an ID</del>, you <del class="diffchange diffchange-inline">should also specify a type</del>.  <del class="diffchange diffchange-inline">A command ID of 19 is "Set House Mode" whereas an event ID of 19 is "Watching Media".  So if you only specify the ID of 19, and leave MessageType as 0, your interceptor will get both "Set House Mode" commands and "Watching Media" events.</p></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"><p></del>To register a message interceptor, call the RegisterMsgInterceptor member function, with the Command_Impl class that all plugins and devices are derived from:<del class="diffchange diffchange-inline"></p></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Note that parameters act as 'AND' not 'OR'.  If you register for DeviceCategory="Media Player" and MessageID="Play Media" you will get messages that are both going to Media Players AND have an ID of Play Media.  If you wanted to get messages that go either to Media Players OR have an ID of Play Media, then register 2 separate interceptors.</ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><<del class="diffchange diffchange-inline">p</del>>RegisterMsgInterceptor( ( MessageInterceptorFn )( &Media_Plugin::MediaInserted ), 0, 0, 0, 0, MESSAGETYPE_EVENT, EVENT_Media_Inserted_CONST );</<del class="diffchange diffchange-inline">p</del>></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">==Parameters==</ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"><p></del>This means the member function Media_Plugin::MediaInserted, which must match the definition of MessageInterceptorFn, will be called whenever a device fires a "Media Inserted" Event.</<del class="diffchange diffchange-inline">p</del>></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">===From (PK_Device):===</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">If specified you will only get messages from this particular device ID.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">===To (PK_Device):=== </ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">If specified you will only get messages to this particular device ID.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">===Template (PK_DeviceTemplate):=== </ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">If specified you will only get messages to devices of this particular DeviceTemplate.  Note that if the message type is an Event, that is coming from a device rather than going to it, the Router will look at the template of the From device.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">===Category (PK_DeviceCategory):=== </ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">If specified you will only get messages to devices of this particular DeviceCategory.  Note that if the message type is an Event, that is coming from a device rather than going to it, the Router will look at the category of the From device.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">===MessageType:===</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">The type of message, as defined in the source file DCE/Message.h. The 2 most common message types are 1 and 2 (MESSAGETYPE_COMMAND=1, MESSAGETYPE_EVENT=2). But you can also receive message of type 7 (MESSAGETYPE_SYSCOMMAND=7) if DCERouter is reloaded. In this case MessageID is 1 and it means 'Reload'</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">===MessageID:===</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">The ID of the message, as defined in the source file DCE/Message.h.  The ID depends on the message type.  Event ID's are defined in the table 'Event' in pluto_main.  Command ID's are defined in the table 'Command'.  In [[LinuxMCE Admin Website]] you can choose 'Advanced', 'DCE' to see the command and event ID's.  If you specify an ID, you should also specify a type.  A command ID of 19 is "Set House Mode" whereas an event ID of 19 is "Watching Media".  So if you only specify the ID of 19, and leave MessageType as 0, your interceptor will get both "Set House Mode" commands and "Watching Media" events.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">==Register a Message Interceptor==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>To register a message interceptor, call the RegisterMsgInterceptor member function, with the Command_Impl class that all plugins and devices are derived from:</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><<ins class="diffchange diffchange-inline">pre</ins>>RegisterMsgInterceptor( ( MessageInterceptorFn )( &Media_Plugin::MediaInserted ), 0, 0, 0, 0, MESSAGETYPE_EVENT, EVENT_Media_Inserted_CONST );</<ins class="diffchange diffchange-inline">pre</ins>></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>This means the member function Media_Plugin::MediaInserted, which must match the definition of MessageInterceptorFn, will be called whenever a device fires a "Media Inserted" Event.</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">==Sending Message Manually==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">If you are not using the DCE C++ library, you can send a message to [[DCERouter]] manually to register the message interceptor, and then you will get intercepted messages encapsulated within another message.  To register a message interceptor this way, send a message to [[DCERouter]], which is always device ID -1000 (#define DEVICEID_DCEROUTER -1000) with a MessageType of 8 (MESSAGETYPE_REGISTER_INTERCEPTOR=8).  The parameters for the message are the 6 interceptor parameters:</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline"><pre> enum { PARM_FROM=1, PARM_TO, PARM_TEMPLATE, PARM_CATEGORY, PARM_MESSAGE_TYPE, PARM_MESSAGE_ID };</ins></<ins class="diffchange diffchange-inline">pre</ins>></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"><p>If you are not using the DCE C++ library, you can send a message to DCERouter manually to register the message interceptor, and then you will get intercepted messages encapsulated within another message.  To register a message interceptor this way, send a message to DCERouter, which is always device ID -1000 (#define DEVICEID_DCEROUTER -1000) with a MessageType of 8 (MESSAGETYPE_REGISTER_INTERCEPTOR=8).  The parameters for the message are the 6 interceptor parameters: enum { PARM_FROM=1, PARM_TO, PARM_TEMPLATE, PARM_CATEGORY, PARM_MESSAGE_TYPE, PARM_MESSAGE_ID };<p></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Here is the same interceptor sent by hand, not using the framework:</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> </div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">    </ins><<ins class="diffchange diffchange-inline">pre</ins>> <ins class="diffchange diffchange-inline">  </ins>Message *pMessage = new Message(m_dwPK_Device,DEVICEID_DCEROUTER,PRIORITY_NORMAL,</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"><p></del>Here is the same interceptor sent by hand, not using the framework:<del class="diffchange diffchange-inline"><p></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">     </ins>MESSAGETYPE_REGISTER_INTERCEPTOR,2,</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><<del class="diffchange diffchange-inline">p</del>>Message *pMessage = new Message(m_dwPK_Device,DEVICEID_DCEROUTER,PRIORITY_NORMAL,<del class="diffchange diffchange-inline"><br></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">     </ins>PARM_MESSAGE_TYPE,MESSAGETYPE_EVENT,</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"> </del>MESSAGETYPE_REGISTER_INTERCEPTOR,2,<del class="diffchange diffchange-inline"><br></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">     </ins>PARM_MESSAGE_ID,EVENT_Media_Inserted_CONST);</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"> </del>PARM_MESSAGE_TYPE,MESSAGETYPE_EVENT,<del class="diffchange diffchange-inline"><br></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">      </ins>QueueMessageToRouter(pMessage);</<ins class="diffchange diffchange-inline">pre</ins>></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"> </del>PARM_MESSAGE_ID,EVENT_Media_Inserted_CONST);<del class="diffchange diffchange-inline"><br></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>In this case you will receive all intercepted messages embedded within a message of type: MESSAGETYPE_MESSAGE_INTERCEPTED.  The actual intercepted message will be the single embedded message in m_vectExtraMessages.</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>QueueMessageToRouter(pMessage);<del class="diffchange diffchange-inline"><br></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div></<del class="diffchange diffchange-inline">p</del>></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> </div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"><p></del>In this case you will receive all intercepted messages embedded within a message of type: MESSAGETYPE_MESSAGE_INTERCEPTED.  The actual intercepted message will be the single embedded message in m_vectExtraMessages.<del class="diffchange diffchange-inline"></p></del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></div></td></tr>
</table>Rwilson131http://wiki.linuxmce.org/index.php?title=Message_Interceptors&diff=4642&oldid=prevMstovenour: Added to Category: Programmer's Guide2007-08-11T14:49:51Z<p>Added to Category: Programmer's Guide</p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 14:49, 11 August 2007</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category: Programmer's Guide]]</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>This allows your device to tell DCERouter that it wants to get copies of all messages that meet a certain criteria.  For example, a device may want to work with the lights and get copies of all messages going to a light, or another may want a copy of all events from the disk drive.  When you register a message interceptor with DCERouter you specify 6 numeric parameters which limit the messages you will receive.  For each you can specify 0, which means match all, or a non-zero integer which means only match messages which match that criteria.  If you register a message interceptor with all 0's, you will get all messages.  Be sure to provide restrictions so you only get the messages you really need.  DCERouter processes lots of messages, so if you register a message interceptor that is too vague, you could get flooded.  For example, the media players typically broadcast a message every second with an updated time code.  If you register a message interceptor to grab all messages from a media device, you would get time-code messages every second.  Note that parameters act as 'AND' not 'OR'.  If you register for DeviceCategory="Media Player" and MessageID="Play Media" you will get messages that are both going to Media Players AND have an ID of Play Media.  If you wanted to get messages that go either to Media Players OR have an ID of Play Media, then register 2 separate interceptors.</p></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>This allows your device to tell DCERouter that it wants to get copies of all messages that meet a certain criteria.  For example, a device may want to work with the lights and get copies of all messages going to a light, or another may want a copy of all events from the disk drive.  When you register a message interceptor with DCERouter you specify 6 numeric parameters which limit the messages you will receive.  For each you can specify 0, which means match all, or a non-zero integer which means only match messages which match that criteria.  If you register a message interceptor with all 0's, you will get all messages.  Be sure to provide restrictions so you only get the messages you really need.  DCERouter processes lots of messages, so if you register a message interceptor that is too vague, you could get flooded.  For example, the media players typically broadcast a message every second with an updated time code.  If you register a message interceptor to grab all messages from a media device, you would get time-code messages every second.  Note that parameters act as 'AND' not 'OR'.  If you register for DeviceCategory="Media Player" and MessageID="Play Media" you will get messages that are both going to Media Players AND have an ID of Play Media.  If you wanted to get messages that go either to Media Players OR have an ID of Play Media, then register 2 separate interceptors.</p></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>Mstovenourhttp://wiki.linuxmce.org/index.php?title=Message_Interceptors&diff=3397&oldid=prevJuliet at 14:19, 16 March 20072007-03-16T14:19:38Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 14:19, 16 March 2007</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"><table width="100%"> <tr><td bgcolor="#FFCFCF">This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007.  In general any information should apply to LinuxMCE.  However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.</td></tr> </table></del><p>This allows your device to tell DCERouter that it wants to get copies of all messages that meet a certain criteria.  For example, a device may want to work with the lights and get copies of all messages going to a light, or another may <del class="diffchange diffchange-inline">want </del>want a copy of all events from the disk drive.  When you register a message interceptor with DCERouter you specify 6 numeric parameters which limit the messages you will receive.  For each you can specify 0, which means match all, or a non-zero integer which means only match messages which match that criteria.  If you register a message interceptor with all 0's, you will get all messages.  Be sure to provide restrictions so you only get the messages you really need.  DCERouter processes lots of messages, so if you register a message interceptor that is too vague, you could get flooded.  For example, the media players typically broadcast a message every second with an updated time code.  If you register a message interceptor to grab all messages from a media device, you would get <del class="diffchange diffchange-inline">timecode </del>messages every second.  Note that parameters act as 'AND' not 'OR'.  If you register for DeviceCategory="Media Player" and MessageID="Play Media" you will get messages that are both going to Media Players AND have an ID of Play Media.  If you wanted to get messages that go either to Media Players OR have an ID of <del class="diffchange diffchange-inline">PlayMedia</del>, then register 2 separate interceptors.</p></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><p>This allows your device to tell DCERouter that it wants to get copies of all messages that meet a certain criteria.  For example, a device may want to work with the lights and get copies of all messages going to a light, or another may want a copy of all events from the disk drive.  When you register a message interceptor with DCERouter you specify 6 numeric parameters which limit the messages you will receive.  For each you can specify 0, which means match all, or a non-zero integer which means only match messages which match that criteria.  If you register a message interceptor with all 0's, you will get all messages.  Be sure to provide restrictions so you only get the messages you really need.  DCERouter processes lots of messages, so if you register a message interceptor that is too vague, you could get flooded.  For example, the media players typically broadcast a message every second with an updated time code.  If you register a message interceptor to grab all messages from a media device, you would get <ins class="diffchange diffchange-inline">time-code </ins>messages every second.  Note that parameters act as 'AND' not 'OR'.  If you register for DeviceCategory="Media Player" and MessageID="Play Media" you will get messages that are both going to Media Players AND have an ID of Play Media.  If you wanted to get messages that go either to Media Players OR have an ID of <ins class="diffchange diffchange-inline">Play Media</ins>, then register 2 separate interceptors.</p></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>From (PK_Device): If specified you will only get messages from this particular device ID.</p></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>From (PK_Device): If specified you will only get messages from this particular device ID.</p></div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 6:</td>
<td colspan="2" class="diff-lineno">Line 6:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>Category (PK_DeviceCategory): If specified you will only get messages to devices of this particular DeviceCategory.  Note that if the message type is an Event, that is coming from a device rather than going to it, the Router will look at the category of the From device.</p></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>Category (PK_DeviceCategory): If specified you will only get messages to devices of this particular DeviceCategory.  Note that if the message type is an Event, that is coming from a device rather than going to it, the Router will look at the category of the From device.</p></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>MessageType: The type of message, as defined in the source file DCE/Message.h.  The 2 most common message types are 1 and 2 (MESSAGETYPE_COMMAND=1, MESSAGETYPE_EVENT=2). But you can also receive message of type 7 (MESSAGETYPE_SYSCOMMAND=7) if DCERouter is reloaded. In this case MessageID is 1 and it means 'Reload'</p></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>MessageType: The type of message, as defined in the source file DCE/Message.h.  The 2 most common message types are 1 and 2 (MESSAGETYPE_COMMAND=1, MESSAGETYPE_EVENT=2). But you can also receive message of type 7 (MESSAGETYPE_SYSCOMMAND=7) if DCERouter is reloaded. In this case MessageID is 1 and it means 'Reload'</p></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><p>MessageID: The ID of the message, as defined in the source file DCE/Message.h.  The ID depends on the message type.  Event ID's are defined in the table 'Event' in pluto_main.  Command ID's are defined in the table 'Command'.  In <del class="diffchange diffchange-inline">Pluto </del>Admin you can choose 'Advanced', 'DCE' to see the command and event ID's.  If you specify an ID, you should also specify a type.  A command ID of 19 is "Set House Mode" whereas an event ID of 19 is "Watching Media".  So if you only specify the ID of 19, and leave MessageType as 0, your interceptor will get both "Set House Mode" commands and "Watching Media" events.</p></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><p>MessageID: The ID of the message, as defined in the source file DCE/Message.h.  The ID depends on the message type.  Event ID's are defined in the table 'Event' in pluto_main.  Command ID's are defined in the table 'Command'.  In <ins class="diffchange diffchange-inline">LinuxMCE </ins>Admin you can choose 'Advanced', 'DCE' to see the command and event ID's.  If you specify an ID, you should also specify a type.  A command ID of 19 is "Set House Mode" whereas an event ID of 19 is "Watching Media".  So if you only specify the ID of 19, and leave MessageType as 0, your interceptor will get both "Set House Mode" commands and "Watching Media" events.</p></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>To register a message interceptor, call the RegisterMsgInterceptor member function, with the Command_Impl class that all plugins and devices are derived from:</p></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>To register a message interceptor, call the RegisterMsgInterceptor member function, with the Command_Impl class that all plugins and devices are derived from:</p></div></td></tr>
</table>Juliethttp://wiki.linuxmce.org/index.php?title=Message_Interceptors&diff=2657&oldid=prevWikiadmin at 07:28, 18 October 20062006-10-18T07:28:51Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 07:28, 18 October 2006</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 5:</td>
<td colspan="2" class="diff-lineno">Line 5:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>Template (PK_DeviceTemplate): If specified you will only get messages to devices of this particular DeviceTemplate.  Note that if the message type is an Event, that is coming from a device rather than going to it, the Router will look at the template of the From device.</p></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>Template (PK_DeviceTemplate): If specified you will only get messages to devices of this particular DeviceTemplate.  Note that if the message type is an Event, that is coming from a device rather than going to it, the Router will look at the template of the From device.</p></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>Category (PK_DeviceCategory): If specified you will only get messages to devices of this particular DeviceCategory.  Note that if the message type is an Event, that is coming from a device rather than going to it, the Router will look at the category of the From device.</p></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>Category (PK_DeviceCategory): If specified you will only get messages to devices of this particular DeviceCategory.  Note that if the message type is an Event, that is coming from a device rather than going to it, the Router will look at the category of the From device.</p></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><p>MessageType: The type of message, as defined in the source file DCE/Message.h.  The 2 most common message types are 1 and 2 (MESSAGETYPE_COMMAND=1, MESSAGETYPE_EVENT=2).</p></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><p>MessageType: The type of message, as defined in the source file DCE/Message.h.  The 2 most common message types are 1 and 2 (MESSAGETYPE_COMMAND=1, MESSAGETYPE_EVENT=2). <ins class="diffchange diffchange-inline">But you can also receive message of type 7 (MESSAGETYPE_SYSCOMMAND=7) if DCERouter is reloaded. In this case MessageID is 1 and it means 'Reload'</ins></p></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>MessageID: The ID of the message, as defined in the source file DCE/Message.h.  The ID depends on the message type.  Event ID's are defined in the table 'Event' in pluto_main.  Command ID's are defined in the table 'Command'.  In Pluto Admin you can choose 'Advanced', 'DCE' to see the command and event ID's.  If you specify an ID, you should also specify a type.  A command ID of 19 is "Set House Mode" whereas an event ID of 19 is "Watching Media".  So if you only specify the ID of 19, and leave MessageType as 0, your interceptor will get both "Set House Mode" commands and "Watching Media" events.</p></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>MessageID: The ID of the message, as defined in the source file DCE/Message.h.  The ID depends on the message type.  Event ID's are defined in the table 'Event' in pluto_main.  Command ID's are defined in the table 'Command'.  In Pluto Admin you can choose 'Advanced', 'DCE' to see the command and event ID's.  If you specify an ID, you should also specify a type.  A command ID of 19 is "Set House Mode" whereas an event ID of 19 is "Watching Media".  So if you only specify the ID of 19, and leave MessageType as 0, your interceptor will get both "Set House Mode" commands and "Watching Media" events.</p></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 23:</td>
<td colspan="2" class="diff-lineno">Line 23:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>In this case you will receive all intercepted messages embedded within a message of type: MESSAGETYPE_MESSAGE_INTERCEPTED.  The actual intercepted message will be the single embedded message in m_vectExtraMessages.</p></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><p>In this case you will receive all intercepted messages embedded within a message of type: MESSAGETYPE_MESSAGE_INTERCEPTED.  The actual intercepted message will be the single embedded message in m_vectExtraMessages.</p></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2"> </td></tr>
</table>Wikiadminhttp://wiki.linuxmce.org/index.php?title=Message_Interceptors&diff=2081&oldid=prevWikiadmin: Imported document2006-06-05T16:48:51Z<p>Imported document</p>
<p><b>New page</b></p><div><table width="100%"> <tr><td bgcolor="#FFCFCF">This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007. In general any information should apply to LinuxMCE. However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.</td></tr> </table><p>This allows your device to tell DCERouter that it wants to get copies of all messages that meet a certain criteria. For example, a device may want to work with the lights and get copies of all messages going to a light, or another may want want a copy of all events from the disk drive. When you register a message interceptor with DCERouter you specify 6 numeric parameters which limit the messages you will receive. For each you can specify 0, which means match all, or a non-zero integer which means only match messages which match that criteria. If you register a message interceptor with all 0's, you will get all messages. Be sure to provide restrictions so you only get the messages you really need. DCERouter processes lots of messages, so if you register a message interceptor that is too vague, you could get flooded. For example, the media players typically broadcast a message every second with an updated time code. If you register a message interceptor to grab all messages from a media device, you would get timecode messages every second. Note that parameters act as 'AND' not 'OR'. If you register for DeviceCategory="Media Player" and MessageID="Play Media" you will get messages that are both going to Media Players AND have an ID of Play Media. If you wanted to get messages that go either to Media Players OR have an ID of PlayMedia, then register 2 separate interceptors.</p><br />
<br />
<p>From (PK_Device): If specified you will only get messages from this particular device ID.</p><br />
<p>To (PK_Device): If specified you will only get messages to this particular device ID.</p><br />
<p>Template (PK_DeviceTemplate): If specified you will only get messages to devices of this particular DeviceTemplate. Note that if the message type is an Event, that is coming from a device rather than going to it, the Router will look at the template of the From device.</p><br />
<p>Category (PK_DeviceCategory): If specified you will only get messages to devices of this particular DeviceCategory. Note that if the message type is an Event, that is coming from a device rather than going to it, the Router will look at the category of the From device.</p><br />
<p>MessageType: The type of message, as defined in the source file DCE/Message.h. The 2 most common message types are 1 and 2 (MESSAGETYPE_COMMAND=1, MESSAGETYPE_EVENT=2).</p><br />
<p>MessageID: The ID of the message, as defined in the source file DCE/Message.h. The ID depends on the message type. Event ID's are defined in the table 'Event' in pluto_main. Command ID's are defined in the table 'Command'. In Pluto Admin you can choose 'Advanced', 'DCE' to see the command and event ID's. If you specify an ID, you should also specify a type. A command ID of 19 is "Set House Mode" whereas an event ID of 19 is "Watching Media". So if you only specify the ID of 19, and leave MessageType as 0, your interceptor will get both "Set House Mode" commands and "Watching Media" events.</p><br />
<br />
<p>To register a message interceptor, call the RegisterMsgInterceptor member function, with the Command_Impl class that all plugins and devices are derived from:</p><br />
<p>RegisterMsgInterceptor( ( MessageInterceptorFn )( &Media_Plugin::MediaInserted ), 0, 0, 0, 0, MESSAGETYPE_EVENT, EVENT_Media_Inserted_CONST );</p><br />
<p>This means the member function Media_Plugin::MediaInserted, which must match the definition of MessageInterceptorFn, will be called whenever a device fires a "Media Inserted" Event.</p><br />
<br />
<p>If you are not using the DCE C++ library, you can send a message to DCERouter manually to register the message interceptor, and then you will get intercepted messages encapsulated within another message. To register a message interceptor this way, send a message to DCERouter, which is always device ID -1000 (#define DEVICEID_DCEROUTER -1000) with a MessageType of 8 (MESSAGETYPE_REGISTER_INTERCEPTOR=8). The parameters for the message are the 6 interceptor parameters: enum { PARM_FROM=1, PARM_TO, PARM_TEMPLATE, PARM_CATEGORY, PARM_MESSAGE_TYPE, PARM_MESSAGE_ID };<p><br />
<br />
<p>Here is the same interceptor sent by hand, not using the framework:<p><br />
<p>Message *pMessage = new Message(m_dwPK_Device,DEVICEID_DCEROUTER,PRIORITY_NORMAL,<br><br />
MESSAGETYPE_REGISTER_INTERCEPTOR,2,<br><br />
PARM_MESSAGE_TYPE,MESSAGETYPE_EVENT,<br><br />
PARM_MESSAGE_ID,EVENT_Media_Inserted_CONST);<br><br />
QueueMessageToRouter(pMessage);<br><br />
</p><br />
<br />
<p>In this case you will receive all intercepted messages embedded within a message of type: MESSAGETYPE_MESSAGE_INTERCEPTED. The actual intercepted message will be the single embedded message in m_vectExtraMessages.</p><br />
</div>Wikiadmin