diff --git a/brmd/brmd.pl b/brmd/brmd.pl index 1838b05..d51fb21 100755 --- a/brmd/brmd.pl +++ b/brmd/brmd.pl @@ -7,11 +7,14 @@ use POE qw(Component::IRC Component::IRC::Plugin::Connector Component::Server::H use Symbol qw(gensym); use Device::SerialPort; use HTTP::Status qw/RC_OK/; +use CGI; our $channel = "#brmlab"; our $device = "/dev/ttyUSB0"; our ($status, $record, $topic) = (0, 0, 'BRMLAB OPEN'); +my $serial; + my $irc = POE::Component::IRC->spawn( nick => 'brmbot', ircname => 'The Brmlab Automaton', @@ -25,6 +28,7 @@ my $web = POE::Component::Server::HTTP->new( "/brmstatus.js" => \&web_brmstatus_js, "/brmstatus.png" => \&web_brmstatus_png, "/brmstatus.txt" => \&web_brmstatus_txt, + "/brmstatus-switch" => \&web_brmstatus_switch, "/" => \&web_index }, Headers => {Server => 'brmd/xxx'}, @@ -48,7 +52,7 @@ $poe_kernel->run(); sub _start { my $heap = $_[HEAP]; - $heap->{serial} = POE::Wheel::ReadWrite->new( + $serial = $heap->{serial} = POE::Wheel::ReadWrite->new( Handle => serial_open($device), Filter => POE::Filter::Line->new( InputLiteral => "\x0A", # Received line endings. @@ -219,6 +223,17 @@ sub web_brmstatus_html {
+Manual Override+Manual override persists until the next time the physical button is switched. ++ + + |