Class: SDN::CLI::Simulator::MockMotor
- Inherits:
-
Object
- Object
- SDN::CLI::Simulator::MockMotor
- Defined in:
- lib/sdn/cli/simulator.rb
Overview
Simulated motor implementation that responds to a subset of SDN requests.
Constant Summary collapse
- ALLOWED_MOVE_TYPES =
Absolute move target types supported by the simulator implementation.
%i[up_limit down_limit ip position_pulses position_percent].freeze
Instance Attribute Summary collapse
-
#address ⇒ (Integer, Integer, Integer)
Simulated motor address.
- #down_limit ⇒ Integer?
-
#groups ⇒ <(Integer, Integer, Integer), nil>
Stored group memberships keyed by slot index.
-
#ips ⇒ <Integer, nil>
Stored intermediate positions keyed by slot index.
-
#ir_channels ⇒ Integer
Simulated ILT2 IR channel bitmask.
- #label ⇒ String
- #lock_priority ⇒ Integer?
- #network_lock_priority ⇒ Integer?
- #node_type ⇒ :st30, :lt50
-
#position_pulses ⇒ Integer?
Current motor position in pulses from the upper limit.
- #up_limit ⇒ Integer?
Instance Method Summary collapse
-
#initialize(client) ⇒ MockMotor
constructor
Creates a simulated motor backed by an SDN client.
Constructor Details
#initialize(client) ⇒ MockMotor
Creates a simulated motor backed by an SDN client.
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/sdn/cli/simulator.rb', line 62 def initialize(client) @client = client self.address = Message.parse_address("00.00.00") self.node_type = :st30 self.label = "" self.ips = Array.new(16) self.groups = Array.new(16) self.ir_channels = 0 self.lock_priority = 0 end |
Instance Attribute Details
#address ⇒ (Integer, Integer, Integer)
Simulated motor address.
12 13 14 |
# File 'lib/sdn/cli/simulator.rb', line 12 def address @address end |
#down_limit ⇒ Integer?
34 35 36 |
# File 'lib/sdn/cli/simulator.rb', line 34 def down_limit @down_limit end |
#groups ⇒ <(Integer, Integer, Integer), nil>
Stored group memberships keyed by slot index.
39 40 41 |
# File 'lib/sdn/cli/simulator.rb', line 39 def groups @groups end |
#ips ⇒ <Integer, nil>
Stored intermediate positions keyed by slot index.
23 24 25 |
# File 'lib/sdn/cli/simulator.rb', line 23 def ips @ips end |
#ir_channels ⇒ Integer
Simulated ILT2 IR channel bitmask.
50 51 52 |
# File 'lib/sdn/cli/simulator.rb', line 50 def ir_channels @ir_channels end |
#label ⇒ String
18 19 20 |
# File 'lib/sdn/cli/simulator.rb', line 18 def label @label end |
#lock_priority ⇒ Integer?
45 46 47 |
# File 'lib/sdn/cli/simulator.rb', line 45 def lock_priority @lock_priority end |
#network_lock_priority ⇒ Integer?
42 43 44 |
# File 'lib/sdn/cli/simulator.rb', line 42 def network_lock_priority @network_lock_priority end |
#node_type ⇒ :st30, :lt50
15 16 17 |
# File 'lib/sdn/cli/simulator.rb', line 15 def node_type @node_type end |
#position_pulses ⇒ Integer?
Current motor position in pulses from the upper limit.
28 29 30 |
# File 'lib/sdn/cli/simulator.rb', line 28 def position_pulses @position_pulses end |
#up_limit ⇒ Integer?
31 32 33 |
# File 'lib/sdn/cli/simulator.rb', line 31 def up_limit @up_limit end |