Code:
#!/usr/bin/perl -w
use CGI::Carp qw(fatalsToBrowser);
use CGI;
use Device::SerialPort;
my $cgi = new CGI;
$r_number=$cgi->param('number');
$sms_text=$cgi->param('sms_text');
my $schnittstelle = '/dev/ttyUSB-1-1';
# HTTP HEADER
print "content-type: text/html \n\n";
#my $s_number = $cnum;
#my $s_text = $ctext;
#print $s_number;
#print $Name;
#ab hier nichts mehr ändern
# Zyklischer Aufruf nach restart, empfang GA oder nach einstellung rrd (typisch 300sek).
#$plugin_info{$plugname.'_cycle'} = 25;
if( length($r_number) > 0 && length($sms_text) >0 )
{
print 'receiver number: ' .$r_number;
print '<br/><br/>';
print 'SMS-Text: ' .$sms_text;
$command_number = 'AT+CMGS="' .$r_number .'" \r';
$command_text = $sms_text .'<CTRL-Z>';
my $serial = Device::SerialPort->new($schnittstelle) || die "can't open $schnittstelle! ($!)\n";
$serial->baudrate(9600);
$serial->parity("none");
$serial->databits(8);
$serial->stopbits(1);
$serial->write($command_number); #Befehl an das Modem senden
select(undef, undef, undef, 0.2);
$serial->write($command_text); #Befehl an das Modem senden
}
Was mir jetzt noch fehlt is wie ich die richtige Adresse für die im Wiregate eingebaute serielle Schnittstelle heraus find, bzw wie die heißt.
Und ob das wie ich das bei $command_number mit dem CR gemacht hab funtioniert?
Und vor allem wie ich das Ascii Zeichen 26 hinter den SMS-Text hängen kann?
Gruß
David
EDIT:
Ich hab das Script jetzt mal laufen lassen, dann gibts folgenden Error:
Software error:
can't open /dev/tty0! at /usr/lib/cgi-bin/gsm-sms.pl line 42.
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
can't open /dev/tty0! at /usr/lib/cgi-bin/gsm-sms.pl line 42.
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.


.


Einen Kommentar schreiben: