class Serial_client
Public Class Methods
new(port_, baup_, data_bits_, stop_bits_, parity_)
click to toggle source
Calls superclass method
# File bin/serialclient, line 37 def initialize (port_, baup_, data_bits_, stop_bits_, parity_) @sp = SerialPort.new port_, baup_ @sp.set_modem_params( { "data_bits" => data_bits_, "stop_bits" => stop_bits_, "parity" => parity_ } ) @read_th = Thread.new { while 1 do get = @sp.gets if get.nil? puts "HW disconnect detected" Process.exit 255 else puts get end end } super() end
Public Instance Methods
process_line(line_)
click to toggle source
# File bin/serialclient, line 57 def process_line (line_) # process line is called by rink when user inputs something @sp.write(line_+ "\n") sleep 0.01 # if device respond to a request, it has time to display: this is only cosmetic end