Added -p to control the HTTP relay port
parent
2c57b1f5ed
commit
2d183051f7
|
@ -70,6 +70,10 @@ module ELM327HWBridgeRelay
|
|||
# @return [Integer] Stop bit
|
||||
attr_accessor :serial_stop_bits
|
||||
|
||||
# @!attribute server_port
|
||||
# @return [Integer] HTTP Relay server port
|
||||
attr_accessor :server_port
|
||||
|
||||
def initialize(info={})
|
||||
# Set some defaults
|
||||
self.serial_port = "/dev/ttyUSB0"
|
||||
|
@ -81,6 +85,12 @@ module ELM327HWBridgeRelay
|
|||
exit
|
||||
end
|
||||
|
||||
if @opts.has_key? :server_port
|
||||
self.server_port = @opts[:server_port]
|
||||
else
|
||||
self.server_port = 8080
|
||||
end
|
||||
|
||||
super(update_info(info,
|
||||
'Name' => 'ELM327/STN1100 HWBridge Relay Server',
|
||||
'Description' => %q{
|
||||
|
@ -100,6 +110,7 @@ module ELM327HWBridgeRelay
|
|||
'DefaultAction' => 'WebServer',
|
||||
'DefaultOptions' =>
|
||||
{
|
||||
'SRVPORT' => self.server_port,
|
||||
'URIPATH' => "/"
|
||||
}))
|
||||
self.serial_port = @opts[:serial] if @opts.has_key? :serial
|
||||
|
@ -369,6 +380,11 @@ module ELM327HWBridgeRelay
|
|||
options[:serial] = v
|
||||
end
|
||||
|
||||
opt.on('-p', '--port <server_port>',
|
||||
"(Optional) Sets the listening HTTP server port (Default=8080)") do |v|
|
||||
options[:server_port] = v
|
||||
end
|
||||
|
||||
opt.on_tail('-h', '--help', 'Show this message') do
|
||||
$stdout.puts opt
|
||||
exit
|
||||
|
|
Loading…
Reference in New Issue