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 |
use DBD::SQLite; |
---|
29 |
|
---|
30 |
$path = $0; |
---|
31 |
$path =~ s/changestbch.pl$//i; |
---|
32 |
if ($path ne "./"){ |
---|
33 |
push( @INC, "$path"); |
---|
34 |
} |
---|
35 |
require 'foltialib.pl'; |
---|
36 |
|
---|
37 |
|
---|
38 |
|
---|
39 |
|
---|
40 |
|
---|
41 |
|
---|
42 |
$pid = $ARGV[0] ; |
---|
43 |
if ($pid eq "" ){ |
---|
44 |
|
---|
45 |
print "usage :changestbch.pl [PID]\n"; |
---|
46 |
&writelog("changestbch ERR PID null"); |
---|
47 |
exit; |
---|
48 |
} |
---|
49 |
|
---|
50 |
|
---|
51 |
if ($haveirdaunit == 1){ |
---|
52 |
|
---|
53 |
if (-e "/dev/ttyUSB0"){ |
---|
54 |
|
---|
55 |
|
---|
56 |
|
---|
57 |
$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; |
---|
58 |
|
---|
59 |
$sth = $dbh->prepare($stmt{'changestbch.1'}); |
---|
60 |
$sth->execute($pid); |
---|
61 |
@chstatus = $sth->fetchrow_array; |
---|
62 |
$tunertype = $chstatus[0]; |
---|
63 |
$tunercmd = $chstatus[1]; |
---|
64 |
$recch = $chstatus[2]; |
---|
65 |
$stationid = $chstatus[3]; |
---|
66 |
$cmdjoined = "$tunertype"."$tunercmd"; |
---|
67 |
|
---|
68 |
&writelog("changestbch DEBUG $cmdjoined :$recch:$stationid"); |
---|
69 |
|
---|
70 |
$length = length($cmdjoined); |
---|
71 |
$sendcmdfile = ""; |
---|
72 |
for ($i=0 ; $i < $length ; $i++ ){ |
---|
73 |
$cmdtxt = substr($cmdjoined,$i,1); |
---|
74 |
|
---|
75 |
$sendcmdfile .= " $toolpath/perl/irda/$cmdtxt".".dat "; |
---|
76 |
} |
---|
77 |
|
---|
78 |
|
---|
79 |
system("$toolpath/perl/irda/transfer.pl $sendcmdfile"); |
---|
80 |
&writelog("changestbch DEBUG $toolpath/perl/irda/transfer.pl $toolpath/perl/irda/$sendcmdfile"); |
---|
81 |
|
---|
82 |
|
---|
83 |
|
---|
84 |
|
---|
85 |
|
---|
86 |
|
---|
87 |
|
---|
88 |
|
---|
89 |
|
---|
90 |
|
---|
91 |
}else{ |
---|
92 |
|
---|
93 |
&writelog("changestbch ERR Tira2 Not found."); |
---|
94 |
} |
---|
95 |
|
---|
96 |
} |
---|
97 |
|
---|
98 |
|
---|