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, #is_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.



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

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.



73
74
75
# File 'lib/sdn/message/post.rb', line 73

def down_limit
  @down_limit
end

#up_limitObject

Returns the value of attribute up_limit.



73
74
75
# File 'lib/sdn/message/post.rb', line 73

def up_limit
  @up_limit
end

Instance Method Details

#paramsObject



87
88
89
# File 'lib/sdn/message/post.rb', line 87

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

#parse(params) ⇒ Object



81
82
83
84
85
# File 'lib/sdn/message/post.rb', line 81

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