Class: SDN::Message::PostMotorStatus

Inherits:
SDN::Message show all
Defined in:
lib/sdn/messages/post.rb

Constant Summary collapse

MSG =
0x0f
PARAMS_LENGTH =
4
STATE =
{ stopped: 0x00, running: 0x01, blocked: 0x02, locked: 0x03 }.freeze
DIRECTION =
{ down: 0x00, up: 0x01 }.freeze
SOURCE =
{ internal: 0x00, network: 0x01, dct: 0x02 }.freeze
CAUSE =
{ target_reached: 0x00,
explicit_command: 0x01,
wink: 0x02,
limits_not_set: 0x10,
ip_not_set: 0x11,
polarity_not_checked: 0x12,
in_configuration_mode: 0x13,
obstacle_detection: 0x20,
over_current_protection: 0x21,
thermal_protection: 0x22 }.freeze

Instance Attribute Summary collapse

Attributes inherited from SDN::Message

#ack_requested, #dest, #reserved, #src

Instance Method Summary collapse

Methods inherited from SDN::Message

#class_inspect, #initialize, #inspect, parse, readpartial, #serialize

Methods included from Helpers

#checksum, #from_number, #from_string, #is_group_address?, #parse_address, #print_address, #to_number, #to_string, #transform_param

Constructor Details

This class inherits a constructor from SDN::Message

Instance Attribute Details

#last_action_causeObject

Returns the value of attribute last_action_cause.



34
35
36
# File 'lib/sdn/messages/post.rb', line 34

def last_action_cause
  @last_action_cause
end

#last_action_sourceObject

Returns the value of attribute last_action_source.



34
35
36
# File 'lib/sdn/messages/post.rb', line 34

def last_action_source
  @last_action_source
end

#last_directionObject

Returns the value of attribute last_direction.



34
35
36
# File 'lib/sdn/messages/post.rb', line 34

def last_direction
  @last_direction
end

#stateObject

Returns the value of attribute state.



34
35
36
# File 'lib/sdn/messages/post.rb', line 34

def state
  @state
end

Instance Method Details

#parse(params) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/sdn/messages/post.rb', line 36

def parse(params)
  super
  self.state = STATE.invert[to_number(params[0])]
  self.last_direction = DIRECTION.invert[to_number(params[1])]
  self.last_action_source = SOURCE.invert[to_number(params[2])]
  self.last_action_cause = CAUSE.invert[to_number(params[3])]
end