Class: SDN::Message::GetMotorIP

Inherits:
Message
  • Object
show all
Defined in:
lib/sdn/message/get.rb

Overview

Request for a motor's stored intermediate position at a given slot.

Constant Summary collapse

MSG =

Protocol message number

0x25
PARAMS_LENGTH =

Number of protocol parameter bytes expected

1

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dest = nil, ip = 1, **kwargs) ⇒ GetMotorIP

Creates a 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



73
74
75
76
77
# File 'lib/sdn/message/get.rb', line 73

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.

Returns:

  • (Integer)


66
67
68
# File 'lib/sdn/message/get.rb', line 66

def ip
  @ip
end

Instance Method Details

#params<Integer>

Returns the protocol-specific payload bytes for this message.

Returns:

  • (<Integer>)


92
93
94
# File 'lib/sdn/message/get.rb', line 92

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



80
81
82
83
# File 'lib/sdn/message/get.rb', line 80

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