class ComConnection

Attributes

databits[R]
flowcontrol[R]
parity[R]
portname[R]
readtimeout[R]
speed[R]
stopbits[R]
usereadbuffer[R]
writetimeout[R]

Public Class Methods

new(args) click to toggle source
# File lib/com_connection.rb, line 4
def initialize(args)
  @portname      = args[:portname]
  @databits      = args[:databits]       || default_databits
  @speed         = args[:speed]          || default_speed
  @parity        = args[:parity]         || default_parity
  @stopbits      = args[:stopbits]       || default_stopbits
  @flowcontrol   = args[:flowcontrol]    || default_flowcontrol
  @readtimeout   = args[:readtimeout]    || default_readtimeout
  @writetimeout  = args[:writetimeout]   || default_writetimeout
  @usereadbuffer = args[:usereadbuffer]  || default_usereadbuffer
end

Public Instance Methods

port_config_string() click to toggle source
# File lib/com_connection.rb, line 16
def port_config_string  
  "PortName=#{portname};DataBits=#{databits};Speed=#{speed};Parity=#{parity};StopBits=#{stopbits};FlowControl=#{flowcontrol};ReadTimeout=#{readtimeout};WriteTimeout=#{writetimeout};UseReadBuffer=#{usereadbuffer}"
end

Private Instance Methods

default_databits() click to toggle source
# File lib/com_connection.rb, line 21
def default_databits
  8
end
default_flowcontrol() click to toggle source
# File lib/com_connection.rb, line 37
def default_flowcontrol
  'X'
end
default_parity() click to toggle source
# File lib/com_connection.rb, line 29
def default_parity
  'N'
end
default_readtimeout() click to toggle source
# File lib/com_connection.rb, line 41
def default_readtimeout
  40000
end
default_speed() click to toggle source
# File lib/com_connection.rb, line 25
def default_speed
  9600
end
default_stopbits() click to toggle source
# File lib/com_connection.rb, line 33
def default_stopbits
  1
end
default_usereadbuffer() click to toggle source
# File lib/com_connection.rb, line 49
def default_usereadbuffer
  0
end
default_writetimeout() click to toggle source
# File lib/com_connection.rb, line 45
def default_writetimeout
  50
end