Please login or register.

Login with username, password and session length

Author Topic: RecvAction and PHP  (Read 6888 times)

orangehairedboy

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 2
RecvAction and PHP
« on: August 21, 2009, 12:39:43 PM »

Hi all! I need some help with RecvAction using COM/ActiveX. The code below executes fine, but no events are triggered. I'm convinced that the problem is the interface I currently have specified (IActiveHome). What COM Interface do I need to specify to receive RecvAction events?

Thanks!

Code: [Select]
<?php
class X10EventSinker {
function __call$name $params ) {
echo $name "\n\n";
print_r$params );
exit;
}
}
$x10 =  new COM("X10.ActiveHome") or die("Unable to instantiate X10 COM object");
$sink = new X10EventSinker();
com_event_sink$x10 $sink "IActiveHome" );
$x time() + 5;
// wait for no more than 5 seconds for an event
while( time() < $x com_message_pump4000 );
?>
Logged

orangehairedboy

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 2
Re: RecvAction and PHP
« Reply #1 on: August 25, 2009, 10:22:39 PM »

I figured it out...here a working script that will receive events in PHP. I'll be re-writing this and putting it in a class at some point.

Code: [Select]
<?php
class X10EventSinker {
function recvaction$bszRecv $vParm1 $vParm2 $vParm3 $vParm4 $vParm5 ) {
echo "{$bszRecv} {$vParm1} {$vParm2} {$vParm3} {$vParm4} {$vParm5}\n";
}
}
$x10 =  new COM("X10.ActiveHome") or die("Unable to instantiate X10 COM object");
$sink = new X10EventSinker();
com_event_sink$x10 $sink "_DIActiveHomeEvents" );
$x time() + 30;
echo 
"start\n\n";
while( 
time() < $x com_message_pump1000 );
echo 
"\n\nend";
?>
« Last Edit: August 25, 2009, 10:31:56 PM by orangehairedboy »
Logged
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.