Class: SDN::Message::PostMotorStatus
- Inherits:
-
Message
- Object
- Message
- SDN::Message::PostMotorStatus
- Defined in:
- lib/sdn/message/post.rb
Overview
Response carrying a motor's movement state and last-action metadata.
Constant Summary collapse
- MSG =
Protocol message number
0x0f- PARAMS_LENGTH =
Number of protocol parameter bytes expected
4- STATE =
Mapping from symbolic motor states to SDN parameter values.
{ stopped: 0x00, running: 0x01, blocked: 0x02, locked: 0x03 }.freeze
- DIRECTION =
Mapping from symbolic directions to SDN parameter values.
{ down: 0x00, up: 0x01 }.freeze
- SOURCE =
Mapping from symbolic action sources to SDN parameter values.
{ internal: 0x00, network: 0x01, dct: 0x02 }.freeze
- CAUSE =
Mapping from symbolic action causes to SDN parameter values.
{ 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
-
#last_action_cause ⇒ :target_reached, ...
Reported cause of the last action.
-
#last_action_source ⇒ :internal, ...
Reported source of the last action.
-
#last_direction ⇒ :down, ...
Reported direction of the last movement.
-
#state ⇒ :stopped, ...
Reported current motor state.
Instance Method Summary collapse
-
#parse(params) ⇒ void
Parses protocol-specific parameter bytes into this message instance.
Instance Attribute Details
#last_action_cause ⇒ :target_reached, ...
Reported cause of the last action.
274 275 276 |
# File 'lib/sdn/message/post.rb', line 274 def last_action_cause @last_action_cause end |
#last_action_source ⇒ :internal, ...
Reported source of the last action.
259 260 261 |
# File 'lib/sdn/message/post.rb', line 259 def last_action_source @last_action_source end |
#last_direction ⇒ :down, ...
Reported direction of the last movement.
254 255 256 |
# File 'lib/sdn/message/post.rb', line 254 def last_direction @last_direction end |
#state ⇒ :stopped, ...
Reported current motor state.
249 250 251 |
# File 'lib/sdn/message/post.rb', line 249 def state @state end |
Instance Method Details
#parse(params) ⇒ void
This method returns an undefined value.
Parses protocol-specific parameter bytes into this message instance.
277 278 279 280 281 282 283 |
# File 'lib/sdn/message/post.rb', line 277 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 |