Rev 650 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 650 | Rev 681 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | #!/usr/bin/perl |
1 | #!/usr/bin/perl |
| - | 2 | ||
| - | 3 | # |
|
| - | 4 | # for use with serial ports, install module with apt-get install libdevice-serialport-perl |
|
| - | 5 | # |
|
| - | 6 | # |
|
| - | 7 | # |
|
| 2 | 8 | ||
| 3 | 9 | ||
| 4 | $hubport = 1200; |
10 | $hubport = 1200; |
| 5 | #$udpip = "193.11.254.22"; |
11 | #$udpip = "193.11.254.22"; |
| 6 | #$udpport = 1100; |
12 | #$udpport = 1100; |
| Line 9... | Line 15... | ||
| 9 | require 5.002; |
15 | require 5.002; |
| 10 | use IO::Socket; |
16 | use IO::Socket; |
| 11 | use IO::Select; |
17 | use IO::Select; |
| 12 | use threads; |
18 | use threads; |
| 13 | use Getopt::Long; |
19 | use Getopt::Long; |
| 14 | 20 | ||
| 15 | $binaryname = "canDaemon.pl"; |
21 | $binaryname = "canDaemon.pl"; |
| 16 | if ( @ARGV > 0 ) { |
22 | if ( @ARGV > 0 ) { |
| 17 | GetOptions( "baudrate=i" => \$baudarg, # |
23 | GetOptions( "baudrate=i" => \$baudarg, # |
| 18 | "server=s" => \$serverarg, # |
24 | "server=s" => \$serverarg, # |
| 19 | "port=i" => \$portarg, # |
25 | "port=i" => \$portarg, # |
| 20 | "tcpport=i" => \$tcpportarg, # |
26 | "tcpport=i" => \$tcpportarg, # |
| 21 | "device=s" => \$devicearg, # |
27 | "device=s" => \$devicearg, # |
| 22 | "help" => \$help, # |
28 | "help" => \$help, # |
| 23 | ); |
29 | ); |
| - | 30 | } else { |
|
| - | 31 | $help = 1; |
|
| 24 | } |
32 | } |
| - | 33 | ||
| 25 | if ($help) { |
34 | if ($help) { |
| 26 | print "Usage ./$binaryname [options]\n"; |
35 | print "Usage ./$binaryname [options]\n"; |
| 27 | print "Options:\n"; |
36 | print "Options:\n"; |
| 28 | print " -d <device> (udp or /dev/ttyXYZ) Choose hardware for communication\n"; |
37 | print " -d <device> (udp or /dev/ttyXYZ) Choose hardware for communication\n"; |
| 29 | print " -b <baudrate> Baudrate, for serial devices\n"; |
38 | print " -b <baudrate> Baudrate, for serial devices\n"; |