Author Topic: Registering a Message Interceptor....  (Read 934 times)

derailed

  • Newbie
  • *
  • Posts: 10
    • View Profile
Registering a Message Interceptor....
« on: February 15, 2009, 07:21:47 pm »
Hi,

   I am trying to register an exec to catch various events. I have put a shell script in /usr/pluto/bin and was hoping for this exec to be invoked when in this case lighting events occurs. I am following the post on the wiki to set up my interceptor, which was added as a child device (#43) of core with a generic#1 template.

   I register my interceptor using the following command:

MessageSend localhost 43 -1000 8 0 5 2 4 73 6 192

DCE log says

Device 43 registered Message interceptor 0/0/0/73/2/192 <0x6d8c7b90>

all good so far... ( I think ? )

Then I issue the following cmd to turn the light on

MessageSend localhost -r 0 42 1 192

Now the dce log says

The target device 43 (routed to 43) has not registered. <0x6d8c7b90>

Any ideas ?

The just of it: I would like to trap device events and have some custom code run when specific events take place. I am hoping I could register an interceptor to get callbacks when certain events get trigger on adhoc devices with some info for which device fired the event and which event occurred....

Is this achievable ? Is so can someone shed some light ?


Many Thanks !!

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: Registering a Message Interceptor....
« Reply #1 on: February 20, 2009, 06:26:46 pm »
You have registered an interceptor and then tried to send a command to it. This is not what interceptors are for. The idea is that you set up an interceptor to catch all lighting plugin messages, then when a message is sent to a light they are also sent to the target in your interceptor.

My wiki page may be of some use, as I hacked something together which does what you are trying to achieve.

http://wiki.linuxmce.org/index.php/User:Chrisbirkinshaw

BTW why do you want to do this? If you just want to run code on events then you can already do this through the web admin respond to events pages. If you have a case for which this does not work I am interested as I am trying to collect all such cases and propose some changes.

Chris

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: Registering a Message Interceptor....
« Reply #2 on: February 24, 2009, 11:35:45 pm »
Agreed.

If you really are stuck, do a wiki search for some of my code.
Insteon, PLCBUS, and ThreadedRuby.

All of those implement Lighting.

Good Luck.

Dan
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

derailed

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Registering a Message Interceptor....
« Reply #3 on: February 25, 2009, 01:37:13 am »
Hi Chris, Dan,

   Thanks so much for the response. Very useful insights....

-F