Class: SDN::Message::PostMotorLimits

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

Constant Summary collapse

MSG =
0x31
PARAMS_LENGTH =
4

Instance Attribute Summary collapse

Attributes inherited from SDN::Message

#ack_requested, #dest, #node_type, #src

Instance Method Summary collapse

Methods inherited from SDN::Message

#==, #class_inspect, expected_response?, inherited, #inspect, parse, #serialize

Methods included from Helpers

#checksum, #from_number, #from_string, #group_address?, #node_type_from_number, #node_type_to_number, #node_type_to_string, #parse_address, #print_address, #to_number, #to_string, #transform_param

Constructor Details

#initialize(up_limit = nil, down_limit = nil, **kwargs) ⇒ PostMotorLimits

Returns a new instance of PostMotorLimits.



77
78
79
80
81
# File 'lib/sdn/message/post.rb', line 77

def initialize(up_limit = nil, down_limit = nil, **kwargs)
  super(**kwargs)
  self.up_limit = up_limit
  self.down_limit = down_limit
end

Instance Attribute Details

#down_limitObject

Returns the value of attribute down_limit.



75
76
77
# File 'lib/sdn/message/post.rb', line 75

def down_limit
  @down_limit
end

#up_limitObject

Returns the value of attribute up_limit.



75
76
77
# File 'lib/sdn/message/post.rb', line 75

def up_limit
  @up_limit
end

Instance Method Details

#paramsObject



89
90
91
# File 'lib/sdn/message/post.rb', line 89

def params
  from_number(up_limit, 2) + from_number(down_limit, 2)
end

#parse(params) ⇒ Object



83
84
85
86
87
# File 'lib/sdn/message/post.rb', line 83

def parse(params)
  super
  self.up_limit = to_number(params[0..1], nillable: true)
  self.down_limit = to_number(params[2..3], nillable: true)
end