Class: Kiss::KissSerial
- Inherits:
-
KissAbstract
- Object
- KissAbstract
- Kiss::KissSerial
- Defined in:
- lib/kiss/kiss_serial.rb
Constant Summary collapse
- DEFAULT_READ_BYTES =
1000
- SERIAL_READ_TIMEOUT =
-1
Instance Method Summary collapse
Methods inherited from KissAbstract
#read_datagram, #write_datagram, #write_exit_kiss_mode, #write_full_duplex, #write_generic_command, #write_persistence, #write_set_hardware, #write_slot_time, #write_tx_delay, #write_tx_tail
Methods included from Kiss
#read_datagram, #write_datagram, #write_exit_kiss_mode, #write_full_duplex, #write_generic_command, #write_persistence, #write_set_hardware, #write_slot_time, #write_tx_delay, #write_tx_tail
Instance Method Details
#close(*args, **kwargs) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/kiss/kiss_serial.rb', line 64 def close(*args, **kwargs) super if @exit_kiss write_interface(MODE_END) end if @serial == nil or @serial.closed? raise IOError.new('Attempting to close before the class has been started.') else @serial.close(*args, **kwargs) end end |
#connect(mode_init = nil, *args, **kwargs) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/kiss/kiss_serial.rb', line 49 def connect(mode_init=nil, *args, **kwargs) super @serial = SerialPort.new(@com_port, @baud, @byte_size, @stop_bits, @parity, *args, **kwargs) @serial.read_timeout = SERIAL_READ_TIMEOUT if mode_init write_interface(mode_init) @exit_kiss = true else @exit_kiss = false end end |