Class: SDN::Message::ILT2::GetMotorIP

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

Overview

Request for an ILT2 intermediate position at a given slot.

Constant Summary collapse

MSG =

Protocol message number

0x43
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(dest = nil, ip = 1, **kwargs) ⇒ GetMotorIP

Creates an ILT2 request for a specific intermediate position slot.

Parameters:

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

    destination address

  • ip (Integer) (defaults to: 1)

    intermediate position slot

  • kwargs (Hash)

    additional message options



38
39
40
41
42
# File 'lib/sdn/message/ilt2/get.rb', line 38

def initialize(dest = nil, ip = 1, **kwargs)
  kwargs[:dest] ||= dest
  super(**kwargs)
  self.ip = ip
end

Instance Attribute Details

#ipInteger

Intermediate position slot being queried in the range 1..16.

Returns:

  • (Integer)


31
32
33
# File 'lib/sdn/message/ilt2/get.rb', line 31

def ip
  @ip
end

Instance Method Details

#params<Integer>

Returns the protocol-specific payload bytes for this message.

Returns:

  • (<Integer>)


57
58
59
# File 'lib/sdn/message/ilt2/get.rb', line 57

def params
  transform_param(@ip - 1)
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:



51
52
53
54
# File 'lib/sdn/message/ilt2/get.rb', line 51

def parse(params)
  super
  self.ip = to_number(params[0]) + 1
end