Class: SDN::Message::PostMotorLimits
- Inherits:
-
Message
- Object
- Message
- SDN::Message::PostMotorLimits
- Defined in:
- lib/sdn/message/post.rb
Overview
Response carrying a motor's upper and lower travel limits.
Constant Summary collapse
- MSG =
Protocol message number
0x31- PARAMS_LENGTH =
Number of protocol parameter bytes expected
4
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(up_limit = nil, down_limit = nil) ⇒ PostMotorLimits
constructor
Creates a motor limits response message.
-
#params ⇒ <Integer>
Returns the protocol-specific payload bytes for this message.
-
#parse(params) ⇒ void
Parses protocol-specific parameter bytes into this message instance.
Constructor Details
#initialize(up_limit = nil, down_limit = nil) ⇒ PostMotorLimits
Creates a motor limits response message.
133 134 135 136 137 |
# File 'lib/sdn/message/post.rb', line 133 def initialize(up_limit = nil, down_limit = nil, **) super(**) self.up_limit = up_limit self.down_limit = down_limit end |
Instance Attribute Details
#down_limit ⇒ Integer?
127 128 129 |
# File 'lib/sdn/message/post.rb', line 127 def down_limit @down_limit end |
#up_limit ⇒ Integer?
124 125 126 |
# File 'lib/sdn/message/post.rb', line 124 def up_limit @up_limit end |
Instance Method Details
#params ⇒ <Integer>
Returns the protocol-specific payload bytes for this message.
147 148 149 |
# File 'lib/sdn/message/post.rb', line 147 def params from_number(up_limit, 2) + from_number(down_limit, 2) end |
#parse(params) ⇒ void
This method returns an undefined value.
Parses protocol-specific parameter bytes into this message instance.
140 141 142 143 144 |
# File 'lib/sdn/message/post.rb', line 140 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 |