Class: SDN::Message::ILT2::PostLockStatus

Inherits:
SDN::Message show all
Defined in:
lib/sdn/message/ilt2/post.rb

Overview

Response carrying the current ILT2 lock priority.

Constant Summary collapse

MSG =

Protocol message number

0x6B
PARAMS_LENGTH =

Number of protocol parameter bytes expected

1

Instance Attribute Summary collapse

Attributes inherited from SDN::Message

#ack_requested, #dest, #node_type, #src

Instance Method Summary collapse

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(priority = nil) ⇒ PostLockStatus

Creates an ILT2 lock status response.

Parameters:

  • priority (Integer, nil) (defaults to: nil)

    current lock priority



64
65
66
67
# File 'lib/sdn/message/ilt2/post.rb', line 64

def initialize(priority = nil, **)
  super(**)
  self.priority = priority
end

Instance Attribute Details

#priorityInteger?

Reported lock priority, or 0 when unlocked.

Returns:

  • (Integer, nil)


59
60
61
# File 'lib/sdn/message/ilt2/post.rb', line 59

def priority
  @priority
end

Instance Method Details

#params<Integer>

Returns the protocol-specific payload bytes for this message.

Returns:

  • (<Integer>)


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

def params
  transform_param(priority)
end

#parse(params) ⇒ void

This method returns an undefined value.

Parses protocol-specific parameter bytes into this message instance.

Parameters:

  • params (<Integer>)

    raw parameter bytes

Raises:



70
71
72
73
# File 'lib/sdn/message/ilt2/post.rb', line 70

def parse(params)
  super
  self.current_lock_priority = to_number(params[0])
end