Class: ComConnection
- Inherits:
-
Object
- Object
- ComConnection
- Defined in:
- lib/com_connection.rb
Instance Attribute Summary collapse
-
#databits ⇒ Object
readonly
Returns the value of attribute databits.
-
#flowcontrol ⇒ Object
readonly
Returns the value of attribute flowcontrol.
-
#parity ⇒ Object
readonly
Returns the value of attribute parity.
-
#portname ⇒ Object
readonly
Returns the value of attribute portname.
-
#readtimeout ⇒ Object
readonly
Returns the value of attribute readtimeout.
-
#speed ⇒ Object
readonly
Returns the value of attribute speed.
-
#stopbits ⇒ Object
readonly
Returns the value of attribute stopbits.
-
#usereadbuffer ⇒ Object
readonly
Returns the value of attribute usereadbuffer.
-
#writetimeout ⇒ Object
readonly
Returns the value of attribute writetimeout.
Instance Method Summary collapse
-
#initialize(args) ⇒ ComConnection
constructor
A new instance of ComConnection.
- #port_config_string ⇒ Object
Constructor Details
#initialize(args) ⇒ ComConnection
Returns a new instance of ComConnection.
4 5 6 7 8 9 10 11 12 13 14 |
# 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 |
Instance Attribute Details
#databits ⇒ Object (readonly)
Returns the value of attribute databits.
2 3 4 |
# File 'lib/com_connection.rb', line 2 def databits @databits end |
#flowcontrol ⇒ Object (readonly)
Returns the value of attribute flowcontrol.
2 3 4 |
# File 'lib/com_connection.rb', line 2 def flowcontrol @flowcontrol end |
#parity ⇒ Object (readonly)
Returns the value of attribute parity.
2 3 4 |
# File 'lib/com_connection.rb', line 2 def parity @parity end |
#portname ⇒ Object (readonly)
Returns the value of attribute portname.
2 3 4 |
# File 'lib/com_connection.rb', line 2 def portname @portname end |
#readtimeout ⇒ Object (readonly)
Returns the value of attribute readtimeout.
2 3 4 |
# File 'lib/com_connection.rb', line 2 def readtimeout @readtimeout end |
#speed ⇒ Object (readonly)
Returns the value of attribute speed.
2 3 4 |
# File 'lib/com_connection.rb', line 2 def speed @speed end |
#stopbits ⇒ Object (readonly)
Returns the value of attribute stopbits.
2 3 4 |
# File 'lib/com_connection.rb', line 2 def stopbits @stopbits end |
#usereadbuffer ⇒ Object (readonly)
Returns the value of attribute usereadbuffer.
2 3 4 |
# File 'lib/com_connection.rb', line 2 def usereadbuffer @usereadbuffer end |
#writetimeout ⇒ Object (readonly)
Returns the value of attribute writetimeout.
2 3 4 |
# File 'lib/com_connection.rb', line 2 def writetimeout @writetimeout end |
Instance Method Details
#port_config_string ⇒ Object
16 17 18 |
# 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 |