Class: SDN::Message::ILT2::SetLockStatus
- Inherits:
-
SDN::Message
- Object
- SDN::Message
- SDN::Message::ILT2::SetLockStatus
- Defined in:
- lib/sdn/message/ilt2/set.rb
Overview
Command that applies or clears an ILT2 lock target.
Constant Summary collapse
- MSG =
Protocol message number
0x5B- PARAMS_LENGTH =
Number of protocol parameter bytes expected
3- TARGET_TYPE =
Mapping from symbolic lock targets to SDN parameter values.
{ current: 0, up_limit: 1, down_limit: 2, ip: 4, unlock: 5 }.freeze
Instance Attribute Summary collapse
- #priority ⇒ Integer
- #target ⇒ Integer?
-
#target_type ⇒ :current, ...
when target_type is down_limit, target is number of 10ms intervals it's still allowed to roll up Requested ILT2 lock target selector.
Attributes inherited from SDN::Message
#ack_requested, #dest, #node_type, #src
Instance Method Summary collapse
-
#initialize(dest = nil, target_type = :unlock, target = nil, priority = 1, **kwargs) ⇒ SetLockStatus
constructor
Creates an ILT2 lock status write command.
-
#params ⇒ <Integer>
Returns the protocol-specific payload bytes for this message.
-
#parse(params) ⇒ void
Parses protocol-specific parameter bytes into this message instance.
Methods inherited from SDN::Message
#==, expected_response?, #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(dest = nil, target_type = :unlock, target = nil, priority = 1, **kwargs) ⇒ SetLockStatus
Creates an ILT2 lock status write command.
58 59 60 61 62 63 64 |
# File 'lib/sdn/message/ilt2/set.rb', line 58 def initialize(dest = nil, target_type = :unlock, target = nil, priority = 1, **kwargs) kwargs[:dest] ||= dest super(**kwargs) self.target_type = target_type self.target = target self.priority = priority end |
Instance Attribute Details
#priority ⇒ Integer
49 50 51 |
# File 'lib/sdn/message/ilt2/set.rb', line 49 def priority @priority end |
#target ⇒ Integer?
46 47 48 |
# File 'lib/sdn/message/ilt2/set.rb', line 46 def target @target end |
#target_type ⇒ :current, ...
when target_type is down_limit, target is number of 10ms intervals it's still allowed to roll up Requested ILT2 lock target selector.
43 44 45 |
# File 'lib/sdn/message/ilt2/set.rb', line 43 def target_type @target_type end |
Instance Method Details
#params ⇒ <Integer>
Returns the protocol-specific payload bytes for this message.
94 95 96 |
# File 'lib/sdn/message/ilt2/set.rb', line 94 def params transform_param(TARGET_TYPE[target_type]) + transform_param(target) + transform_param(priority) end |
#parse(params) ⇒ void
This method returns an undefined value.
Parses protocol-specific parameter bytes into this message instance.
67 68 69 70 71 72 |
# File 'lib/sdn/message/ilt2/set.rb', line 67 def parse(params) super self.target_type = TARGET_TYPE.invert[to_number(params[0])] self.target = to_number(params[1]) self.priority = to_number(params[2]) end |