class RapiroWrapper::Commander

Commander class for RAPIRO

Public Class Methods

dryrun(commands, duration = 10) click to toggle source
# File lib/rapiro_wrapper/commander.rb, line 20
def self.dryrun(commands, duration = 10)
  RapiroWrapper::Command.new(commands).to_sequence(duration)
end
new(device = '/dev/ttyAMA0') click to toggle source
# File lib/rapiro_wrapper/commander.rb, line 6
def initialize(device = '/dev/ttyAMA0')
  @serial = SerialPort.new(device, 57_600)
end

Public Instance Methods

execute!(commands, duration = 10) click to toggle source
# File lib/rapiro_wrapper/commander.rb, line 10
def execute!(commands, duration = 10)
  write(sequences(commands, duration))
rescue
  write('#M0')
end
sequences(commands, duration = 10) click to toggle source
# File lib/rapiro_wrapper/commander.rb, line 16
def sequences(commands, duration = 10)
  RapiroWrapper::Command.new(commands).to_sequence(duration)
end
write(sequences) click to toggle source
# File lib/rapiro_wrapper/commander.rb, line 24
def write(sequences)
  @serial.write(sequences)
end