1 |
|
---|
2 |
|
---|
3 |
|
---|
4 |
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 |
|
---|
11 |
|
---|
12 |
|
---|
13 |
|
---|
14 |
|
---|
15 |
|
---|
16 |
|
---|
17 |
|
---|
18 |
|
---|
19 |
|
---|
20 |
|
---|
21 |
|
---|
22 |
|
---|
23 |
|
---|
24 |
|
---|
25 |
|
---|
26 |
use DBI; |
---|
27 |
use DBD::Pg; |
---|
28 |
|
---|
29 |
$path = $0; |
---|
30 |
$path =~ s/changestbch.pl$//i; |
---|
31 |
if ($pwd ne "./"){ |
---|
32 |
push( @INC, "$path"); |
---|
33 |
} |
---|
34 |
require 'foltialib.pl'; |
---|
35 |
|
---|
36 |
|
---|
37 |
|
---|
38 |
|
---|
39 |
|
---|
40 |
|
---|
41 |
$pid = $ARGV[0] ; |
---|
42 |
if ($pid eq "" ){ |
---|
43 |
|
---|
44 |
print "usage :changestbch.pl [PID]\n"; |
---|
45 |
&writelog("changestbch ERR PID null"); |
---|
46 |
exit; |
---|
47 |
} |
---|
48 |
|
---|
49 |
|
---|
50 |
if ($haveirdaunit == 1){ |
---|
51 |
|
---|
52 |
if (-e "/dev/ttyUSB0"){ |
---|
53 |
|
---|
54 |
|
---|
55 |
|
---|
56 |
my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", |
---|
57 |
$DBDriv,$DBName,$DBHost,$DBPort); |
---|
58 |
$dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; |
---|
59 |
|
---|
60 |
$DBQuery = "SELECT foltia_station.tunertype,foltia_station.tunerch ,foltia_station.stationrecch ,foltia_station.stationid FROM foltia_subtitle,foltia_station WHERE foltia_subtitle.stationid = foltia_station.stationid AND foltia_subtitle.pid = '$pid' "; |
---|
61 |
$sth = $dbh->prepare($DBQuery); |
---|
62 |
$sth->execute(); |
---|
63 |
@chstatus = $sth->fetchrow_array; |
---|
64 |
$tunertype = $chstatus[0]; |
---|
65 |
$tunercmd = $chstatus[1]; |
---|
66 |
$recch = $chstatus[2]; |
---|
67 |
$stationid = $chstatus[3]; |
---|
68 |
$cmdjoined = "$tunertype"."$tunercmd"; |
---|
69 |
|
---|
70 |
&writelog("changestbch DEBUG $cmdjoined :$recch:$stationid"); |
---|
71 |
|
---|
72 |
$length = length($cmdjoined); |
---|
73 |
$sendcmdfile = ""; |
---|
74 |
for ($i=0 ; $i < $length ; $i++ ){ |
---|
75 |
$cmdtxt = substr($cmdjoined,$i,1); |
---|
76 |
|
---|
77 |
$sendcmdfile .= " $toolpath/perl/irda/$cmdtxt".".dat "; |
---|
78 |
} |
---|
79 |
|
---|
80 |
|
---|
81 |
system("$toolpath/perl/irda/transfer.pl $sendcmdfile"); |
---|
82 |
&writelog("changestbch DEBUG $toolpath/perl/irda/transfer.pl $toolpath/perl/irda/$sendcmdfile"); |
---|
83 |
|
---|
84 |
|
---|
85 |
|
---|
86 |
|
---|
87 |
|
---|
88 |
|
---|
89 |
|
---|
90 |
|
---|
91 |
|
---|
92 |
|
---|
93 |
}else{ |
---|
94 |
|
---|
95 |
&writelog("changestbch ERR Tira2 Not found."); |
---|
96 |
} |
---|
97 |
|
---|
98 |
} |
---|
99 |
|
---|
100 |
|
---|