#!/usr/bin/perl 

use tradioreset;


$rs=tradioreset->new("/dev/ttyS0");

#if($rs->ping()) { print "ONLINE\n"; } else { print "OFFLINE\n";}
#$lastmsg=$rs->readmsg();
#print "Ze serioveho portu prislo: $lastmsg\n\n";

$par=$ARGV[0];
#print "Command: $par\n";
#print "Answer: ";

if(length($par)>0){
 $rs->command($par);
 $lastmsg=$rs->readmsg();
 print "$lastmsg";
}


# Primy reset
#if($rs->dreset(1,1)){
#  print "\nOK\n";
#} else {
#  print "\nERR\n";
#}

# Remote reset
#if($rs->remotereset("123",3,1)){
#  print "\nOK\n";
#} else {
#  print "\nERR\n";
#}

# Repater reset
#if($rs->rptrreset("888","785",3,1)){
#  print "\nOK\n";
#} else {
#  print "\nERR\n";
#}


$rs->DESTROY;
