RecvAction and PHP

Started by orangehairedboy, August 21, 2009, 12:39:43 PM

Previous topic - Next topic

orangehairedboy

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!

<?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_pump( 4000 );
?>

orangehairedboy

#1
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.

<?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_pump( 1000 );
echo
"\n\nend";
?>

SMF spam blocked by CleanTalk