Class: SDN::CLI::Simulator::MockMotor

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ MockMotor

Creates a simulated motor backed by an SDN client.

Parameters:

  • client (SDN::Client)

    SDN client used to receive and send messages



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.

Returns:

  • ((Integer, Integer, Integer))


12
13
14
# File 'lib/sdn/cli/simulator.rb', line 12

def address
  @address
end

#down_limitInteger?

Returns:

  • (Integer, nil)


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.

Returns:

  • (<(Integer, Integer, Integer), nil>)


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.

Returns:

  • (<Integer, nil>)


23
24
25
# File 'lib/sdn/cli/simulator.rb', line 23

def ips
  @ips
end

#ir_channelsInteger

Simulated ILT2 IR channel bitmask.

Returns:

  • (Integer)


50
51
52
# File 'lib/sdn/cli/simulator.rb', line 50

def ir_channels
  @ir_channels
end

#labelString

Returns:

  • (String)


18
19
20
# File 'lib/sdn/cli/simulator.rb', line 18

def label
  @label
end

#lock_priorityInteger?

Returns:

  • (Integer, nil)


45
46
47
# File 'lib/sdn/cli/simulator.rb', line 45

def lock_priority
  @lock_priority
end

#network_lock_priorityInteger?

Returns:

  • (Integer, nil)


42
43
44
# File 'lib/sdn/cli/simulator.rb', line 42

def network_lock_priority
  @network_lock_priority
end

#node_type:st30, :lt50

Returns:

  • (:st30, :lt50)


15
16
17
# File 'lib/sdn/cli/simulator.rb', line 15

def node_type
  @node_type
end

#position_pulsesInteger?

Current motor position in pulses from the upper limit.

Returns:

  • (Integer, nil)


28
29
30
# File 'lib/sdn/cli/simulator.rb', line 28

def position_pulses
  @position_pulses
end

#up_limitInteger?

Returns:

  • (Integer, nil)


31
32
33
# File 'lib/sdn/cli/simulator.rb', line 31

def up_limit
  @up_limit
end