Class: NXT::Command::Output::Program
- Inherits:
-
Object
- Object
- NXT::Command::Output::Program
- Includes:
- Base
- Defined in:
- lib/nxt/commands/program.rb
Constant Summary collapse
- START_PROGRAM =
0x00- STOP_PROGRAM =
0x01- GET_CURRENT_PROGRAM_NAME =
0x11- @@command_type =
COMMAND_TYPES[:direct]
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(interface, name = nil) ⇒ Program
constructor
A new instance of Program.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(interface, name = nil) ⇒ Program
Returns a new instance of Program.
12 13 14 15 |
# File 'lib/nxt/commands/program.rb', line 12 def initialize(interface, name=nil) @interface = interface @name = name end |
Class Method Details
.get_running_name(interface) ⇒ Object
43 44 45 46 47 |
# File 'lib/nxt/commands/program.rb', line 43 def get_running_name(interface) response = send_command(interface, GET_CURRENT_PROGRAM_NAME) raise NXT::Exceptions::CommandError.new(response[:message]) if response[:status] != NXT::Errors::SUCCESS convert_data_to_string(response[:data]) end |
.start(interface, name) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/nxt/commands/program.rb', line 28 def start(interface, name) response = send_command(interface, START_PROGRAM, name) unless response[:status] == NXT::Errors::SUCCESS = "#{response[:message]}; Try using '.rxe' as the filename extension" raise NXT::Exceptions::CommandError.new end response end |
.stop(interface) ⇒ Object
39 40 41 |
# File 'lib/nxt/commands/program.rb', line 39 def stop(interface) send_command(interface, STOP_PROGRAM) end |
Instance Method Details
#start ⇒ Object
17 18 19 |
# File 'lib/nxt/commands/program.rb', line 17 def start self.class.start(@interface, @name) end |
#stop ⇒ Object
21 22 23 |
# File 'lib/nxt/commands/program.rb', line 21 def stop self.class.stop(@interface) end |