#!/usr/bin/perl use HTTP::Daemon; use HTTP::Status; my $d = HTTP::Daemon->new(LocalPort => 8080) || die; print "Please contact me at: url, ">\n"; $SIG{'PIPE'} = 'IGNORE'; while (my $c = $d->accept) { while (my $r = $c->get_request) { if ($r->method eq 'GET' and $r->url->path =~ /display/) { my @args; my ($foo,$command,$arg1,$arg2) = split /\//, $r->url->path; $arg1 =~ s/%20/ /g; $arg2 =~ s/%20/ /g; $arg1 = substr($arg1,0,20); print "command: $command arg1: $arg1 arg2:$arg2\n"; open SERIAL, ">>/dev/ttyS0" || die "Can't open serial"; select((select(SERIAL), $| = 1)[0]); print SERIAL "\x04\x01\x43\x31\x58\x17$arg1\x04\x01\x50\x44\x17 \$$arg2"; #print SERIAL "$$arg2 "; my $code = "200"; my $mess = "Cache-Control: no-cache"; $c->send_basic_header( $code, $mess ); close SERIAL; next; }elsif($r->method eq 'GET' and $r->url->path =~ /scroll/) { print SERIAL "\x04\x01\x44\x31\x33\x17";#DISPLAY DEMO }else { $c->send_error(RC_FORBIDDEN) } } $c->close; undef($c); }