Class: SDN::Message::SetFactoryDefault
- Inherits:
-
Message
- Object
- Message
- SDN::Message::SetFactoryDefault
- Defined in:
- lib/sdn/message/set.rb
Overview
Command that resets a motor's persisted settings.
Constant Summary collapse
- MSG =
Protocol message number
0x1f- PARAMS_LENGTH =
Number of protocol parameter bytes expected
1- RESET =
Mapping from symbolic reset scopes to SDN parameter values.
{ all_settings: 0x00, group_addresses: 0x01, limits: 0x11, rotation: 0x12, rolling_speed: 0x13, ips: 0x15, locks: 0x17 }.freeze
Instance Attribute Summary collapse
-
#reset ⇒ :all_settings, ...
Requested reset scope.
Instance Method Summary collapse
-
#initialize(dest = nil, reset = :all_settings, **kwargs) ⇒ SetFactoryDefault
constructor
Creates a factory reset command.
-
#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(dest = nil, reset = :all_settings, **kwargs) ⇒ SetFactoryDefault
Creates a factory reset command.
32 33 34 35 36 |
# File 'lib/sdn/message/set.rb', line 32 def initialize(dest = nil, reset = :all_settings, **kwargs) kwargs[:dest] ||= dest super(**kwargs) self.reset = reset end |
Instance Attribute Details
#reset ⇒ :all_settings, ...
Requested reset scope.
25 26 27 |
# File 'lib/sdn/message/set.rb', line 25 def reset @reset end |
Instance Method Details
#params ⇒ <Integer>
Returns the protocol-specific payload bytes for this message.
54 55 56 |
# File 'lib/sdn/message/set.rb', line 54 def params transform_param(RESET[reset]) end |
#parse(params) ⇒ void
This method returns an undefined value.
Parses protocol-specific parameter bytes into this message instance.
39 40 41 42 |
# File 'lib/sdn/message/set.rb', line 39 def parse(params) super self.reset = RESET.invert[to_number(params)] end |